/* Built by site/tools/build_landing.py from base.css, chrome.css, shell.css and sections/*.css. Edit those, not this. */

/* ===== landing/base.css ===== */
/* Hearthvale landing page: design tokens and shared primitives (docs/LANDING.md).
   Dark theme is night in the Vale, light theme is day. Section styles build on these and never hard-code a colour.
   No inline styles anywhere on the page (the site CSP is style-src 'self'): state goes through classes, data
   attributes and custom properties set from script. */

@font-face {
  font-family: "Hearthvale Pixel";
  src: url("/assets/fonts/HearthvalePixel-Regular.woff") format("woff"), url("/assets/fonts/HearthvalePixel-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Hearthvale Pixel";
  src: url("/assets/fonts/HearthvalePixel-Bold.woff") format("woff"), url("/assets/fonts/HearthvalePixel-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

/* Registered so the whole palette can glide from night to day while the 3D sun moves (a plain custom property
   switches instantly; a registered <color> interpolates). */
@property --bg      { syntax: "<color>"; inherits: true; initial-value: #0a0912; }
@property --bg-2    { syntax: "<color>"; inherits: true; initial-value: #12101c; }
@property --bg-3    { syntax: "<color>"; inherits: true; initial-value: #1b1829; }
@property --ink     { syntax: "<color>"; inherits: true; initial-value: #f4eddd; }
@property --ink-2   { syntax: "<color>"; inherits: true; initial-value: #b3abbf; }
@property --ink-3   { syntax: "<color>"; inherits: true; initial-value: #8a839a; }
@property --line    { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, .09); }
@property --line-2  { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, .18); }
@property --gold    { syntax: "<color>"; inherits: true; initial-value: #ffd25c; }
@property --gold-2  { syntax: "<color>"; inherits: true; initial-value: #e0a526; }
@property --ember   { syntax: "<color>"; inherits: true; initial-value: #ff9a3c; }
@property --glint   { syntax: "<color>"; inherits: true; initial-value: #5fe3e8; }
@property --leaf    { syntax: "<color>"; inherits: true; initial-value: #8fd46a; }
@property --danger  { syntax: "<color>"; inherits: true; initial-value: #ff6b55; }
@property --arcane  { syntax: "<color>"; inherits: true; initial-value: #a995ff; }
@property --glass   { syntax: "<color>"; inherits: true; initial-value: rgba(20, 17, 32, .58); }
@property --glass-2 { syntax: "<color>"; inherits: true; initial-value: rgba(34, 30, 52, .62); }
@property --glass-line { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, .12); }
@property --glass-hi   { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, .14); }
@property --spot    { syntax: "<color>"; inherits: true; initial-value: rgba(255, 210, 92, .16); }
@property --shade   { syntax: "<color>"; inherits: true; initial-value: rgba(0, 0, 0, .55); }
@property --veil    { syntax: "<color>"; inherits: true; initial-value: rgba(10, 9, 18, .72); }

:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #0a0912;          /* page */
  --bg-2: #12101c;        /* raised */
  --bg-3: #1b1829;        /* raised again, wells */
  /* text */
  --ink: #f4eddd;
  --ink-2: #b3abbf;
  --ink-3: #8a839a;      /* 4.8:1 or better on every surface: fine for small text */
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .18);
  /* brand and accents. --gold is safe as text on --bg in both themes. */
  --gold: #ffd25c;
  --gold-2: #e0a526;
  --ember: #ff9a3c;
  --glint: #5fe3e8;
  --leaf: #8fd46a;
  --danger: #ff6b55;
  --arcane: #a995ff;
  /* the gold button keeps the same face in both themes */
  --btn-face: #ffd25c;
  --btn-face-2: #f0aa2c;
  --btn-edge: #9a5a12;
  --btn-ink: #2a1806;
  /* glass panels */
  --glass: rgba(20, 17, 32, .58);
  --glass-2: rgba(34, 30, 52, .62);
  --glass-line: rgba(255, 255, 255, .12);
  --glass-hi: rgba(255, 255, 255, .14);
  --spot: rgba(255, 210, 92, .16);       /* pointer highlight on glass */
  --shade: rgba(0, 0, 0, .55);           /* drop shadow colour */
  --veil: rgba(10, 9, 18, .72);          /* scrim over imagery behind text */

  /* type */
  --f-display: "Hearthvale Pixel", ui-monospace, "SF Mono", Menlo, monospace;
  --f-body: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --t-hero: clamp(2.6rem, 1.2rem + 6.2vw, 6.5rem);
  --t-h2: clamp(2rem, 1.1rem + 3.6vw, 4rem);
  --t-h3: clamp(1.25rem, 1.05rem + .8vw, 1.75rem);
  --t-lede: clamp(1.05rem, .98rem + .4vw, 1.3rem);
  --t-body: 1.0625rem;
  --t-small: .875rem;
  --t-micro: .75rem;

  /* space, radius, layout */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px; --s-9: 112px;
  --r-1: 8px; --r-2: 14px; --r-3: 22px; --r-4: 32px; --r-pill: 999px;
  --wrap: 1200px;
  --gutter: clamp(18px, 4vw, 40px);
  --sec-y: clamp(84px, 11vw, 168px);
  --topbar-h: 64px;

  /* motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: linear(0, .009, .035 2.1%, .141 4.4%, .723 12.9%, .938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, .991, .977 51%, .974 53.8%, .975 57.1%, .997 69.8%, 1.003 76.9%, 1);
  --dur-1: .18s; --dur-2: .4s; --dur-3: .9s;
  --theme-dur: 2.2s;       /* night to day, matched by the 3D sun */

  /* elevation */
  --shadow-1: 0 1px 2px var(--shade), 0 6px 18px -8px var(--shade);
  --shadow-2: 0 2px 4px -1px var(--shade), 0 18px 44px -18px var(--shade);
  --shadow-3: 0 4px 10px -2px var(--shade), 0 40px 90px -30px var(--shade);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6efe0;
  --bg-2: #fffaf0;
  --bg-3: #ece2cc;
  --ink: #1f1a2b;
  --ink-2: #554d63;
  --ink-3: #665e76;
  --line: rgba(31, 26, 43, .11);
  --line-2: rgba(31, 26, 43, .22);
  --gold: #99590a;
  --gold-2: #7a4505;
  --ember: #b0460a;
  --glint: #0a727a;
  --leaf: #2f7a22;
  --danger: #c2331f;
  --arcane: #5d41c9;
  --glass: rgba(255, 251, 242, .62);
  --glass-2: rgba(255, 255, 255, .74);
  --glass-line: rgba(31, 26, 43, .1);
  --glass-hi: rgba(255, 255, 255, .85);
  --spot: rgba(255, 176, 64, .22);
  --shade: rgba(84, 58, 24, .22);
  --veil: rgba(246, 239, 224, .7);
}

/* The palette glides only once the page has loaded (.theme-anim is set by core.js), never on first paint. */
:root.theme-anim {
  transition: --bg var(--theme-dur) var(--ease-in-out), --bg-2 var(--theme-dur) var(--ease-in-out),
    --bg-3 var(--theme-dur) var(--ease-in-out), --ink var(--theme-dur) var(--ease-in-out),
    --ink-2 var(--theme-dur) var(--ease-in-out), --ink-3 var(--theme-dur) var(--ease-in-out),
    --line var(--theme-dur) var(--ease-in-out), --line-2 var(--theme-dur) var(--ease-in-out),
    --gold var(--theme-dur) var(--ease-in-out), --gold-2 var(--theme-dur) var(--ease-in-out),
    --ember var(--theme-dur) var(--ease-in-out), --glint var(--theme-dur) var(--ease-in-out),
    --leaf var(--theme-dur) var(--ease-in-out), --danger var(--theme-dur) var(--ease-in-out),
    --arcane var(--theme-dur) var(--ease-in-out), --glass var(--theme-dur) var(--ease-in-out),
    --glass-2 var(--theme-dur) var(--ease-in-out), --glass-line var(--theme-dur) var(--ease-in-out),
    --glass-hi var(--theme-dur) var(--ease-in-out), --spot var(--theme-dur) var(--ease-in-out),
    --shade var(--theme-dur) var(--ease-in-out), --veil var(--theme-dur) var(--ease-in-out);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--glint); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--gold); color: #1a1206; }

.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--btn-face); color: var(--btn-ink); padding: 10px 16px; font-family: var(--f-display); }
.skip:focus { left: 12px; top: 12px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Pixel art is always scaled nearest-neighbour, at whole multiples of its native size where possible. */
.px { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- layout ---------- */
.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
.sec { position: relative; z-index: 1; padding-block: var(--sec-y); }
/* An opaque section: covers the fixed 3D stage. */
.sec-solid { background: var(--bg); }
/* A window onto the fixed 3D stage: transparent, the Vale shows through. */
.sec-stage { background: transparent; }

.sec-head { display: grid; gap: var(--s-4); justify-items: center; text-align: center; margin-bottom: clamp(36px, 6vw, 72px); }
.sec-head.left { justify-items: start; text-align: left; }
.sec-head > p:not(.eyebrow) { max-width: 46ch; color: var(--ink-2); font-size: var(--t-lede); text-wrap: balance; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-display); font-size: var(--t-small); letter-spacing: .14em; text-transform: uppercase;
  color: var(--ember);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; background: currentColor; transform: rotate(45deg); box-shadow: 0 0 12px currentColor; }

.h1, .h2, .h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.12; letter-spacing: .005em; text-wrap: balance; }
.h1 { font-size: var(--t-hero); }
.h2 { font-size: var(--t-h2); }
.h3 { font-size: var(--t-h3); line-height: 1.15; }
/* Gold gradient lettering with a hard pixel shadow, the game's title treatment.
   The pixel font's glyphs are taller than its em box (capitals reach 1.13em, descenders drop .25em below), and
   background-clip: text only paints inside the element's box. The padding widens that box so no row of pixels
   is cut off; the negative margin gives the space back to the layout. */
.gilt {
  color: var(--gold);
  background: linear-gradient(180deg, color-mix(in oklab, var(--gold) 70%, white) 0%, var(--gold) 45%, var(--gold-2) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  padding-block: .3em; margin-block: -.3em;
  filter: drop-shadow(0 .06em 0 color-mix(in oklab, var(--gold-2) 40%, black)) drop-shadow(0 .5em 1.2em color-mix(in oklab, var(--gold) 22%, transparent));
}
.lede { font-size: var(--t-lede); color: var(--ink-2); max-width: 52ch; text-wrap: pretty; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }

/* ---------- buttons ---------- */
.btn {
  --_y: 0px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 10px 20px;
  font-family: var(--f-display); font-weight: 700; font-size: 1rem; letter-spacing: .03em; line-height: 1; white-space: nowrap;
  color: var(--btn-ink);
  background: linear-gradient(180deg, color-mix(in oklab, var(--btn-face) 80%, white), var(--btn-face) 40%, var(--btn-face-2));
  border-radius: var(--r-1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(120, 60, 0, .28), 0 calc(4px - var(--_y)) 0 var(--btn-edge), 0 calc(10px - var(--_y)) 24px -6px rgba(255, 170, 40, .45);
  transform: translateY(var(--_y));
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), filter var(--dur-1);
  overflow: hidden; isolation: isolate;
}
.btn::after { /* shine sweep */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .7) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform .7s var(--ease-out);
}
.btn:hover { filter: brightness(1.05); --_y: -1px; }
.btn:hover::after { transform: translateX(120%); }
.btn:active { --_y: 3px; transition-duration: .05s; }
.btn-lg { min-height: 58px; padding: 14px 28px; font-size: 1.2rem; border-radius: var(--r-2); }
.btn img { width: 24px; height: 24px; }
.btn-ghost {
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: inset 0 0 0 1px var(--glass-line), inset 0 1px 0 var(--glass-hi), var(--shadow-1);
}
.btn-ghost::after { background: linear-gradient(105deg, transparent 35%, var(--spot) 50%, transparent 65%); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 var(--glass-hi), var(--shadow-2); }
.btn-ghost:active { --_y: 1px; }

/* ---------- glass panel ---------- */
.glass {
  position: relative;
  background: linear-gradient(160deg, var(--glass-2), var(--glass));
  -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-3);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-2);
}
/* Pointer highlight: follows --mx/--my (0..1) and shows while --hover is 1. core.js tilt() and [data-spot] set them. */
.glass::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: radial-gradient(520px circle at calc(var(--mx, .5) * 100%) calc(var(--my, .5) * 100%), var(--spot), transparent 55%);
  opacity: var(--hover, 0); transition: opacity .35s;
}
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); }

.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-pill);
  font-family: var(--f-display); font-size: var(--t-small); letter-spacing: .04em; line-height: 1.2;
  color: var(--ink); background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.chip img { width: 20px; height: 20px; }
.tag {
  display: inline-block; padding: 4px 9px; border-radius: 6px;
  font-family: var(--f-display); font-size: var(--t-micro); letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); background: color-mix(in oklab, var(--gold) 14%, transparent); border: 1px solid color-mix(in oklab, var(--gold) 35%, transparent);
}
.tag.danger { color: var(--danger); background: color-mix(in oklab, var(--danger) 14%, transparent); border-color: color-mix(in oklab, var(--danger) 40%, transparent); }

/* A soft coloured light behind a section. Set --aura to an accent token on the section. */
.aura { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 180px); mask-image: linear-gradient(to bottom, transparent, #000 180px); }
.aura::before {
  content: ""; position: absolute; left: 50%; top: 0; width: min(1100px, 120vw); aspect-ratio: 1.6; translate: -50% -35%;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--aura, var(--gold)) 16%, transparent), transparent);
  filter: blur(10px);
}

/* ---------- motion utilities (driven by core.js) ---------- */
/* [data-reveal]: hidden until it scrolls into view. Values: up (default), down, left, right, scale, fade.
   Put data-stagger on a parent to delay each revealed child in order. Content is never hidden without script. */
.js [data-reveal] { opacity: 0; transition: opacity .9s var(--ease-out), transform 1.1s var(--ease-out), filter .9s var(--ease-out); transition-delay: var(--d, 0ms); will-change: opacity, transform; }
.js [data-reveal], .js [data-reveal="up"] { transform: translate3d(0, 28px, 0); }
.js [data-reveal="down"] { transform: translate3d(0, -28px, 0); }
.js [data-reveal="left"] { transform: translate3d(36px, 0, 0); }
.js [data-reveal="right"] { transform: translate3d(-36px, 0, 0); }
.js [data-reveal="scale"] { transform: scale(.94); }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal].in { opacity: 1; transform: none; }

/* [data-tilt]: core.js sets --rx/--ry in degrees, --mx/--my 0..1 and --hover 0|1. Give the parent a perspective. */
[data-tilt] { transform: perspective(var(--tilt-persp, 900px)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; will-change: transform; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  [data-tilt] { transform: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  :root.theme-anim { transition: none; }
}

/* ===== landing/chrome.css ===== */
/* Site chrome, shared by the home page and every inner page (docs/PAGES.md): the floating top bar, the theme
   toggle, the phone menu, the scroll meter, the footer bar and the crossfade between pages.
   build_landing.py puts it into both landing.css and site.css. */

/* ---------- moving between pages ---------- */
/* Same-site links crossfade instead of flashing white, and the top bar stays where it is (browsers without
   cross-document view transitions just load the page). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .38s; animation-timing-function: var(--ease-out); }
.topbar-in { view-transition-name: topbar; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* A hairline of ember across the top that fills as the page scrolls. */
.scroll-meter { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 30; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--ember), var(--gold)); box-shadow: 0 0 12px var(--ember); pointer-events: none; }
@supports (animation-timeline: scroll()) {
  .scroll-meter { animation: meter linear both; animation-timeline: scroll(root); }
  @keyframes meter { to { transform: scaleX(1); } }
}

/* ---------- top bar ---------- */
.topbar { position: fixed; top: 12px; left: 0; right: 0; z-index: 20; pointer-events: none; }
.topbar-in {
  pointer-events: auto;
  width: min(var(--wrap), 100% - 24px); margin-inline: auto; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-5); padding: 0 10px 0 16px;
  border-radius: var(--r-3);
  border: 1px solid transparent;
  transition: background-color .4s, border-color .4s, box-shadow .4s, -webkit-backdrop-filter .4s, backdrop-filter .4s;
}
.topbar.is-stuck .topbar-in {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  border-color: var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-2);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.brand { min-height: 44px; }
.brand img { flex: none; width: 32px; height: 32px; border-radius: 8px; box-shadow: var(--shadow-1); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { position: relative; padding: 10px 14px; border-radius: var(--r-1); font-family: var(--f-display); font-size: 1rem; letter-spacing: .04em; color: var(--ink-2); transition: color .2s, background-color .2s; }
.nav a:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 8%, transparent); }
/* the page you are on: brighter, with a small gold diamond under it */
.nav a[aria-current] { color: var(--ink); }
.nav a[aria-current]::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; translate: -50% 0; rotate: 45deg; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--ink); transition: background-color .2s, transform .2s var(--ease-out); }
.icon-btn:hover { background: color-mix(in oklab, var(--ink) 10%, transparent); }
.icon-btn:active { transform: scale(.92); }
.icon-btn img { width: 26px; height: auto; }
.top-play { min-height: 44px; padding: 8px 18px; }

/* sun and moon trade places */
.theme-toggle { position: relative; color: var(--gold); }
.theme-toggle svg { position: absolute; transition: transform .7s var(--ease-spring), opacity .35s; }
.tt-sun { transform: rotate(-90deg) scale(.3); opacity: 0; }
.tt-moon { transform: none; opacity: 1; }
:root[data-theme="light"] .tt-sun { transform: none; opacity: 1; }
:root[data-theme="light"] .tt-moon { transform: rotate(90deg) scale(.3); opacity: 0; }

/* ---------- phone menu: a popover (no script needed), shown where the nav links do not fit ---------- */
.menu-btn { display: none; }
.menu-bars { display: grid; gap: 4px; width: 18px; }
.menu-bars i { height: 2px; border-radius: 2px; background: currentColor; transition: transform .35s var(--ease-out), opacity .2s; }
.topbar:has(.menu:popover-open) .menu-bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.topbar:has(.menu:popover-open) .menu-bars i:nth-child(2) { opacity: 0; }
.topbar:has(.menu:popover-open) .menu-bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.menu {
  /* the top bar ignores the pointer outside its own box; the menu sits in the top layer but still inherits that */
  pointer-events: auto;
  position: fixed; inset: calc(12px + var(--topbar-h) + 8px) 12px auto auto; margin: 0;
  width: min(300px, 100vw - 24px); max-height: calc(100svh - var(--topbar-h) - 40px); overflow: auto;
  padding: 8px; color: var(--ink);
  background: linear-gradient(160deg, var(--glass-2), var(--glass));
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid var(--glass-line); border-radius: var(--r-3);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-3);
  transform-origin: calc(100% - 40px) 0;
  opacity: 0; translate: 0 -8px; scale: .97;
  transition: opacity .22s var(--ease-out), translate .4s var(--ease-out), scale .4s var(--ease-out), overlay .4s allow-discrete, display .4s allow-discrete;
}
.menu:popover-open { opacity: 1; translate: 0; scale: 1; }
@starting-style { .menu:popover-open { opacity: 0; translate: 0 -8px; scale: .97; } }
.menu::backdrop { background: color-mix(in oklab, var(--bg) 35%, transparent); }
.menu ul { display: grid; gap: 2px; }
.menu a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 14px; border-radius: var(--r-1); font-family: var(--f-display); font-size: 1.05rem; letter-spacing: .04em; color: var(--ink); transition: background-color .2s, color .2s; }
.menu a:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); }
.menu a[aria-current] { color: var(--gold); }
.menu a[aria-current]::after { content: ""; width: 7px; height: 7px; rotate: 45deg; background: var(--gold); box-shadow: 0 0 10px var(--gold); }

/* Browsers without popovers (before Safari 17, Chrome 114, Firefox 125): no menu button, and the footer carries the
   links. Without this the hidden menu would still sit over the page and catch taps. */
@supports not selector(:popover-open) { .menu, .menu-btn { display: none !important; } }

@media (max-width: 960px) {
  .nav { display: none; }
  .top-actions { margin-left: auto; }
  .menu-btn { display: grid; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
}
@media (max-width: 380px) {
  .topbar-in { gap: 8px; padding-left: 12px; }
  .top-actions { gap: 0; }
  .top-play { padding-inline: 14px; }
}

/* ---------- footer bar (inner pages; the home page's finale draws the same bar) ---------- */
.site-foot { position: relative; z-index: 1; margin-top: clamp(56px, 8vw, 112px); }
.site-foot-bar {
  border-radius: var(--r-4) var(--r-4) 0 0;
  border-bottom: 0;
  display: grid; gap: var(--s-5);
  padding: clamp(24px, 3.4vw, 40px) clamp(20px, 3.4vw, 44px) max(clamp(26px, 3.4vw, 36px), env(safe-area-inset-bottom));
}
.site-foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4) var(--s-6); }
.site-foot-brand { display: inline-flex; }
.site-foot-brand img { width: 256px; height: 80px; max-width: none; }
.site-foot-nav ul { display: flex; flex-wrap: wrap; gap: 6px 26px; }
.site-foot-nav a, .site-foot-small a {
  position: relative; display: inline-block; padding-block: 10px;
  color: var(--ink); font-weight: 600;
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 7px) / 0 1px no-repeat;
  transition: background-size .35s var(--ease-out);
}
.site-foot-nav a:hover, .site-foot-small a:hover, .site-foot-nav a[aria-current] { background-size: 100% 1px; }
.site-foot-small { gap: var(--s-2) var(--s-6); }
.site-foot-small p { font-size: var(--t-small); color: var(--ink-2); }
.site-foot-small a { font-weight: 500; }
@media (max-width: 640px) {
  .site-foot-row { justify-content: center; text-align: center; }
  .site-foot-nav ul { justify-content: center; }
  .site-foot-small { flex-direction: column; }
}

/* ===== landing/shell.css ===== */
/* Landing page shell: the fixed 3D stage, the top bar, the hero, the map labels and the lightbox. */

/* ---------- the stage ---------- */
.stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.stage-poster, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* A still of the same scene, drawn by the engine (site/tools: see docs/LANDING.md §6). One per theme and per screen
   shape; as backgrounds, so a browser only fetches the one that applies. */
.stage-poster { background: center / cover no-repeat url("poster/vale-wide-dark.webp"); transition: opacity 1.4s var(--ease-out); }
:root[data-theme="light"] .stage-poster { background-image: url("poster/vale-wide-light.webp"); }
@media (max-aspect-ratio: 9/10) {
  .stage-poster { background-image: url("poster/vale-tall-dark.webp"); }
  :root[data-theme="light"] .stage-poster { background-image: url("poster/vale-tall-light.webp"); }
}
.stage canvas { opacity: 0; transition: opacity 1.6s var(--ease-out); touch-action: pan-y; cursor: grab; }
.stage canvas.is-dragging { cursor: grabbing; }
.vale-on .stage canvas { opacity: 1; }
.vale-on .stage-poster { opacity: 0; }
/* Blends the picture into the page colour at the very top and bottom of the screen. */
.stage-grade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, color-mix(in oklab, var(--bg) 55%, transparent), transparent 22%, transparent 78%, color-mix(in oklab, var(--bg) 70%, transparent)); }

/* 3D tilts and glows may reach past a section's sides; they must not widen the page. */
main > section { overflow-x: clip; }

/* Solid sections melt into the stage above and below them instead of ending on a hard line. */
main > .sec-solid::before, main > .sec-solid::after { content: ""; position: absolute; left: 0; right: 0; height: clamp(90px, 16vw, 220px); pointer-events: none; z-index: -1; }
main > .sec-solid::before { bottom: calc(100% - 1px); background: linear-gradient(to bottom, transparent, var(--bg)); }
main > .sec-solid::after { top: calc(100% - 1px); background: linear-gradient(to top, transparent, var(--bg)); }
main > .sec-solid + .sec-solid::before, main > .sec-solid:has(+ .sec-solid)::after { content: none; }


/* ---------- top bar: music toggle (the rest of the bar is in chrome.css) ---------- */

/* music: four bars that lie flat when off and dance when on, and the track name sliding out beside them */
.sound-toggle { position: relative; color: var(--ink-2); }
.sound-toggle.is-on { color: var(--gold); }
.sound-bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.sound-bars i { width: 3px; height: 100%; border-radius: 2px; background: currentColor; transform-origin: 50% 100%; transform: scaleY(.45); transition: transform .3s var(--ease-out); }
.sound-bars i:nth-child(2) { transform: scaleY(.9); }
.sound-bars i:nth-child(3) { transform: scaleY(.6); }
.sound-bars i:nth-child(4) { transform: scaleY(.3); }
/* off: a stroke through the bars */
.sound-toggle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 26px; height: 2px; border-radius: 2px; background: currentColor; box-shadow: 0 0 0 2px var(--bg); translate: -50% -50%; rotate: -38deg; transition: scale .3s var(--ease-out), opacity .3s; }
.sound-toggle.is-on::after { scale: 0 1; opacity: 0; }
.sound-toggle.is-on .sound-bars i { animation: bars 1.1s var(--ease-in-out) infinite alternate; }
.sound-toggle.is-on .sound-bars i:nth-child(2) { animation-delay: -.45s; animation-duration: .9s; }
.sound-toggle.is-on .sound-bars i:nth-child(3) { animation-delay: -.2s; animation-duration: 1.3s; }
.sound-toggle.is-on .sound-bars i:nth-child(4) { animation-delay: -.7s; animation-duration: 1s; }
@keyframes bars { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
.sound-now {
  position: absolute; right: calc(100% + 6px); top: 50%; translate: 8px -50%; opacity: 0; pointer-events: none; white-space: nowrap;
  padding: 5px 10px; border-radius: var(--r-pill); font-family: var(--f-display); font-size: var(--t-small); letter-spacing: .04em; line-height: 1.5;
  color: var(--ink); background: var(--glass-2); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: opacity .4s, translate .5s var(--ease-out);
}
.sound-now:empty { display: none; }
.sound-toggle.is-naming .sound-now { opacity: 1; translate: 0 -50%; }
@media (max-width: 760px) { .sound-now { right: auto; left: 50%; top: calc(100% + 8px); translate: -50% -6px; } .sound-toggle.is-naming .sound-now { translate: -50% 0; } }


/* ---------- hero ---------- */
.hero { position: relative; z-index: 1; min-height: max(100svh, 620px); display: grid; align-items: center; pointer-events: none; }
.hero-in { padding-block: calc(var(--topbar-h) + 48px) 96px; }
.hero-copy { max-width: 560px; display: grid; gap: var(--s-5); justify-items: start; pointer-events: auto; transition: opacity .6s var(--ease-out), transform .8s var(--ease-out), filter .6s; }
.hero-scrim { position: absolute; inset: 0; background: radial-gradient(ellipse 60% 75% at 16% 50%, var(--veil), transparent 72%); }
.hero-chip { color: var(--ink); }
.hero-live { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 0 var(--leaf); animation: live 2.4s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--leaf) 70%, transparent); } 70%, 100% { box-shadow: 0 0 0 9px transparent; } }
.hero-title { line-height: 0; }
.hero-logo { width: min(512px, 82vw); height: auto; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .28)) drop-shadow(0 18px 40px rgba(0, 0, 0, .45)); animation: bob 7s var(--ease-in-out) infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.hero-lede { color: var(--ink); max-width: 30ch; font-size: clamp(1.15rem, 1rem + .8vw, 1.55rem); line-height: 1.35; text-shadow: 0 1px 14px var(--bg); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
@media (min-width: 901px) { .hero-cta { flex-wrap: nowrap; } .hero-cta .btn-lg { padding-inline: 22px; } }
.hero-tri { width: 0; height: 0; border-left: 11px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.hero-store svg { width: 26px; height: 26px; }

.hero-hint { position: absolute; right: max(var(--gutter), 6vw); bottom: 92px; pointer-events: none; color: var(--ink-2); opacity: 0; transition: opacity .8s; }
.vale-on .hero-hint { opacity: 1; }
.hero.is-exploring .hero-hint, .hero.is-touched .hero-hint { opacity: 0; }
.hero-drag { width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; position: relative; animation: drag 2.6s var(--ease-in-out) infinite; }
@keyframes drag { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }

.hero-back { position: absolute; left: 50%; bottom: 92px; translate: -50% 0; pointer-events: auto; }
.hero-back::before { content: ""; width: 9px; height: 9px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.hero.is-exploring .hero-copy { opacity: 0; transform: translateX(-24px); filter: blur(6px); pointer-events: none; }
.hero.is-exploring .hero-scrim { opacity: 0; }
.hero-scrim { transition: opacity .8s; }

.hero-scroll { position: absolute; left: 50%; bottom: 26px; translate: -50% 0; width: 44px; height: 44px; display: grid; place-items: center; pointer-events: auto; color: var(--ink-2); }
.hero-scroll i { width: 12px; height: 12px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); animation: nudge 2s var(--ease-in-out) infinite; }
@keyframes nudge { 50% { transform: translateY(6px) rotate(45deg); } }
.hero.is-exploring .hero-scroll { opacity: 0; }

@media (max-width: 900px) {
  .hero { align-items: start; }
  .hero-in { padding-block: calc(var(--topbar-h) + 44px) 0; }
  .hero-copy { max-width: none; justify-items: center; text-align: center; gap: var(--s-4); }
  .hero-lede { max-width: 26ch; }
  .hero-cta { justify-content: center; }
  .hero-scrim { background: linear-gradient(to bottom, var(--veil), color-mix(in oklab, var(--veil) 70%, transparent) 38%, transparent 62%); }
  .hero-hint { right: auto; left: 50%; translate: -50% 0; bottom: 84px; white-space: nowrap; }
}
@media (max-width: 480px) {
  .hero-cta .btn-lg { min-height: 52px; padding: 12px 18px; font-size: 1.05rem; }
}

/* ---------- labels on the map ---------- */
.stage-labels { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .6s; overflow: hidden; }
.stage-labels.is-on { opacity: 1; }
.no-vale .stage-labels { display: none; }
.vale-pin {
  position: absolute; left: 0; top: 0; pointer-events: none; visibility: hidden;
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 8px;
  font-family: var(--f-display); font-size: var(--t-small); letter-spacing: .05em; white-space: nowrap; color: var(--ink);
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r-pill);
  -webkit-backdrop-filter: blur(10px) saturate(1.5); backdrop-filter: blur(10px) saturate(1.5);
  box-shadow: var(--shadow-1);
  transition: background-color .2s, color .2s, scale .25s var(--ease-spring), opacity .4s;
  transform-origin: 0 100%;
}
.stage-labels.is-on .vale-pin.is-vis { pointer-events: auto; visibility: visible; }
.vale-pin::before { content: ""; width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); box-shadow: 0 0 10px var(--gold); flex: none; }
.vale-pin.is-danger::before { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
/* the stalk from the label down to the town */
.vale-pin::after { content: ""; position: absolute; left: 11px; top: 100%; width: 1px; height: var(--stalk, 26px); background: linear-gradient(to bottom, var(--line-2), transparent); }
.vale-pin:hover, .vale-pin:focus-visible { scale: 1.08; background: var(--glass-2); color: var(--gold); }
.vale-pin.is-here { color: var(--btn-ink); background: var(--btn-face); border-color: transparent; }
.vale-pin.is-here::before { background: var(--btn-ink); box-shadow: none; }
.vale-pin.is-far { opacity: .0; }
@media (max-width: 760px) { .vale-pin { font-size: var(--t-micro); padding: 9px 10px 9px 8px; } }

/* ---------- lightbox ---------- */
.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; color: var(--ink); }
.lightbox::backdrop { background: rgba(6, 5, 12, .9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; animation: lb-in .35s var(--ease-out); }
@keyframes lb-in { from { opacity: 0; transform: scale(.97); } }
.lightbox figure { width: min(1500px, 94vw); text-align: center; }
.lightbox figure img { width: 100%; max-height: 80vh; object-fit: contain; border-radius: var(--r-2); box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 40px 120px -20px #000; background: #0a0912; }
.lightbox figcaption { margin-top: 16px; font-family: var(--f-display); letter-spacing: .04em; color: #f4eddd; }
.lb-btn { position: fixed; z-index: 2; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: rgba(24, 20, 36, .8); border: 1px solid rgba(255, 255, 255, .16); color: #ffd25c; font: 700 22px/1 var(--f-display); transition: background-color .2s, transform .2s var(--ease-out); }
.lb-btn:hover { background: rgba(48, 40, 70, .9); transform: scale(1.06); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 14px; top: 50%; margin-top: -24px; }
.lb-next { right: 14px; top: 50%; margin-top: -24px; }
.lb-close img { width: 28px; height: 28px; }

@media (prefers-reduced-motion: reduce) {
  .hero-logo, .hero-live, .hero-drag, .hero-scroll i { animation: none; }
  .sound-toggle.is-on .sound-bars i { animation: none; transform: scaleY(.7); }
  .scroll-meter { display: none; }
}

/* ===== landing/sections/stats.css ===== */
/* stats: The Vale in numbers. Tokens only (docs/LANDING.md §3). */

.stats-sec {
  padding-block: clamp(24px, 3.5vw, 44px) clamp(72px, 9vw, 120px);
}

/* The ledger panel: one glass slab with eight cells and hairline dividers. */
.stats-panel {
  overflow: hidden;
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 4px 10px -2px var(--shade), 0 46px 90px -34px var(--shade);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  padding-block: 8px;
}
.stats-cell {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 14px;
  padding: clamp(28px, 3vw, 40px) 10px clamp(26px, 3vw, 36px);
  text-align: center;
}
.stats-cell + .stats-cell { border-left: 1px solid var(--line); }

.stats-icon {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 6px 8px var(--shade));
}

/* The number is solid gold when there is no script; the script rolls digits and gives each one the gilt face. */
.stats-num {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 1.5rem + 1.3vw, 2.9rem);
  line-height: 1;
  white-space: nowrap;
  color: var(--gold);
  filter: drop-shadow(0 .06em 0 color-mix(in oklab, var(--gold-2) 40%, black)) drop-shadow(0 .5em 1.2em color-mix(in oklab, var(--gold) 22%, transparent));
}
.stats-num .gilt { filter: none; }

.stats-label {
  font-family: var(--f-display);
  font-size: clamp(.66rem, .58rem + .3vw, .8rem);
  letter-spacing: .12em;
  line-height: 1.2;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* Odometer: one column per digit, a strip of 0 to 9. The strip moves when the panel gets .in (core.js reveal). */
.stats-col {
  display: inline-block;
  width: 1ch;
  height: 1.5em;
  overflow: hidden;
  vertical-align: top;
}
.stats-strip {
  display: block;
  transform: translate3d(0, 0, 0);
  transition: transform 1.4s var(--ease-out) var(--d, 0ms);
  will-change: transform;
}
.stats-panel.in .stats-strip {
  transform: translate3d(0, calc(var(--to, 0) * -1.5em), 0);
}
.stats-d {
  display: block;
  height: 1.5em;
  line-height: 1.5;
  padding-block: 0; margin-block: 0;
  text-align: center;
}

/* One ember light crosses the top edge once as the panel appears. */
.stats-trace {
  position: absolute;
  left: 0;
  top: 0;
  width: 30%;
  height: 2px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, var(--gold), var(--ember), transparent);
  box-shadow: 0 0 14px var(--ember);
  transform: translate3d(-100%, 0, 0);
}
.stats-panel.in .stats-trace {
  animation: stats-trace 1.9s var(--ease-out) .25s both;
}
@keyframes stats-trace {
  0%   { transform: translate3d(-100%, 0, 0); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translate3d(333%, 0, 0); opacity: 0; }
}

/* Place-name marquee: decoration only, faded at both edges. */
.stats-marquee {
  margin-top: clamp(28px, 4vw, 44px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, var(--ink) 16%, var(--ink) 84%, transparent);
  mask-image: linear-gradient(90deg, transparent, var(--ink) 16%, var(--ink) 84%, transparent);
}
.stats-track {
  display: flex;
  width: max-content;
}
.stats-set {
  display: flex;
  flex: none;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stats-set li {
  display: flex;
  align-items: center;
  font-family: var(--f-display);
  font-size: .9rem;
  letter-spacing: .08em;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink-2);
}
.stats-set li::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin: 0 26px;
  background: currentColor;
  opacity: .6;
  transform: rotate(45deg);
}
.js .stats-track { animation: stats-scroll 80s linear infinite; }
.stats-marquee:hover .stats-track { animation-play-state: paused; }
@keyframes stats-scroll {
  to { transform: translate3d(-50%, 0, 0); }
}

/* Tablet and small laptops: 4 by 2. */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats-cell { border-left: 0; border-top: 0; }
  .stats-cell:nth-child(4n+2),
  .stats-cell:nth-child(4n+3),
  .stats-cell:nth-child(4n+4) { border-left: 1px solid var(--line); }
  .stats-cell:nth-child(n+5) { border-top: 1px solid var(--line); }
}

/* Phone: 2 by 4. */
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-cell { border-left: 0; border-top: 0; padding: 24px 8px 22px; gap: 12px; }
  .stats-cell:nth-child(2n) { border-left: 1px solid var(--line); }
  .stats-cell:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats-icon { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .stats-track { animation: none; }
  .stats-trace { display: none; }
}

/* ===== landing/sections/trailer.css ===== */
/* Trailer: a cinema frame that tilts back and rises flat as the section scrolls in, with an ambilight glow taken
   from the picture. --p is set on the section by ctx.progress (trailer.js). */

.trailer { --tilt-x: 24deg; --tilt-y: 64px; --tilt-persp: 1600px; overflow-x: clip; }

.trailer-stage {
  position: relative;
  isolation: isolate;
  width: min(100%, 1040px);
  margin-inline: auto;
  perspective: var(--tilt-persp);
}

/* ---------- the frame ---------- */
/* --k runs 0 to 1 over the first 42% of the section's progress, then stays at 1 (flat). */
.trailer-frame {
  --k: clamp(0, calc(var(--p, 0) * 2.381), 1);
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-4);
  border: 1px solid var(--glass-line);
  background: var(--bg);
  box-shadow: var(--shadow-3);
  transform:
    translate3d(0, calc((1 - var(--k)) * var(--tilt-y)), 0)
    scale(calc(0.9 + 0.1 * var(--k)))
    rotateX(calc((1 - var(--k)) * var(--tilt-x)));
  will-change: transform;
}
.trailer-stage.is-playing .trailer-frame,
.trailer-frame.is-flat { --k: 1; }
@media (prefers-reduced-motion: reduce) {
  .trailer-frame { --k: 1; }
}

/* A faint inner top highlight, and a light that follows the pointer (--mx, --my, --hover from data-spot). */
.trailer-frame::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  z-index: 3; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--glass-hi) 30%, var(--glass-hi) 70%, transparent);
}
.trailer-frame::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 2; pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(620px circle at calc(var(--mx, 0.5) * 100%) calc(var(--my, 0.5) * 100%), var(--spot), transparent 60%);
  opacity: var(--hover, 0);
  transition: opacity 0.4s;
}

.trailer-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
}
/* One play control only: the custom disc. The native overlay button is hidden. */
.trailer-video::-webkit-media-controls-overlay-play-button { display: none; }
.trailer-video::-webkit-media-controls-start-playback-button { display: none; }

/* ---------- the custom play button ---------- */
.trailer-cover {
  position: absolute; inset: 0;
  z-index: 2;
  display: grid; place-items: center;
  /* centre the disc above the native control bar */
  padding-bottom: 52px;
  pointer-events: none;
}
.trailer-play {
  pointer-events: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);
  border-radius: 50%;
}
.trailer-play[hidden] { display: none; }
:root:not(.js) .trailer-play { display: none; }

.trailer-disc {
  position: relative;
  display: grid; place-items: center;
  width: 92px; height: 92px;
  border-radius: 50%;
  color: var(--btn-ink);
  background: linear-gradient(180deg, color-mix(in oklab, var(--btn-face) 80%, white), var(--btn-face) 45%, var(--btn-face-2));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    inset 0 -4px 0 rgba(120, 60, 0, 0.3),
    0 6px 0 var(--btn-edge),
    0 24px 48px -12px var(--shade);
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
/* A slow pulsing ring. */
.trailer-disc::before {
  content: "";
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  opacity: 0;
  pointer-events: none;
  animation: trailer-ring 2.8s var(--ease-out) infinite;
}
@keyframes trailer-ring {
  0%   { transform: scale(1);    opacity: 0.8; }
  100% { transform: scale(1.5);  opacity: 0; }
}
.trailer-disc svg {
  width: 34px; height: 34px;
  margin-left: 5px;
  fill: currentColor;
}
.trailer-play:hover .trailer-disc { transform: scale(1.05); }
.trailer-play:active .trailer-disc { transform: translateY(3px) scale(0.98); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 var(--btn-edge), 0 10px 24px -10px var(--shade); }

.trailer-len {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-family: var(--f-display);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

/* ---------- ambilight ---------- */
/* The glow spreads 4% past the stage on each side (not scaled, so it never runs off the phone width). */
.trailer-glow {
  position: absolute;
  inset: -6% 0 -12%;
  z-index: -1;
  -webkit-mask-image: radial-gradient(ellipse 62% 58% at 50% 48%, #000 45%, transparent 100%);
  mask-image: radial-gradient(ellipse 62% 58% at 50% 48%, #000 45%, transparent 100%);
  pointer-events: none;
}
.trailer-glow > * {
  position: absolute;
  left: -4%; top: -4%;
  width: 108%; height: 108%;
  object-fit: cover;
  filter: blur(60px) saturate(1.6);
}
.trailer-glow-poster { opacity: 0.55; }
:root[data-theme="light"] .trailer-glow-poster { opacity: 0.4; }
.trailer-glow-canvas { opacity: 0; transition: opacity 1.2s var(--ease-out); }
.trailer-stage.is-playing .trailer-glow-canvas { opacity: 1; }

/* ---------- chips ---------- */
.trailer-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-7);
}

/* ---------- phones: nearly full width, gentler tilt ---------- */
@media (max-width: 640px) {
  .trailer { --tilt-x: 12deg; --tilt-y: 32px; --tilt-persp: 900px; }
  .trailer-frame { border-radius: var(--r-3); }
  .trailer-disc { width: 72px; height: 72px; }
  .trailer-disc svg { width: 28px; height: 28px; }
  .trailer-cover { padding-bottom: 44px; }
  .trailer-chips { margin-top: var(--s-6); }
}

@media (prefers-reduced-motion: reduce) {
  .trailer-disc::before { animation: none; opacity: 0.35; transform: scale(1.12); }
}

/* ===== landing/sections/skills.css ===== */
/* Skills section: a 3D carousel of fifteen skill tiles on a floor, and a detail panel (docs/LANDING.md). Classes are prefixed skills-. */

/* Registered so the accent glides from one skill colour to the next. */
@property --aura { syntax: "<color>"; inherits: true; initial-value: #ffd25c; }

.skills {
  --skills-radius: 430px;     /* ring radius */
  --skills-tile: 112px;       /* tile size */
  --skills-icon: 64px;        /* 16 px art at 4x */
  --skills-stage-h: 380px;
  --skills-persp: 1400px;
  transition: --aura .9s var(--ease-out);
}

/* ---------- no script: a tidy wrapped grid ---------- */

.skills-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s-3);
}
.skills-list > li { min-width: 0; }

.skills-tile {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 12px;
  text-align: center;
  color: var(--ink);
  border: 1px solid var(--glass-line);
  border-radius: 20px;
  background: linear-gradient(160deg, var(--glass-2), var(--glass));
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-1);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow .45s var(--ease-out), border-color .45s var(--ease-out), scale .45s var(--ease-out);
}
.skills-tile img {
  width: 48px;
  height: 48px;
  -webkit-user-drag: none;
  filter: drop-shadow(0 6px 8px var(--shade));
}
.skills-tile-name {
  font-family: var(--f-display);
  font-size: 1.05rem;
  line-height: 1.1;
}
.skills-tile-line {
  max-width: 22ch;
  font-size: var(--t-small);
  line-height: 1.35;
  color: var(--ink-2);
}

/* The front tile, lit in its own skill colour (set from script). */
.skills-tile.is-front {
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 0 0 1px color-mix(in oklab, var(--c) 70%, transparent),
    0 14px 40px -10px color-mix(in oklab, var(--c) 75%, var(--gold)),
    var(--shadow-2);
}

/* Floor and ring line: hidden until the script turns the ring on. */
.skills-floor,
.skills-ring-line { display: none; }

/* ---------- with script: the 3D carousel ---------- */

.skills-ring-on .skills-stage {
  position: relative;
  height: var(--skills-stage-h);
  margin-inline: calc(var(--gutter) * -1);
  overflow-x: clip;               /* side tiles may leave the stage sideways, never top or bottom */
  perspective: var(--skills-persp);
  perspective-origin: 50% 30%;    /* seen from a little above */
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none; user-select: none;
}
.skills-ring-on .skills-stage:active { cursor: grabbing; }
.skills-stage:focus-visible { outline-offset: -4px; border-radius: var(--r-3); }

/* Floor: a wide soft glow in the selected skill's colour, lying flat under the ring (tilted like it). */
.skills-ring-on .skills-floor {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--skills-radius) * 2.6);
  height: calc(var(--skills-radius) * 2.6);
  translate: -50% -50%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--aura) 40%, transparent), transparent);
  filter: blur(10px);
  transform: translateZ(calc(var(--skills-radius) * -1)) rotateX(78deg);
}

/* The circle the tiles travel on: same radius, same tilt as the ring. */
.skills-ring-on .skills-ring-line {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--skills-radius) * 2);
  height: calc(var(--skills-radius) * 2);
  translate: -50% -50%;
  border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--ink) 22%, transparent);
  pointer-events: none;
  transform: translateZ(calc(var(--skills-radius) * -1)) rotateX(78deg);
}

/* The ring. Turned by --spin (degrees) from script. Tilted -12 degrees after the spin, so the front sits at the stage plane. */
.skills-ring-on .skills-list {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  display: block;
  margin: 0;
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--skills-radius) * -1)) rotateX(-12deg) rotateY(var(--spin, 0deg));
  will-change: transform;
}
.skills-ring-on .skills-list > li {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateY(calc(var(--i, 0) * 24deg)) translateZ(var(--skills-radius));
}

/* Each tile turns back to face the viewer (--face), so icons never show mirrored.
   --depth runs 0 at the front to 1 at the back: it fades, dims and softens the far tiles. */
.skills-ring-on .skills-tile {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--skills-tile);
  height: var(--skills-tile);
  margin: calc(var(--skills-tile) / -2) 0 0 calc(var(--skills-tile) / -2);
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 22px;
  backface-visibility: visible;
  transform: rotateY(var(--face, 0deg));
  opacity: calc(1 - .72 * var(--depth, 0));
  filter: brightness(calc(1 - .45 * var(--depth, 0))) blur(calc(1.5px * var(--depth, 0)));
  transition: scale .45s var(--ease-out), box-shadow .45s var(--ease-out), border-color .45s var(--ease-out);
}
.skills-ring-on .skills-tile img {
  width: var(--skills-icon);
  height: var(--skills-icon);
}
/* The selected tile: bigger, gold rim, and a glow in its own colour. */
.skills-ring-on .skills-tile.is-front {
  scale: 1.18;
  border: 2px solid var(--gold);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 0 46px 6px color-mix(in oklab, var(--c) 60%, transparent),
    var(--shadow-2);
}
/* Names are in the panel and for screen readers only while the ring is on. */
.skills-ring-on .skills-tile-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- detail panel and arrows ---------- */

.skills-detail { position: relative; z-index: 1; }

.skills-panel {
  margin: clamp(8px, 2vw, 16px) auto 0;
  max-width: 560px;
  padding: clamp(20px, 3vw, 28px);
  display: grid;
  gap: 12px;
  text-align: left;
}
.skills-panel-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.skills-name { min-width: 0; }
.skills-lv {
  flex: none;
  font-family: var(--f-display);
  font-size: 1.1rem;
  line-height: 1.4;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.skills-line {
  font-size: 1.05rem;
  color: var(--ink-2);
}
.skills-bar {
  position: relative;
  height: 12px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: color-mix(in oklab, var(--ink) 12%, transparent);
  box-shadow: inset 0 1px 2px var(--shade);
}
.skills-fill {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  transform-origin: 0 50%;
  transform: scaleX(var(--fill, .99));
  background: linear-gradient(90deg, color-mix(in oklab, var(--aura) 60%, var(--gold)), var(--gold));
  box-shadow: 0 0 14px -2px color-mix(in oklab, var(--aura) 70%, transparent);
}
/* A soft shine that sweeps across the filled bar. */
.skills-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--ink) 50%, transparent), transparent);
  animation: skills-shine 2.6s linear infinite;
}
@keyframes skills-shine {
  from { transform: translateX(0); }
  to { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) {
  .skills-fill::after { animation: none; display: none; }
}

/* Round glass arrows. Shown only with the ring (they need the script). */
.skills-arrow {
  display: none;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: linear-gradient(160deg, var(--glass-2), var(--glass));
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-1);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.skills-arrow::before {
  content: "";
  width: 12px;
  height: 12px;
  border-style: solid;
  border-color: currentColor;
  border-width: 3px 3px 0 0;
}
.skills-next::before { transform: translateX(-2px) rotate(45deg); }
.skills-prev::before { transform: translateX(2px) rotate(-135deg); }
.skills-arrow:hover { color: var(--gold); }
.skills-arrow:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skills-ring-on .skills-arrow { display: grid; }
.skills-ring-on .skills-detail {
  margin-top: -24px;                 /* the panel sits over the lower front of the ring */
  display: grid;
  grid-template-columns: 48px minmax(0, 560px) 48px;
  justify-content: center;
  align-items: center;
  gap: var(--s-4);
}
.skills-ring-on .skills-panel { margin: 0; }

/* ---------- mid widths (760 to 1099 px) ---------- */
@media (max-width: 1099px) {
  .skills {
    --skills-radius: 340px;
    --skills-tile: 92px;
    --skills-icon: 48px;
    --skills-stage-h: 340px;
    --skills-persp: 1200px;
  }
}

/* ---------- phones (up to 759 px): a smaller ring that fits 360 px; arrows sit under the panel ---------- */
@media (max-width: 759px) {
  .skills {
    --skills-radius: 210px;
    --skills-tile: 68px;
    --skills-icon: 48px;
    --skills-stage-h: 250px;
    --skills-persp: 1000px;
  }
  .skills-tile { padding: 14px 8px; }
  .skills-ring-on .skills-detail {
    grid-template-columns: 1fr 1fr;
    gap: var(--s-3);
  }
  .skills-ring-on .skills-panel { grid-column: 1 / -1; grid-row: 1; }
  .skills-ring-on .skills-prev { grid-row: 2; grid-column: 1; justify-self: start; }
  .skills-ring-on .skills-next { grid-row: 2; grid-column: 2; justify-self: end; }
}

/* ===== landing/sections/world.css ===== */
/* world: a tour of nine places. Without script it is a plain list of cards in one column. With script (.world-on,
   set by world.js) the section is ten screens tall and the stack sits in one pinned viewport, crossfading cards.
   The tall, pinned layout hangs off .js on <html>, which boot.js sets before first paint, so the page never changes
   height under the reader when this section's module loads. */

.world { padding-block: var(--sec-y); pointer-events: auto; }

/* ---------- no script: one column ---------- */
.world-panel { display: flex; align-items: center; gap: clamp(20px, 3vw, 40px); }
.world-stack { display: grid; width: min(400px, 100%); gap: 28px; }
.world-stack > * { position: relative; }
.world-rail, .world-hint { display: none; }

/* ---------- script: a tall section with a pinned viewport ---------- */
.js .world { height: calc(10 * 100vh); padding-block: 0; pointer-events: none; }
.js .world .world-sticky { position: sticky; top: 0; height: 100vh; pointer-events: none; overflow: clip; }
.js .world .world-wrap { height: 100%; display: flex; align-items: center; }
.js .world .world-panel { width: 100%; }
.js .world .world-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.js .world .world-stack > * { grid-area: 1 / 1; align-self: center; }

/* Intro: the title on a soft veil, no card. */
.world-intro { isolation: isolate; display: grid; gap: var(--s-4); justify-items: start; text-align: left; padding: 8px 0; }
.world-intro::before {
  content: ""; position: absolute; z-index: -1; inset: -100px -140px; pointer-events: none;
  background: radial-gradient(closest-side, var(--veil), transparent);
}
.world-intro .h2 { font-size: clamp(2.4rem, 1.2rem + 2.4vw, 3.5rem); white-space: nowrap; }
.world-intro > p:not(.eyebrow) { max-width: 26ch; font-size: var(--t-lede); color: var(--ink-2); text-wrap: pretty; }

/* A place card: the same glass panel as the rest of the page. */
.world-card { display: grid; gap: 14px; padding: 16px; border-radius: var(--r-3); }
.world-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.world-count { font-family: var(--f-display); font-size: var(--t-micro); letter-spacing: .12em; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.world-body { display: grid; gap: 14px; }
.world-name { font-size: clamp(1.4rem, 1.2rem + .6vw, 1.85rem); }
.world-line { margin-top: 8px; font-size: .95rem; line-height: 1.45; color: var(--ink-2); text-wrap: pretty; }
.world-shot {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px;
  background: var(--bg-3);
  box-shadow: inset 0 0 0 1px var(--glass-line), 0 14px 26px -14px var(--shade);
}
.world-shot img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.world-shot:hover img { transform: scale(1.04); }
.world-shot:focus-visible { outline-offset: 4px; }

/* The flip: the incoming card rises and unfolds, the outgoing one folds back and fades. */
.js .world .world-card,
.js .world .world-intro {
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: perspective(900px) translate3d(0, 44px, 0) rotateX(-14deg);
  transform-origin: 50% 100%;
  transition: opacity .5s var(--ease-out), transform .5s var(--ease-out), visibility .5s;
}
.js .world .world-card.is-on,
.js .world .world-intro.is-on { opacity: 1; visibility: visible; transform: none; }
.js .world .world-card.is-on { pointer-events: auto; }
.js .world .world-card.is-out,
.js .world .world-intro.is-out { opacity: 0; transform: perspective(900px) translate3d(0, -36px, 0) rotateX(16deg); }

/* The veil scrim under the intro sits behind everything. Phones: the card is a compact sheet at the bottom. */

/* ---------- progress rail: vertical on desktop, a row above the sheet on phones ---------- */
.js .world .world-rail { position: relative; display: block; margin-right: 6px; flex: none; pointer-events: none; }
.world-track {
  position: absolute; left: 50%; top: 12px; bottom: 12px; width: 1px; margin-left: -.5px;
  background: var(--line-2); overflow: hidden;
}
.world-fill {
  position: absolute; inset: 0; background: var(--gold);
  transform-origin: 50% 0; transform: scaleY(var(--p, 0));
  box-shadow: 0 0 8px var(--gold);
}
.world-dots { position: relative; display: flex; flex-direction: column; gap: 14px; }
.world-dot {
  position: relative; display: block; width: 24px; height: 24px; pointer-events: auto;
  border-radius: 6px;
}
.world-dot::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px; transform: rotate(45deg);
  background: var(--bg-2); box-shadow: inset 0 0 0 1.5px var(--ink-3);
  transition: transform .35s var(--ease-out), background .35s, box-shadow .35s;
}
.world-dot:hover::before { transform: rotate(45deg) scale(1.3); }
.world-dot.is-on::before { background: var(--gold); box-shadow: 0 0 12px var(--gold), inset 0 0 0 1.5px var(--gold); transform: rotate(45deg) scale(1.2); }

/* ---------- the hint in the intro ---------- */
.js .world .world-hint {
  position: absolute; left: 50%; bottom: clamp(24px, 6vh, 56px); translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--f-display); font-size: var(--t-micro); letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-2); opacity: 0; pointer-events: none; transition: opacity .4s var(--ease-out);
}
.js .world[data-step="0"] .world-hint { opacity: 1; }
.world-hint svg { width: 16px; height: 16px; color: var(--gold); animation: world-bob 1.4s var(--ease-in-out) infinite alternate; }
@keyframes world-bob { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, 7px, 0); } }

/* ---------- phones: a compact sheet pinned to the bottom ---------- */
@media (max-width: 760px) {
  .js .world { height: calc(10 * 100vh); height: calc(10 * 100svh); }
  .js .world .world-sticky { height: 100vh; height: 100svh; }
  .js .world .world-wrap { padding-bottom: max(14px, env(safe-area-inset-bottom)); align-items: flex-end; }
  .js .world .world-panel { flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 12px; max-height: 100%; }
  .js .world .world-stack { width: 100%; }
  .js .world .world-stack > * { align-self: end; }

  .js .world .world-rail { width: 100%; max-width: 320px; margin: 0 auto 0 auto; align-self: center; }
  .world-track { left: 12px; right: 12px; top: 50%; bottom: auto; width: auto; height: 1px; margin: -.5px 0 0; }
  .world-fill { transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
  .world-dots { flex-direction: row; justify-content: space-between; gap: 0; }

  .world-card { padding: 14px; gap: 10px; border-radius: 20px; }
  .world-body { grid-template-columns: minmax(0, 1fr) 124px; align-items: center; gap: 14px; }
  .world-name { font-size: 1.35rem; }
  .world-line { margin-top: 6px; font-size: .9rem; }

  .js .world[data-step="0"] .world-hint { top: 30%; bottom: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .js .world .world-card, .js .world .world-intro { transition: none; }
  .world-hint svg { animation: none; }
}

/* ===== landing/sections/bosses.css ===== */
/* bosses: nine world bosses as holographic cards. Colours on the cards are fixed (they sit on a picture). */

.bosses { --aura: var(--danger); }

/* ---------- the card row ---------- */
.bosses-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2.2vw, 28px);
  align-items: start;
}
/* The slot takes the entrance (rise and fan) so the button keeps its own tilt transform. */
.bosses-slot { position: relative; }
.bosses-row > :nth-child(1) { --fan: 20deg; }
.bosses-row > :nth-child(2) { --fan: 8deg; }
.bosses-row > :nth-child(3) { --fan: -8deg; }
.bosses-row > :nth-child(4) { --fan: -20deg; }
.js .bosses-slot[data-reveal]:not(.in) {
  transform: perspective(1000px) translate3d(0, 60px, 0) rotateY(var(--fan, 0deg)) scale(.96);
}

/* ---------- one card ---------- */
.bosses-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(255, 210, 92, .38);
  background: #0d0b16;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 14px 26px -14px rgba(0, 0, 0, .7), 0 36px 60px -30px rgba(0, 0, 0, .8);
  transition: box-shadow .6s var(--ease-out), border-color .4s var(--ease-out);
}
.bosses-card:hover {
  border-color: rgba(255, 226, 140, .95);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .5), 0 26px 40px -16px rgba(0, 0, 0, .75), 0 60px 90px -34px rgba(0, 0, 0, .95),
    0 0 0 1px rgba(255, 210, 92, .4), 0 0 36px -6px rgba(255, 210, 92, .38);
}
.bosses-card:focus-visible { outline-offset: 6px; border-radius: 18px; }

/* Every layer is a child of the card, pushed to its own depth with translateZ. */
.bosses-card > * { position: absolute; display: block; }

.bosses-pic {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 17px;
  transform: translateZ(0);
  filter: saturate(1.08) contrast(1.04);
}
.bosses-scrim {
  inset: 0;
  border-radius: 17px;
  transform: translateZ(4px);
  background: linear-gradient(to top, rgba(6, 4, 12, .94) 0%, rgba(6, 4, 12, .72) 30%, rgba(6, 4, 12, 0) 58%);
}

/* Holographic foil: two rainbow layers that slide with the pointer. */
.bosses-foil {
  inset: 0;
  border-radius: 17px;
  pointer-events: none;
  transform: translateZ(10px);
  mix-blend-mode: color-dodge;
  background-image:
    repeating-linear-gradient(115deg, #ff6aa8 0%, #ffd25c 7%, #7dfbff 14%, #a995ff 21%, #ff6aa8 28%),
    repeating-linear-gradient(-28deg, rgba(255, 255, 255, 0) 0 7px, rgba(255, 255, 255, .55) 9px, rgba(255, 255, 255, 0) 12px);
  background-size: 300% 300%, 240% 240%;
  background-position:
    calc(var(--mx, .5) * 100%) calc(var(--my, .5) * 100%),
    calc((1 - var(--mx, .5)) * 100%) calc((1 - var(--my, .5)) * 100%);
  opacity: calc(.12 + .4 * var(--hover, 0));
  transition: opacity .5s var(--ease-out);
}

/* The glare at the pointer. */
.bosses-glare {
  inset: 0;
  border-radius: 17px;
  pointer-events: none;
  transform: translateZ(12px);
  background: radial-gradient(circle at calc(var(--mx, .5) * 100%) calc(var(--my, .5) * 100%), rgba(255, 255, 255, .4), rgba(255, 255, 255, 0) 42%);
  opacity: var(--hover, 0);
  transition: opacity .4s;
}

/* The inner gold frame, floating above the picture. */
.bosses-frame {
  inset: 10px;
  border-radius: 10px;
  pointer-events: none;
  transform: translateZ(20px);
  border: 1px solid rgba(255, 210, 92, .5);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
  transition: border-color .4s var(--ease-out), box-shadow .4s var(--ease-out);
}
.bosses-card:hover .bosses-frame {
  border-color: rgba(255, 226, 140, 1);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), inset 0 0 18px -4px rgba(255, 210, 92, .45);
}

/* Text and badge float highest. */
.bosses-lv {
  top: 20px;
  left: 20px;
  transform: translateZ(46px);
  padding: 7px 10px 6px;
  border-radius: 6px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .95rem;
  line-height: 1;
  letter-spacing: .04em;
  color: #fff6ee;
  background: #c8371f;
  box-shadow: 0 3px 0 #5b1208, 0 8px 16px -6px rgba(0, 0, 0, .6);
}
.bosses-caption {
  left: 24px;
  right: 24px;
  bottom: 24px;
  transform: translateZ(46px);
}
.bosses-name {
  display: block;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 1rem + .6vw, 1.5rem);
  line-height: 1.38;
  color: #ffd25c;
  text-shadow: 0 2px 0 #3a1a00, 0 0 18px rgba(255, 190, 60, .35);
}
.bosses-lair {
  display: block;
  margin-top: 8px;
  font-size: .875rem;
  line-height: 1.35;
  color: rgba(255, 244, 226, .88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

/* Touch has no pointer: the foil sweeps on its own (off under reduced motion). */
@media (hover: none) {
  .bosses-foil { opacity: .32; }
}
@media (hover: none) and (prefers-reduced-motion: no-preference) {
  .bosses-foil { animation: bosses-sweep 7s ease-in-out infinite alternate; }
}
@keyframes bosses-sweep {
  from { background-position: 0% 0%, 100% 0%; }
  to { background-position: 100% 100%, 0% 100%; }
}

/* ---------- the other five ---------- */
.bosses-also {
  margin-top: clamp(48px, 6vw, 80px);
  text-align: center;
  font-family: var(--f-display);
  font-size: var(--t-micro);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.bosses-rest {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 1000px;
  margin: 22px auto 0;
}
/* Each chip: the name on top, then the level and the lair on one line below it. */
.bosses-chip {
  flex: 0 1 calc(33.333% - 8px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
  padding: 12px 18px 12px 16px;
  border-radius: var(--r-2);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: var(--t-small);
  line-height: 1.3;
}
.bosses-mark {
  grid-row: 1 / span 2;
  width: 7px;
  height: 7px;
  background: var(--danger);
  transform: rotate(45deg);
  box-shadow: 0 0 10px var(--danger);
}
.bosses-chip-name {
  grid-column: 2;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: .02em;
  color: var(--ink);
}
.bosses-chip-meta {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}
.bosses-chip-lv {
  font-family: var(--f-display);
  font-size: var(--t-micro);
  letter-spacing: .06em;
  color: var(--danger);
}
.bosses-chip-lair { color: var(--ink-2); }

/* ---------- tablet: 2 by 2 ---------- */
@media (max-width: 1000px) and (min-width: 641px) {
  .bosses-row { grid-template-columns: repeat(2, minmax(0, 300px)); justify-content: center; }
}

/* ---------- phone: a snap strip with the next card peeking ---------- */
@media (max-width: 640px) {
  .bosses-row {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 78vw;
    justify-content: start;
    gap: 14px;
    margin-inline: calc(-1 * var(--gutter));
    padding: 12px var(--gutter) 28px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .bosses-row::-webkit-scrollbar { display: none; }
  .bosses-slot { scroll-snap-align: start; }
  .bosses-rest { flex-direction: column; align-items: stretch; gap: 8px; }
  .bosses-chip { flex-basis: auto; }
}

/* ===== landing/sections/devices.css ===== */
/* devices: one hero, two screens (a browser window and a 3D iPhone turned by scroll), then the touch controls.
   Tokens only, except the fixed artwork colours of the phone body and the browser art (same in both themes). */

.devices { --aura: var(--glint); }

/* ---------- the stage: sized from its own width (cqi), scroll drives --p (set by core.js) ----------
   Desktop: browser 62% of the wrap (max 760), phone in landscape 46% of the wrap (max 560), lower right of the browser,
   phone in front. The phone starts upright at the top right and turns to landscape between p .25 and .5. */
.devices-stage {
  container-type: inline-size;
  position: relative;
  perspective: 1600px;
  /* phone: portrait width (landscape visual width is 2.06 of it) */
  --pw: min(272px, 22.4cqi);
  /* browser width and height (36px bar + 16:9 picture) */
  --bw: min(760px, 62cqi);
  --bh: calc(36px + var(--bw) * .5625);
  /* phone centre when upright (top at 0) and when landscape (bottom on the browser's bottom edge, overlapping its
     lower-right corner by a third of the phone's width) */
  --cxu: 80cqi;
  --cyu: calc(var(--pw) * 1.03);
  --cxl: calc(var(--bw) + var(--pw) * .343);
  --cyl: calc(var(--bh) - var(--pw) * .5);
  /* k0: the browser eases into place over the first half. kt: the phone turns from p .25 to .5.
     kx: the screen cross-fades to the landscape picture as it turns. Flat and final from p .5 on. */
  --k0: clamp(0, calc(var(--p) * 2), 1);
  --kt: clamp(0, calc((var(--p) - .25) * 4), 1);
  --kx: clamp(0, calc((var(--p) - .32) * 7), 1);
  /* tl: how far the phone still leans in space (1 at the start, 0 once it lies flat) */
  --tl: calc(1 - var(--kt));
  --p: 1;                 /* no script: the final, resting state */
}
.js .devices-stage { --p: 0; }             /* with script, starts at the top until the first scroll reading */
.devices-stage.devices-static { --p: 1; }  /* reduced motion: never moves, rests in the final state */

.devices-scene {
  position: relative;
  height: max(calc(var(--bh) + 56px), calc(var(--pw) * 2.06));
  transform-style: preserve-3d;
}

/* ---------- the browser window, back left ---------- */
.devices-win {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--bw);
  margin: 0;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  box-shadow: var(--shadow-3);
  transform:
    translate3d(0, 0, calc(-160px + 160px * var(--k0)))
    rotateX(calc(6deg - 6deg * var(--k0)))
    rotateY(calc(18deg - 10deg * var(--k0)));
}
.devices-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  background: color-mix(in oklab, var(--ink) 6%, var(--bg-2));
  border-bottom: 1px solid var(--line);
}
.devices-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.devices-dot--a { background: var(--danger); }
.devices-dot--b { background: var(--gold); }
.devices-dot--c { background: var(--leaf); }
.devices-url {
  margin-left: 14px;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  font-family: var(--f-display);
  font-size: .8rem;
  letter-spacing: .03em;
  line-height: 1.3;
  color: var(--ink-2);
  background: var(--bg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.devices-win picture { display: block; }
.devices-win-pic { display: block; width: 100%; height: auto; }

/* ---------- the iPhone: a fixed-colour titanium body, a black bezel, a screen ---------- */
.devices-phone {
  position: absolute;
  left: var(--cxu);
  top: var(--cyu);
  width: var(--pw);
  aspect-ratio: 1 / 2.06;
  /* the box moves from upright to landscape with the turn; the rotation is about its centre */
  translate:
    calc(-50% + var(--kt) * (var(--cxl) - var(--cxu)))
    calc(-50% + var(--kt) * (var(--cyl) - var(--cyu)));
  transform:
    translateZ(60px)
    rotateY(calc(-24deg * var(--tl)))
    rotateX(calc(8deg * var(--tl)))
    rotateZ(calc(-90deg * var(--kt)));
  filter: drop-shadow(0 calc(var(--pw) * .06) calc(var(--pw) * .09) var(--shade));
}

.devices-body {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--pw) * .14);
  background: linear-gradient(145deg, #f3f0ea 0%, #b3aea5 14%, #6f6b64 40%, #3f3d39 56%, #8f8a82 78%, #e8e4dc 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .75),
    inset 0 0 0 2px #cdc8bf,
    inset 0 0 0 4px #5b5852,
    inset 0 0 0 5px #24221f,
    0 2px 0 #111,
    0 28px 44px -18px rgba(0, 0, 0, .55),
    0 12px 22px -12px rgba(0, 0, 0, .5);
}
/* a diagonal sheen over the titanium, moving with the pointer */
.devices-body::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .28) 46%, transparent 62%);
  background-size: 260% 260%;
  background-position: calc(var(--mx, .5) * 100%) calc(var(--my, .5) * 100%);
  mix-blend-mode: soft-light;
}

.devices-bezel {
  position: absolute;
  inset: calc(var(--pw) * .02);
  border-radius: calc(var(--pw) * .125);
  background: #050507;
  padding: 0;
}
.devices-screen {
  position: absolute;
  inset: calc(var(--pw) * .018);
  border-radius: calc(var(--pw) * .112);
  overflow: hidden;
  background: #000;
  isolation: isolate;
}
.devices-shot,
.devices-land {
  position: absolute;
  inset: 0;
}
.devices-shot { width: 100%; height: 100%; object-fit: cover; transition: none; opacity: calc(1 - var(--kx)); }
/* the landscape picture is laid on its side inside the portrait screen, so it reads upright once the phone turns */
.devices-land {
  inset: auto;
  left: 50%;
  top: 50%;
  width: 215%;
  height: 100%;
  transform: translate(-50%, -50%) rotate(90deg);
  opacity: var(--kx);
}
.devices-land img,
.devices-shot { display: block; }
.devices-land img { width: 100%; height: 100%; object-fit: cover; }

.devices-island {
  position: absolute;
  z-index: 3;
  top: calc(var(--pw) * .04);
  left: 50%;
  width: 34%;
  height: calc(var(--pw) * .092);
  translate: -50% 0;
  border-radius: 999px;
  background: #000;
  box-shadow: inset 0 0 0 1px #151515;
}
/* a soft reflection on the glass */
.devices-glare {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: calc(.35 + .4 * var(--hover, 0));
  background: linear-gradient(115deg, transparent 0 34%, rgba(255, 255, 255, .26) 44%, rgba(255, 255, 255, .06) 52%, transparent 60% 100%);
  background-size: 260% 260%;
  background-position: calc(var(--mx, .5) * 100%) calc(var(--my, .5) * 100%);
  transition: opacity .4s;
}

/* side buttons: small titanium bars on the edges */
.devices-btn {
  position: absolute;
  width: 3px;
  border-radius: 2px 0 0 2px;
  background: linear-gradient(90deg, #3e3c38, #bdb9b1);
}
.devices-btn--mute { left: -3px; top: 15%; height: 4%; }
.devices-btn--up { left: -3px; top: 22%; height: 7.5%; }
.devices-btn--down { left: -3px; top: 31%; height: 7.5%; }
.devices-btn--power { right: -3px; top: 27%; height: 11%; border-radius: 0 2px 2px 0; background: linear-gradient(270deg, #3e3c38, #bdb9b1); }

/* the chips: directly under their device, 16px below its bottom edge */
.devices-chips {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--bh) + 16px);
  height: 0;
}
.devices-chips .chip { position: absolute; top: 0; left: 0; white-space: nowrap; }
.devices-chips .chip + .chip { left: calc(var(--bw) - var(--pw) * .687); }

/* ---------- the controls: six glass tiles ---------- */
.devices-controls { margin-top: clamp(40px, 4vw, 60px); }
.devices-sub { text-align: center; margin-bottom: clamp(28px, 3.4vw, 44px); }

.devices-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 22px);
}
.devices-tile--wide { grid-column: span 2; }
.devices-tile {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: var(--r-3);
}
.devices-text { display: grid; gap: 6px; }
.devices-art {
  position: relative;
  height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--r-2);
  background: color-mix(in oklab, var(--ink) 4%, transparent);
}
/* diagrams are drawn for a 120-unit height, so at 120px tall they render at exactly 1x */
.devices-art svg { display: block; width: 100%; height: 120px; }
.devices-art--cast { display: block; height: 190px; }
.devices-tile-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 1rem + .4vw, 1.35rem);
  line-height: 1.4;
  color: var(--ink);
  letter-spacing: .01em;
  text-wrap: balance;
}
.devices-tile-line { color: var(--ink-2); font-size: .95rem; line-height: 1.45; }

/* colour helpers, set on groups and read through currentColor */
.devices-c-glint { color: var(--glint); }
.devices-c-water { color: color-mix(in oklab, var(--glint) 40%, var(--arcane)); }
.devices-c-leaf { color: var(--leaf); }
.devices-c-ember { color: var(--ember); }
.devices-c-gold { color: var(--gold); }
.devices-c-danger { color: var(--danger); }
.devices-c-ink { color: var(--ink-2); }

/* shared strokes and fills for the diagrams */
.devices-art .devices-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.devices-ground { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-linecap: round; }
.devices-lane { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; }
.devices-slot { fill: color-mix(in oklab, var(--ink) 6%, transparent); stroke: var(--line-2); stroke-width: 1.5; }
.devices-set-name {
  font-family: var(--f-display);
  font-size: 14px;
  letter-spacing: .06em;
  text-anchor: middle;
  fill: var(--ink-2);
}
.devices-page { fill: var(--ink-2); }

/* ---------- 1. draw to cast: the glyph alone, centred, its name beside it; the whole box takes a stroke ---------- */
.devices-art--cast .devices-pad {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.devices-live {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: .8;
  transition: opacity .9s var(--ease-out);
}
.devices-live.is-fading { opacity: 0; }
.devices-cast {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  pointer-events: none;
}
.devices-art .devices-cast-glyph { flex: none; width: 120px; height: 120px; }
.devices-cast-glyph .devices-stroke { stroke-width: 4; }
.devices-cast-names { display: grid; }
/* four names share one grid cell: only the one whose glyph is up is visible */
.devices-cast-name {
  grid-area: 1 / 1;
  font-family: var(--f-display);
  font-size: 1.2rem;
  line-height: 1.4;
  letter-spacing: .04em;
  opacity: 0;
  animation: devices-cast-on 12s linear infinite;
}
/* the four glyphs take turns in a 12 s loop: each shows for 2.3 s, fades out fully, then the next starts */
.devices-glyph {
  opacity: 0;
  animation: devices-cast-on 12s linear infinite;
}
.devices-glyph .devices-stroke {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: devices-cast-draw 12s linear infinite;
}
.devices-glyph--water,
.devices-glyph--water .devices-stroke,
.devices-name--water { animation-delay: 3s; }
.devices-glyph--earth,
.devices-glyph--earth .devices-stroke,
.devices-name--earth { animation-delay: 6s; }
.devices-glyph--fire,
.devices-glyph--fire .devices-stroke,
.devices-name--fire { animation-delay: 9s; }

@keyframes devices-cast-on {
  0% { opacity: 0; }
  1% { opacity: 1; }
  19% { opacity: 1; }
  24% { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes devices-cast-draw {
  0% { stroke-dashoffset: 100; }
  9% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}

/* ---------- 2. steer and bump: the thumb drags, the hero dot slides into a monster, which flashes with a hit number ---------- */
.devices-thumb {
  fill: currentColor;
  opacity: .85;
  animation: devices-thumb 3.2s ease-in-out infinite;
}
.devices-hero {
  fill: currentColor;
  animation: devices-hero 3.2s ease-in-out infinite;
}
.devices-mon {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
  animation: devices-flash 3.2s ease-out infinite;
}
.devices-hit {
  font-family: var(--f-display);
  font-size: 16px;
  text-anchor: middle;
  fill: currentColor;
  opacity: 0;
  transform-box: view-box;
  animation: devices-hit 3.2s ease-out infinite;
}
@keyframes devices-thumb {
  0%, 36% { transform: translateX(0); }
  50%, 84% { transform: translateX(30px); }
  94%, 100% { transform: translateX(0); }
}
@keyframes devices-hero {
  0%, 34% { transform: translateX(0); }
  48%, 88% { transform: translateX(34px); }
  96%, 100% { transform: translateX(0); }
}
@keyframes devices-flash {
  0%, 46% { opacity: 1; transform: scale(1); }
  49% { opacity: .35; transform: scale(1.25); }
  54% { opacity: 1; transform: scale(1.08); }
  62%, 100% { opacity: 1; transform: scale(1); }
}
@keyframes devices-hit {
  0%, 48% { opacity: 0; transform: translateY(6px); }
  52% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; transform: translateY(-6px); }
  88%, 100% { opacity: 0; transform: translateY(-8px); }
}

/* ---------- 3. again: a 64px button, a pulse ring and a spark burst at each press ---------- */
.devices-again-btn {
  fill: var(--btn-face);
  stroke: var(--btn-edge);
  stroke-width: 4;
  transform-box: fill-box;
  transform-origin: center;
  animation: devices-press 1.6s ease-in-out infinite;
}
.devices-art .devices-again-arrow {
  stroke: var(--btn-ink);
  stroke-width: 4;
  transform-box: fill-box;
  transform-origin: center;
  animation: devices-press 1.6s ease-in-out infinite;
}
.devices-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: devices-ring 1.6s ease-out infinite;
}
.devices-spark {
  transform-box: view-box;
  transform-origin: 120px 60px;
  opacity: 0;
  animation: devices-spark 1.6s ease-out infinite;
}
@keyframes devices-press {
  0% { transform: scale(1); }
  6% { transform: scale(.92); }
  14%, 100% { transform: scale(1); }
}
@keyframes devices-ring {
  0% { opacity: 0; transform: scale(1); }
  6% { opacity: .9; transform: scale(1.02); }
  60%, 100% { opacity: 0; transform: scale(1.75); }
}
@keyframes devices-spark {
  0%, 6% { opacity: 0; transform: scale(.6); }
  10% { opacity: 1; transform: scale(.85); }
  40% { opacity: 0; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* ---------- 4. loot to pack: three items arc into the bag along three different paths; the bag bumps on each landing ----------
   Each item runs a 3.6 s cycle: arcs from 4% to 80%, then shrinks into the bag. Items two and three start 0.9 s and 1.8 s late,
   so they land at 5% and 30% of the bag's cycle, where the bag bumps. */
.devices-drop {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation-duration: 3.6s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}
.devices-drop--a { animation-name: devices-loot-a; }
.devices-drop--b { animation-name: devices-loot-b; animation-delay: .9s; }
.devices-drop--c { animation-name: devices-loot-c; animation-delay: 1.8s; }
.devices-bag {
  transform-box: fill-box;
  transform-origin: center;
  animation: devices-bag 3.6s linear infinite;
}
@keyframes devices-loot-a {
  0% { opacity: 0; transform: translate(0, 0) scale(1); }
  4% { opacity: 1; transform: translate(0, 0) scale(1); }
  23% { transform: translate(26.4px, -34.2px) scale(1); }
  42% { transform: translate(61.5px, -47px) scale(1); }
  61% { transform: translate(105.4px, -38.2px) scale(1); }
  80% { opacity: 1; transform: translate(158px, -8px) scale(1); }
  88%, 100% { opacity: 0; transform: translate(162px, -6px) scale(.4); }
}
@keyframes devices-loot-b {
  0% { opacity: 0; transform: translate(0, 0) scale(1); }
  4% { opacity: 1; transform: translate(0, 0) scale(1); }
  23% { transform: translate(41.4px, -15.4px) scale(1); }
  42% { transform: translate(81.5px, -22px) scale(1); }
  61% { transform: translate(120.4px, -19.4px) scale(1); }
  80% { opacity: 1; transform: translate(158px, -8px) scale(1); }
  88%, 100% { opacity: 0; transform: translate(162px, -6px) scale(.4); }
}
@keyframes devices-loot-c {
  0% { opacity: 0; transform: translate(0, 0) scale(1); }
  4% { opacity: 1; transform: translate(0, 0) scale(1); }
  23% { transform: translate(48.9px, -41.7px) scale(1); }
  42% { transform: translate(91.5px, -57px) scale(1); }
  61% { transform: translate(127.9px, -45.7px) scale(1); }
  80% { opacity: 1; transform: translate(158px, -8px) scale(1); }
  88%, 100% { opacity: 0; transform: translate(162px, -6px) scale(.4); }
}
@keyframes devices-bag {
  0% { transform: scale(1); }
  5% { transform: scale(1.12); }
  8%, 30% { transform: scale(1); }
  32% { transform: scale(1.12); }
  35%, 82% { transform: scale(1); }
  84% { transform: scale(1.12); }
  87%, 100% { transform: scale(1); }
}

/* ---------- 5. one-tap craft: a tap ripple on the raw item, then it becomes the cooked one ---------- */
.devices-raw {
  animation: devices-raw 3s linear infinite;
}
.devices-cooked {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: devices-cooked 3s linear infinite;
}
.devices-tap {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
  animation: devices-tap 3s ease-in-out infinite;
}
.devices-ripple {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: devices-ripple 3s ease-out infinite;
}
@keyframes devices-raw {
  0%, 30% { opacity: 1; }
  34%, 88% { opacity: 0; }
  92%, 100% { opacity: 1; }
}
@keyframes devices-cooked {
  0%, 34% { opacity: 0; transform: scale(.6); }
  42% { opacity: 1; transform: scale(1.1); }
  48%, 88% { opacity: 1; transform: scale(1); }
  94%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes devices-tap {
  0%, 100% { transform: scale(1); }
  6% { transform: scale(.7); }
  14% { transform: scale(1); }
}
@keyframes devices-ripple {
  0% { opacity: 0; transform: scale(.4); }
  4% { opacity: .9; transform: scale(.5); }
  26%, 100% { opacity: 0; transform: scale(2.2); }
}

/* ---------- 6. swipe kits: the strip slides one set to the left and back; two page dots follow ---------- */
.devices-kits {
  transform-box: view-box;
  animation: devices-kits 4.8s linear infinite;
}
.devices-page--a { animation: devices-page-a 4.8s linear infinite; }
.devices-page--b { animation: devices-page-b 4.8s linear infinite; }
@keyframes devices-kits {
  0%, 18% { transform: translateX(0); animation-timing-function: ease-in-out; }
  34%, 66% { transform: translateX(-400px); animation-timing-function: ease-in-out; }
  82%, 100% { transform: translateX(0); }
}
@keyframes devices-page-a {
  0%, 18% { opacity: 1; }
  34%, 66% { opacity: .3; }
  82%, 100% { opacity: 1; }
}
@keyframes devices-page-b {
  0%, 18% { opacity: .3; }
  34%, 66% { opacity: 1; }
  82%, 100% { opacity: .3; }
}

/* ---------- calls to action ---------- */
.devices-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 48px;
}

/* ---------- tablet: two columns, the wide tiles span both ---------- */
@media (max-width: 1000px) and (min-width: 641px) {
  .devices-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- phone: the phone stands upright, large, in front of a smaller window that peeks out left and top;
   the chips stack under it; the tiles become one full-width card per row, diagram on top ---------- */
@media (max-width: 760px) {
  .devices-stage {
    --pw: 62cqi;
    --bw: 80cqi;
    --cxu: calc(24cqi + var(--pw) * .5);
    --cyu: calc(60px + var(--pw) * 1.03);
    --kt: 0;
    --tl: 0;
    --k0: 1;
  }
  .devices-scene { height: calc(60px + var(--pw) * 2.06); }
  .devices-chips {
    position: static;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
  }
  .devices-chips .chip { position: static; }

  .devices-tiles {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .devices-tile--wide { grid-column: auto; }
  .devices-tile { padding: 18px; gap: 12px; }
  .devices-text { gap: 4px; }
  .devices-art { height: 120px; }
  .devices-art--cast { height: 120px; }
  .devices-art--cast .devices-cast { gap: 16px; }
}

/* ---------- reduced motion: the diagrams rest in a readable state ---------- */
@media (prefers-reduced-motion: reduce) {
  .devices-glyph,
  .devices-cast-name { animation: none; }
  .devices-glyph--air,
  .devices-name--air { opacity: 1; }
  .devices-glyph--air .devices-stroke { stroke-dashoffset: 0; }
  .devices-glyph .devices-stroke,
  .devices-thumb,
  .devices-hero,
  .devices-mon,
  .devices-hit,
  .devices-again-btn,
  .devices-again-arrow,
  .devices-ring,
  .devices-spark,
  .devices-drop,
  .devices-bag,
  .devices-raw,
  .devices-cooked,
  .devices-tap,
  .devices-ripple,
  .devices-kits,
  .devices-page--a,
  .devices-page--b { animation: none; }
  .devices-drop,
  .devices-hit,
  .devices-ring,
  .devices-spark,
  .devices-ripple,
  .devices-cooked { opacity: 0; }
  .devices-page--a { opacity: 1; }
  .devices-page--b { opacity: .3; }
  .devices-raw { opacity: 0; }
  .devices-cooked { opacity: 1; }
}

/* ===== landing/sections/bento.css ===== */
/* bento: a feature grid. Every tile is a .glass card with explicit rows: the live miniature fills the space above
   the text, and the text sits bottom-left. Demos are CSS keyframes (transform, opacity, filter); bento.js drives the
   slow cycles (the gear power, the weather, the typed name) and the particles.
   Artwork that must look the same in both themes (the sky, the stone plinth, the island water) keeps its own colours. */

/* Registered so the gear glow can glide from one power colour to the next (the default is the artwork's gold). */
@property --glow { syntax: "<color>"; inherits: true; initial-value: #ffd25c; }

.bento { --aura: var(--arcane); }

/* ---------- grid: explicit rows, so no tile's content can stretch the grid ---------- */
/* Desktop (>= 1024px): 12 columns, 300 px rows.
   row 1-2: gear | market, side by side
   row 3:   mounts | island | no sign-up
   row 4:   weather | chat */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 300px;
  gap: 18px;
}
.bento-tile {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  padding: clamp(20px, 2vw, 24px);
  overflow: clip;
}
.bento-t1 { grid-column: 1 / span 7; grid-row: 1 / span 2; }
.bento-t2 { grid-column: 8 / span 5; grid-row: 1; }
.bento-t3 { grid-column: 8 / span 5; grid-row: 2; }
.bento-t4 { grid-column: 1 / span 4; grid-row: 3; }
.bento-t5 { grid-column: 5 / span 4; grid-row: 3; }
.bento-t6 { grid-column: 9 / span 4; grid-row: 3; }
.bento-t7 { grid-column: 1 / span 7; grid-row: 4; }
.bento-t8 { grid-column: 8 / span 5; grid-row: 4; }

/* The demo fills the space above the text. It is clipped to the tile and never sets the tile's height. */
.bento-demo {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: clip;
  isolation: isolate;
}
/* A soft tint behind each demo, in the tile's own accent. */
.bento-demo::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: -1;
  background: radial-gradient(closest-side at 50% 46%, color-mix(in oklab, var(--tint, var(--arcane)) 20%, transparent), transparent);
  pointer-events: none;
}

.bento-text { position: relative; z-index: 1; padding-top: 14px; }
.bento-text .h3 { margin-bottom: 6px; font-size: clamp(1.25rem, 1.05rem + .7vw, 1.6rem); line-height: 1.4; }
.bento-text p { color: var(--ink-2); font-size: .95rem; line-height: 1.45; max-width: 34ch; text-wrap: balance; }

/* ---------- 1. infused gear ---------- */
.bento-gear-demo {
  --tint: var(--glow);
  align-content: center;
  justify-items: center;
  gap: clamp(12px, 2.4vh, 22px);
  transition: --glow .4s ease;
}
.bento-gear { position: relative; width: 280px; height: 216px; }
/* Soft ellipse behind the sword, about 340 px wide. */
.bento-glow {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 340px;
  height: 230px;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  filter: blur(14px);
  opacity: .55;
  animation: bento-breathe 3.2s ease-in-out infinite;
}
.bento-sword {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 160px;
  height: 160px;
  translate: -50% 0;
  transform-origin: 50% 90%;
  filter: drop-shadow(0 0 10px var(--glow)) drop-shadow(0 8px 6px rgba(0, 0, 0, .35));
  animation: bento-float 4s ease-in-out infinite;
}
/* Stone plinth: artwork, so fixed colours. Its top is an ellipse with a glow pool on the surface. */
.bento-ped {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 200px;
  height: 46px;
  translate: -50% 0;
  border-radius: 12px / 8px;
  background: linear-gradient(180deg, #8a8898 0%, #5a5968 42%, #34323f 100%);
  box-shadow: 0 6px 0 #1d1c27, 0 18px 26px -10px rgba(0, 0, 0, .65), inset 0 2px 0 rgba(255, 255, 255, .25);
}
.bento-ped::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: -9px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #a9a7b6, #7b7989);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2);
}
.bento-ped::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: -6px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  filter: blur(2px);
  opacity: .9;
}
.bento-sparks { position: absolute; inset: 0; pointer-events: none; }
.bento-sparks i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 5px;
  height: 5px;
  background: var(--glow);
  box-shadow: 0 0 6px var(--glow);
  opacity: 0;
  animation: bento-spark var(--dur, 2.6s) linear var(--d, 0s) infinite;
}
.bento-power { display: flex; align-items: center; gap: 14px; }
.bento-power-name {
  font-family: var(--f-display);
  font-size: clamp(1.4rem, 1.2rem + .8vw, 2rem);
  line-height: 1.4;
  letter-spacing: .03em;
  /* The glow colour, pulled toward the ink so pale powers stay readable on the light day theme. */
  color: color-mix(in oklab, var(--glow) 62%, var(--ink));
  text-shadow: 0 2px 0 var(--bg-2), 0 0 18px color-mix(in oklab, var(--glow) 35%, transparent);
  white-space: nowrap;
}
.bento-pips { display: inline-flex; gap: 5px; }
.bento-pips i { width: 9px; height: 9px; border-radius: 2px; background: var(--line-2); }
.bento-pips i.on { background: var(--glow); box-shadow: 0 0 6px var(--glow); }
/* Ten round swatches, one per power. --c is set from script. */
.bento-swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 100%; }
.bento-sw {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c, var(--ink-3));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .35);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.bento-sw:hover { transform: scale(1.12); }
.bento-sw[aria-pressed="true"] {
  transform: scale(1.35);
  box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--c, var(--ink-3)), 0 0 12px var(--c, var(--ink-3));
}

/* ---------- 2. the Lantern Market ---------- */
/* The viewport is absolute and fills the demo, so the tickers never size the tile. */
.bento-market { display: block; }
.bento-view {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-inline: 2px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%);
}
.bento-col { position: relative; min-height: 0; overflow: hidden; }
.bento-track { display: flex; flex-direction: column; will-change: transform; }
.bento-track--up { animation: bento-up 22s linear infinite; }
.bento-track--down { animation: bento-down 26s linear infinite; }
.bento-list { display: flex; flex-direction: column; gap: 10px; padding: 0 0 10px; margin: 0; list-style: none; }
.bento-offer {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 10px 0 6px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.bento-offer > .px:first-child { width: 32px; height: 32px; flex: none; }
.bento-amt {
  margin-left: auto;
  font-family: var(--f-display);
  font-size: .95rem;
  line-height: 1.4;
  color: var(--ink);
  white-space: nowrap;
}
.bento-coin { width: 24px; height: 24px; flex: none; }

/* ---------- 3. side by side ---------- */
.bento-pair-demo { container-type: inline-size; }
.bento-pair {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}
/* Sprites are 48 px frames. 3x is 144 px on wide tiles, 2x below that. */
.bento-char {
  width: 96px;
  height: 96px;
  background: url("/assets/sprites/knight-walk.png") 0 0 / 384px 96px no-repeat;
  image-rendering: pixelated;
}
.bento-char--knight { animation: bento-chop 1.6s ease-in-out infinite; }
.bento-char--monk {
  background-image: url("/assets/sprites/monk-walk.png");
  animation: bento-idle 1.6s ease-in-out -.8s infinite;
}
@container (min-width: 420px) {
  .bento-char { width: 144px; height: 144px; background-size: 576px 144px; }
}
.bento-tree-wrap { position: relative; flex: none; margin-left: 6px; }
.bento-tree { position: relative; width: 104px; height: 112px; }
/* The two +10% xp pops take turns: each is visible for under half of the 5.6 s cycle. */
.bento-pop {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% 0;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--glass-2);
  border: 1px solid var(--glass-line);
  font-family: var(--f-display);
  font-size: 1.1rem;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--leaf);
  opacity: 0;
  animation: bento-pop 5.6s var(--ease-out) infinite;
}
.bento-pop--2 { animation-delay: -2.8s; }
.bento-ground-line {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 12px;
  height: 3px;
  border-radius: 2px;
  background: var(--line-2);
}

/* ---------- 4. mounts ---------- */
.bento-mounts-demo { container-type: inline-size; }
.bento-mounts { display: flex; align-items: center; justify-content: space-evenly; width: 100%; }
.bento-mount { position: relative; flex: none; width: 96px; height: 96px; }
.bento-mount > img {
  position: relative;
  width: 96px;
  height: 96px;
  animation: bento-bob 3.4s ease-in-out infinite;
  filter: drop-shadow(0 0 8px color-mix(in oklab, var(--glint) 45%, transparent));
}
.bento-mount:nth-child(2) > img { animation-delay: -1.1s; }
.bento-mount:nth-child(3) > img { animation-delay: -2.2s; }
/* The shadow stays on the ground and shrinks as its mount rises. */
.bento-shadow {
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: -12px;
  height: 9px;
  border-radius: 50%;
  background: var(--shade);
  filter: blur(3px);
  animation: bento-shadow 3.4s ease-in-out infinite;
}
.bento-mount:nth-child(2) .bento-shadow { animation-delay: -1.1s; }
.bento-mount:nth-child(3) .bento-shadow { animation-delay: -2.2s; }
.bento-streak {
  position: absolute;
  left: -34px;
  top: 40px;
  width: 40px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--glint));
  opacity: 0;
  animation: bento-streak 1.7s linear infinite;
}
.bento-mount:nth-child(2) .bento-streak { top: 30px; animation-delay: -.6s; }
.bento-mount:nth-child(3) .bento-streak { top: 50px; animation-delay: -1.1s; }
/* Narrow demos: 2x the art, so the three mounts still fit. */
@container (max-width: 319px) {
  .bento-mount, .bento-mount > img { width: 64px; height: 64px; }
  .bento-streak { top: 26px; }
  .bento-mount:nth-child(2) .bento-streak { top: 20px; }
  .bento-mount:nth-child(3) .bento-streak { top: 32px; }
}

/* ---------- 5. your own island ---------- */
.bento-plot-demo { perspective: 700px; }
/* 220 px wide. The water and ground are laid flat and tipped back, so they read as an isometric plot. */
.bento-plot { position: relative; width: 220px; height: 146px; }
.bento-water {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 150px;
  translate: -50% -50%;
  transform: rotateX(50deg) rotateZ(45deg);
  border-radius: 40px;
  background: #5fb8d8;
  box-shadow: 0 0 0 8px rgba(127, 212, 255, .28), 0 0 0 14px rgba(127, 212, 255, .12);
}
.bento-ground {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 136px;
  height: 136px;
  translate: -50% -50%;
  transform: rotateX(50deg) rotateZ(45deg);
  border-radius: 30px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .14), transparent 45%),
    linear-gradient(160deg, #7cc46a 0%, #4f9a4a 60%, #3d7d3c 100%);
  border: 8px solid #e6c98a;
  box-shadow: inset 0 0 0 3px #c9a464, 0 8px 0 #b38a4c;
}
/* Furniture at 2x its native size, standing on the plot. Left and top are its base point on the ground. */
.bento-furn {
  position: absolute;
  translate: -50% -100%;
  transform-origin: 50% 100%;
  animation: bento-furn 6s both infinite;
}
.bento-furn--chair { left: 42%; top: 72%; width: 32px; height: 48px; animation-delay: .6s; }
.bento-furn--table { left: 52%; top: 80%; width: 64px; height: 48px; animation-delay: 1.2s; }
.bento-furn--shelf { left: 74%; top: 52%; width: 64px; height: 76px; animation-delay: 1.8s; }
.bento-furn--planter { left: 33%; top: 82%; width: 60px; height: 52px; animation-delay: 2.4s; }
.bento-furn--topiary { left: 22%; top: 60%; width: 48px; height: 64px; animation-delay: 3s; }
.bento-furn--lantern { left: 46%; top: 50%; width: 32px; height: 64px; animation-delay: 3.6s; }

/* ---------- 6. no sign-up ---------- */
.bento-start-demo { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.bento-play {
  position: relative;
  width: 180px;
  min-height: 58px;
  justify-content: center;
  animation: bento-press 3.2s var(--ease-out) infinite;
}
.bento-play::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 6px;
  border: 2px solid color-mix(in oklab, var(--btn-ink) 55%, transparent);
  opacity: 0;
  animation: bento-ripple 3.2s ease-out infinite;
  pointer-events: none;
}
.bento-field {
  display: flex;
  align-items: center;
  width: 180px;
  height: 52px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--glass-2);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-1);
  font-family: var(--f-display);
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
}
.bento-caret {
  width: 2px;
  height: 1.1em;
  margin-left: 3px;
  background: var(--glint);
  animation: bento-blink 1s steps(1) infinite;
}

/* ---------- 7. day, night and weather: the sky is the whole tile ---------- */
.bento-t7 { display: flex; flex-direction: column; justify-content: flex-end; padding: 0; }
.bento-sky {
  --tint: var(--glint);
  position: absolute;
  inset: 0;
  z-index: 0;
  container-type: size;
  overflow: hidden;
  isolation: isolate;
}
.bento-layer { position: absolute; inset: 0; }
/* Sky colours are artwork: fixed in both themes. */
.bento-layer--day {
  background: linear-gradient(180deg, #4a9fe6 0%, #8ccbf2 50%, #d6eeff 84%, #eef6e6 100%);
  animation: bento-day 16s ease-in-out infinite;
}
.bento-layer--night {
  background: linear-gradient(180deg, #05060f 0%, #101634 55%, #26305a 100%);
  animation: bento-night 16s ease-in-out infinite;
}
.bento-star { position: absolute; width: 1.1cqw; height: 1.1cqw; border-radius: 50%; background: #fff; animation: bento-twinkle 3.2s ease-in-out infinite; }
.bento-star--1 { left: 12%; top: 14%; }
.bento-star--2 { left: 26%; top: 6%; animation-delay: -1s; }
.bento-star--3 { left: 40%; top: 20%; animation-delay: -2s; }
.bento-star--4 { left: 68%; top: 9%; animation-delay: -.5s; }
.bento-star--5 { left: 82%; top: 22%; animation-delay: -1.6s; }
.bento-star--6 { left: 92%; top: 5%; animation-delay: -2.4s; }

.bento-sun, .bento-moon {
  position: absolute;
  left: 0;
  top: 0;
  width: 10cqw;
  height: 10cqw;
  border-radius: 50%;
  animation: bento-arc 16s linear infinite;
}
.bento-sun {
  background: radial-gradient(circle at 38% 36%, #fff9d6, #ffd25c 58%, #f0a030 100%);
  box-shadow: 0 0 5cqw rgba(255, 210, 92, .55);
}
.bento-moon {
  background: radial-gradient(circle at 36% 34%, #ffffff, #dfe4f6 58%, #a9b3d6 100%);
  box-shadow: 0 0 4cqw rgba(200, 212, 255, .4);
  animation-delay: -8s;
}
.bento-hill {
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -40cqw;
  height: 60cqw;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(20, 44, 36, .85), rgba(10, 24, 22, .95));
}
.bento-tint { position: absolute; inset: 0; opacity: 0; transition: opacity .8s var(--ease-out); pointer-events: none; }
.bento-tint--dark { background: rgba(18, 26, 42, .6); }
.bento-tint--fog { background: rgba(214, 220, 230, .62); }
.bento-tint--warm { background: rgba(196, 124, 52, .46); }
.bento-tint--ash { background: rgba(58, 46, 44, .55); }
.bento-sky[data-wx="cloudy"] .bento-tint--dark { opacity: .25; }
.bento-sky[data-wx="rain"] .bento-tint--dark,
.bento-sky[data-wx="storm"] .bento-tint--dark { opacity: 1; }
.bento-sky[data-wx="fog"] .bento-tint--fog { opacity: 1; }
.bento-sky[data-wx="sandstorm"] .bento-tint--warm { opacity: 1; }
.bento-sky[data-wx="ashfall"] .bento-tint--ash { opacity: 1; }

.bento-particles { position: absolute; inset: 0; pointer-events: none; }
.bento-p { position: absolute; left: var(--x); top: var(--y); opacity: 0; transition: opacity .8s var(--ease-out); }
.bento-p--rain {
  width: .3cqw;
  height: 4.2cqw;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(220, 236, 255, 0), rgba(220, 236, 255, .9));
  animation: bento-rain var(--dur, 1.2s) linear var(--d, 0s) infinite;
}
.bento-p--snow {
  width: 1.2cqw;
  height: 1.2cqw;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 2px rgba(255, 255, 255, .8);
  animation: bento-fall var(--dur, 6s) linear var(--d, 0s) infinite;
}
.bento-p--ash {
  width: .9cqw;
  height: .9cqw;
  background: #ffb074;
  box-shadow: 0 0 4px rgba(255, 120, 60, .6);
  animation: bento-fall var(--dur, 8s) linear var(--d, 0s) infinite;
}
.bento-p--sand {
  width: 7cqw;
  height: .35cqw;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 226, 170, .95));
  animation: bento-sand var(--dur, 1.2s) linear var(--d, 0s) infinite;
}
.bento-p--fog {
  width: 84cqw;
  height: 12cqw;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .6), transparent);
  animation: bento-drift 14s ease-in-out var(--d, 0s) infinite alternate;
}
.bento-p--cloud {
  width: 26cqw;
  height: 8cqw;
  border-radius: 99px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 4cqw -3cqw 0 -1cqw rgba(255, 255, 255, .8);
  animation: bento-drift 20s ease-in-out var(--d, 0s) infinite alternate;
}
.bento-sky[data-wx="cloudy"] .bento-p--cloud,
.bento-sky[data-wx="rain"] .bento-p--cloud,
.bento-sky[data-wx="storm"] .bento-p--cloud,
.bento-sky[data-wx="fog"] .bento-p--fog,
.bento-sky[data-wx="rain"] .bento-p--rain,
.bento-sky[data-wx="storm"] .bento-p--rain,
.bento-sky[data-wx="snow"] .bento-p--snow,
.bento-sky[data-wx="sandstorm"] .bento-p--sand,
.bento-sky[data-wx="ashfall"] .bento-p--ash { opacity: 1; }
.bento-sky[data-wx="cloudy"] .bento-p--cloud { opacity: .9; }
.bento-sky[data-wx="rain"] .bento-p--cloud,
.bento-sky[data-wx="storm"] .bento-p--cloud { opacity: .45; }

.bento-flash { position: absolute; inset: 0; background: rgba(255, 255, 255, .92); opacity: 0; pointer-events: none; }
.bento-sky[data-wx="storm"] .bento-flash { animation: bento-flash 3.6s linear infinite; }

/* The text and the chips sit on a veil that fades up into the sky. */
.bento-wx-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 72px clamp(20px, 2vw, 24px) clamp(20px, 2vw, 24px);
  background: linear-gradient(180deg, transparent 0%, var(--veil) 40%, var(--veil) 100%);
}
.bento-wx {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bento-wx-chip {
  position: relative;
  isolation: isolate;
  padding: 6px 11px;
  border-radius: 999px;
  font-family: var(--f-display);
  font-size: .9rem;
  line-height: 1.4;
  color: var(--ink-2);
  background: var(--glass-2);
  border: 1px solid var(--glass-line);
}
.bento-wx-chip::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: color-mix(in oklab, var(--gold) 26%, transparent);
  border: 1px solid color-mix(in oklab, var(--gold) 70%, transparent);
  opacity: 0;
  transition: opacity .45s var(--ease-out);
}
.bento-wx-chip.is-on { color: var(--ink); }
.bento-wx-chip.is-on::before { opacity: 1; }
.bento-wx-panel .bento-text { padding-top: 0; }

/* ---------- 8. chat ---------- */
.bento-chat-demo { padding-inline: 2px; }
.bento-chat { display: flex; flex-direction: column; justify-content: center; gap: 10px; width: 100%; }
.bento-bubble {
  position: relative;
  max-width: 88%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--glass-2);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-1);
  font-family: var(--f-display);
  font-size: .95rem;
  line-height: 1.4;
  color: var(--ink);
  animation: bento-rise 9s var(--ease-out) infinite both;
}
.bento-bubble--l { align-self: flex-start; border-bottom-left-radius: 4px; }
.bento-bubble--r {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  background: color-mix(in oklab, var(--gold) 16%, var(--glass-2));
}
.bento-bubble:nth-child(2) { animation-delay: 1s; }
.bento-bubble:nth-child(3) { animation-delay: 2s; }
.bento-who {
  margin-right: 8px;
  font-family: var(--f-display);
  font-size: .85rem;
  line-height: 1.4;
  color: var(--ember);
}
.bento-say { display: inline-flex; align-items: center; gap: 6px; letter-spacing: .02em; }
.bento-say img { width: 24px; height: 24px; }

/* ---------- keyframes ---------- */
@keyframes bento-breathe { 0%, 100% { transform: scale(.92); opacity: .42; } 50% { transform: scale(1.06); opacity: .6; } }
@keyframes bento-bob { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -8px, 0); } }
@keyframes bento-float {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-4deg); }
  50% { transform: translate3d(0, -10px, 0) rotate(4deg); }
}
@keyframes bento-shadow { 0%, 100% { transform: scale(1); opacity: .5; } 50% { transform: scale(.6); opacity: .25; } }
@keyframes bento-streak {
  0% { opacity: 0; transform: translate3d(12px, 0, 0); }
  25% { opacity: .9; }
  100% { opacity: 0; transform: translate3d(-14px, 0, 0); }
}
@keyframes bento-spark {
  0% { opacity: 0; transform: translate3d(0, 10px, 0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--dx, 0px), -84px, 0); }
}
@keyframes bento-idle { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -3px, 0); } }
@keyframes bento-chop {
  0%, 100% { transform: translate3d(0, 0, 0); }
  30% { transform: translate3d(10px, 0, 0); }
  45% { transform: translate3d(10px, -3px, 0); }
  60% { transform: translate3d(0, 0, 0); }
}
@keyframes bento-pop {
  0% { opacity: 0; transform: translate3d(0, 8px, 0); }
  8% { opacity: 1; transform: translate3d(0, 0, 0); }
  36% { opacity: 1; transform: translate3d(0, -14px, 0); }
  44%, 100% { opacity: 0; transform: translate3d(0, -20px, 0); }
}
@keyframes bento-up { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, -50%, 0); } }
@keyframes bento-down { from { transform: translate3d(0, -50%, 0); } to { transform: translate3d(0, 0, 0); } }
@keyframes bento-furn {
  0% { transform: scale(0); animation-timing-function: var(--ease-spring); }
  10% { transform: scale(1); animation-timing-function: linear; }
  86% { transform: scale(1); animation-timing-function: ease-in; }
  92%, 100% { transform: scale(0); }
}
@keyframes bento-press {
  0%, 30%, 100% { transform: translate3d(0, 0, 0); }
  36% { transform: translate3d(0, 3px, 0); }
  46% { transform: translate3d(0, 0, 0); }
}
@keyframes bento-ripple {
  0%, 34% { opacity: 0; transform: scale(1); }
  36% { opacity: 1; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(1.12); }
}
@keyframes bento-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
/* One 16 s day. Sun and moon share a path on the arc, half a cycle apart. */
@keyframes bento-arc {
  0% { transform: translate3d(-12cqw, 42cqw, 0); opacity: 0; }
  12% { transform: translate3d(4cqw, 33cqw, 0); opacity: 1; }
  25% { transform: translate3d(16cqw, 16cqw, 0); opacity: 1; }
  50% { transform: translate3d(44cqw, 4cqw, 0); opacity: 1; }
  75% { transform: translate3d(72cqw, 16cqw, 0); opacity: 1; }
  88% { transform: translate3d(84cqw, 33cqw, 0); opacity: 1; }
  100% { transform: translate3d(100cqw, 42cqw, 0); opacity: 0; }
}
@keyframes bento-day { 0%, 16% { opacity: 0; } 24%, 76% { opacity: 1; } 84%, 100% { opacity: 0; } }
@keyframes bento-night { 0%, 16% { opacity: 1; } 24%, 76% { opacity: 0; } 84%, 100% { opacity: 1; } }
@keyframes bento-twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes bento-flash {
  0%, 52% { opacity: 0; }
  53% { opacity: .85; }
  55% { opacity: .15; }
  57% { opacity: .7; }
  60%, 100% { opacity: 0; }
}
@keyframes bento-rain {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-3cqw, 130cqh, 0); }
}
@keyframes bento-fall {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(1.6cqw, 55cqh, 0); }
  100% { transform: translate3d(-.8cqw, 115cqh, 0); }
}
@keyframes bento-sand {
  from { transform: translate3d(-12cqw, 0, 0); }
  to { transform: translate3d(112cqw, 0, 0); }
}
@keyframes bento-drift {
  from { transform: translate3d(-14cqw, 0, 0); }
  to { transform: translate3d(14cqw, 0, 0); }
}
@keyframes bento-rise {
  0% { opacity: 0; transform: translate3d(0, 14px, 0); }
  8% { opacity: 1; transform: translate3d(0, 0, 0); }
  84% { opacity: 1; transform: translate3d(0, 0, 0); }
  94%, 100% { opacity: 0; transform: translate3d(0, -4px, 0); }
}

/* ---------- tablet (640 to 1023 px): 6 columns, 280 px rows ---------- */
@media (max-width: 1023px) and (min-width: 640px) {
  .bento-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: 280px; }
  .bento-t1 { grid-column: 1 / -1; grid-row: 1 / span 2; }
  .bento-t2 { grid-column: 1 / span 3; grid-row: 3; }
  .bento-t3 { grid-column: 4 / span 3; grid-row: 3; }
  .bento-t4 { grid-column: 1 / span 3; grid-row: 4; }
  .bento-t5 { grid-column: 4 / span 3; grid-row: 4; }
  .bento-t6 { grid-column: 1 / span 3; grid-row: 5; }
  .bento-t8 { grid-column: 4 / span 3; grid-row: 5; }
  .bento-t7 { grid-column: 1 / -1; grid-row: 6; }
  /* 3-col demos are shorter: the island plot is scaled to fit, the characters drop to 2x. */
  .bento-plot { transform: scale(.86); }
  .bento-pair { bottom: 14px; }
  /* Short chat tile: bubbles take the full width and tighten, so all three fit. */
  /* Short chat tile: two bubbles, so nothing is cut off at the bottom. */
  .bento-chat { gap: 8px; }
  .bento-bubble:nth-child(3) { display: none; }
  .bento-bubble { max-width: 100%; padding: 8px 12px; line-height: 1.3; }
}

/* ---------- phone (< 640 px): one column ---------- */
@media (max-width: 639px) {
  .bento-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; gap: 16px; }
  .bento-t1, .bento-t2, .bento-t3, .bento-t4, .bento-t5, .bento-t6, .bento-t7, .bento-t8 {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 260px;
  }
  .bento-t1 { min-height: 420px; }
  .bento-t7 { min-height: 300px; }
  .bento-demo { min-height: 180px; }
  .bento-gear-demo { min-height: 300px; }
  .bento-pair { bottom: 14px; }
  .bento-pair .bento-char { width: 80px; height: 80px; background-size: 320px 80px; }
  .bento-pop { font-size: 1rem; }
  .bento-plot { transform: scale(.9); }
  .bento-market { min-height: 200px; }
  .bento-offer { height: 44px; padding: 0 8px 0 6px; gap: 6px; }
  .bento-amt { font-size: .85rem; }
  .bento-text .h3 { font-size: clamp(1.25rem, 1.1rem + 1vw, 1.5rem); }
}

/* ---------- reduced motion: still frames, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
  .bento *, .bento *::before, .bento *::after { animation: none !important; transition: none !important; }
  .bento-layer--day { opacity: 1; }
  .bento-layer--night { opacity: 0; }
  .bento-sun { transform: translate3d(44cqw, 4cqw, 0); opacity: 1; }
  .bento-moon { opacity: 0; }
  .bento-pop { opacity: 1; transform: translate3d(0, -14px, 0); }
  .bento-pop--2 { display: none; }
  .bento-furn { transform: none; }
  .bento-streak, .bento-sparks i { display: none; }
  .bento-play::before { display: none; }
  .bento-tint { transition: none; }
  .bento-sw { transition: none; }
}

/* a 40px hit area round each small swatch */
.bento-sw { position: relative; }
.bento-sw::after { content: ""; position: absolute; inset: -9px; }

/* on the light theme the pale powers are mixed toward ink so their names still read */
:root[data-theme="light"] .bento-power-name { color: color-mix(in oklab, var(--glow, var(--gold)) 52%, var(--ink)); text-shadow: none; }

/* ===== landing/sections/finale.css ===== */
/* Finale: last call to action, the walking road, and the footer. Stage section: the 3D Vale shows through.
   Every colour is a token from base.css. Prefixed .finale-* (docs/LANDING.md §4). */

.finale { padding-block: 0 max(20px, env(safe-area-inset-bottom)); overflow-x: clip; }

/* ---------- call to action ---------- */
.finale-cta {
  position: relative; min-height: 86vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(72px, 10vh, 120px) 0 clamp(190px, 24vh, 232px);
}
.finale-copy {
  position: relative; isolation: isolate;
  display: grid; justify-items: center; text-align: center; gap: var(--s-4);
}
/* Soft scrim behind the text block, so the copy reads over a busy 3D picture in both themes.
   Kept inside the wrap's sides (a wider box would push the page sideways). */
.finale-copy::before {
  content: ""; position: absolute; inset: -18% -5% -14%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, var(--veil) 0%, var(--veil) 45%, color-mix(in oklab, var(--veil) 72%, transparent) 70%, transparent 100%);
}
/* The logo art is 256 by 80: shown at 2x on desktop, 1x on phones (whole multiples only). */
.finale-logo {
  width: 512px; height: 160px; margin-bottom: var(--s-3);
  filter: drop-shadow(0 14px 22px var(--shade));
  animation: finale-float 6s ease-in-out infinite;
}
@keyframes finale-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.finale-title { text-wrap: balance; }
.finale-lede { color: var(--ink); text-shadow: 0 1px 18px var(--bg); max-width: 26ch; margin-inline: auto; text-wrap: balance; }

.finale-actions {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: var(--s-4); margin-top: var(--s-5);
}
.finale-item { display: flex; }
/* Magnetic buttons: core.js sets --mx / --my (0..1) and --hover while the pointer is over the button.
   Each drifts at most 6px toward the pointer. */
.finale-btn {
  translate: calc((var(--mx, .5) - .5) * 12px * var(--hover, 0)) calc((var(--my, .5) - .5) * 12px * var(--hover, 0));
  transition: translate .45s var(--ease-out), transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), filter var(--dur-1);
}
.finale-play img { width: 32px; height: 32px; }
.finale-discord img { width: 33px; height: 24px; }
.finale-store { padding-inline: 22px 26px; }
.finale-store svg { width: 30px; height: 30px; flex: none; }
.finale-store-text { display: grid; gap: 3px; text-align: left; line-height: 1.1; }
.finale-store small {
  font-family: var(--f-body); font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-2);
}
.finale-store strong { font-family: var(--f-display); font-size: 1.1rem; font-weight: 700; }

/* ---------- the road ---------- */
.finale-road {
  position: absolute; left: 0; right: 0; bottom: 0; height: 176px;
  overflow: hidden; pointer-events: none;
}
/* A faint hairline ground; walkers stand on it. */
.finale-road::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 26px; height: 1px;
  background: var(--line-2);
}
.finale-walk {
  position: absolute; left: 0; bottom: 26px; display: block; will-change: transform;
  animation: finale-travel var(--dur) linear var(--delay) infinite;
}
.finale-sprite {
  display: block; position: relative;
  image-rendering: pixelated; background-repeat: no-repeat;
  animation: finale-step4 .6s steps(4) infinite;
}
.finale-shadow {
  position: absolute; left: 14%; right: 14%; bottom: -6px; height: 12px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--shade), transparent 100%);
  opacity: .9;
}
@keyframes finale-travel { from { transform: translateX(-100%); } to { transform: translateX(100vw); } }
@keyframes finale-step4 { to { background-position: -384px 0; } }
@keyframes finale-step-chicken { to { background-position: -256px 0; } }
@keyframes finale-step-cow { to { background-position: -512px 0; } }
@keyframes finale-step-tiger { to { background-position: -640px 0; } }

/* Sprite sheets are 4 frames at 2x: a 48 px native frame is shown at 96 px. */
.finale-s-knight, .finale-s-monk, .finale-s-chef, .finale-s-goblin { width: 96px; height: 96px; background-size: 384px 96px; }
.finale-s-knight { background-image: url("/assets/sprites/knight-walk.png"); }
.finale-s-monk { background-image: url("/assets/sprites/monk-walk.png"); }
.finale-s-chef { background-image: url("/assets/sprites/chef-walk.png"); }
.finale-s-goblin { background-image: url("/assets/sprites/goblin-walk.png"); }
.finale-s-chicken { width: 64px; height: 64px; background-image: url("/assets/sprites/chicken-walk.png"); background-size: 256px 64px; animation-name: finale-step-chicken; animation-duration: .45s; }
.finale-s-cow { width: 128px; height: 96px; background-image: url("/assets/sprites/cow-walk.png"); background-size: 512px 96px; animation-name: finale-step-cow; animation-duration: .8s; }
.finale-s-tiger { width: 160px; height: 112px; background-image: url("/assets/sprites/tiger-walk.png"); background-size: 640px 112px; animation-name: finale-step-tiger; animation-duration: .7s; }

/* Seven walkers: different speeds, sizes and start points (negative delays spread them out at load). */
.finale-w1 { --dur: 12s; --delay: -3s;  --rest: 6vw; }
.finale-w2 { --dur: 22s; --delay: -5s;  --rest: 18vw; }
.finale-w3 { --dur: 27s; --delay: -14s; --rest: 30vw; }
.finale-w4 { --dur: 18s; --delay: -9s;  --rest: 42vw; }
.finale-w5 { --dur: 34s; --delay: -21s; --rest: 56vw; }
.finale-w6 { --dur: 20s; --delay: -7s;  --rest: 70vw; }
.finale-w7 { --dur: 31s; --delay: -24s; --rest: 84vw; }

/* ---------- footer ---------- */
.finale-foot { position: relative; }
.finale-bar {
  border-radius: var(--r-4) var(--r-4) 0 0;
  border-bottom: 0;
  display: grid; gap: var(--s-5);
  padding: clamp(24px, 3.4vw, 40px) clamp(20px, 3.4vw, 44px) clamp(26px, 3.4vw, 36px);
}
.finale-bar-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s-4) var(--s-6);
}
.finale-brand { display: inline-flex; }
.finale-brand img { width: 256px; height: 80px; max-width: none; }
.finale-nav ul { display: flex; flex-wrap: wrap; gap: 6px 26px; }
.finale-nav a, .finale-legal a {
  position: relative; display: inline-block; padding-block: 4px;
  color: var(--ink); font-weight: 600;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .35s var(--ease-out);
}
.finale-nav a:hover, .finale-legal a:hover { background-size: 100% 1px; }
.finale-bar-small { gap: var(--s-2) var(--s-6); }
.finale-legal { font-size: var(--t-small); color: var(--ink-2); }
.finale-legal a { font-weight: 500; }

/* ---------- phones: buttons stack full width ---------- */
@media (max-width: 640px) {
  .finale-cta { min-height: 86vh; }
  .finale-logo { width: 256px; height: 80px; }
  .finale-actions { flex-direction: column; width: 100%; gap: var(--s-3); }
  .finale-item, .finale-btn { width: 100%; }
  .finale-btn { justify-content: center; }
  .finale-bar-row { justify-content: center; text-align: center; }
  .finale-nav ul { justify-content: center; }
  .finale-bar-small { flex-direction: column; }
}

/* ---------- reduced motion: nothing moves, walkers rest at fixed places ---------- */
@media (prefers-reduced-motion: reduce) {
  .finale-logo, .finale-walk, .finale-sprite { animation: none !important; }
  .finale-walk { transform: translateX(var(--rest)); }
  .finale-btn { translate: none; }
}

/* footer links get a finger-sized hit area */
.finale-nav a, .finale-legal a { display: inline-block; padding-block: 10px; background-position: 0 calc(100% - 7px); }
