/* =====================================================================
   HERO SCROLL — the coded scroll-hero stage shared by every station
   A tall driver (.hs) pins a full-viewport stage (.hs-stage) while the
   visitor scrolls; js/heroscroll.js turns scroll into a progress value,
   fades the story beats (.hs-beat) and asks the station's scene
   (js/heroes/*.js) to draw. Loaded after style.css and arcana.css.

   States on <html>:
     (none)      no JS: the stage is an ordinary header, beats stacked
     .hs-live    JS + motion: pinned stage, beats float over the scene
     .hs-static  prefers-reduced-motion or no WebGL: one still frame,
                 beats stacked over it, nothing pinned
   ===================================================================== */

.hs{position:relative;--hs-len:300vh;--hs-len-m:230vh;--nav-h:58px}
/* the stage tucks under the sticky lintel so the scene is full-bleed from the first frame */
.nav + .hs{margin-top:calc(-1 * var(--nav-h))}

.hs-stage{position:relative;overflow:hidden;isolation:isolate;background:var(--void);
  min-height:100vh;padding:calc(var(--nav-h) + 2.5rem) 0 3rem}
.hs-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;z-index:0}
.hs-fx{position:absolute;inset:0;z-index:1;pointer-events:none}
.hs-fx.hs-touch{pointer-events:auto}

/* ---------- beats: the story told over the scene ---------- */
.hs-beat{position:relative;z-index:5;padding:1.2rem clamp(24px,7vw,120px)}
.hs-in{position:relative;max-width:600px}
.hs-at-right .hs-in{margin-left:auto}
.hs-at-center .hs-in{margin:0 auto;text-align:center;max-width:720px}
/* a soft well of dark exactly where the words sit, never a full-frame overlay */
.hs-in::before{content:"";position:absolute;inset:-2.6rem -3.4rem;z-index:-1;pointer-events:none;
  background:radial-gradient(closest-side,rgba(6,5,4,.62),rgba(6,5,4,.34) 55%,transparent 100%);filter:blur(8px)}
.hs-quiet .hs-in::before{opacity:.55}

.hs .eyebrow{color:var(--st-a);text-shadow:0 1px 4px rgba(0,0,0,.95),0 0 18px color-mix(in srgb,var(--st-a) 45%,transparent)}
.hs h1{font-family:var(--f-display);font-weight:700;font-size:clamp(3rem,7.4vw,6.2rem);line-height:1.02;margin:.08em 0 .22em;
  letter-spacing:.01em;font-kerning:auto;text-wrap:balance;
  background:linear-gradient(100deg,#e7c26c 0%,#f6e3ae 34%,#fffaf0 48%,#f6e3ae 62%,#d9b25a 100%);
  background-size:250% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent;
  animation:gildSweep 7s ease-in-out infinite;
  filter:drop-shadow(0 0 22px color-mix(in srgb,var(--st-a) 32%,transparent)) drop-shadow(0 2px 3px rgba(0,0,0,.9)) drop-shadow(0 6px 18px rgba(0,0,0,.8))}
.hs h2{font-family:var(--f-display);font-weight:600;font-size:clamp(2rem,4.4vw,3.5rem);line-height:1.06;letter-spacing:.015em;
  color:var(--parch);margin:0 0 .4em;text-wrap:balance;
  text-shadow:0 2px 4px rgba(0,0,0,.9),0 6px 30px rgba(0,0,0,.85),0 0 40px color-mix(in srgb,var(--st-a) 18%,transparent)}
.hs p{font-size:clamp(1.05rem,1.45vw,1.24rem);line-height:1.6;color:var(--parch-2);margin:0;max-width:48ch;text-wrap:pretty;
  text-shadow:0 1px 3px rgba(0,0,0,.95),0 2px 16px rgba(0,0,0,.9)}
.hs-at-center p{margin-inline:auto}
.hs p + p{margin-top:.7em}
.hs p b,.hs p strong{color:#fff1cf;font-weight:500}
/* numbers that come from the site's data or exact math wear the mono face */
.hs .num{font-family:var(--f-mono);font-size:.9em;color:#fff4d6;letter-spacing:0;
  text-shadow:0 0 12px color-mix(in srgb,var(--st-a) 55%,transparent),0 1px 3px #000}
.hs-cta{display:flex;flex-wrap:wrap;gap:.8rem;margin-top:1.6rem}
.hs-at-center .hs-cta{justify-content:center}

/* ---------- the skip: a working shortcut to the tool, not a scroll cue ---------- */
.hs-skip{position:absolute;z-index:8;right:clamp(16px,3vw,40px);
  bottom:calc(20px + env(safe-area-inset-bottom));
  font-family:var(--f-head);font-size:.72rem;letter-spacing:.2em;text-transform:uppercase;color:var(--parch-2);
  padding:.62rem 1rem;border:1px solid color-mix(in srgb,var(--st-a) 38%,transparent);border-radius:999px;
  background:rgba(8,6,5,.66);backdrop-filter:blur(6px);text-decoration:none;
  box-shadow:0 0 18px color-mix(in srgb,var(--st-a) 16%,transparent);transition:color .25s,border-color .25s,box-shadow .25s}
.hs-skip:hover,.hs-skip:focus-visible{color:#fff6dc;border-color:var(--st-a);box-shadow:0 0 24px color-mix(in srgb,var(--st-a) 40%,transparent)}
.hs-skip:focus-visible{opacity:1!important;visibility:visible!important}

/* the seam where the scene hands over to the page */
.hs-handoff{position:absolute;left:0;right:0;bottom:0;height:34vh;z-index:4;pointer-events:none;opacity:0;
  background:linear-gradient(180deg,transparent 0%,rgba(10,8,6,.7) 55%,var(--void) 100%)}

/* below the stage, the page's own aether fades in instead of starting at a hard edge */
.hs::after{content:"";position:absolute;left:0;right:0;top:100%;height:26vh;z-index:0;pointer-events:none;
  background:linear-gradient(180deg,var(--void) 0%,rgba(10,8,6,.6) 45%,transparent 100%)}

/* tool sections the skip lands on clear the sticky lintel */
.hs-target{scroll-margin-top:calc(var(--nav-h) + 12px)}
.hs-target:focus{outline:none}
.hs-target:focus-visible{outline:2px solid color-mix(in srgb,var(--st-a) 55%,transparent);outline-offset:-2px}

/* ---------- live: pinned stage, floating beats ---------- */
.hs-live .hs{height:var(--hs-len)}
.hs-live .hs-stage{position:sticky;top:0;height:100vh;height:100lvh;min-height:0;padding:0}
.hs-live .hs-beat{position:absolute;left:0;right:0;top:0;bottom:0;padding:calc(var(--nav-h) + 1.5rem) clamp(24px,7vw,120px) 4.5rem;
  display:flex;flex-direction:column;justify-content:center;opacity:0;visibility:hidden;pointer-events:none;
  will-change:opacity,transform}
.hs-live .hs-beat.on{visibility:visible}
.hs-live .hs-beat.on.hs-click{pointer-events:auto}
.hs-live .hs-beat .hs-in{pointer-events:auto}
.hs-live .hs-at-bottom{justify-content:flex-end}
.hs-live .hs-at-top{justify-content:flex-start}

/* ---------- static: reduced motion, no WebGL, or a scene that failed ---------- */
.hs-static .hs-stage{display:flex;flex-direction:column;justify-content:center;gap:1.4rem;min-height:92vh}
.hs-static .hs-handoff{opacity:1;height:22vh}
.hs-static .hs-skip{position:relative;right:auto;bottom:auto;align-self:center;margin-top:.6rem;z-index:6}
.hs-nogl .hs-stage{background:
  radial-gradient(ellipse 60% 55% at 70% 42%,color-mix(in srgb,var(--st-a) 16%,transparent),transparent 70%),
  radial-gradient(ellipse 50% 50% at 25% 70%,color-mix(in srgb,var(--st-b) 12%,transparent),transparent 70%),var(--void)}

/* ---------- phones: the scene owns the top, the words own the bottom ---------- */
@media (max-width:720px){
  .hs-live .hs{height:var(--hs-len-m)}
  .hs-live .hs-beat{justify-content:flex-end;padding:calc(var(--nav-h) + 1rem) 20px calc(4.6rem + env(safe-area-inset-bottom) + (100lvh - 100svh))}
  .hs-live .hs-at-top{justify-content:flex-start}
  .hs-at-right .hs-in{margin-left:0}
  .hs-at-center .hs-in{text-align:left;margin:0}
  .hs-at-center .hs-cta{justify-content:flex-start}
  .hs-in::before{inset:-1.8rem -1.2rem;background:radial-gradient(closest-side,rgba(6,5,4,.74),rgba(6,5,4,.46) 60%,transparent 100%)}
  .hs h1{font-size:clamp(2.6rem,12.5vw,3.8rem)}
  .hs h2{font-size:clamp(1.75rem,8vw,2.4rem)}
  .hs p{font-size:1.04rem}
  .hs-skip{left:20px;right:auto;bottom:calc(16px + env(safe-area-inset-bottom) + (100lvh - 100svh));font-size:.7rem;padding:.7rem 1rem}
}

@media (prefers-reduced-motion: reduce){
  .hs h1{animation:none}
}
