/* ============================================================================
   Baseline — Reset, typography, primitives
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  /* The page body never scrolls horizontally. Wide content scrolls inside
     its own container — see .scroll-x. */
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }

/* ── Headings ─────────────────────────────────────────────────────────────
   Fixed scale, not fluid. See DESIGN.md §4. */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semi);
  line-height: var(--lh-tight);
  letter-spacing: -0.018em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-xxl); letter-spacing: -0.026em; }
h2 { font-size: var(--fs-xl);  letter-spacing: -0.022em; }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
h5, h6 { font-size: var(--fs-sm); }

p { text-wrap: pretty; }
p, li { max-width: var(--maxw-prose); }

a {
  color: inherit;
  text-decoration-color: color-mix(in oklab, currentColor 35%, transparent);
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-color: currentColor; }

ul, ol { padding-left: 1.15em; }
li + li { margin-top: var(--sp-1); }

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: var(--sp-6) 0;
}

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.92em; }

/* ── Numerals ─────────────────────────────────────────────────────────────
   Tabular everywhere a number can change, so 98 → 102 doesn't shift layout. */
.num, table, .metric, time, .mono {
  font-variant-numeric: tabular-nums;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ── Focus ────────────────────────────────────────────────────────────────
   Visible on every interactive element. Never removed. */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--brand); color: var(--on-brand); }

::placeholder {
  color: var(--ink-3);   /* held to the body threshold, not a lighter grey */
  opacity: 1;
}

/* ── Skip link ────────────────────────────────────────────────────────────*/
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: var(--z-tooltip);
  background: var(--brand);
  color: var(--on-brand);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  font-weight: var(--fw-semi);
  font-size: var(--fs-sm);
  transition: top var(--dur-tip) var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); }

/* ── Text utilities ───────────────────────────────────────────────────────*/
.t-xs  { font-size: var(--fs-xs); }
.t-sm  { font-size: var(--fs-sm); }
.t-md  { font-size: var(--fs-md); }
.t-lg  { font-size: var(--fs-lg); }
.t-xl  { font-size: var(--fs-xl); }
.t-xxl { font-size: var(--fs-xxl); }

.t-ink   { color: var(--ink); }
.t-ink-2 { color: var(--ink-2); }
.t-ink-3 { color: var(--ink-3); }
.t-brand { color: var(--brand); }

.fw-regular { font-weight: var(--fw-regular); }
.fw-medium  { font-weight: var(--fw-medium); }
.fw-semi    { font-weight: var(--fw-semi); }
.fw-bold    { font-weight: var(--fw-bold); }

.t-center { text-align: center; }
.t-right  { text-align: right; }
.t-nowrap { white-space: nowrap; }
.t-upper  { text-transform: uppercase; letter-spacing: 0.06em; }

/* Label: the small caps-ish form used above data, sparingly.
   Not an eyebrow above every section — see DESIGN.md §9. */
.label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.prose { max-width: var(--maxw-prose); }
.prose p + p { margin-top: var(--sp-4); }
.prose h2 { margin-top: var(--sp-8); margin-bottom: var(--sp-3); }
.prose h3 { margin-top: var(--sp-6); margin-bottom: var(--sp-2); }
.prose ul, .prose ol { margin-top: var(--sp-3); }

/* ── Layout utilities ─────────────────────────────────────────────────────*/
.row  { display: flex; align-items: center; gap: var(--sp-3); }
.row-t{ display: flex; align-items: flex-start; gap: var(--sp-3); }
.col  { display: flex; flex-direction: column; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center  { justify-content: center; }
.end     { justify-content: flex-end; }
.grow    { flex: 1 1 auto; min-width: 0; }
.shrink-0{ flex-shrink: 0; }

.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.gap-7 { gap: var(--sp-7); } .gap-8 { gap: var(--sp-8); }

.mt-1{margin-top:var(--sp-1)} .mt-2{margin-top:var(--sp-2)}
.mt-3{margin-top:var(--sp-3)} .mt-4{margin-top:var(--sp-4)}
.mt-5{margin-top:var(--sp-5)} .mt-6{margin-top:var(--sp-6)}
.mt-7{margin-top:var(--sp-7)} .mt-8{margin-top:var(--sp-8)}
.mb-2{margin-bottom:var(--sp-2)} .mb-3{margin-bottom:var(--sp-3)}
.mb-4{margin-bottom:var(--sp-4)} .mb-6{margin-bottom:var(--sp-6)}

/* Breakpoint-free responsive grid. */
.grid { display: grid; gap: var(--sp-4); }
.grid-auto  { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-auto-s{ grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-auto-l{ grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 880px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Anything wide scrolls inside itself, never the body. */
.scroll-x {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.shell { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-6); }
@media (max-width: 620px) { .shell { padding-inline: var(--sp-4); } }

.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-7); }

/* Visually hidden but available to screen readers. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ── Icons ────────────────────────────────────────────────────────────────
   Single hand-authored sprite, referenced via <use>. No icon library,
   no emoji, one visual weight throughout. */
.i {
  width: 20px; height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i-sm { width: 16px; height: 16px; stroke-width: 1.7; }
.i-lg { width: 24px; height: 24px; stroke-width: 1.5; }
.i-xl { width: 32px; height: 32px; stroke-width: 1.4; }

/* ── Motion ───────────────────────────────────────────────────────────────
   Reduced motion drops transforms to a crossfade. Content is visible by
   default — nothing is gated behind a transition that could fail to fire. */
@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;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}
