/* ============================================================================
   SmartRoots — base, reset, typography primitives
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem; /* clears the fixed header on anchor jumps */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 400; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

a {
  color: var(--link);
  text-decoration-color: color-mix(in srgb, var(--link) 32%, transparent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color var(--d-fast) var(--ease-out-soft),
              text-decoration-color var(--d-fast) var(--ease-out-soft);
}
a:hover { text-decoration-color: currentColor; }

::selection { background: var(--yellow-300); color: var(--ink-900); }

/* --- Focus: always visible, never removed -------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--blue-500);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}
.on-ink :focus-visible { outline-color: var(--yellow-300); }

/* --- Skip link ----------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 999;
  padding: 0.75rem 1.25rem;
  background: var(--ink-900);
  color: var(--text-on-ink);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--d-base) var(--ease-out-expo);
}
.skip-link:focus-visible { transform: translateY(0); }

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

/* ===========================================================================
   Typography primitives
   ======================================================================== */

.display-1, .display-2, .h1, .h2, .h3 {
  font-family: var(--font-display);
  /* Bricolage is variable on optical size and width; the widest optical size
     with a neutral width keeps headings even and un-quirky at large sizes. */
  font-variation-settings: 'opsz' 96, 'wdth' 100;
  color: var(--text);
  text-wrap: balance;
}

.display-1 {
  font-size: var(--fs-display-1);
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  font-weight: 700;
}
.display-2 {
  font-size: var(--fs-display-2);
  line-height: 1.12;
  letter-spacing: var(--tr-display);
  font-weight: 700;
}
.h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-heading);
  letter-spacing: var(--tr-heading);
  font-weight: 700;
}
.h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  letter-spacing: var(--tr-heading);
  font-weight: 700;
}
.h3 {
  font-size: var(--fs-h3);
  line-height: 1.3;
  letter-spacing: -0.012em;
  font-weight: 700;
}

/* Sans headings — used where a heading sits inside dense UI, so the serif
   stays reserved for editorial moments and keeps its impact. */
.h4 {
  font-family: var(--font-sans);
  font-size: var(--fs-h4);
  line-height: 1.45;
  letter-spacing: -0.004em;
  font-weight: 600;
  color: var(--text);
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.72;
  color: var(--text-secondary);
  font-weight: 400;
  text-wrap: pretty;
}
.body     { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--text-secondary); text-wrap: pretty; }
.body-sm  { font-size: var(--fs-sm);   line-height: 1.6;            color: var(--text-secondary); text-wrap: pretty; }

/* Not uppercase-tracked any more: this brand labels in sentence case inside
   a pill, which is friendlier and matches the live site. */
.label {
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tr-label);
  line-height: 1.2;
}

/* Measure control — long-form text never runs past a comfortable line length */
.measure    { max-width: 62ch; }
.measure-sm { max-width: 48ch; }
.measure-lg { max-width: 74ch; }

/* Tabular figures for anything numeric that sits in a column or animates */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* On-ink text colour inversion */
.on-ink { color: var(--text-on-ink); }
.on-ink .display-1, .on-ink .display-2,
.on-ink .h1, .on-ink .h2, .on-ink .h3, .on-ink .h4 { color: var(--text-on-ink); }
.on-ink .lead, .on-ink .body, .on-ink .body-sm { color: var(--text-on-ink-2); }
/* Scoped to prose only. A blanket  outranked both .btn--inverse
   (rendering the closing CTA's label pale blue on paper, 2.25:1) and the
   footer's own muted link colour. Navigation and buttons on ink style
   themselves; only inline links in copy need the lift. */
.on-ink p a { color: var(--blue-300); }

/* ===========================================================================
   Layout primitives
   ======================================================================== */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide  { max-width: calc(var(--container-wide) + var(--gutter) * 2); }
.container--narrow{ max-width: calc(var(--container-narrow) + var(--gutter) * 2); }

.section { padding-block: var(--section-y); position: relative; }
/* Sections that sit on the same plain page background are marked
   `section--flow`. Where one follows another there is no colour edge between
   them, so their bottom and top padding added up to a double gap (224px at
   desktop against 112px everywhere else). The follower drops its top padding,
   so the space between any two sections on the page reads as one
   `--section-y`. */
.section--flow + .section--flow { padding-top: 0; }
.section--tight { padding-block: var(--section-y-tight); }
.section--ink { background: var(--surface-ink); color: var(--text-on-ink); }

/* ===========================================================================
   Reduced motion — the site must remain fully legible and usable with all
   animation removed. Content is never hidden behind an animation gate.
   ======================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================================================================
   Numerals
   ---------------------------------------------------------------------------
   Fraunces is beautiful at display sizes but its figures are ambiguous small —
   a 3 reads as a 5 inside a 42px step marker. So the rule is by size, not by
   context: Public Sans below ~1.5rem, Fraunces above it.
   ======================================================================== */
.num-ui {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.num-display {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0;
  font-variant-numeric: tabular-nums;
}
