/* ==========================================================================
   Base: reset, document canvas, type classes, layout primitives, surfaces,
   utilities, focus and selection, reduced motion. Tokens come from tokens.css.
   ========================================================================== */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-synthesis-weight: none;        /* never fake a bold the font does not have */
  scroll-behavior: smooth;            /* no-JS fallback; motion.js does offset-aware smooth scrolling */
  background: var(--canvas);
}
/* with JS, motion.js eases every in-page jump itself; script scrolls (scrollTo) land at once, so the header state
   is never caught half-way through a long programmatic scroll */
html.js { scroll-behavior: auto; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;                   /* full-bleed bands and marquees can never widen the page */
}
main { flex: 1 0 auto; }
img, picture, video, canvas { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; cursor: pointer; }
strong, b { font-weight: var(--fw-ui); }
:where(ul, ol)[role="list"] { list-style: none; }

/* ---- Selection & focus ---- */
::selection { background: var(--teal-200); color: var(--ink); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ring-color);
  outline-offset: 3px;
}
/* a text link's ring gets soft corners. Zero specificity, so any component radius (a card's 24px, a pill) wins */
:where(a:focus-visible) { border-radius: var(--r-xs); }

/* skip link: hidden until it receives keyboard focus */
.skip {
  position: absolute; left: var(--space-4); top: -64px; z-index: var(--z-skip);
  background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: var(--r-sm); font-weight: var(--fw-ui);
  transition: top var(--dur-2) var(--ease-out);
}
.skip:focus { top: var(--space-3); }

/* anchored targets land below the sticky header */
[id] { scroll-margin-top: calc(var(--nav-h) + var(--space-6)); }

/* ---- Headings (element defaults: the display serif. h1/h2 use the fine 300 cut, h3 the 400 title cut) ---- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-title);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
  font-optical-sizing: auto;
}
h1, h2 { font-weight: var(--fw-display); }
/* a heading inside a panel or card (28-44px) uses the sturdier 400 cut: 300 reads faint at panel sizes */
:where(.panel, .split-copy, .card) h2 { font-weight: var(--fw-title); }
h4, h5, h6 { font-family: var(--font-sans); font-weight: var(--fw-ui); line-height: var(--lh-snug); }
p { text-wrap: pretty; }

/* ---- Type classes (use these; see DESIGN.md "Type scale") ----
   display-1  home hero h1 only            display-page  inner-page hero h1 (automatic on .page-hero h1)
   display-2  the heading of a section     h2  a heading inside a panel (400)
   h3 / card-title  card titles            row titles use --fs-row          quote  a statement */
.display-1 {
  font-family: var(--font-display); font-weight: var(--fw-display);
  font-size: var(--fs-display-1);
  line-height: 0.96;
  letter-spacing: var(--tracking-display);
}
/* a section may firm its heading with --fw-display-2 (e.g. 400 beside white cards); unset, it is the display cut */
.display-2 {
  font-family: var(--font-display); font-weight: var(--fw-display-2, var(--fw-display));
  font-size: var(--fs-display-2);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display-2);
}
.display-page {
  font-family: var(--font-display); font-weight: var(--fw-display);
  font-size: var(--fs-display-page);
  line-height: 1;
  letter-spacing: var(--tracking-display);
}
.h2 {
  font-family: var(--font-display); font-weight: var(--fw-title);
  font-size: var(--fs-h2);
  line-height: 1.06;
  letter-spacing: -0.02em;
}
.h3 {
  font-family: var(--font-display); font-weight: var(--fw-title);
  font-size: var(--fs-h3);
  line-height: 1.15;
  letter-spacing: -0.012em;
}
.quote {
  font-family: var(--font-display); font-weight: var(--fw-display);
  font-size: var(--fs-quote);
  line-height: 1.12;
  letter-spacing: var(--tracking-display-2);
  text-wrap: balance;
}
.h4 {
  font-family: var(--font-sans); font-weight: var(--fw-ui);
  font-size: var(--fs-h4);
  line-height: var(--lh-snug);
  letter-spacing: -0.01em;
}
/* the expressive move: one italic phrase in a bright mid teal inside a big serif headline. --accent-em is for display
   type (>= 24px: 3.3:1 or more on every paper field, large text needs 3:1); smaller titles use --accent-em-sm */
:is(h1, h2, h3, .display-1, .display-page, .display-2, .h2, .h3, .quote) em { font-style: italic; color: var(--fg-em); }
:is(h3, h4, .h3, .card-title) em { color: var(--fg-em-sm); }

.lede {
  font-size: var(--fs-lede);
  line-height: 1.5;
  letter-spacing: -0.006em;
  color: var(--fg-2);
  max-width: 52ch;
}
/* eyebrow: the ONE small uppercase label tier, with the lens marker (a ring round a dot: the MDC "scan target").
   Optional: use it where a section needs a locator (at most ~3 per page), never above every heading. */
.eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-sans);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-ui);
  line-height: 1.3;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--fg-link);
  margin-bottom: var(--space-4);
}
.eyebrow::before {
  content: "";
  width: 13px; height: 13px; flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: radial-gradient(circle, currentColor 0 2px, transparent 2.6px);
}
.eyebrow-plain::before { content: none; }
/* Neko-style section marker: eyebrow then a hairline to the end of the row */
.eyebrow-line::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--rule-2); margin-left: var(--space-3); }
.body { font-size: var(--fs-body); max-width: var(--measure); }
.small { font-size: var(--fs-small); line-height: 1.5; }
.caption { font-size: var(--fs-small); line-height: 1.5; color: var(--fg-3); }
.muted { color: var(--fg-3); }
.prose > * + * { margin-top: 1em; }
.prose { max-width: var(--measure); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---- Layout primitives: one container edge for the header, every hero and every section ---- */
.wrap, .wrap-wide { width: min(var(--max), 100%); margin-inline: auto; }
.wrap-narrow { width: min(var(--max-narrow), 100%); margin-inline: auto; }
.section { position: relative; padding: var(--section-y) var(--gutter); }
.section.flush { padding-top: 0; }                         /* chains onto the section above: one gap, not two */
.section-tight { padding-block: var(--section-y-sm); }
.section-head { margin-bottom: var(--stack); }
.section-head > .lede { margin-top: var(--space-5); }
.center { text-align: center; }
.center .eyebrow { justify-content: center; }
.center :is(.lede, .body, .display-1, .display-page, .display-2, .h2) { margin-inline: auto; }
.center .lede { text-wrap: balance; }

/* ---- Surfaces: three tiers ----
   paper:     (default crisp canvas) · .section-butter · .section-mist · .section-tint
              fields with a short fade in or out: .section-field (canvas > butter > canvas) · .section-wash-sand (canvas > butter)
              · .section-wash-sand-end (butter > canvas) · .section-mist-in (canvas > mist) · .section-wash-mist (mist > canvas).
              Fades are --fade px (160-320), then the field is solid. Butter never fades straight into mist (that blend
              goes olive): go through the canvas. ONE butter field per page; most of a page sits on the canvas.
   immersive: .hero-bleed, .bleed photo bands, .photo-card (components.css)
   night:     .section-dark (text, ledes, eyebrows, links and <em> recolour automatically)
   Cards are tinted on the canvas and white on a coloured field: the field sets --card-bg for everything inside it.
   Every surface also sets the SURFACE tokens (tokens.css: --fg*, --rule*, --face, --state-*, --viz-*), so every
   component inside it reads correctly with no per-component override. */
.section-tint { background: var(--canvas-2); }
.section-butter { background: var(--butter); }
.section-mist { background: var(--mist); }
.section-mist-in { background: var(--wash-mist-in), var(--mist); }
.section-wash-sand { background: var(--wash-sand), var(--butter); }
.section-wash-mist { background: var(--wash-mist), var(--mist); }
.section-wash-sand-end { background: var(--wash-sand-end), var(--butter); }
.section-field { background: var(--wash-field), var(--butter); }
:is(.section-tint, .section-butter, .section-mist, .section-wash-sand, .section-wash-mist, .section-mist-in, .section-wash-sand-end, .section-field) { --card-bg: var(--surface); --badge-bg: var(--tint); --card-badge: var(--tint); --face: var(--tint); --face-hover: var(--canvas-2); }
.section-dark { background: var(--wash-night); color: var(--on-night); --card-bg: var(--night-2); --card-fg: var(--on-night); }

/* night scope: a dark band, a dark card, or any element marked .surface-dark */
:is(.section-dark, .card-dark, .surface-dark) {
  --fg: var(--on-night); --fg-2: var(--on-night-2); --fg-3: var(--on-night-3);
  --fg-link: var(--teal-300); --fg-mark: var(--teal-300); --fg-em: var(--teal-300); --fg-em-sm: var(--teal-300); --fg-inverse: var(--ink);
  --rule: var(--line-night); --rule-2: var(--line-night-2);
  --face: rgba(255, 255, 255, 0.08); --face-hover: rgba(255, 255, 255, 0.16); --hover-fill: rgba(255, 255, 255, 0.1);
  --state-in: var(--teal-300); --state-watch: var(--watch-300); --state-out: var(--flag-300);
  --state-in-ink: var(--teal-300); --state-watch-ink: var(--watch-300); --state-out-ink: var(--flag-300);
  --state-in-bg: rgba(99, 194, 180, 0.14); --state-watch-bg: rgba(241, 193, 92, 0.14); --state-out-bg: rgba(244, 147, 122, 0.16);
  --viz-track: rgba(255, 255, 255, 0.12); --viz-band: rgba(99, 194, 180, 0.6); --viz-field: rgba(99, 194, 180, 0.3); --viz-band-o: 0.7; --viz-grid: rgba(255, 255, 255, 0.18); --viz-dot-ring: var(--night);
  --link-underline: var(--link-underline-night);
  --fg-link-strong: var(--teal-300); --fg-shadow: none;
  --edge: var(--line-night-2); --edge-strong: rgba(255, 255, 255, 0.5);
  --ghost-bg: transparent; --ghost-bg-hover: rgba(255, 255, 255, 0.1);
  --fill-strong-hover: var(--surface); --card-bg-hover: var(--night-3);
  --chip-face: var(--face); --chip-edge: var(--rule-2); --chip-ink: var(--fg);
  --logo-filter: grayscale(1) brightness(0) invert(1);
}
.surface-dark { background: var(--night); color: var(--on-night); --card-bg: var(--night-2); --card-fg: var(--on-night); }
.section-dark :is(.lede, .muted, .caption) { color: var(--fg-2); }
.section-dark .eyebrow { color: var(--fg-link); }
/* two coloured sections in a row on the same background chain like .flush */
:is(.section-butter, .section-mist, .section-tint) + :is(.section-butter, .section-mist, .section-tint).flush { padding-top: 0; }

/* photo scope: text on a photo (an immersive hero, a photo band, a photo card). Cards on a photo are dark glass */
:is(.on-photo, .photo-card, .bleed) {
  --fg: var(--on-photo); --fg-2: var(--on-photo-2); --fg-3: rgba(255, 255, 255, 0.8);
  --fg-link: var(--on-photo); --fg-mark: var(--on-photo); --fg-em: var(--on-photo); --fg-em-sm: var(--on-photo); --fg-inverse: var(--ink);
  --rule: var(--on-photo-line); --rule-2: rgba(255, 255, 255, 0.4);
  --face: var(--glass); --face-hover: var(--glass-hover); --hover-fill: var(--glass);
  --state-in: var(--teal-300); --state-watch: var(--watch-300); --state-out: var(--flag-300);
  --state-in-ink: var(--on-photo); --state-watch-ink: var(--on-photo); --state-out-ink: var(--on-photo);
  --state-in-bg: var(--glass-dark); --state-watch-bg: var(--glass-dark); --state-out-bg: var(--glass-dark);
  --viz-track: rgba(255, 255, 255, 0.28); --viz-band: rgba(99, 194, 180, 0.75); --viz-field: rgba(99, 194, 180, 0.55); --viz-band-o: 0.7; --viz-grid: rgba(255, 255, 255, 0.3); --viz-dot-ring: rgba(8, 15, 16, 0.55);
  --card-bg: var(--glass-dark); --card-fg: var(--on-photo); --card-bg-hover: var(--glass-dark-hover); --card-blur: var(--glass-blur);
  --link-underline: rgba(255, 255, 255, 0.5);
  --fg-link-strong: var(--on-photo); --fg-shadow: var(--text-shadow-photo);
  --edge: var(--glass-line); --edge-strong: var(--glass-line-strong);
  --ghost-bg: var(--glass-dark); --ghost-bg-hover: var(--glass-dark-hover);
  --fill-strong-hover: var(--surface);
  --chip-face: var(--face); --chip-edge: var(--rule-2); --chip-ink: var(--fg);
  --logo-filter: grayscale(1) brightness(0) invert(1);
  /* an eyebrow on a photo sits in a dark glass pill (components.css), so it reads on any part of any picture */
  --eyebrow-w: fit-content; --eyebrow-pad: 7px 14px 7px 11px; --eyebrow-bg: var(--glass-dark);
  --eyebrow-border: 1px solid var(--glass-line); --eyebrow-blur: var(--glass-blur);
}
/* light scope: a white card, a flat (canvas-2) card or .surface-light inside a night or photo surface reads as paper
   again: every SURFACE token goes back to its paper value, including the photo-only ones (text shadow, eyebrow pill,
   glass chips, frost), so nothing white-on-photo can leak onto the white face */
:is(.card-white, .card-flat, .surface-light) {
  --fg: var(--ink); --fg-2: var(--ink-2); --fg-3: var(--ink-3);
  --fg-link: var(--teal-700); --fg-mark: var(--teal-600); --fg-em: var(--accent-em); --fg-em-sm: var(--accent-em-sm); --fg-inverse: var(--surface);
  --rule: var(--line); --rule-2: var(--line-2);
  --face: var(--tint); --face-hover: var(--canvas-2); --hover-fill: var(--hover-tint);
  --state-in: var(--teal-500); --state-watch: var(--watch-600); --state-out: var(--flag-600);
  --state-in-ink: var(--teal-700); --state-watch-ink: var(--watch-700); --state-out-ink: var(--flag-700);
  --state-in-bg: var(--teal-50); --state-watch-bg: var(--watch-50); --state-out-bg: var(--flag-50);
  --viz-track: rgba(17, 27, 29, 0.09); --viz-band: var(--teal-300); --viz-field: #cfe7e0; --viz-band-o: 1; --viz-grid: rgba(17, 27, 29, 0.16); --viz-dot-ring: var(--surface);
  --card-fg: var(--ink); --card-bg-hover: var(--surface); --card-blur: none;
  --link-underline: rgba(10, 98, 92, 0.35);
  --fg-link-strong: var(--teal-800); --fg-shadow: none;
  --edge: var(--line-2); --edge-strong: var(--ink-3);
  --ghost-bg: transparent; --ghost-bg-hover: var(--hover-tint);
  --fill-strong-hover: var(--teal-900);
  --chip-face: var(--surface); --chip-edge: var(--line-2); --chip-ink: var(--ink);
  --logo-filter: grayscale(1);
  --eyebrow-w: auto; --eyebrow-pad: 0; --eyebrow-bg: none; --eyebrow-border: 0; --eyebrow-blur: none;
  color: var(--ink);
}
.surface-light { background: var(--surface); }

.on-photo { color: var(--on-photo); }
/* these read the SURFACE tokens (white on the photo itself), never a hard-coded white: a .card-white / .surface-light
   inside the photo re-points the tokens, so its copy, eyebrow and italic go back to paper values */
.on-photo :is(.lede, p) { color: var(--fg-2); }
.on-photo .eyebrow { color: var(--fg-link); }
/* on a photo the italic stays white (--fg-em is white there): a pale teal reads washed-out on warm light */
.on-photo :is(h1, h2, .display-1, .display-page, .display-2, .h2) em { color: var(--fg-em); }
.on-photo :is(h3, .h3) em { color: var(--fg-em-sm); }
.on-photo :is(h1, h2, h3, .display-1, .display-page, .display-2) { text-shadow: var(--fg-shadow); }

/* ---- Utilities (spacing on the 4px scale; replace inline style="") ---- */
.mt-16 { margin-top: var(--space-4); }
.mt-24 { margin-top: var(--space-6); }
.mt-32 { margin-top: var(--space-7); }
.mt-48 { margin-top: var(--space-9); }
.mt-64 { margin-top: var(--space-10); }
.mt-72 { margin-top: 72px; }
.mb-8 { margin-bottom: var(--space-2); }
.mb-16 { margin-bottom: var(--space-4); }
.mb-24 { margin-bottom: var(--space-6); }
.max-12ch { max-width: 12ch; }
.max-14ch { max-width: 14ch; }
.max-16ch { max-width: 16ch; }
.max-18ch { max-width: 18ch; }
.max-20ch { max-width: 20ch; }
.max-52ch { max-width: 52ch; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: clip; clip-path: inset(50%);
  margin: -1px; border: 0; padding: 0;
}

/* ---- Print: everything that waits for a scroll reveal or a scroll position prints in its final state ---- */
@media print {
  html.js :is([data-reveal], [data-reveal-stagger] > *, .sw-i, [data-scrub] *) {
    opacity: 1 !important; translate: none !important; scale: none !important; clip-path: none !important; transition: none !important;
  }
  html.js [data-reveal]::before { content: none !important; }
  .nav, .nav-scrim, .skip, .marquee [aria-hidden="true"] { display: none !important; }
  .hero-bleed { margin-top: 0; }
}

/* ---- Reduced motion: no smooth scrolling, no animation, instant transitions ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
