/* Hero motion library: how a hero section enters and how it leaves the screen on scroll.
   Copied from the design-kickoff library 2026-11-23; only the "fog" scroll-out is kept.
   Contract (references/hero-motion.md): data-hero on the section, data-hero-out="<variant>" on the same element,
   data-hero-bg / data-hero-text / data-hero-title / data-hero-lead / data-hero-actions / data-hero-facts inside.

   Nothing here applies unless the script has confirmed it runs: the scroll-out rules sit under html.hero-out-on,
   the hidden entrance states under html.hero-pending. Without JavaScript, on a script failure and under
   prefers-reduced-motion the hero is a plain static section. */

/* ---------- Entrance ---------- */
html.hero-pending [data-hero-title],
html.hero-pending [data-hero-lead],
html.hero-pending [data-hero-facts],
html.hero-pending [data-hero-late] { opacity: 0; }
/* The main action is never hidden: it is clickable from the first frame. */
[data-hero-title].is-split { display: flex; flex-direction: column; }
/* One mask per rendered line. The padding keeps diacritics, descenders and the blur inside the mask. */
.hero-line { display: block; overflow: hidden; white-space: nowrap; padding: 0.3em 0.5em; margin: -0.3em -0.5em; }
.hero-line__in { display: block; }

/* ---------- Scroll-out: shared ---------- */
:root {
  --hero-run: 70vh;         /* pinned mode only: how long the hero stays put; the script overwrites it in px */
  --hero-focus: 50% 40%;    /* the point "approach" flies into and "porthole" closes around */
  --hero-dark: #0e2240;     /* the colour "curtain" and "tilt" sink into; use the site's darkest tone */
}
[data-hero] { --p: 0; }
/* Default: the hero scrolls away as usual and the effect runs during that scroll (--p goes 0 to 1 over the first
   60% of the hero's height). The owner's rule: the scroll and the effect happen together, nothing is held back.
   Opt-in only, data-hero-pin: the hero stays put while the effect plays, then the next block slides over it.
   For effects that cannot work otherwise ("facts"); never the default. */
html.hero-out-on [data-hero][data-hero-out][data-hero-pin] { position: sticky; top: 0; }
html.hero-out-on [data-hero][data-hero-out][data-hero-pin] + * { margin-top: var(--hero-run); }
/* Everything after the hero covers it: it needs its own opaque background. */
html.hero-out-on [data-hero][data-hero-out] ~ * { position: relative; z-index: 1; }
html.hero-out-on [data-hero][data-hero-out]::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: var(--hero-dark); opacity: 0; border-radius: inherit; }

/* ---------- Scroll-out: ten variants. They differ in the end state, not in degree. ---------- */

/* fog: the text dissolves into a blur, the picture is left clean. Mirrors the entrance. */
html.hero-out-on [data-hero-out="fog"] [data-hero-text] { filter: blur(calc(var(--p) * 18px)); opacity: calc(1 - var(--p) * 1.1); }
