/* Journey scenes (DESIGN.md rule 9): static bands; chapter 1 goes live when js/journey.js sets html.journey-live. */
.journey-scene {
  position: relative; isolation: isolate; overflow: clip; pointer-events: none;
  min-height: 96vh; min-height: max(clamp(620px, 96svh, 960px), 50vw);
  --edge-top: var(--bg-0); --edge-bottom: var(--bg-0);
  --mist: rgba(107,192,240,.10);
}
.journey-scene--nature { min-height: 112vh; min-height: max(clamp(720px, 112svh, 1120px), 58vw); }
.journey-scene--city { --edge-bottom: var(--bg-0); }
.journey-scene--grid { --mist: rgba(79,209,149,.08); background: radial-gradient(ellipse at 20% 62%, rgba(58,163,227,.14), transparent 55%), radial-gradient(ellipse at 80% 70%, rgba(43,182,115,.12), transparent 55%), var(--bg-0); }
.journey-scene--nature { --mist: rgba(79,209,149,.08); --edge-bottom: var(--bg-1); background: radial-gradient(ellipse at 50% 40%, rgba(79,209,149,.14), transparent 60%), linear-gradient(#0A1220, #0F1B2E); }

.journey-scene::before, .journey-scene::after { content: ""; position: absolute; left: 0; right: 0; height: 18%; z-index: 6; }
.journey-scene::before { top: 0; background: linear-gradient(var(--edge-top), transparent); }
.journey-scene::after { bottom: 0; background: linear-gradient(transparent, var(--edge-bottom)); }

.journey-layer { position: absolute; left: 0; width: 100%; display: block; }
.journey-layer img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
.journey-layer--far, .journey-layer--behind { z-index: 1; inset: -4vh 0; inset: -4svh 0; width: auto; scale: 1.03; transform-origin: 50% 55%; }
.journey-layer--far img, .journey-layer--behind img { object-position: 50% 55%; }
.journey-scene--city::before { display: none; }
.journey-layer--mid { z-index: 3; --amp: 6svh; }
.journey-layer--near { z-index: 4; --amp: 12svh; }
.journey-layer--mid, .journey-layer--near { top: calc(var(--amp) * -1); height: calc(100% + var(--amp) * 2); }

.journey-mist {
  position: absolute; z-index: 2; left: -10%; right: -10%; top: 38%; height: 40%;
  background: radial-gradient(60% 50% at 50% 50%, var(--mist), transparent 70%), linear-gradient(transparent, rgba(15,27,46,.55) 50%, transparent);
}
.journey-veil { position: absolute; inset: 0; z-index: 5; background: var(--bg-0); opacity: 0; }

@media (max-width: 640px) {
  .journey-scene { min-height: 86vh; min-height: clamp(560px, 86svh, 780px); }
  .journey-scene--nature { min-height: 108vh; min-height: clamp(680px, 108svh, 940px); }
  .journey-layer--far, .journey-layer--behind { inset: 0; scale: 1; }
  .journey-layer--mid { --amp: 3svh; }
  .journey-layer--near { --amp: 6svh; }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .journey-scene { view-timeline: --scene block; }
    @keyframes journey-far { from { translate: 0 -4svh; scale: 1; } to { translate: 0 4svh; scale: 1.06; } }
    @keyframes journey-mist { from { translate: -4% 2svh; } to { translate: 4% -2svh; } }
    @keyframes journey-par { from { translate: 0 var(--amp); } to { translate: 0 calc(var(--amp) * -1); } }
    @keyframes journey-veil { from { opacity: .5; } to { opacity: 0; } }
    .journey-layer--far, .journey-layer--behind { animation: journey-far linear both; }
    .journey-mist { animation: journey-mist linear both; }
    .journey-layer--mid, .journey-layer--near { animation: journey-par linear both; }
    .journey-veil { animation: journey-veil linear both; }
    .journey-layer--far, .journey-layer--behind, .journey-mist, .journey-layer--mid, .journey-layer--near { animation-timeline: --scene; animation-range: cover 0% cover 100%; }
    .journey-veil { animation-timeline: --scene; animation-range: entry 0% entry 100%; }
    @media (max-width: 640px) {
      .journey-layer--far, .journey-layer--behind, .journey-mist { animation: none; }
    }
  }
}

/* Live chapter: tall scroller, sticky stage (rule 5). */
@media (prefers-reduced-motion: no-preference) {
  .journey-live .journey-chapter { --track: 200svh; --wx: .499; --wy: .429; height: calc(100lvh + var(--track)); }
  .journey-live .journey-stage { position: sticky; top: 0; height: 100vh; height: 100lvh; overflow: clip; background: var(--bg-0); }
  .journey-live .journey-stage .journey-scene { position: absolute; inset: 0; min-height: 0; isolation: auto; }
  .journey-live .journey-stage .journey-scene::before, .journey-live .journey-stage .journey-scene::after, .journey-live .journey-layer--behind, .journey-live .journey-scene--server .journey-mist, .journey-live .journey-stage .journey-veil { display: none; }
  .journey-live .journey-stage .journey-layer { inset: 0; width: 100%; height: 100%; scale: none; translate: none; animation: none; transform-origin: calc(var(--wx) * 100%) calc(var(--wy) * 100%); }
  .journey-live .journey-chapter.is-active .journey-layer { will-change: transform; }
  .journey-live .journey-stage .journey-mist { animation: none; }
  .journey-live .journey-scene--server .journey-layer img { object-position: calc(var(--wx) * 100%) calc(var(--wy) * 100%); }
  .journey-live .journey-scene--server .journey-layer--far { z-index: 4; }
  .journey-live .journey-scene--server .journey-layer--near { z-index: 6; }
  .journey-live .journey-scene--city .journey-layer--near { z-index: 7; }
  .journey-live .journey-scene--city .journey-layer--near img { mask-image: linear-gradient(transparent, #000 30%); }
  .journey-canvas, .journey-fade { position: absolute; left: 0; right: 0; z-index: 5; pointer-events: none; }
  .journey-canvas { top: 0; width: 100%; height: 100%; }
  .journey-fade { height: 18%; z-index: 9; opacity: 0; background: linear-gradient(var(--bg-0), transparent); }
  .journey-fade--top { top: 0; }
  .journey-fade--bottom { bottom: 0; rotate: 180deg; }
  @media (max-width: 640px) {
    .journey-live .journey-chapter { --track: 170svh; }
  }
}
