/* ============================================================================
   scrollcraft.css: the taste floor
   ----------------------------------------------------------------------------
   Two layers, and the split matters:

     TOKENS   what you override per brand. Colour roles, the type ramp, the
              spacing scale, elevation, motion. A brand is ~12 values.
     DEVICES  what the engine drives. Do not restyle these to taste; they are
              the mechanism. Style your own markup instead.

   Nothing here draws a "component". There are no card, badge, or pill classes,
   because a stylesheet that ships those is how every page built on it ends up
   with the same shapes. You get a floor and a vocabulary; the composition is
   yours.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens -- */
:root {
  /* --- colour roles. Override these six and the page is rebranded. -------- */
  --sc-canvas:      #08090b;   /* the page ground. Drift interpolates this.   */
  --sc-surface:     #101217;   /* anything raised off the ground             */
  --sc-ink:         #f4f2ef;   /* primary text                               */
  --sc-ink-soft:    #9a9ba1;   /* secondary text. Tinted, never flat gray.   */
  --sc-accent:      #d8ff3e;   /* ONE accent. It owns a region, not confetti. */
  --sc-accent-ink:  #08090b;   /* text that sits on the accent               */

  --sc-hairline:    color-mix(in oklab, var(--sc-ink) 12%, transparent);
  --sc-hairline-strong: color-mix(in oklab, var(--sc-ink) 22%, transparent);

  /* --- type. Two families max. Display carries voice, text carries prose. - */
  --sc-font-display: "Instrument Sans", "Geist", system-ui, sans-serif;
  --sc-font-text:    "Geist", system-ui, sans-serif;
  --sc-font-mono:    "Geist Mono", ui-monospace, monospace;

  /* Fluid ramp. Tracking tightens as size grows because a face set at 6rem
     with 0 tracking reads loose; this is optical correction, not decoration. */
  --sc-t-xs:   clamp(0.75rem, 0.72rem + 0.15vw, 0.82rem);
  --sc-t-sm:   clamp(0.875rem, 0.84rem + 0.18vw, 0.95rem);
  --sc-t-base: clamp(1rem, 0.96rem + 0.22vw, 1.125rem);
  --sc-t-lg:   clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --sc-t-xl:   clamp(1.6rem, 1.35rem + 1.2vw, 2.25rem);
  --sc-t-2xl:  clamp(2.1rem, 1.6rem + 2.4vw, 3.4rem);
  --sc-t-3xl:  clamp(2.8rem, 1.9rem + 4.2vw, 5rem);
  --sc-t-4xl:  clamp(3.4rem, 1.9rem + 6.6vw, 7.5rem);

  --sc-track-tight:  -0.035em;
  --sc-track-snug:   -0.02em;
  --sc-track-normal: -0.005em;
  --sc-track-wide:    0.08em;

  --sc-leading-none: 0.94;
  --sc-leading-tight: 1.06;
  --sc-leading-body: 1.62;

  --sc-measure: 62ch;

  /* --- space. 4px base: the useful middle steps an 8-only scale misses. --- */
  --sc-1: 0.25rem;  --sc-2: 0.5rem;   --sc-3: 0.75rem;  --sc-4: 1rem;
  --sc-5: 1.5rem;   --sc-6: 2rem;     --sc-7: 3rem;     --sc-8: 4rem;
  --sc-9: 6rem;     --sc-10: 8rem;    --sc-11: 12rem;

  /* Section rhythm is fluid so a phone doesn't inherit desktop air. */
  --sc-section: clamp(4.5rem, 9vw, 11rem);
  --sc-gutter:  clamp(1.25rem, 5vw, 5.5rem);
  --sc-maxw:    82rem;

  /* --- radius. Pick one scale for the page and hold it. ------------------- */
  --sc-r-sm: 6px;  --sc-r-md: 12px;  --sc-r-lg: 20px;  --sc-r-pill: 999px;

  /* --- elevation. Every shadow has an offset AND a soft blur, and is tinted
         to the canvas hue. A zero-offset coloured halo is decoration, not
         depth, so there isn't one here. ---------------------------------- */
  --sc-shadow-color: 220 40% 2%;
  --sc-e1: 0 1px 2px hsl(var(--sc-shadow-color) / 0.28),
           0 2px 6px -1px hsl(var(--sc-shadow-color) / 0.20);
  --sc-e2: 0 2px 4px hsl(var(--sc-shadow-color) / 0.24),
           0 8px 18px -4px hsl(var(--sc-shadow-color) / 0.30);
  --sc-e3: 0 4px 8px hsl(var(--sc-shadow-color) / 0.22),
           0 18px 40px -8px hsl(var(--sc-shadow-color) / 0.38),
           0 48px 90px -24px hsl(var(--sc-shadow-color) / 0.30);

  /* Edge light: a 1px top highlight sells a raised surface better than any
     amount of blur, because real raised things catch light on their lip. */
  --sc-edge: inset 0 1px 0 color-mix(in oklab, var(--sc-ink) 10%, transparent);

  /* --- motion. Built-in CSS easings are too weak for UI. ------------------ */
  --sc-ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --sc-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --sc-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --sc-d-fast: 160ms;  --sc-d-base: 240ms;  --sc-d-slow: 420ms;

  --sc-z-stage: 1; --sc-z-copy: 20; --sc-z-chrome: 60;
}

/* --------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--sc-canvas);
  color: var(--sc-ink);
  font-family: var(--sc-font-text);
  font-size: var(--sc-t-base);
  line-height: var(--sc-leading-body);
  letter-spacing: var(--sc-track-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
  overflow-x: clip;
}
img, video, canvas, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------- the browser surfaces --
   The parts you did not draw still carry the design. Selection, caret, focus
   ring, scrollbar and tabular numerals all ship with defaults that belong to no
   design system. Theming them is the cheapest signal that a page was built
   rather than assembled, and it is the step that gets skipped most reliably. */
::selection { background: var(--sc-accent); color: var(--sc-accent-ink); }
:root { caret-color: var(--sc-accent); accent-color: var(--sc-accent); }
:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 3px;
  border-radius: var(--sc-r-sm);
}
:where(a) { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
@supports (scrollbar-color: auto) {
  html { scrollbar-color: color-mix(in oklab, var(--sc-ink) 26%, transparent) transparent; scrollbar-width: thin; }
}
:where(table, .sc-nums, [data-sc-count]) { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- typography -- */
.sc-display {
  font-family: var(--sc-font-display);
  font-weight: 500;
  line-height: var(--sc-leading-none);
  letter-spacing: var(--sc-track-tight);
  text-wrap: balance;
  margin: 0;
}
.sc-display--xl { font-size: var(--sc-t-4xl); }
.sc-display--lg { font-size: var(--sc-t-3xl); }
.sc-display--md { font-size: var(--sc-t-2xl); letter-spacing: var(--sc-track-snug); }
.sc-lede {
  font-size: var(--sc-t-lg);
  line-height: 1.44;
  letter-spacing: var(--sc-track-snug);
  color: var(--sc-ink);
  max-width: 46ch;
  text-wrap: pretty;
  margin: 0;
}
.sc-body { max-width: var(--sc-measure); color: var(--sc-ink-soft); text-wrap: pretty; margin: 0; }
.sc-label {
  font-family: var(--sc-font-mono);
  font-size: var(--sc-t-xs);
  letter-spacing: var(--sc-track-wide);
  text-transform: uppercase;
  color: var(--sc-ink-soft);
}

/* ---------------------------------------------------------------- layout -- */
.sc-wrap { width: 100%; max-width: var(--sc-maxw); margin-inline: auto; padding-inline: var(--sc-gutter); }
.sc-section { padding-block: var(--sc-section); }
/* More space above a heading than below it: the gap belongs to the boundary,
   not to the pair. */
.sc-stack > * + * { margin-top: var(--sc-4); }
.sc-stack > :is(h1,h2,h3) { margin-top: var(--sc-7); }
.sc-stack > :is(h1,h2,h3):first-child { margin-top: 0; }
.sc-rule { height: 1px; border: 0; background: var(--sc-hairline); margin: 0; }

/* =============================================================== DEVICES ==
   Driven by the engine. Restyle your own markup, not these.                */

.sc-act--pinned { position: relative; }
.sc-stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: clip;
  z-index: var(--sc-z-stage);
}

/* scrub / sequence media */
.sc-stage :is(video[data-sc-scrub], canvas[data-sc-sequence], .sc-stage__poster) {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
video[data-sc-scrub] { opacity: 0; transition: opacity 380ms var(--sc-ease-out); }
.sc-has-clip video[data-sc-scrub] { opacity: 1; }
/* The poster is a live frame-holder, not a placeholder: it stays up until a
   real video frame has painted, which is what stops the blank-stage flash. */
.sc-stage__poster { z-index: 0; transition: opacity 380ms var(--sc-ease-out); }
.sc-has-clip .sc-stage__poster { opacity: 0; }

/* A scrim only where text sits. A full-frame darkening layer flattens the
   image everywhere to fix contrast in one corner. */
.sc-scrim {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(
    var(--sc-scrim-angle, 180deg),
    color-mix(in oklab, var(--sc-canvas) var(--sc-scrim-a, 78%), transparent) 0%,
    color-mix(in oklab, var(--sc-canvas) 30%, transparent) 42%,
    transparent 68%);
}
/* Point the scrim at the copy. A scrim gradient that darkens the top while the
   copy sits at the bottom fixes contrast nowhere and flattens the image
   everywhere, which is the most common way text-over-video goes wrong. */
.sc-scrim--bottom { --sc-scrim-angle: 0deg; }
.sc-scrim--left   { --sc-scrim-angle: 90deg; }
.sc-scrim--right  { --sc-scrim-angle: 270deg; }

/* Corner scrims, for copy anchored to a corner. An edge gradient has to darken
   a whole band across the frame to cover one corner; a corner gradient puts the
   density where the text is and leaves the rest of the image alone. Pair with
   .sc-copy--lead / .sc-copy--trail. */
.sc-scrim--lead {
  background: linear-gradient(to top right,
    color-mix(in oklab, var(--sc-canvas) 94%, transparent) 0%,
    color-mix(in oklab, var(--sc-canvas) 72%, transparent) 30%,
    color-mix(in oklab, var(--sc-canvas) 30%, transparent) 52%,
    transparent 72%);
}
.sc-scrim--trail {
  background: linear-gradient(to top left,
    color-mix(in oklab, var(--sc-canvas) 94%, transparent) 0%,
    color-mix(in oklab, var(--sc-canvas) 72%, transparent) 30%,
    color-mix(in oklab, var(--sc-canvas) 30%, transparent) 52%,
    transparent 72%);
}
/* A band across the bottom, for copy that spans the full width of the frame.
   That is what both corner anchors become below 860px, and it is also the right
   shape whenever the copy block is wider than a corner. */
.sc-scrim--band {
  background: linear-gradient(to top,
    color-mix(in oklab, var(--sc-canvas) 94%, transparent) 0%,
    color-mix(in oklab, var(--sc-canvas) 74%, transparent) 22%,
    color-mix(in oklab, var(--sc-canvas) 30%, transparent) 42%,
    transparent 58%);
}
.sc-scrim--vignette {
  background: radial-gradient(120% 90% at 50% 45%, transparent 40%,
              color-mix(in oklab, var(--sc-canvas) 70%, transparent) 100%);
}

/* copy over a stage.
   max-width is in rem, never ch. A `ch` on this container resolves against the
   CONTAINER's font-size (body size), not the display size of the heading inside
   it, so `max-width: 20ch` here silently produces a ~180px column and wraps a
   hero headline to six lines. Set a ch measure on the text element itself. */
.sc-copy {
  position: absolute; z-index: var(--sc-z-copy);
  inset-inline: var(--sc-gutter);
  max-width: min(46rem, 76vw);
  will-change: opacity, transform;
}
.sc-copy--lead   { left: var(--sc-gutter); bottom: clamp(3rem, 12vh, 9rem); }
/* inset-inline FIRST. It is the shorthand for left+right, so declaring it after
   `left: 50%` resets left to auto and the block drifts off the left edge. */
.sc-copy--center { inset-inline: auto; left: 50%; top: 50%; translate: -50% -50%; text-align: center; }
.sc-copy--trail  { inset-inline: auto; right: var(--sc-gutter); bottom: clamp(3rem, 12vh, 9rem); text-align: right; }

/* cue defaults: the engine writes opacity/transform inline, these are the
   pre-paint state so nothing flashes before the first read() */
[data-sc-cue] { opacity: 0; will-change: opacity, transform; }
.sc-ready [data-sc-cue] { transition: none; }

/* kinetic split */
.sc-split { display: inline-block; overflow: hidden; vertical-align: top; }
/* Descenders live below the baseline; a line mask clipped to the line box eats
   the tails off g, y, p, j. The padding buys them room back. */
.sc-split--line { display: block; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.sc-split__i { display: inline-block; will-change: transform, opacity; }
.sc-is-split { opacity: 1 !important; }

/* horizontal rail */
[data-sc-pan] { display: flex; will-change: transform; }

/* reveal + parallax */
[data-sc-reveal] { will-change: clip-path; }
[data-sc-parallax] { will-change: transform; }

/* flow reveal (fires once) */
[data-sc-in], [data-sc-stagger] > * {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition: opacity 620ms var(--sc-ease-out), transform 620ms var(--sc-ease-out);
}
[data-sc-in].sc-in, [data-sc-stagger] > .sc-in { opacity: 1; transform: none; }

/* pointer devices */
[data-sc-tilt] { transform-style: preserve-3d; will-change: transform; }
[data-sc-magnet] { will-change: transform; }
/* isolation always; position only if nothing more specific already set it.
   Written with :where() (zero specificity) on purpose: a plain `position:
   relative` here has the same weight as `.sc-stage` and, being later in the
   file, silently wins. A stage carrying both attributes then stops being
   sticky and the whole act scrolls away instead of pinning. */
[data-sc-spotlight] { isolation: isolate; }
:where([data-sc-spotlight]) { position: relative; }
[data-sc-spotlight]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(
    28rem 28rem at calc(var(--sc-mx, 0.5) * 100%) calc(var(--sc-my, 0.5) * 100%),
    color-mix(in oklab, var(--sc-accent) 16%, transparent), transparent 70%);
  opacity: 0; transition: opacity var(--sc-d-slow) var(--sc-ease-out);
}
[data-sc-spotlight]:hover::after { opacity: 1; }

/* =========================================================== WORLDFLIGHT ==
   One fixed stage for the whole page. The only thing in document flow is the
   spacer, and it is empty. If you find yourself adding a section here, you want
   act mode instead: the moment a real block scrolls past the fixed stage, the
   page has a seam again and the whole point is gone.                        */

[data-sc-mode="worldflight"] { position: relative; }

.sc-world {
  position: fixed; inset: 0;
  overflow: clip;
  z-index: var(--sc-z-stage);
  background: var(--sc-canvas);
}

/* Every leg is mounted for the life of the page and stacked in the same box.
   The engine owns opacity, visibility and z-index here; do not set them. */
.sc-world__seg {
  position: absolute; inset: 0;
  opacity: 0;
  will-change: opacity;
}
.sc-world__seg > :is(video, img, canvas) {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
/* The poster is the frame-holder AND the first camera move: the engine pushes
   it in slowly until a real decoded frame is available to replace it. */
.sc-world__poster {
  z-index: 0;
  transform-origin: 50% 50%;
  transition: opacity 420ms var(--sc-ease-out);
}
.sc-world__seg > video { z-index: 1; }
.sc-world__seg.sc-has-clip .sc-world__poster { opacity: 0; }
/* The act stylesheet lights a clip through its ancestor act. A worldflight leg
   has no act, so match the class the engine also writes on the clip itself. */
video[data-sc-scrub].sc-has-clip { opacity: 1; }

/* The copy layer is fixed too, and inert by default: the engine hands
   pointer-events back to a block only while it is actually legible. */
.sc-world__copy {
  position: fixed; inset: 0;
  z-index: var(--sc-z-copy);
  pointer-events: none;
}
.sc-world__scrim { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
[data-sc-copy] {
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
}
.sc-ready [data-sc-copy] { transition: none; }

/* The track. Empty on purpose. */
.sc-world__spacer { pointer-events: none; }

/* scroll progress */
[data-sc-progress] {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: var(--sc-z-chrome);
  background: var(--sc-accent); transform-origin: 0 50%; transform: scaleX(0);
  will-change: transform;
}

/* ----------------------------------------------------------- atmosphere --
   Depth is not only shadow. Grain keeps a flat dark ground from banding, and
   it is the difference between "a dark page" and "a lit room". */
.sc-grain { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: 0.045; }
.sc-grain::before {
  content: ""; position: absolute; inset: -50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
}

/* -------------------------------------------------------- reduced motion -- */
@media (prefers-reduced-motion: reduce) {
  /* Fewer and gentler, not zero. Opacity still carries the reveal so the page
     is comprehensible; every position change is dropped. */
  [data-sc-in], [data-sc-stagger] > * { transform: none; transition-duration: 220ms; }
  [data-sc-parallax], [data-sc-pan], .sc-split__i { transform: none !important; }
  /* A wipe is a position change too. Show reveal content settled. */
  [data-sc-reveal] { clip-path: none !important; }
  /* A rail's transform IS its navigation, not decoration. Zeroing it the way
     parallax and kinetic type are zeroed parks the act on its first screenful
     and makes everything past the fold unreachable: a device degrading into
     missing content. Hand the travel back to the reader as an ordinary scroll
     region instead, so the same items are all still gettable without motion.
     A build that would rather re-lay the rail out as a grid can still do that;
     this is the floor, not the ceiling. */
  [data-sc-act="pan"] .sc-stage,
  [data-sc-act="pan"] [data-sc-stage] {
    overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
  }
  [data-sc-pan] > * { scroll-snap-align: center; }
  [data-sc-spotlight]::after { display: none; }
  /* A worldflight keeps its whole story here. No clip is ever fetched, so the
     posters are the film, and they cross-dissolve through exactly the same
     seams at exactly the same scroll positions. The push-in and the copy drift
     are the only things that go. */
  .sc-world__poster, [data-sc-copy] { transform: none !important; }
}

/* --------------------------------------------------------------- mobile -- */
@media (max-width: 860px) {
  .sc-copy { inset-inline: var(--sc-gutter); max-width: none; }
  .sc-copy--trail { text-align: left; }
  .sc-stage { height: 100svh; }
  /* .sc-copy--trail re-anchors to the left and spans the full width here, so a
     bottom-RIGHT corner gradient darkens the one corner the copy just left and
     guarantees a contrast failure over any bright clip. Point the density at
     the copy: the same band .sc-scrim--band paints. */
  .sc-scrim--trail {
    background: linear-gradient(to top,
      color-mix(in oklab, var(--sc-canvas) 94%, transparent) 0%,
      color-mix(in oklab, var(--sc-canvas) 74%, transparent) 22%,
      color-mix(in oklab, var(--sc-canvas) 30%, transparent) 42%,
      transparent 58%);
  }
}

/* Palettes from avenex-academy/mobile/lib/theme.ts — light-dark(light, dark) */
:root {
  color-scheme: light dark;
  --paper: light-dark(#ffffff, #0c1015);
  --surface: light-dark(#f5f7fa, #141a22);
  --surface-2: light-dark(#ebeff4, #1b222c);
  --ink: light-dark(#121820, #e7ebf1);
  --ink-2: light-dark(#384352, #bec7d3);
  --muted: light-dark(#5f6b7b, #8a95a5);
  --accent: light-dark(#946010, #d6a548);
  --accent-hover: light-dark(#7a4f0d, #e4b862);
  --accent-soft: light-dark(#fbf1df, #291f10);
  --on-accent: light-dark(#ffffff, #0c1015);
  --good: light-dark(#16795d, #54b79a);
  --good-soft: light-dark(#e3f4ee, #12241d);
  --signal: light-dark(#b83a2e, #e2776c);
  --signal-soft: light-dark(#fceae8, #2a1715);

  /* Hero and closing stay a dark field in both themes. */
  --field: #0c1015;
  --field-2: #141a22;
  --field-ink: #e7ebf1;
  --field-muted: #a3adbb;
  --field-accent: #d6a548;

  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  /* Condensed scoreboard caps for the large type only; everything read at length stays in --font. */
  --font-display: "Big Shoulders Display", "Arial Narrow", var(--font);
  /* The only five type sizes on the page. Map anything new onto one of them. */
  --step-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.375rem, 1.1rem + 1vw, 2rem);
  --step-head: clamp(2.5rem, 1.2rem + 5vw, 5.5rem);
  --step-display: clamp(4.5rem, 14vw, 13.5rem);

  --gutter: clamp(1rem, 2.4vw, 2rem);
  --section: clamp(6rem, 12vw, 12rem);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  /* ScrollCraft reads its own tokens; point them at the brand. */
  --sc-canvas: var(--paper);
  --sc-ink: var(--ink);
  --sc-ink-soft: var(--muted);
  --sc-accent: var(--accent);
  --sc-accent-ink: var(--on-accent);
  --sc-font-display: var(--font-display);
  --sc-font-text: var(--font);
  --sc-gutter: var(--gutter);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
  -webkit-text-size-adjust: 100%;

  @media (prefers-reduced-motion: reduce) {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

figure {
  margin: 0;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 2px;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h2 {
  font-size: var(--step-head);
}

/* Vietnamese caps carry marks above and below (Ấ, Ậ, Ù): under ~1.1 leading they touch the next line. */
:is(h1, h2, .display) {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: uppercase;
}

h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

sup {
  font-size: var(--step-small);
  line-height: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;

  &:focus {
    top: 16px;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: var(--step-small);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out);

  &:hover {
    background: var(--accent-hover);
  }

  &:active {
    transform: scale(0.97);
  }
}

.button-ink {
  background: var(--ink);
  color: var(--paper);

  &:hover {
    background: var(--ink-2);
  }
}

.button-paper {
  background: var(--paper);
  color: var(--ink);

  &:hover {
    background: var(--surface-2);
  }
}

.read-progress {
  height: 3px;
}

/* Before ScrollCraft mounts, or if it never loads, everything it would animate stays visible. */
html:not(.sc-on) :is([data-sc-cue], [data-sc-in], [data-sc-stagger] > *) {
  opacity: 1;
  transform: none;
}

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px var(--gutter);
  color: var(--field-ink);
  font-size: var(--step-small);
  font-weight: 700;

  & a {
    text-decoration: none;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--step-lead);
  font-weight: 900;
  text-transform: uppercase;

  & .logo {
    color: var(--field-accent);
  }
}

.site-nav {
  display: flex;
  gap: clamp(16px, 2.4vw, 36px);

  & a {
    padding: 8px 0;
    color: var(--field-muted);
    transition: color 160ms var(--ease-out);

    &:hover {
      color: var(--field-ink);
    }
  }

  @media (max-width: 900px) {
    display: none;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;

  & .button {
    white-space: nowrap;
    background: var(--field-accent);
    color: var(--field);

    &:hover {
      background: #e4b862;
    }
  }
}

.web-link {
  transition: color 160ms var(--ease-out);

  &:hover {
    color: var(--field-accent);
  }

  @media (max-width: 640px) {
    display: none;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding-inline: 16px;
  }

  .header-actions {
    gap: 4px;

    & .button {
      padding: 0 14px;
    }
  }

  .theme-toggle {
    width: 40px;
  }
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--field-muted);
  cursor: pointer;
  transition: color 160ms var(--ease-out);

  &:hover {
    color: var(--field-ink);
  }

  & svg {
    display: none;
  }

  &[data-mode="system"] .icon-system,
  &[data-mode="light"] .icon-light,
  &[data-mode="dark"] .icon-dark {
    display: block;
  }

  &[hidden] {
    display: none;
  }
}

/* Past the hero the bar comes back down and stays (desktop only: on a phone the floating pill carries
   the stage and the button). The section being read is underlined (main.js). */
@media (min-width: 901px) {
  /* Equal side columns, so the nav sits at the true centre whatever the logo and the buttons measure. */
  .site-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;

    & .header-actions {
      justify-self: end;
    }
  }

  /* Narrower screens: the right side must not outgrow its column or the nav slides off centre. The web
     app link stays in the footer. */
  @media (max-width: 1279px) {
    .web-link {
      display: none;
    }
  }

  @media (max-width: 1099px) {
    .site-header {
      column-gap: 16px;
    }

    .site-nav {
      gap: 18px;
    }

    .header-actions .button {
      padding: 0 16px;
    }
  }

  html.header-stuck {
    scroll-padding-top: 88px;

    & .split-side {
      top: 112px;
    }
  }

  .site-header.is-stuck {
    position: fixed;
    height: 64px;
    padding-block: 0;
    border-bottom: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
    background: color-mix(in oklab, var(--paper) 90%, transparent);
    backdrop-filter: blur(12px);
    color: var(--ink);
    animation: header-in 280ms var(--ease-out);

    & .brand {
      font-size: var(--step-body);

      & .logo {
        width: 22px;
        height: 21px;
        color: var(--accent);
      }
    }

    & .site-nav a {
      color: var(--muted);

      &:hover {
        color: var(--ink);
      }
    }

    & .theme-toggle {
      color: var(--muted);

      &:hover {
        color: var(--ink);
      }
    }

    /* Past the hero the bar is only for finding your way: the pill and the closing carry the button. */
    & .web-link,
    & .header-actions .button {
      display: none;
    }

    /* Over the closing, which stays a dark field in both themes. */
    &.on-field {
      border-bottom-color: rgb(255 255 255 / 0.08);
      background: color-mix(in oklab, var(--field) 90%, transparent);
      color: var(--field-ink);

      & .brand .logo {
        color: var(--field-accent);
      }

      & .site-nav a,
      & .theme-toggle {
        color: var(--field-muted);

        &:hover {
          color: var(--field-ink);
        }
      }
    }
  }

  .site-nav a {
    position: relative;

    &::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 2px;
      height: 2px;
      border-radius: 1px;
      background: var(--accent);
      transform: scaleX(0);
      transform-origin: left;
      transition: transform 240ms var(--ease-out);
    }

    &[aria-current] {
      color: var(--ink);

      &::after {
        transform: scaleX(1);
      }
    }
  }
}

@keyframes header-in {
  from { transform: translateY(-100%); }
}

@media (prefers-reduced-motion: reduce) {
  .site-header.is-stuck {
    animation: none;
  }
}

.hero {
  background: var(--field);
  color: var(--field-ink);
}

/* .sc-stage is sticky and already the containing block: never set position here. */
.hero-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: max(104px, 12svh) var(--gutter) 0;
  background: var(--field);
  text-align: center;
}

.hero-title {
  font-size: clamp(3.5rem, 7vw, 7.5rem);
  line-height: 1.02;
  letter-spacing: 0;
  text-transform: uppercase;

  & span {
    display: block;
  }
}

.hero-lead {
  max-width: 52ch;
  font-size: var(--step-body);
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 24px;
}

.hero-cta {
  background: var(--field-accent);
  color: var(--field);

  &:hover {
    background: var(--field-ink);
  }
}

.hero-fact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 10px;
  color: var(--field-muted);
  font-size: var(--step-small);

  & b {
    color: var(--field-ink);
    font-size: var(--step-body);
    font-weight: 900;
  }
}

/* Full bleed, so the foothills run edge to edge. Opens standing on the bottom edge and
   sinks 96px across the pin; the 48px top margin keeps the flag clear of the copy. */
.hero-mountain {
  flex: 1 1 0;
  min-height: 0;
  width: calc(100% + 2 * var(--gutter));
  margin: 48px calc(-1 * var(--gutter)) -48px;

  & img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* The peak sits at 48.5% of mountain-wide.svg, not at its centre. */
    object-position: 48.5% 100%;
  }
}

@media (max-width: 860px) {
  .hero-stage {
    align-items: flex-start;
    gap: 18px;
    padding-top: 96px;
    text-align: left;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-mountain {
    margin: 8px calc(-1 * var(--gutter)) 0;
  }

  /* No room for the drift on a phone, as before the redesign. */
  .hero-mountain[data-sc-parallax] {
    transform: none !important;
  }

}

.statement {
  background: var(--paper);
}

.statement-stage {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  align-items: center;
  padding: 48px var(--gutter);
}

/* Each line steps further right, down the slope it is about to climb. */
.stair {
  grid-column: 1 / 7;
  font-family: var(--font-display);
  font-size: var(--step-head);
  font-weight: 900;
  line-height: 1.05;
  text-transform: uppercase;

  & span {
    display: block;
    white-space: nowrap;
  }

  & span:nth-child(even) {
    color: var(--accent);
  }

  & span:nth-child(2) { padding-left: 0.35em; }
  & span:nth-child(3) { padding-left: 0.7em; }
  & span:nth-child(4) { padding-left: 1.05em; }
  & span:nth-child(5) { padding-left: 1.4em; }
}

.statement-side {
  grid-column: 7 / 13;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.statement-note {
  max-width: 40ch;
  padding-top: 24px;
  border-top: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  color: var(--ink-2);
}

@media (max-width: 860px) {
  .statement-stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 28px;
  }

  .statement-side {
    gap: 20px;
  }
}

/* No taller than half the screen, so the summit never leaves a wide, short window. */
.climb-slot-start {
  width: min(100%, calc(50svh * 386.58 / 206));
}

/* Every section after the statement: the title holds still on the left while its steps climb past
   on the right, on the same dotted line as the trail. main.js lights a step once it crosses the
   climber's line (45% of the viewport). */
.split {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  padding: var(--section) var(--gutter);
  background: var(--paper);

  & + .split {
    border-top: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
  }
}

.split-side {
  grid-column: 1 / 6;
  align-self: start;
  position: sticky;
  top: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

.split-lead {
  max-width: 36ch;
  color: var(--ink-2);

  & a {
    color: var(--accent);
    font-weight: 700;
  }
}

.split-fact {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 24px;
  border-top: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  color: var(--muted);
  font-size: var(--step-small);

  & span {
    max-width: 40ch;
  }

  & b {
    color: var(--accent);
    font-size: var(--step-head);
    line-height: 0.9;
  }
}

.split-main {
  grid-column: 7 / 13;
  min-width: 0;
}

/* ---- the steps ---- */
.steps {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;

  &::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 7px;
    border-left: 3px dotted var(--muted);
  }
}

.step {
  position: relative;
  padding: 0 0 48px 48px;

  &:last-child {
    padding-bottom: 0;
  }

  &::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 0;
    width: 17px;
    height: 17px;
    border: 3px solid var(--muted);
    border-radius: 50%;
    background: var(--paper);
    transition: background-color 300ms var(--ease-out), border-color 300ms var(--ease-out);
  }

  & h3 {
    color: var(--muted);
    font-size: var(--step-lead);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.015em;
    transition: color 300ms var(--ease-out);
  }

  /* Unlit, the whole step is muted as one block, so its text never outshines its own title. */
  & > p {
    max-width: 44ch;
    margin-top: 12px;
    color: var(--muted);
    transition: color 300ms var(--ease-out);
  }

  & a {
    color: var(--accent);
    font-weight: 700;
    transition: color 160ms var(--ease-out);

    &:hover {
      color: var(--ink);
    }
  }
}

.step-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: var(--step-small);
  font-weight: 700;
  transition: color 300ms var(--ease-out);
}

/* Passed by the climber, or no script to walk it. */
:is(.step.is-on, html:not(.js) .step) {
  &::before {
    border-color: var(--accent);
    background: var(--accent);
  }

  & h3 {
    color: var(--ink);
  }

  & .step-label {
    color: var(--accent);
  }

  & > p {
    color: var(--ink-2);
  }

  & .facts {
    color: var(--ink);

    & small {
      color: var(--ink-2);
    }
  }
}

.step-alone {
  color: var(--muted) !important;
  font-size: var(--step-small);
}

.step-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

/* A programme's figures: one ruled row each, figure on the right. */
.facts {
  max-width: 520px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  color: var(--muted);
  transition: color 300ms var(--ease-out);

  & li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
  }

  & span {
    font-weight: 700;
  }

  & small {
    display: block;
    color: inherit;
    font-size: var(--step-small);
    font-weight: 400;
  }

  & b {
    flex: none;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    text-align: right;
  }

  & + .step-links {
    margin-top: 20px;
  }
}

@media (max-width: 860px) {
  .split {
    display: block;
  }

  .split-side {
    position: static;
    margin-bottom: 48px;
  }

  .step {
    padding-left: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .step,
  .step::before,
  .step h3,
  .step > p,
  .facts,
  .step-label {
    transition: none;
  }
}

/* ---- Khác ở đâu: the two ways side by side, Avenex's column on a tinted band ---- */
.vs {
  align-self: start;
  width: 100%;
  border-collapse: collapse;

  & th,
  & td {
    padding: 16px;
    border-bottom: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
    text-align: left;
    vertical-align: top;
  }

  & thead th {
    padding-top: 12px;
    color: var(--muted);
    font-size: var(--step-small);
    font-weight: 700;

    &:last-child {
      background: var(--accent-soft);
      color: var(--accent);
    }
  }

  & tbody th {
    width: 32%;
    padding-left: 0;
    font-weight: 700;
  }
}

.vs-alone {
  color: var(--muted);
}

.vs-us {
  background: var(--accent-soft);
  font-weight: 700;
}

.vs-alone,
.vs-us {
  & span {
    display: block;
    padding-left: 28px;
  }
}

.vs-mark {
  float: left;
  margin-top: 4px;

  .vs-us & {
    color: var(--accent);
  }
}

/* ---- Hỏi đáp: one answer open at a time (details with a shared name) ---- */
.faq-list {
  align-self: start;
  border-top: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
}

.faq-item {
  border-bottom: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);

  & summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 0;
    list-style: none;
    cursor: pointer;

    &::-webkit-details-marker {
      display: none;
    }

    &::after {
      content: "";
      flex: none;
      width: 10px;
      height: 10px;
      margin-right: 6px;
      border-right: 2.5px solid var(--accent);
      border-bottom: 2.5px solid var(--accent);
      transform: translateY(-3px) rotate(45deg);
      transition: transform 200ms var(--ease-out);
    }

    &:hover h3 {
      color: var(--accent);
    }

    &:focus-visible {
      outline: 3px solid var(--accent);
      outline-offset: 2px;
    }
  }

  &[open] summary::after {
    transform: translateY(3px) rotate(-135deg);
  }

  & h3 {
    font-size: var(--step-body);
    font-weight: 700;
    line-height: 1.35;
    transition: color 160ms var(--ease-out);
  }

  & p {
    max-width: 56ch;
    padding-bottom: 24px;
    color: var(--ink-2);
  }

  & a {
    color: var(--accent);
    font-weight: 700;
  }
}

/* ---- Chương trình: the open programme at a glance, the others as rows ---- */
.programme {
  & .step-label {
    color: var(--accent);
  }

  & h3 {
    font-size: var(--step-lead);
    font-weight: 900;
    letter-spacing: -0.015em;
  }

  & .step-links {
    margin-top: 16px;
  }

  & a {
    color: var(--accent);
    font-weight: 700;
  }
}

.figures {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 24px 0 0;
  padding: 20px 0;
  border-top: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);

  & div {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 6px;
  }

  & dd {
    margin: 0;
    color: var(--accent);
    font-size: var(--step-lead);
    line-height: 1;
  }

  & dt {
    color: var(--ink-2);
    font-size: var(--step-small);
  }
}

.programme-note {
  max-width: 52ch;
  margin-top: 16px;
  color: var(--ink-2);
}

.programme-rows {
  margin-top: 56px;
  border-top: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
}

.programme-row {
  display: block;
  border-bottom: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
  color: inherit;
  text-decoration: none;

  & > summary,
  &:is(a) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 0;
    list-style: none;
    cursor: pointer;
  }

  & > summary::-webkit-details-marker {
    display: none;
  }

  & b {
    display: block;
    font-size: var(--step-lead);
    font-weight: 700;
    letter-spacing: -0.015em;
    transition: color 160ms var(--ease-out);
  }

  & small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: var(--step-small);
  }

  & svg {
    flex: none;
    color: var(--accent);
    transition: transform 200ms var(--ease-out);
  }

  &:is(a):hover svg,
  & > summary:hover svg {
    transform: translateX(4px);
  }

  &:is(a):hover b,
  & > summary:hover b {
    color: var(--accent);
  }

  &[open] > summary svg {
    transform: rotate(90deg);
  }

  & > summary:focus-visible,
  &:is(a):focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }
}

.programme-more {
  padding-bottom: 24px;

  & > p:first-child {
    max-width: 52ch;
    color: var(--ink-2);
  }

  & .facts {
    color: var(--ink);

    & small {
      color: var(--ink-2);
    }
  }

  & a {
    color: var(--accent);
    font-weight: 700;
  }
}

@media (max-width: 860px) {
  .figures {
    grid-template-columns: 1fr 1fr;
  }

  /* No room for three columns: each row stacks, Avenex's answer first. */
  .vs {
    & thead {
      display: none;
    }

    & tr {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 18px 0;
      border-bottom: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
    }

    & th,
    & td {
      padding: 0;
      border: 0;
    }

    & tbody th {
      width: auto;
    }

    & .vs-us {
      order: 1;
      padding: 10px 12px;
    }

    & .vs-alone {
      order: 2;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq-item summary::after,
  .programme-row svg {
    transition: none;
  }
}

/* The live match: one question at a time on a 90-second clock. */
.quiz-bar {
  height: 6px;
  background: color-mix(in oklab, var(--ink) 12%, transparent);

  & span {
    display: block;
    height: 100%;
    background: var(--accent);
    transform-origin: 0 50%;
  }

  html:not(.js) & {
    display: none;
  }
}

.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  margin: 10px 0 20px;
}

.quiz-status {
  margin: 0;
  font-size: var(--step-small);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.quiz-q {
  margin: 0;
  padding: 0;
  border: 0;

  html.js &:not(.is-current) {
    display: none;
  }

  & legend {
    padding: 0;
    margin-bottom: 20px;
    font-size: var(--step-body);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
  }

  & label {
    display: flex;
    gap: 14px;
    align-items: baseline;
    min-height: 56px;
    margin-bottom: 6px;
    padding: 16px 18px;
    background: var(--paper);
    cursor: pointer;
    transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out);

    &:hover {
      background: var(--surface);
    }

    &:active {
      transform: scale(0.99);
    }

    &:has(input:focus-visible) {
      outline: 3px solid var(--accent);
      outline-offset: 2px;
    }

    & b {
      flex: none;
      width: 1.4em;
      font-weight: 900;
    }

    & input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
  }

  &.is-locked label {
    cursor: default;
  }

  & label.is-right {
    background: var(--good);
    color: #ffffff;
  }

  & label.is-wrong {
    background: var(--signal);
    color: #ffffff;
  }
}

.quiz-no {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-2);
  font-size: var(--step-small);
  font-weight: 400;
  letter-spacing: 0;
}

.quiz-key {
  margin-top: 12px;
  font-size: var(--step-small);

  & summary {
    cursor: pointer;
    font-weight: 700;
  }

  & p {
    margin-top: 8px;
  }

  html.js & {
    display: none;
  }
}

/* ---- the sheet that fills in after each answer: one step per question ---- */
.quiz {
  padding: clamp(20px, 3vw, 32px);
  background: var(--surface-2);
}

.sheet-title {
  margin: 56px 0 24px;
  font-size: var(--step-lead);
  font-weight: 900;
}

.sheet {
  & li.step {
    animation: sheet-in 420ms var(--ease-out) both;
  }

  & .sheet-empty {
    max-width: 40ch;
    color: var(--ink-2);
  }

  &:has(.sheet-empty)::before {
    display: none;
  }

  & .sheet-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-weight: 700;
  }

  & .sheet-mark {
    flex: none;
    font-weight: 900;
  }

  & .is-right {
    --mark: var(--good);
  }

  & .is-wrong {
    --mark: var(--signal);
  }

  & li.step::before {
    border-color: var(--mark);
    background: var(--mark);
  }

  & .sheet-mark {
    color: var(--mark);
  }

  & p {
    max-width: 52ch;
    color: var(--ink-2);
  }

  & p + p {
    margin-top: 6px;
  }
}

.sheet-total {
  margin-top: 28px;
  font-size: var(--step-lead);
  font-weight: 900;
  letter-spacing: -0.02em;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet li {
    animation-duration: 1ms;
  }
}

.closing {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  align-items: center;
  min-height: 90svh;
  overflow: hidden;
  background: var(--field);
  color: var(--field-ink);
}

/* Where the climb ends: the mountain lands here with the climber on the summit. */
.climb-slot-end {
  grid-column: 1 / 9;
  align-self: end;
  padding: 64px 0 0 var(--gutter);
}

.closing-copy {
  grid-column: 9 / 13;
  padding: 64px var(--gutter) 64px 0;

  & h2 {
    font-size: var(--step-head);
  }

  & p {
    margin-top: 16px;
    color: var(--field-muted);
  }

  & .button {
    margin-top: 28px;
    background: var(--field-accent);
    color: var(--field);

    &:hover {
      background: #e4b862;
    }
  }
}

.closing-fact {
  color: var(--field-ink) !important;
  font-size: var(--step-lead);
  font-weight: 900;
}

/* ---- footer: the back of the card ---- */
.site-footer {
  padding: 96px var(--gutter) 64px;
  background: var(--surface-2);
}

.postcard {
  --scallop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='24'%3E%3Ccircle cx='50' cy='50' r='50'/%3E%3C/svg%3E");
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 64px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px clamp(24px, 4vw, 56px) 32px;
  background: var(--paper);

  &::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -24px;
    height: 24px;
    background: var(--paper);
    mask: var(--scallop) repeat-x left bottom / calc(100% / 12) 24px;
  }
}

.postcard-sign {
  margin-bottom: 16px;
  font-size: var(--step-lead);
  font-weight: 900;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.postcard-message p:not(.postcard-sign) {
  max-width: 40ch;
  font-size: var(--step-body);
}

.postcard-address {
  position: relative;
  padding-top: 8px;

  & ul {
    display: grid;
    gap: 12px;
    max-width: calc(100% - 120px);
  }

  & a {
    font-size: var(--step-body);
    font-weight: 700;
    text-decoration: none;
    transition: color 160ms var(--ease-out);

    &:hover {
      color: var(--accent);
    }
  }
}

.stamp {
  position: absolute;
  top: 0;
  right: 0;
  width: 88px;
  height: 88px;
  padding: 14px;
  color: var(--accent);
  background: var(--surface);
  transform: rotate(3deg);
}

.postcard-fine {
  grid-column: 1 / -1;
  max-width: 75ch;
  display: grid;
  gap: 12px;
  font-size: var(--step-small);
  color: var(--ink-2);
}

.imprint {
  margin-top: 12px;
  text-align: center;
}

@media (max-width: 860px) {
  .closing {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }

  .closing-copy {
    order: -1;
    padding: 64px 20px 40px;

    & .button {
      width: 100%;
    }
  }

  .climb-slot-end {
    padding: 0 20px 40px;
  }

  .site-footer {
    padding: 56px 0 0;
  }

  .postcard {
    grid-template-columns: 1fr;
    padding: 40px 20px 28px;

    &::before {
      mask-size: calc(100% / 6) 24px;
    }
  }

  .stamp {
    width: 64px;
    height: 64px;
    padding: 10px;
  }

}

/* The trail: one line down the left margin from the foot of the mountain (after the hero) to the
   summit (the closing). Each section is a stop on it; main.js places the stops and walks the
   climber down the line as the page scrolls. Loaded last. */
:root {
  --trail-w: 72px;
}

main {
  position: relative;
}

main > section[data-stop]:not(.closing) {
  margin-left: var(--trail-w);
}

.trail {
  position: absolute;
  left: 0;
  z-index: 3;
  width: var(--trail-w);
  pointer-events: none;

  /* The way ahead: the app's dotted trail. */
  &::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 1.5px);
    border-left: 3px dotted var(--muted);
  }
}

/* The way already climbed. */
.trail-done {
  position: absolute;
  top: 0;
  left: calc(50% - 2px);
  width: 4px;
  height: var(--done, 0px);
  background: var(--accent);
}

.trail-stop {
  position: absolute;
  left: calc(50% - 8px);
  width: 16px;
  height: 16px;
  border: 3px solid var(--muted);
  border-radius: 50%;
  background: var(--paper);

  &.is-passed {
    border-color: var(--accent);
    background: var(--accent);
  }
}

/* Starts at the trail column's edge and sits on the seam between two sections. */
.trail-label {
  position: absolute;
  left: calc(var(--trail-w) / 2 + 4px);
  top: -6px;
  padding: 2px 8px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: var(--step-small);
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;

  .is-passed > & {
    color: var(--accent);
  }
}

/* The first and last stops sit on seams with a dark field (the hero, the closing): a dark badge across
   the seam, like the mountain's milestone names, instead of a paper strip half over the dark. */
.trail-stop:nth-child(1 of .trail-stop) > .trail-label,
.trail-stop:last-child > .trail-label {
  border: 1px solid rgb(255 255 255 / 0.12);
  background: var(--field-2);
  color: var(--field-ink);

  .is-passed > & {
    color: var(--field-accent);
  }
}

/* The climber: the one moving thing on the page. */
.trail-climber {
  position: absolute;
  top: var(--climber, 0px);
  left: calc(50% - 11px);
  width: 22px;
  height: 22px;
  margin-top: -3px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);

  &::after {
    content: "";
    position: absolute;
    inset: -9px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    animation: climber-pulse 1800ms var(--ease-out) infinite;
  }
}

@keyframes climber-pulse {
  from { opacity: 0.7; transform: scale(0.7); }
  to { opacity: 0; transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .trail-climber::after {
    animation: none;
    opacity: 0;
  }
}

@media (max-width: 860px) {
  :root {
    --trail-w: 32px;
  }
}

/* The mountain that walks down the page with the reader: it leaves the hero, lands beside the
   statement, hands over to the small one in the floating pill while the sections scroll past, and
   lands again at the summit in the closing. main.js places it every frame and moves the climber. */
.climb {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
  will-change: transform, width;

  html.js & {
    display: block;
  }

  /* Over the hero and the closing, which stay a dark field in both themes. */
  &.on-field {
    --accent: var(--field-accent);
  }

  /* Foothills fade out at both ends instead of stopping in a hard edge (EDGE in main.js matches). */
  & svg {
    display: block;
    width: 100%;
    height: auto;
    mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  }

  /* Warm light behind the summit (53% across, 15.5% down the drawing), coming up as the fog clears
     on the last stretch (--glow, main.js). */
  &::before {
    content: "";
    position: absolute;
    z-index: -1;
    left: 18.1%;
    top: -39%;
    width: 70%;
    aspect-ratio: 1.2;
    background: radial-gradient(closest-side, rgb(255 230 180 / 0.3), rgb(255 214 150 / 0.08) 45%, transparent 75%);
    opacity: var(--glow, 0);
    pointer-events: none;
  }
}

/* Dark field in both themes, like the hero and the closing, so it never reads as part of a section. */
.climb-pill {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 24px);
  padding: 6px;
  border: 1px solid rgb(255 255 255 / 0.08);
  background: color-mix(in oklab, var(--field-2) 94%, transparent);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.28);
  backdrop-filter: blur(12px);
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, calc(100% + 24px));
  transition: transform 320ms var(--ease-out), opacity 320ms var(--ease-out), visibility 0s 320ms;

  &.is-on {
    visibility: visible;
    opacity: 1;
    transform: translate(-50%, 0);
    transition: transform 320ms var(--ease-out), opacity 320ms var(--ease-out);
  }
}

/* A close-up that follows the climber (main.js). Square like every block on the page; only dots are round. */
.climb-lens {
  flex: none;
  width: 52px;
  height: 52px;
  overflow: hidden;
  background: #2a3340;
}

.climb-mini {
  display: block;
  width: 100%;
  height: 100%;

  /* In viewBox units (main.js frames 80 of them around the climber): vector-effect would turn the
     dash that draws the climbed part into pixels. */
  & .climb-done {
    stroke: var(--field-accent);
    stroke-width: 4;
  }

  & .climb-here,
  & .climb-flag {
    fill: var(--field-accent);
  }

  & .climb-here {
    stroke-width: 2.5;
  }
}

.climb-pill-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-right: 8px;
  color: var(--field-muted);
  font-size: var(--step-small);
  line-height: 1.3;
  white-space: nowrap;

  & b {
    overflow: hidden;
    color: var(--field-accent);
    text-overflow: ellipsis;
  }
}

.climb-pill-cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  background: var(--field-accent);
  color: var(--field);
  font-size: var(--step-small);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out);

  &:hover {
    background: #e4b862;
  }
}

@media (max-width: 480px) {
  .climb-pill {
    gap: 8px;
    width: calc(100% - 24px);
  }

  .climb-lens {
    width: 44px;
    height: 44px;
  }

  .climb-pill-label {
    flex: 1;
    margin-right: 0;
  }

  .climb-pill-cta {
    padding: 0 16px;
  }

  .climb-pill-more {
    display: none;
  }
}

.climb-done {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.climb-here {
  fill: var(--accent);
  stroke: #ffffff;
  stroke-width: 1.8;
}

/* Thickens on the way up to the high camp, clears at the summit. */
.climb-fog {
  opacity: var(--fog, 0);
  transform-box: fill-box;
  animation: fog-drift 9s ease-in-out infinite alternate;

  & ellipse {
    fill: #f3f5f8;
  }
}

@keyframes fog-drift {
  from { transform: translateX(-14px); }
  to { transform: translateX(14px); }
}

/* The three milestones: a name always beside each while the mountain stands still (statement, closing);
   a hover or a tap on the name or the mark opens its card (main.js). */
.climb-marks circle {
  fill: transparent;
  stroke: var(--field-accent);
  stroke-width: 0;
  transition: stroke-width 160ms var(--ease-out);

  .climb.is-live & {
    pointer-events: all;
    cursor: pointer;
  }

  &.is-active {
    stroke-width: 1.6;
  }
}

.climb-label {
  position: absolute;
  padding: 3px 9px;
  border: 1px solid rgb(255 255 255 / 0.12);
  background: var(--field-2);
  color: var(--field-ink);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 200ms var(--ease-out), border-color 160ms var(--ease-out);

  .climb.is-live & {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
  }

  .climb.is-live &.is-open {
    opacity: 0;
  }

  &:hover {
    border-color: var(--field-accent);
  }
}

.climb-tip {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  max-width: 240px;
  padding: 10px 14px 12px;
  border: 1px solid rgb(255 255 255 / 0.1);
  background: var(--field-2);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.3);
  color: var(--field-muted);
  font-size: var(--step-small);
  line-height: 1.4;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - var(--gap, 16px)));
  animation: tip-in 160ms var(--ease-out);

  /* Points at the mark. */
  &::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 10px;
    height: 10px;
    border: solid rgb(255 255 255 / 0.1);
    border-width: 0 1px 1px 0;
    background: var(--field-2);
    transform: translateX(-50%) rotate(45deg);
  }

  &.is-below {
    transform: translate(-50%, var(--gap, 16px));

    &::after {
      top: -6px;
      bottom: auto;
      border-width: 1px 0 0 1px;
    }
  }

  &[hidden] {
    display: none;
  }

  & small {
    color: var(--field-accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  & b {
    color: var(--field-ink);
  }
}

@keyframes tip-in {
  from { opacity: 0; }
}

.climb-pole {
  stroke: #121820;
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* The drawing's near-black pole disappears on the dark field; the flag would float. */
.climb.on-field .climb-pole,
.climb-mini .climb-pole {
  stroke: #c3cad4;
}

.climb-flag {
  fill: var(--accent);
  stroke: #ffffff;
  stroke-width: 0.8;
  stroke-linejoin: round;
}

/* Holds the mountain's place; its own copy shows only when the script is off. */
.climb-slot {
  aspect-ratio: 386.58 / 206;

  & img {
    width: 100%;
    height: 100%;
  }

  html.js & img {
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .climb-fog {
    animation: none;
  }

  .climb-pill {
    transform: translate(-50%, 0);
  }

  .climb-tip {
    animation: none;
  }
}

