/* ============================================================
   Interactive Figma board (index hero)
   A faithful, interactive mock of the Figma editor UI
   ============================================================ */

.hero {
  padding: 24px 0 8px;
}

.board {
  /* floating Figma window: wide, but with breathing room on the sides */
  width: calc(100% - 96px);
  margin: 0 auto;
  --panel: #ffffff;
  --line: var(--fg-color-border);
  --ui-fg: var(--fg-color-text);
  --ui-fg-2: var(--fg-color-text-secondary);
  --ui-fg-3: var(--fg-color-text-tertiary);
  --brand: var(--fg-color-brand);

  position: relative;
  display: grid;
  grid-template-columns: 248px 1fr 248px;
  height: 640px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.05),
    0 16px 48px -16px rgba(0, 0, 0, 0.18),
    0 0 0.5px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0.1px;
  color: var(--ui-fg);
  user-select: none;
  /* Figma-style arrow cursor across the whole editor UI */
  cursor: url("../assets/cursor-figma.svg") 3 2, default;
}

/* keep the same Figma arrow on every child of the board */
.board * {
  cursor: inherit;
}

/* ---------- Generic Figma sidebar ---------- */
.fsb {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  min-height: 0;
  overflow: hidden;
}

.fsb--left {
  border-right: 1px solid var(--line);
}

.fsb--right {
  border-left: 1px solid var(--line);
}

.fsb__row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 8px;
}

.fsb__row--header {
  min-height: 48px;
  padding: 8px;
  justify-content: space-between;
}

.fsb__group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 8px 0 8px;
  font-weight: 550;
}

.fsb__title {
  font-weight: 550;
  font-size: 11px;
  color: var(--ui-fg);
}

.fsb__sub {
  font-size: 11px;
  color: var(--ui-fg-2);
}

.fsb__divider {
  height: 1px;
  background: var(--line);
  margin: 0;
}

.fsb__item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 8px;
  margin: 0 8px;
  border-radius: 5px;
  color: var(--ui-fg);
  cursor: default;
}

.fsb__item:hover {
  background: var(--fg-color-bg-hover);
}

.fsb__item.is-active {
  background: #e5f4ff;
  color: var(--brand);
}

.fsb__item .ico {
  width: 16px;
  height: 16px;
  color: var(--ui-fg-2);
  flex: none;
}

.fsb__tabs {
  display: flex;
  gap: 4px;
}

.fsb__tab {
  height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  font-size: 11px;
  color: var(--ui-fg-2);
}

.fsb__tab.is-active {
  background: var(--fg-color-bg-secondary);
  color: var(--ui-fg);
  font-weight: 550;
}

.icobtn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--ui-fg-2);
}

.icobtn:hover {
  background: var(--fg-color-bg-hover);
}

.icobtn svg,
.fsb__item .ico svg,
.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Right panel rows */
.prop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.prop__title {
  font-weight: 550;
}

.prop__color {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  flex: 1;
  margin-right: 8px;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--border-translucent, #0000001a);
  flex: none;
}

.avatars {
  display: flex;
  align-items: center;
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #b3b3b3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}

.share-btn {
  height: 28px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 550;
  border: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.12s ease;
}

.share-btn:hover {
  background: #0b87e0;
}

.play-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--ui-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.play-btn:hover {
  background: var(--fg-color-bg-hover);
}

/* ---------- Canvas ---------- */
.canvas {
  position: relative;
  background: #e5e5e5;
  overflow: hidden;
  /* pan-y, not none: a vertical swipe must scroll the page rather than being
     swallowed by the board's pan handler. touch-action only affects touch/pen,
     so mouse and trackpad panning + zooming are unchanged. */
  touch-action: pan-y;
}

.canvas.is-panning,
.canvas.is-panning * {
  cursor: grabbing;
}

.canvas__world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.obj {
  position: absolute;
}

.obj__label {
  position: absolute;
  top: -18px;
  left: 0;
  font-size: 11px;
  color: var(--brand);
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.obj.is-selected .obj__label,
.obj:hover .obj__label {
  opacity: 1;
}

.obj::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  pointer-events: none;
}

.obj:hover::after {
  border-color: var(--brand);
}

.obj.is-selected::after {
  border-color: var(--brand);
  border-width: 2px;
  inset: -2px;
}

/* selection handles */
.obj.is-selected .handle {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #fff;
  border: 1px solid var(--brand);
  border-radius: 1px;
  pointer-events: none;
}
.obj.is-selected .handle.tl { top: -4px; left: -4px; }
.obj.is-selected .handle.tr { top: -4px; right: -4px; }
.obj.is-selected .handle.bl { bottom: -4px; left: -4px; }
.obj.is-selected .handle.br { bottom: -4px; right: -4px; }
.handle { display: none; }
.obj.is-selected .handle { display: block; }

.obj--img {
  width: 218px;
}

.obj--img img {
  width: 218px;
  height: 290px;
  max-width: none;
  object-fit: cover;
  border-radius: 2px;
  display: block;
  pointer-events: none;
}

.obj--text {
  font-family: var(--font-head);
  font-weight: 300;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -1px;
  color: #111;
  white-space: nowrap;
  min-width: 24px;
  min-height: 56px;
}

.obj--text .obj__text {
  white-space: nowrap;
}

/* text being "typed" in Figma: blue edit box + blinking caret */
.obj.is-typing::after {
  border-color: var(--brand);
}

.obj--text.is-typing .obj__text::after {
  content: "";
  display: inline-block;
  width: 2.5px;
  height: 0.85em;
  margin-left: 3px;
  vertical-align: -0.06em;
  background: var(--brand);
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* ---------- Multiplayer cursor (decorative) ---------- */
.mcursor {
  position: absolute;
  left: 430px;
  top: 140px;
  z-index: 3;
  pointer-events: none;
  animation: cursor-drift 16s ease-in-out infinite alternate;
}

.mcursor svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.mcursor__label {
  position: absolute;
  left: 15px;
  top: 19px;
  background: var(--tag);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

@keyframes cursor-drift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(150px, 70px); }
  50%  { transform: translate(60px, 200px); }
  75%  { transform: translate(240px, 110px); }
  100% { transform: translate(30px, 20px); }
}

@media (prefers-reduced-motion: reduce) {
  .mcursor { animation: none; }
  .obj--text.is-typing .obj__text::after { animation: none; }
}

/* ---------- Floating toolbar ---------- */
.toolbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
  padding: 0 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12), 0 0 0.5px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.tool {
  height: 32px;
  min-width: 32px;
  padding: 0 4px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--ui-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.tool:hover {
  background: var(--fg-color-bg-hover);
}

.tool.is-active {
  background: var(--brand);
  color: #fff;
}

.tool .chev {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}

.tool svg {
  width: 22px;
  height: 22px;
}

.toolbar__sep {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
}

.modeToggle {
  width: 40px;
  height: 24px;
  border-radius: 9999px;
  background: var(--fg-color-bg-secondary);
  border: 1px solid var(--line);
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 1px;
}

.modeToggle .knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px #0003;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-fg-2);
  transition: transform 0.18s ease;
}

.modeToggle.is-dev .knob {
  transform: translateX(16px);
}

/* zoom control in right header */
.zoomctl {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  color: var(--ui-fg);
  font-size: 11px;
}

.zoomctl:hover {
  background: var(--fg-color-bg-hover);
}

.hero__hint {
  margin: 12px auto 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .board {
    grid-template-columns: 200px 1fr;
    height: 520px;
    width: calc(100% - 48px);
  }
  .fsb--right {
    display: none;
  }
}

@media (max-width: 560px) {
  .board {
    grid-template-columns: 1fr;
    height: 460px;
    width: calc(100% - 24px);
    border-radius: 12px;
  }
  .fsb--left {
    display: none;
  }
}
