/* =====================================================================
   Karst signal · "The interface is about to change"
   HERO · loader + sticky WebGL track + four centred overlays

   Pairs with hero.js and hero-markup.html.
   Uses the page's existing :root tokens (--dark, --cream, --gold-light,
   --font-headline, --font-body, --font-editorial, --ease-standard).
   Karst fonts only: Montserrat / Inter / Libre Baskerville.
   ===================================================================== */

:root {
  /* Linear's measured big-move curve. Chrome only; scrubbed values never use it. */
  --ease-out-soft: cubic-bezier(0.32, 0.72, 0, 1);
}

/* =====================================================================
   1 · Loader
   ===================================================================== */

.hero-loader {
  position: fixed; inset: 0; z-index: 60;
  background: var(--dark);
  opacity: 1;
  transform: scale(1);
  will-change: opacity, transform;
}
.hero-loader.out {
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 900ms cubic-bezier(0.6, 0.05, 0.2, 1), transform 900ms cubic-bezier(0.6, 0.05, 0.2, 1);
  pointer-events: none;
}
.hero-loader.reduced.out {
  transform: none;
  transition: opacity 420ms linear;
}
.hero-loader canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
.hero-loader .ld-mark,
.hero-loader .ld-foot {
  position: absolute; left: 0; right: 0;
  padding: 28px 24px;
  font-family: var(--font-headline); font-weight: 500;
  font-size: 10px; line-height: 1;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: rgba(243, 239, 230, 0.55);
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
}
.hero-loader .ld-mark { top: 0; }
.hero-loader .ld-mark > span:first-child { font-size: 12px; letter-spacing: 0.42em; color: var(--cream); }
.hero-loader .ld-mark .sig { opacity: 0.38; }
.hero-loader .ld-foot { bottom: 14px; }
.hero-loader .ld-foot .status { opacity: 0.40; }
.hero-loader .ld-foot .pct { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; opacity: 0.80; }
.hero-loader .ld-foot .sign { opacity: 0.35; }
.hero-loader .ld-track {
  position: absolute; bottom: 0; left: 24px; right: 24px;
  height: 1px; background: rgba(243, 239, 230, 0.12);
  margin-bottom: 14px;
}
.hero-loader .ld-bar {
  height: 100%; width: 0%;
  background: #dbe6f6;
  transition: width 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* =====================================================================
   2 · Track and canvas
   ===================================================================== */

.cinematic-hero {
  position: relative;
  height: 900lvh;            /* 4 form tracks × 200lvh + 100lvh trail */
  background: var(--dark);
}
.hero-sticky {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: var(--dark);
}
.hero-canvas-wrap { position: absolute; inset: 0; z-index: 0; background: var(--dark); }
.hero-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.hero-fallback {
  position: absolute; inset: 0; display: none;
  background:
    radial-gradient(ellipse 60% 44% at 52% 58%, rgba(51, 64, 122, 0.42), transparent 62%),
    radial-gradient(ellipse 34% 26% at 48% 46%, rgba(219, 230, 246, 0.14), transparent 70%),
    var(--dark);
}

/* edge darkener · a separate job from the type scrim */
.hero-vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 58%, rgba(5, 5, 7, 0.30) 100%);
}
/* legibility scrim · static, never animated, darkness only where type sits */
.hero-scrim {
  position: absolute; inset: 0; z-index: 9; pointer-events: none;
  background: radial-gradient(ellipse 78% 62% at 50% 48%, rgba(5, 5, 7, 0.62), rgba(5, 5, 7, 0.28) 55%, transparent 78%);
}

/* =====================================================================
   3 · The four centred overlays
   Scrubbed: opacity / transform / filter are set every frame by hero.js.
   These elements carry NO transition property.
   ===================================================================== */

.hero-beat {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: 0 24px;
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform, filter;
}
.hero-beat.active { pointer-events: none; }
.hero-beat.active a { pointer-events: auto; }

.beat-col {
  max-width: 980px;
  text-align: center;
  transform: translateY(-4svh);   /* optical centre */
}

.hero-beat .b-label {
  font-family: var(--font-headline); font-weight: 500;
  font-size: 10px; line-height: 1; letter-spacing: 0.34em; text-transform: uppercase;
  color: #a6aade;
  margin-bottom: 28px;
}
.hero-beat h1,
.hero-beat h2 {
  font-family: var(--font-headline); font-weight: 300;
  color: var(--cream);
  margin: 0 auto 26px;
  max-width: 17ch;
  text-wrap: balance;
}
.hero-beat h1 .h1-line { display: block; }
.hero-beat h1 { font-size: 84px; line-height: 1.04; letter-spacing: -0.032em; }
.hero-beat h2 { font-size: 76px; line-height: 1.06; letter-spacing: -0.030em; color: var(--cream); }
.font-editorial { font-family: var(--font-editorial); font-style: italic; font-weight: 400; }
@keyframes sunset-wave { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
.hero-beat h1 .font-editorial,
.hero-beat h2 .font-editorial {
  font-family: var(--font-editorial); font-style: italic; font-weight: 400;
  display: inline-block;
  letter-spacing: -0.012em;
  line-height: inherit;
  padding: 0.14em 0.06em 0.18em;
  margin: -0.14em -0.06em -0.18em;
}
/* the padded inline-block must keep its own clip, or the pivot renders flat cream */
.hero-beat h1 .text-sunset-cycle-light,
.hero-beat h2 .text-sunset-cycle-light {
  background: linear-gradient(90deg, #8a8ec8, #a0b8dc, #c6d6ee, #eaf1fb, #c6d6ee, #a0b8dc, #8a8ec8);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: sunset-wave 12s linear infinite;
}
.hero-beat .tag {
  margin: 0 auto;
  max-width: 30ch;
  font-family: var(--font-body); font-weight: 500;
  font-size: 26px; line-height: 1.45; letter-spacing: -0.006em;
  color: var(--cream);
}
.hero-beat .src {
  display: inline-block; margin-top: 32px;
  font-family: var(--font-headline); font-weight: 500;
  font-size: 9.5px; line-height: 1; letter-spacing: 0.26em; text-transform: uppercase;
  color: rgba(243, 239, 230, 0.80);
  text-decoration: none;
  border-bottom: 1px solid rgba(243, 239, 230, 0.30);
  padding-bottom: 5px;
  transition: color 160ms var(--ease-standard), border-bottom-color 160ms var(--ease-standard);
}
.hero-beat .src:hover { color: var(--cream); border-bottom-color: rgba(243, 239, 230, 0.45); }
.hero-beat .cta {
  display: inline-block; margin-top: 36px;
  border-radius: 3px; border: 1px solid rgba(160, 184, 220, 0.45);
  background: var(--cream); color: #171512;
  padding: 15px 34px;
  font-family: var(--font-headline); font-weight: 500;
  font-size: 10px; line-height: 1; letter-spacing: 0.22em; text-transform: uppercase;
  text-decoration: none;
  transition: transform 160ms var(--ease-standard);
}
.hero-beat .cta:hover { transform: translateY(-1px); }

@media (max-width: 1199px) {
  .hero-beat h1 { font-size: 64px; letter-spacing: -0.028em; }
  .hero-beat h2 { font-size: 58px; letter-spacing: -0.028em; }
}

/* =====================================================================
   4 · Chrome: hint, rail, stage count
   ===================================================================== */

.hero-hint {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 10; text-align: center;
  transition: opacity 700ms var(--ease-out-soft);
}
.hero-hint .line {
  display: block; margin: 0 auto 12px; height: 32px; width: 1px;
  background: linear-gradient(180deg, transparent, rgba(138, 142, 200, 0.8));
  animation: hint-drift 2.6s ease-in-out infinite;
}
@keyframes hint-drift { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.hero-hint .word {
  font-family: var(--font-headline); font-weight: 500;
  font-size: 8.5px; line-height: 1; letter-spacing: 0.36em; text-transform: uppercase;
  color: rgba(243, 239, 230, 0.42);
}

.hero-railgroup {
  position: absolute; right: max(24px, calc((100vw - 1152px) / 2));
  top: 50%; transform: translateY(-50%);
  z-index: 10;
  display: flex; flex-direction: column; align-items: flex-end; gap: 20px;
}
.hero-rail { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0; padding: 0; }
.hero-rail li {
  width: 1px; height: 18px;
  background: rgba(243, 239, 230, 0.16);
  transition: height 700ms var(--ease-out-soft), background 700ms var(--ease-out-soft);
}
.hero-rail li.on { height: 28px; background: rgba(243, 239, 230, 0.72); }
.hero-stage-count {
  font-family: var(--font-headline); font-weight: 400;
  font-size: 10px; line-height: 1; letter-spacing: 0.30em;
  color: rgba(243, 239, 230, 0.38);
  writing-mode: vertical-rl;
}

/* =====================================================================
   5 · Mobile (≤720px)
   ===================================================================== */

@media (max-width: 720px) {
  .cinematic-hero { height: 780lvh; }   /* 4 × 160lvh + 140lvh trail */
  .hero-beat { padding: 0 20px; }
  .beat-col { transform: translateY(-3svh); }
  .hero-beat h1 { font-size: 40px; line-height: 1.06; letter-spacing: -0.022em; max-width: 14ch; }
  .hero-beat h2 { font-size: 38px; line-height: 1.08; letter-spacing: -0.020em; max-width: 14ch; }
  .hero-beat .b-label { font-size: 9.5px; letter-spacing: 0.30em; margin-bottom: 22px; }
  .hero-beat .tag { font-size: 19px; line-height: 1.5; letter-spacing: -0.003em; max-width: none; }
  .hero-beat .src { font-size: 9px; letter-spacing: 0.24em; margin-top: 26px; }
  .hero-beat .cta { margin-top: 30px; }
  .beat-extra { display: none; }
  .hero-railgroup { display: none; }
  .hero-loader .ld-mark, .hero-loader .ld-foot { padding: 22px 20px; font-size: 9px; letter-spacing: 0.28em; }
  .hero-loader .ld-track { left: 20px; right: 20px; }
}

/* mobile: keep the source line clear of the home indicator */
@media (max-width: 720px) {
  .hero-beat { padding-bottom: 34px; }
}

/* =====================================================================
   6 · Reduced motion
   The journey stays scroll-walkable; it just stops breathing.
   Each form has a settled state that still teaches.
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .hero-hint, .hero-railgroup { display: none; }
  .hero-loader .ld-bar { transition: none; }
  .text-sunset-cycle-light { animation: none; background-position: 30% 50%; }
  .hero-hint .line { animation: none; }
  .hero-beat .src, .hero-beat .cta { transition: none; }
}
