/* Base: reset, typography, layout primitives and controls. Reads every value from tokens.css. */

/* Fonts: self-hosted, open licence (OFL), latin + latin-ext split so most pages load ~47 kB of type. Swap per project
   from ~/elite-web-kit/fonts (see its README for pairings). Avoid the AI defaults: Inter, Geist, Space Grotesk, DM Sans. */
@font-face {
  font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('../assets/fonts/schibsted-grotesk-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('../assets/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Newsreader'; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url('../assets/fonts/newsreader-latin-standard-italic.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  scrollbar-gutter: stable;
  hanging-punctuation: first last;          /* Safari: quotes hang outside the text edge */
}
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0; min-height: 100svh;
  background: var(--paper); color: var(--ink);
  font: 400 var(--fs-body)/var(--lh-body) var(--font-sans);
  letter-spacing: var(--tr-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--select); color: var(--paper); }

/* ---------- type ---------- */
.display {
  font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--tr-display);
  font-weight: 500; text-wrap: balance;
}
/* authored lines that must never wrap: --fit (set by fitLines) is the longest line in em; 16px allows for a scrollbar */
.display.fit { font-size: min(var(--fs-display), calc(100cqi / var(--fit))); }   /* cqi: the headline's own column */
.display.fit > .line > span { white-space: nowrap; }
.h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--tr-h2); font-weight: 500; text-wrap: balance; }
.h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: var(--tr-h3); font-weight: 500; text-wrap: balance; }
.lede { font-size: var(--fs-lede); line-height: 1.5; color: var(--ink-2); max-width: var(--measure-lede); text-wrap: pretty; }
p, .body { max-width: var(--measure); text-wrap: pretty; }
.fine { font-size: var(--fs-fine); line-height: 1.45; color: var(--ink-3); }
.label { font-size: var(--fs-small); font-weight: 500; color: var(--ink-2); }   /* sentence case, no tracking, no caps */
/* .num: tabular figures for tables, columns and counters that change. .fig: proportional lining figures for numbers
   in running or display text (tabular spacing turns "2.4" into "2 . 4" at display sizes). */
.num { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: 'tnum' 1, 'lnum' 1; }
.fig { font-variant-numeric: proportional-nums lining-nums; font-feature-settings: 'pnum' 1, 'lnum' 1; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: 0; }

/* links: a quiet underline that sits off the descenders */
.link, p a {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em;
  text-decoration-color: var(--rule-2);
  transition: text-decoration-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.link:hover, p a:hover { text-decoration-color: currentColor; }

/* ---------- layout ---------- */
.wrap { padding-inline: var(--g); }
/* a capped column keeps its side padding outside the cap: max-width alone collapses it on a 5120 px screen */
.wrap--cap { max-width: calc(var(--cap, 2400px) + 2 * var(--g)); margin-inline: auto; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(16px, 1.6vw, 40px); }
.sec { padding-block: var(--sec); }
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.full-bleed { width: 100%; }

/* ---------- controls ---------- */
.btn {
  --h: var(--btn-h);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 22px; border-radius: var(--r-2);
  font-weight: 500; font-size: var(--fs-btn); letter-spacing: -.01em; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out),
              border-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.btn:active { transform: scale(.98); transition-duration: 90ms; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--quiet { border: 1px solid var(--rule-2); }
/* hover only for a real mouse or trackpad: on touch a hover state sticks after the tap */
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: color-mix(in oklch, var(--ink) 86%, var(--paper)); }
  .btn--quiet:hover { border-color: var(--ink-3); }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-1); }
.skip { position: fixed; left: 16px; top: -64px; z-index: 100; padding: 10px 14px; border-radius: var(--r-1); background: var(--ink); color: var(--paper); }
.skip:focus { top: 16px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-inline: var(--g);
  transition: background-color var(--dur-ui) var(--ease-out), box-shadow var(--dur-ui) var(--ease-out);
}
/* once the page scrolls, text must never run through the nav: a solid paper bar and one hairline (no blur) */
.nav.is-scrolled { background: var(--paper); box-shadow: 0 1px 0 var(--rule); }
.nav-right { display: flex; align-items: center; gap: clamp(20px, 2.2vw, 44px); }   /* links sit by the CTA: on 5120 a centred nav floats 2,000 px from both ends */
.nav-links { display: flex; gap: clamp(20px, 2vw, 40px); font-size: var(--fs-nav); color: var(--ink-2); }
.nav-links a { text-decoration: none; transition: color var(--dur-micro) var(--ease-out); }
.nav-links a:hover { color: var(--ink); }
@media (max-width: 760px) { .nav-links { display: none; } }

/* ---------- canvas stages ---------- */
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* a fallback poster shows only when its own canvas failed (scoped, so one lost context never hides a healthy neighbour) */
.stage-poster { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; }
.no-gl > .stage-poster, .gl-lost > .stage-poster { opacity: 1; }
html:not(.js) .stage-poster, .no-script .stage-poster { opacity: 1; }

/* authored headline lines stay on their own lines even if scripts never run */
.display > .line { display: block; }

/* first draw: nothing fades in from the browser's default colours (the class leaves two frames after the page is parsed) */
.is-loading *, .is-loading *::before, .is-loading *::after { transition: none !important; }
