/* ============================================================================
   scenes.css — the scroll-driven build
   ----------------------------------------------------------------------------
   A 520vh container with a sticky viewport inside. Scroll progress p ∈ [0,1]
   is handed to scene.render(p), which interpolates the whole SVG.
   ========================================================================= */

.stage-outer {
  position: relative;
  height: 520vh;
  background: var(--deep);
}

.stage-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.scene svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Keeps the copy legible without flattening the scene. */
.stage-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 5, 6, 0.55) 0%, rgba(6, 5, 6, 0) 26%),
    linear-gradient(0deg, rgba(6, 5, 6, 0.72) 0%, rgba(6, 5, 6, 0) 42%);
}

/* ------------------------------------------------------------- stage copy */

.stage-copy {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: var(--maxw);
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
  color: #f7f0e6;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.stage-copy.is-hidden {
  opacity: 0;
  transform: translate(-50%, -46%);
  pointer-events: none;
}

.stage-copy__eyebrow { color: #ffd9a0; justify-content: center; }

.stage-copy__title {
  font-size: clamp(2.2rem, 1.2rem + 5.4vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  max-width: 18ch;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.4);
}

.stage-copy__sub {
  font-size: clamp(1rem, 0.92rem + 0.4vw, 1.25rem);
  color: rgba(247, 240, 230, 0.78);
  max-width: 52ch;
}

/* ------------------------------------------------------------- phase rail */

.phase-rail {
  position: absolute;
  z-index: 4;
  right: clamp(14px, 2.4vw, 40px);
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 14px;
}

.phase-rail__item {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 240, 230, 0.42);
  transition: color 0.35s var(--ease);
}
.phase-rail__item span {
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease-out);
}
.phase-rail__item i {
  display: block;
  width: 22px;
  height: 1px;
  background: currentColor;
  transition: width 0.4s var(--ease-out), background-color 0.35s var(--ease);
}
.phase-rail__item:hover { color: rgba(247, 240, 230, 0.8); }
.phase-rail__item.is-on { color: #ffb98a; }
.phase-rail__item.is-on i { width: 42px; }
.phase-rail__item.is-on span,
.phase-rail__item:hover span { opacity: 1; transform: none; }

/* ------------------------------------------------------------ phase stack */

.phase-stack {
  position: absolute;
  z-index: 4;
  left: var(--gutter);
  bottom: clamp(28px, 6vh, 64px);
  width: min(460px, 62vw);
  pointer-events: none;
}

.phase-stack > div { display: grid; }

.phase {
  grid-area: 1 / 1;
  display: grid;
  gap: 8px;
  color: #f7f0e6;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease-out);
  pointer-events: none;
}
.phase.is-on { opacity: 1; transform: none; }

.phase__time {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #ffb98a;
}

.phase__title {
  font-size: clamp(1.3rem, 1.05rem + 1.1vw, 2.1rem);
  line-height: 1.05;
}

.phase__body {
  font-size: var(--step--1);
  color: rgba(247, 240, 230, 0.76);
  max-width: 46ch;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 860px) {
  .stage-outer { height: 420vh; }
  .phase-rail { display: none; }
  .phase-stack { width: min(420px, 84vw); }
  .stage-copy__title { max-width: 14ch; }
}

@media (max-width: 720px) {
  .stage-outer { height: 380vh; }
  .stage-copy { top: 42%; }
  .phase-stack { bottom: 20px; }
}

/* ------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  .stage-outer { height: auto; }
  .stage-sticky { position: static; height: auto; min-height: 78vh; }
  .stage-copy { position: static; transform: none; padding-block: 120px 40px; }
  .stage-copy.is-hidden { opacity: 1; transform: none; }
  .phase-stack {
    position: static;
    width: auto;
    padding: 0 var(--gutter) 80px;
    pointer-events: auto;
  }
  .phase-stack > div { display: grid; gap: 28px; }
  .phase {
    grid-area: auto;
    opacity: 1;
    transform: none;
    border-top: 1px solid rgba(247, 240, 230, 0.2);
    padding-top: 16px;
  }
  .phase-rail { display: none; }
}
