/* The scene supplies these values from its damped motion timeline. The
   background has no independent clock, animated gradient or blur pass. */
.stage {
  --orbit-turn: 0deg;
  --orbit-shift: 0px;
  --motion-energy: 0;
  --detail-focus: 0;
}
.experience { height: 3894.94vh; }
@media (prefers-reduced-motion: reduce) {
  .experience { height: 650vh; }
}
.stage::after { height: var(--copy-edge, 210px); transition: height 1.2s, opacity .5s; }

/* A compact title gives the returning construction its own viewing area. */
.experience .story-8 h2 { font-size: clamp(22px, 3vw, 32px); }
.experience .story-8 .intro { display: none; }
.experience[data-chapter="8"] .stage::after { height: 150px; }

@media (max-height: 540px) and (orientation: landscape) {
  .experience .stage { height: 100svh; min-height: 0; }
  .experience .story-copy { top: 61px; }
  .experience .story-copy h1, .experience .story-copy h2 { font-size: 26px; }
  .experience .story-copy .intro { font-size: 10px; max-width: 620px; }
  .experience .story-copy .layer-more { margin-top: 8px; padding: 7px 13px; }
  .experience .stage-bottom { bottom: 10px; }
  .experience .chapter-rail { gap: 0; }
  .experience .chapter-rail button { width: 20px; height: 20px; }
  .experience .chapter-rail button::after { left: 8px; top: 8px; }
  .experience .chapter-rail button.current::after { left: 7px; top: 7px; }
}

.stage .ambient-orbit,
.stage .grid-glow {
  display: block;
  position: absolute;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
}

/* Two fine studio-light contours, kept outside the centre of the product. */
.stage .ambient-orbit {
  left: 50%;
  top: 57%;
  width: min(1050px, 88vw);
  height: min(510px, 52svh);
  opacity: calc((.09 + var(--motion-energy) * .05) * (1 - var(--detail-focus) * .78));
  transform: translate3d(calc(-50% + var(--orbit-shift)), -50%, 0) rotate(var(--orbit-turn));
}

.stage .ambient-orbit::before,
.stage .ambient-orbit::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid #85718b;
  border-radius: 50%;
  box-shadow: 0 1px 0 #fffdf9;
}

.stage .ambient-orbit::before {
  transform: rotate(-16deg) scaleY(.82);
}

.stage .ambient-orbit::after {
  inset: 5% 7%;
  border-color: #a594a6;
  transform: rotate(23deg) scaleY(.83);
  opacity: .68;
}

/* A broad, quiet reflection pool. The gradient itself is never animated. */
.stage .grid-glow {
  inset: 15% 5% 3%;
  background:
    radial-gradient(ellipse at 33% 47%, #978ba5 0%, #978ba500 56%),
    radial-gradient(ellipse at 72% 61%, #c5ac9f 0%, #c5ac9f00 51%);
  opacity: calc((.095 + var(--motion-energy) * .04) * (1 - var(--detail-focus) * .42));
  transform: translate3d(calc(var(--orbit-shift) * -.32), 0, 0) scale(calc(1 + var(--motion-energy) * .035));
}

/* A small arc follows chapter progress; selection remains clear at rest. */
.chapter-rail button.current {
  border-color: #715d6d35;
}

.chapter-rail button::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  border-top-color: #715d6d;
  border-right-color: #715d6d;
  border-radius: 50%;
  opacity: 0;
  transform: rotate(-135deg);
  pointer-events: none;
}

.chapter-rail button.current::before {
  opacity: .65;
  transform: rotate(calc(-135deg + var(--chapter-progress, 0) * 270deg));
}

@media (max-width: 600px) {
  .stage .ambient-orbit {
    top: 61%;
    width: 92vw;
    height: min(420px, 46svh);
  }

  .stage .ambient-orbit::before { transform: rotate(-29deg) scaleY(.7); }
  .stage .ambient-orbit::after { transform: rotate(31deg) scaleY(.7); }
  .stage .grid-glow { inset: 29% -4% 7%; }
}

@media (max-height: 540px) and (orientation: landscape) {
  .stage .ambient-orbit {
    top: 61%;
    width: 77vw;
    height: 44svh;
  }

  .stage .grid-glow { inset: 31% 12% 3%; }
}

@media (prefers-reduced-motion: reduce) {
  .stage::after { transition: none; }
  .stage .ambient-orbit {
    opacity: .045;
    transform: translate3d(-50%, -50%, 0) rotate(-9deg);
    will-change: auto;
  }

  .stage .grid-glow {
    opacity: .07;
    transform: none;
    will-change: auto;
  }

  .chapter-rail button.current::before { transform: rotate(-135deg); }
}
