/* Zenithy landing - base.css
 * Reset, type roles, page furniture (top bar, chapter progress), buttons, film/static modes.
 * Colours only through the tokens (tokens.css): light, dark and the 8 seeds all just work. */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow-x: clip;
  scrollbar-width: thin;
  scrollbar-color: var(--ink4) transparent;
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-body-l);
  line-height: var(--lh-body-l);
  font-variation-settings: 'ROND' 30;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--bg);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--selection); }

:root {
  --topbar: 72px;
  --fa: 0.52;                    /* opacity of the ambient colour fields */
  --measure: 31rem;
}
[data-theme="dark"] { --fa: 0.34; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --fa: 0.34; } }
@media (max-width: 759px) { :root { --topbar: 60px; --measure: 100%; } }

/* very large screens: scale every rem-based size (type, measure) with the viewport */
@media (min-width: 2000px) { html { font-size: 118.75%; } }
@media (min-width: 2600px) { html { font-size: 150%; } }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: fixed; left: 12px; top: -80px; z-index: 1000; padding: 10px 18px; border-radius: var(--r-full);
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; transition: top var(--dur-effects) var(--ease-effects);
}
.skip:focus-visible { top: 12px; }

/* ---------- type roles (sizes from the tokens; ROND/weight per M3E role) ---------- */
.t-hero { font-size: var(--fs-hero); line-height: var(--lh-hero); letter-spacing: var(--ls-hero); font-weight: var(--fw-hero); font-variation-settings: 'ROND' var(--rond-hero); }
.t-d1 { font-size: var(--fs-display-l); line-height: var(--lh-display-l); letter-spacing: var(--ls-display-l); font-weight: 500; font-variation-settings: 'ROND' 100; }
.t-d2 { font-size: var(--fs-display-m); line-height: var(--lh-display-m); font-weight: 500; font-variation-settings: 'ROND' 100; }
.t-d3 { font-size: var(--fs-display-s); line-height: var(--lh-display-s); font-weight: 500; font-variation-settings: 'ROND' 100; }
.lead { font-size: var(--lead); line-height: 1.5; letter-spacing: 0.1px; color: var(--ink-muted); max-width: 34ch; font-variation-settings: 'ROND' 40; }
.lead em, .t-hero em, .t-d1 em, .t-d2 em { font-style: normal; }
.t-hero em, .t-d1 em, .t-d2 em { color: var(--accent-ink); }
.lead em { color: var(--accent-ink); font-weight: 700; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px;
  font-size: var(--fs-label-l); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-ink); font-variation-settings: 'ROND' 60;
}
.eyebrow::before {
  content: ''; width: 12px; height: 12px; background: var(--accent);
  clip-path: polygon(50% 0, 62% 24%, 88% 12%, 76% 38%, 100% 50%, 76% 62%, 88% 88%, 62% 76%, 50% 100%, 38% 76%, 12% 88%, 24% 62%, 0 50%, 24% 38%, 12% 12%, 38% 24%);
}

/* split-text words: a mask with room for descenders */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.06em 0.04em 0.16em; margin: -0.06em -0.04em -0.16em; }
.wi { display: inline-block; will-change: transform, opacity; }
.film [data-split] .wi { opacity: 0; }        /* the scene unveils them; static mode leaves them as text */

/* ---------- material symbols ---------- */
.ms {
  font-family: var(--font-icon); font-weight: 400; font-style: normal; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr; font-size: 24px; font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0; -webkit-font-smoothing: antialiased; user-select: none;
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 200; height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between; padding: 0 var(--gutter);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: block; height: 36px; border-radius: 10px; }
.brand img { height: 36px; width: auto; }
.brand .on-dark { display: none; }
[data-theme="dark"] .brand .on-light { display: none; }
[data-theme="dark"] .brand .on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .on-light { display: none; }
  :root:not([data-theme="light"]) .brand .on-dark { display: block; }
}
.topbar-end { display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px;
  border-radius: var(--r-full); font-weight: 700; font-size: var(--fs-label-l); letter-spacing: 0.1px; font-variation-settings: 'ROND' 60;
  border: 0; transition: border-radius var(--dur-spatial-fast) var(--ease-spatial-fast), background var(--dur-effects) var(--ease-effects), box-shadow var(--dur-effects) var(--ease-effects);
}
.pill:active { border-radius: var(--r-press); }
.pill-soft { background: var(--accent-soft); color: var(--accent-ink); }
.pill-soft:hover { box-shadow: var(--shadow-soft); }
.pill-fill { background: var(--accent); color: var(--on-accent); min-height: 56px; padding: 0 30px; font-size: var(--fs-title-m); }
.pill-fill:hover { box-shadow: var(--shadow-lift); }
.icon-btn {
  position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-full); border: 0;
  background: color-mix(in srgb, var(--surface) 72%, transparent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line2);
  transition: border-radius var(--dur-spatial-fast) var(--ease-spatial-fast), background var(--dur-effects) var(--ease-effects);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn:active { border-radius: var(--r-press); }
.theme-toggle .ms { position: absolute; transition: transform var(--dur-spatial) var(--ease-spatial), opacity var(--dur-effects) var(--ease-effects); }
.theme-toggle .ms-moon { transform: scale(0.4) rotate(-80deg); opacity: 0; }
[data-theme="dark"] .theme-toggle .ms-sun { transform: scale(0.4) rotate(80deg); opacity: 0; }
[data-theme="dark"] .theme-toggle .ms-moon { transform: none; opacity: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .ms-sun { transform: scale(0.4) rotate(80deg); opacity: 0; }
  :root:not([data-theme="light"]) .theme-toggle .ms-moon { transform: none; opacity: 1; }
}
@media (max-width: 759px) { .brand, .brand img { height: 30px; } .pill-soft { min-height: 40px; padding: 0 16px; } .icon-btn { width: 40px; height: 40px; } }

/* ---------- chapter progress ---------- */
.progress { position: fixed; z-index: 190; right: clamp(10px, 1.6vw, 26px); top: 50%; transform: translateY(-50%); }
.progress ol { display: flex; flex-direction: column; gap: 2px; }
.progress a { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 10px; height: 26px; padding-left: 14px; border-radius: 13px; }
.progress .pn { display: none; }
.progress .pt {
  font-size: var(--fs-label-m); font-weight: 700; letter-spacing: 0.4px; color: var(--ink-muted); white-space: nowrap;
  opacity: 0; transform: translateX(8px); pointer-events: none;
  transition: opacity var(--dur-effects) var(--ease-effects), transform var(--dur-spatial) var(--ease-spatial);
}
.progress a:hover .pt, .progress a:focus-visible .pt, .progress .is-cur .pt { opacity: 1; transform: none; }
.progress .pd { position: relative; width: 8px; height: 8px; border-radius: 4px; background: var(--ink4); overflow: hidden;
  transition: height var(--dur-spatial) var(--ease-spatial), background var(--dur-effects) var(--ease-effects); }
.progress .pd b { position: absolute; inset: 0; background: var(--accent); transform: scaleY(0); transform-origin: top; }
.progress a:hover .pd { background: var(--ink3); }
.progress .is-cur .pd { height: 26px; background: var(--accent-soft); }
.progress .is-cur .pt { color: var(--accent-ink); }
.progress-m { display: none; }
@media (max-width: 759px) {
  .progress { display: none; }
  .progress-m {
    position: fixed; z-index: 190; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px; border-radius: var(--r-full); overflow: hidden;
    background: color-mix(in srgb, var(--surface) 78%, transparent); box-shadow: inset 0 0 0 1px var(--line2), var(--shadow-soft);
    font-size: var(--fs-label-m); font-weight: 700; letter-spacing: 0.4px; white-space: nowrap;
  }
  .pm-n { color: var(--accent-ink); }
  .pm-t { color: var(--ink-muted); }
  .pm-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
  .pm-bar b { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0); }
}

/* ---------- film mode (default): fixed stages, tall empty runways ---------- */
.scene { position: relative; }
.film .stage { position: fixed; inset: 0; z-index: 10; overflow: hidden; visibility: hidden; background: var(--bg); contain: layout paint; }
.film .stage.is-on { visibility: visible; }
.film .stage:not(.is-live) *, .film .stage:not(.is-live) *::before, .film .stage:not(.is-live) *::after { animation-play-state: paused !important; }
.film .scene { pointer-events: none; }
.film .stage.is-on { pointer-events: auto; }
.veil { position: fixed; inset: 0; z-index: 300; background: var(--bg); opacity: 0; pointer-events: none; }
.veil.run { animation: veil 0.42s ease both; }
@keyframes veil { 0% { opacity: 0; } 38% { opacity: 1; } 100% { opacity: 0; } }
.wipe-ring { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 150; pointer-events: none; opacity: 0; }
.wipe-ring path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }

/* ---------- static mode (reduced motion): scenes stack as ordinary sections ---------- */
.static .stage { position: relative; overflow: hidden; min-height: max(100svh, 680px); background: var(--bg); }
.static .stage + .stage { border-top: 1px solid var(--line); }
.static .scene + .scene { border-top: 1px solid var(--line); }
.static .progress, .static .progress-m, .static .scroll-cue { display: none; }
.static .only-film { display: none !important; }
.film .only-static { display: none !important; }
html:not(.js) .vis, html:not(.js) .progress, html:not(.js) .progress-m { display: none; }
html:not(.js) .stage { position: relative; min-height: 0; padding: 120px var(--gutter) 64px; }
html:not(.js) .copy { position: static; width: auto; }
html:not(.js) .chaos-b, html:not(.js) .hero-beat2 { display: block; }
html:not(.js) .chaos-copy .heads > * { grid-area: auto; }
html:not(.js) .hero-beat2 { align-items: flex-start; text-align: left; padding: 0; margin-top: 2.5rem; }
html:not(.js) .hero-beat2 .lead { margin-inline: 0; }
html:not(.js) .scroll-cue { display: none; }
