/* ==========================================================================
   Block 04 — 3D setup animation
   The 3D stage sticks to the screen while you scroll through the section;
   the text blocks scroll over it normally. The animation starts as soon as
   the section enters the screen, so the box flies in before it pins.
   ========================================================================== */

.setup3d {
  position: relative;
  height: 1080vh;   /* index.html (V1): 26 timeline units x ~41.5vh (LENGTH in setup3d.js) */
  background: #fff;   /* matches the intro block, so the white void is seamless */
  color: #fff;
}

/* phones run the shorter KEYS_MOBILE cut (15.7 units, class set by setup3d.js) */
.setup3d--mobile { height: 652vh; }   /* index2 phones (chapter mode sets its own height inline) */
.setup3d--mobile [data-m-hide] { display: none; }

/* chapter mode (index2.html): the current chapter's caption fades in over the stage
   instead of scrolling past (setup3d.js moves the blocks into .setup3d__caps) */
.setup3d__caps { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.setup3d__caps .setup3d__block {
  top: auto;
  bottom: max(64px, 9vh);   /* over the table, under the box */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s var(--ease), transform 0.6s var(--ease);
}
.setup3d__caps .setup3d__block.is-on { opacity: 1; transform: none; transition-delay: 0.15s; }
/* the big "Plug in. Game on." heading fades once the stage pins (it no longer has room to scroll away) */
.setup3d--chapters .setup3d__intro { transition: opacity 0.4s var(--ease); }
.setup3d--chapters.is-pinned .setup3d__intro { opacity: 0; }

.setup3d__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.setup3d__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s;
}

.setup3d.is-ready .setup3d__canvas { opacity: 1; }


/* ---------- scrolling text ---------- */

.setup3d__content {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.setup3d__intro,
.setup3d__block {
  position: absolute;
  left: var(--gutter);
  width: min(480px, calc(100% - var(--gutter) * 2));
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}

.setup3d__intro { width: calc(100% - var(--gutter) * 2); }

/* blocks that sit over the white void use dark text */
.setup3d__intro,
.setup3d__block--dark { color: var(--c-ink); text-shadow: none; }
.setup3d__block.setup3d__block--dark p { color: rgba(0, 0, 0, 0.65); }

.setup3d__intro .eyebrow { color: rgba(0, 0, 0, 0.6); }

.setup3d__intro .display {
  font-size: clamp(72px, 13vw, 200px);
  line-height: 0.9;
}

.setup3d__intro .display em {
  display: inline-block;
  margin-top: 0.06em;
  padding: 0.04em 0.08em 0;
  line-height: 1;
  background: var(--c-accent);
  color: var(--c-ink);
}

.setup3d__num {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--c-accent);
  color: var(--c-ink);
  font: 700 12px/1 var(--font-mono);
  text-shadow: none;
}

.setup3d__block h3 {
  margin: 12px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 72px);
  font-weight: 400;
  line-height: 0.95;
  text-transform: uppercase;
}

.setup3d__block p {
  max-width: 36ch;
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
}

/* ---------- progress bar ---------- */

.setup3d__bar {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 24px;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  transition: background-color 0.4s;
}

.setup3d.is-void .setup3d__bar { background: rgba(0, 0, 0, 0.1); }
.setup3d.is-void .setup3d__bar span { background: var(--c-ink); }

.setup3d__bar span {
  display: block;
  height: 100%;
  background: var(--c-accent);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- no WebGL ---------- */

.setup3d__fallback {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  color: rgba(255, 255, 255, 0.5);
}

.setup3d.is-fallback .setup3d__fallback { display: grid; }

/* small label above the showcase captions */
.setup3d__eyebrow { margin: 0; color: var(--c-accent); }
.setup3d__block .setup3d__eyebrow { font-size: 12px; color: var(--c-accent); }

/* ==========================================================================
   Block 05 — What's in the box (lives in the pinned stage, fades in at the end)
   ========================================================================== */

.inbox {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  color: var(--c-ink);
}

.inbox__figure {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  width: min(58vw, 1040px);
  margin: 0;
  opacity: 0;
  transform: translateY(-46%);
}

.inbox__figure img {
  display: block;
  width: 100%;
  height: auto;
  /* soften the photo edges into the white void */
  -webkit-mask-image: radial-gradient(ellipse 72% 72% at 50% 50%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 72% at 50% 50%, #000 62%, transparent 100%);
}

/* numbered markers on the items in the photo */
.inbox__marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-ink);
  box-shadow: 0 0 0 4px rgba(212, 255, 0, 0.3);
  font: 700 13px/1 var(--font-mono);
}

.inbox__copy {
  position: absolute;
  left: var(--gutter);
  top: 50%;
  width: min(34vw, 440px);
  transform: translateY(-46%);
}

.inbox__copy .display { font-size: clamp(48px, 5.4vw, 88px); margin-bottom: 28px; }
.inbox__copy .eyebrow { color: rgba(0, 0, 0, 0.6); }

.inbox__list {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inbox__list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  align-items: start;
}

.inbox__num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c-ink);
  color: var(--c-accent);
  font: 700 14px/1 var(--font-mono);
}

.inbox__list h3 {
  margin: 4px 0 2px;
  font-size: 16px;
  font-weight: 700;
}

.inbox__list p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(0, 0, 0, 0.62);
}

/* appear one by one (class toggled by the timeline) */
.inbox [data-step] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
}

.inbox .inbox__marker[data-step] { transform: scale(0.4); }
.inbox [data-step].is-active { opacity: 1; transform: none; }

/* phones/tablets: photo on top, list underneath */
@media (max-width: 989px) {
  .inbox__figure {
    top: calc(var(--header-h) + 8px);
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    transform: none;
  }
  .inbox__copy {
    top: auto;
    bottom: 48px;
    width: calc(100% - var(--gutter) * 2);
    transform: none;
  }
  .inbox__copy .display { font-size: 44px; margin-bottom: 16px; }
  .inbox__list { gap: 12px; }
  .inbox__list p { font-size: 13px; }
  .inbox__marker { width: 22px; height: 22px; margin: -11px 0 0 -11px; font-size: 11px; }
}

/* ==========================================================================
   Explore mode (index3.html): labels float around the zoomed-in box; clicking one changes
   what its screen shows. Desktop: setup3d.js lays .explore__ring over the display's front
   face every frame and the labels hang off its sides. Phones: a 2-column grid under the box.
   ========================================================================== */

.explore {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0s linear 0.5s;
}

.setup3d.is-explore .explore { opacity: 1; visibility: visible; transition-delay: 0s; }

.explore__ring { position: absolute; }

.explore__hint {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 28px);
  margin: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7);
}

.explore__tag {
  position: absolute;
  top: var(--y);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font: 600 13px/1 var(--font-body);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
  animation: explore-float 4.5s ease-in-out infinite;
}

/* the dot points at the box */
.explore__tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

/* thin leader line from the label to the box edge */
.explore__tag::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 44px;   /* = the gap to the box below, so the line touches it */
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.explore__tag--l { right: calc(100% + 44px); flex-direction: row-reverse; }
.explore__tag--l::after { left: 100%; }
.explore__tag--r { left: calc(100% + 44px); }
.explore__tag--r::after { right: 100%; }

.explore__tag:nth-of-type(2) { animation-delay: -1.5s; }
.explore__tag:nth-of-type(3) { animation-delay: -3s; }
.explore__tag:nth-of-type(4) { animation-delay: -0.8s; }
.explore__tag:nth-of-type(5) { animation-delay: -2.3s; }
.explore__tag:nth-of-type(6) { animation-delay: -3.7s; }

.explore__tag:hover { border-color: #fff; background: rgba(10, 10, 10, 0.8); }

.explore__tag[aria-pressed="true"] {
  border-color: var(--c-accent);
  background: var(--c-accent);
  color: var(--c-accent-ink);
}
.explore__tag[aria-pressed="true"]::before { opacity: 1; }
.explore__tag[aria-pressed="true"]::after { background: var(--c-accent); }

@keyframes explore-float {
  0%, 100% { transform: translateY(-50%); }
  50% { transform: translateY(calc(-50% - 6px)); }
}

/* phones: no ring, the labels sit as a grid under the box */
@media (max-width: 749px) {
  .explore__ring {
    left: var(--gutter);
    right: var(--gutter);
    bottom: max(56px, 7vh);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .explore__hint {
    position: static;
    grid-column: 1 / -1;
    margin-bottom: 6px;
    transform: none;
    text-align: center;
    white-space: normal;
  }
  .explore__tag {
    position: static;
    justify-content: center;
    padding: 0 12px;
    font-size: 12px;
    animation: none;
  }
  .explore__tag--l { flex-direction: row; }
  .explore__tag::after { display: none; }
}

@media (prefers-reduced-motion: reduce) and (min-width: 750px) {
  .explore__tag { animation: none; transform: translateY(-50%); }
}

/* index3: the white-screen heading fades out as the room comes in */
.setup3d[data-explore] .setup3d__intro { transition: opacity 0.4s var(--ease); }
.setup3d[data-explore].is-played .setup3d__intro { opacity: 0; }

/* index3: one static block, no scroll animation — the display on the table with the buttons */
.setup3d.setup3d--static { height: 100vh; height: 100svh; min-height: 560px; }
.setup3d--static .setup3d__stage { position: relative; height: 100%; }
