/* The Journey — landing page prologue (index.html). Scene: js/journey.js.
   A sticky full-screen stage (WebGL canvas, or a static illustrated fallback) with the chapter copy
   scrolling over it. journey.js writes --edge-rgb / --glow-rgb / --lum / --k / --fill / --op so the
   copy, header and fallback follow the same light as the 3D scene. Ends on --paper for a seamless join. */

.journey {
  --edge-rgb: 19 11 8;
  --glow-rgb: 58 30 22;
  --lum: 0;
  --j-ink: #F6EDE4;
  --j-soft: #CDBBAD;
  --j-accent: #E3B39C;
  position: relative;
  background: rgb(var(--edge-rgb));
  color: var(--j-ink);
}
@supports (color: color-mix(in oklab, red 50%, blue)) {
  .journey {
    --j-ink: color-mix(in oklab, var(--ink) calc(var(--lum) * 100%), #F6EDE4);
    --j-soft: color-mix(in oklab, var(--ink-soft) calc(var(--lum) * 100%), #CDBBAD);
    --j-accent: color-mix(in oklab, var(--clay) calc(var(--lum) * 100%), #E3B39C);
  }
}

/* Header floats over the dark opening frame on this page only. With JS it stays fixed while scrolling:
   a dark veil over the scene once scrolled (.is-scrolled), paper + dark text once the scene turns light
   (.is-light, set by journey.js). Without JS it stays absolute, so light text never sits on paper. */
.site-header--over {
  position: absolute; inset: 0 0 auto 0; z-index: 10; color: #F6EDE4;
  transition: background-color .5s var(--ease-out), color .5s var(--ease-out), box-shadow .5s var(--ease-out);
}
.js .site-header--over { position: fixed; }
.site-header--over.is-scrolled {
  background: rgba(19, 11, 8, .5);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.site-header--over .muted { color: #CDBBAD; transition: color .5s var(--ease-out); }
.site-header--over .link-u:hover, .site-header--over .link-u:focus-visible { color: #fff; }
.site-header--over :focus-visible { outline-color: #E3B39C; }
.btn-veil { color: #F6EDE4; border-color: rgba(246, 237, 228, .38); min-height: 40px; padding: 0 1rem; font-size: .9375rem; }
.btn-veil:hover:not(:disabled) { border-color: #F6EDE4; }

.site-header--over.is-light {
  color: var(--ink); background: rgba(251, 247, 242, .88);
  box-shadow: 0 1px 0 var(--line);
}
.site-header--over.is-light .muted { color: var(--ink-soft); }
.site-header--over.is-light .link-u:hover, .site-header--over.is-light .link-u:focus-visible { color: var(--ink); }
.site-header--over.is-light :focus-visible { outline-color: var(--clay); }
.site-header--over.is-light .btn-veil { color: #fff; background: var(--clay); border-color: var(--clay); }
.site-header--over.is-light .btn-veil:hover:not(:disabled) { background: var(--clay-deep); border-color: var(--clay-deep); }

/* ---------- Stage ---------- */
.journey-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  background: radial-gradient(ellipse 62% 78% at var(--gx, 75%) var(--gy, 50%), rgb(var(--glow-rgb)), rgb(var(--edge-rgb)) 78%);
}
.journey-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  opacity: 0; transition: opacity 0.5s ease-out;
}
.journey.is-live .journey-canvas { opacity: 1; }
.mode-cepat .journey-canvas { display: none !important; }

/* Mobile: subject sits in the upper half; copy gets a soft floor so it stays readable over the scene. */
@media (max-width: 767px), (max-aspect-ratio: 9/10) {
  .journey-stage::after {
    content: ""; position: absolute; inset: auto 0 0 0; height: 58%; pointer-events: none;
    background: linear-gradient(to top, rgb(var(--edge-rgb) / .86) 0%, rgb(var(--edge-rgb) / .55) 45%, rgb(var(--edge-rgb) / 0) 100%);
  }
}

/* ---------- Progress rail ---------- */
.journey-rail {
  position: absolute; right: clamp(16px, 3vw, 40px); top: 50%; transform: translateY(-50%);
  list-style: none; margin: 0; padding: 0; display: grid; gap: 1.6rem; z-index: 3;
  --rail: color-mix(in oklab, var(--j-soft) 45%, transparent);
}
.journey-rail::before, .journey-rail::after {
  content: ""; position: absolute; right: 3px; top: 6px; bottom: 6px; width: 1px; background: var(--rail);
}
.journey-rail::after { background: var(--j-accent); transform: scaleY(var(--fill, 0)); transform-origin: top; }
.journey-rail li {
  position: relative; display: flex; align-items: center; justify-content: flex-end; gap: .75rem;
  font-family: var(--font-display); font-style: italic; font-size: .875rem; color: var(--j-soft);
  opacity: .5; transition: opacity .6s var(--ease-out), color .6s var(--ease-out);
}
.journey-rail li::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--edge-rgb));
  box-shadow: inset 0 0 0 1px var(--j-soft); position: relative; z-index: 1;
  transition: background-color .6s var(--ease-out), box-shadow .6s var(--ease-out);
}
.journey-rail li.is-on { opacity: 1; color: var(--j-ink); }
.journey-rail li.is-on::after { background: var(--j-accent); box-shadow: none; }
.journey-rail span { opacity: 0; transform: translateX(6px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.journey-rail li.is-on:last-of-type span, .journey-rail li.is-on:has(+ li:not(.is-on)) span { opacity: 1; transform: none; }
@media (max-width: 1023px) { .journey-rail span { display: none; } }
@media (max-width: 767px) {
  .journey-rail { top: auto; bottom: 0; right: 16px; left: 16px; transform: none; display: block; height: 2px; }
  .journey-rail::before, .journey-rail::after { inset: 0; width: auto; height: 1px; top: auto; }
  .journey-rail::after { transform: scaleX(var(--fill, 0)); transform-origin: left; }
  .journey-rail li { display: none; }
}

/* ---------- Chapters (real DOM copy over the stage) ---------- */
.journey-chapters { position: relative; z-index: 2; margin-top: -100vh; margin-top: -100svh; }
.chapter {
  min-height: 100vh; min-height: 100svh; box-sizing: border-box;
  display: flex; align-items: center; padding: 6rem 0;
}
.chapter-inner { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }
@media (min-width: 640px) { .chapter-inner { padding: 0 24px; } }
.chapter-copy { max-width: 27rem; opacity: var(--op, 1); }
.js .chapter-copy { will-change: opacity; }

.chapter-mark { font-family: var(--font-display); font-style: italic; color: var(--j-accent); font-size: 1rem; margin: 0; }
.chapter-mark small { font-family: var(--font-body); font-style: normal; font-size: .8125rem; color: var(--j-soft); margin-left: .6rem; letter-spacing: .02em; }
.chapter-mark small::before { content: ""; display: inline-block; width: 22px; height: 1px; background: currentColor; vertical-align: middle; margin-right: .6rem; opacity: .6; }
.chapter h2 {
  font-family: var(--font-display); font-weight: 500; font-optical-sizing: auto;
  font-size: clamp(2.1rem, 4.4vw, 3.5rem); line-height: 1.06; letter-spacing: -.02em; margin: .9rem 0 0;
}
.chapter .lede { color: var(--j-soft); font-size: 1.0625rem; line-height: 1.65; margin: 1.1rem 0 0; max-width: 24rem; }

.journey-hero h1 {
  font-family: var(--font-display); font-weight: 500; font-optical-sizing: auto;
  font-size: clamp(2.7rem, 6.2vw, 5.4rem); line-height: .98; letter-spacing: -.025em; margin: 1rem 0 0; max-width: 10.5ch;
}
.journey-hero h1 em { font-style: italic; color: var(--j-accent); }
.journey-hero .eyebrow { color: var(--j-accent); }
.journey-hero .lede { font-size: 1.125rem; max-width: 22rem; }
.journey-actions { display: flex; align-items: center; gap: 1.5rem; margin-top: 2.25rem; flex-wrap: wrap; }
.journey-cue { display: inline-flex; align-items: center; gap: .75rem; color: var(--j-soft); font-size: .875rem; }
.journey-cue i { display: block; width: 1px; height: 34px; background: currentColor; transform-origin: top; animation: cue 3.2s var(--ease-soft) infinite; }
@keyframes cue { 0% { transform: scaleY(0); opacity: 0; } 30% { opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
.journey-link { color: var(--j-ink); font-weight: 700; }

/* Rotating quote (js/quotes.js). Phones: in the flow above the hero copy, i.e. just under the fetus.
   Landscape: centred under the fetus (the subject sits at ~65% of the width). Fades with the hero copy (--op). */
.journey-hero { position: relative; }
.journey-quote {
  margin: 0 auto 1.4rem; max-width: 26rem; text-align: center;
  font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: .98rem; line-height: 1.45;
  color: var(--j-soft); min-height: 2.9em;   /* two lines reserved: the copy below never jumps */
  transition: opacity .7s var(--ease-out);
}
.journey-quote::before {
  content: ""; display: block; width: 28px; height: 1px; margin: 0 auto .7rem; background: var(--j-accent); opacity: .7;
}
.journey-quote.is-quote-out { opacity: 0; }
@media (min-width: 768px) and (min-aspect-ratio: 9/10) {
  .journey-quote {
    position: absolute; left: 65%; top: 86%; width: min(30rem, 34vw); max-width: none; margin: 0;
    transform: translateX(-50%); font-size: 1.08rem;   /* fades with its parent .chapter-copy (--op) */
  }
}

.chapter--climax { justify-content: center; text-align: center; }
.chapter--climax .chapter-copy { max-width: none; margin: 0 auto; }
.chapter--climax p {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 3.3rem); line-height: 1.14; letter-spacing: -.015em;
  max-width: 17ch; margin: 0 auto; color: var(--j-ink);
}
@media (min-width: 768px) and (min-aspect-ratio: 9/10) {
  .chapter--climax { align-items: flex-end; padding-bottom: 13vh; }
}

@media (max-width: 767px), (max-aspect-ratio: 9/10) {
  .chapter { align-items: flex-end; padding: 0 0 13svh; }
  .chapter.journey-hero { padding-bottom: 9svh; }
  .chapter--climax { padding-bottom: 14svh; }
}

/* ---------- Arrival: the clinic, on paper again ---------- */
.arrival { position: relative; }

@media (prefers-reduced-motion: reduce) {
  .journey-cue i { animation: none; transform: none; opacity: .6; }
  .journey-canvas { transition: none; }
}
