/* ============================================================================
   Verity · base.css — @font-face, reset, element defaults, focus, a11y.
   No component styling lives here.
   ========================================================================== */

/* ── Fonts. Self-hosted variable woff2. Zero external requests, ever. ────── */
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/atkinson-next-latin.woff2') format('woff2');
  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: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/atkinson-next-latin-ext.woff2') format('woff2');
  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: 'Spline Sans Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/spline-mono-latin.woff2') format('woff2');
  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: 'Spline Sans Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/spline-mono-latin-ext.woff2') format('woff2');
  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;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-ui);
  font-size: var(--t-body);
  line-height: var(--lh-ui);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  /* The page body NEVER scrolls sideways, at any width. Wide content
     scrolls inside its own container. */
  overflow-x: hidden;
}

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

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

button { background: none; border: none; padding: 0; cursor: pointer; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: 600; }
h1 { font-size: var(--t-h1); font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: var(--t-h2); letter-spacing: -0.01em; }
h3 { font-size: var(--t-h3); letter-spacing: -0.005em; }
h4 { font-size: var(--t-h4); }
h1, h2, h3 { text-wrap: balance; }
p  { text-wrap: pretty; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }

ul, ol { padding: 0; list-style: none; }

table { border-collapse: collapse; border-spacing: 0; width: 100%; }
th { text-align: left; font-weight: 600; }

hr { border: none; border-top: 1px solid var(--line); }

fieldset { border: none; padding: 0; }
legend { padding: 0; }

/* ── Focus. Visible at all times, on every interactive thing. ────────────── */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
/* Inside the dark chrome the ring needs its own value to stay ≥3:1. */
.chrome :focus-visible,
[data-region='chrome'] :focus-visible { outline-color: #b9b0ff; }

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

/* ── Mono. Functional, never stylistic. If it isn't data, it isn't mono. ── */
.mono,
.metric,
td.num, th.num,
time,
.tnum {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.01em;
}
/* Numeric alignment is mandatory wherever columns are compared. */
.num, .metric, .risk-value, .news2-agg, .news2-cell, .cite,
.dose, .volume, .weight, .count, .chart text, .page-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
td.num, th.num { text-align: right; }

/* ── Typographic utilities ──────────────────────────────────────────────── */
.t-micro { font-size: var(--t-micro); line-height: 1.2; font-weight: 500; }
.t-meta  { font-size: var(--t-meta);  line-height: 1.35; }
.t-dense { font-size: var(--t-dense); }
.t-body  { font-size: var(--t-body); }
.t-lg    { font-size: var(--t-body-lg); line-height: var(--lh-prose); }

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

.w-400 { font-weight: 400; } .w-500 { font-weight: 500; }
.w-600 { font-weight: 600; } .w-700 { font-weight: 700; }

.prose { max-width: 68ch; line-height: var(--lh-prose); color: var(--ink-2); }
.prose p + p { margin-top: var(--s-3); }
.prose strong { color: var(--ink); font-weight: 600; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap   { white-space: nowrap; }

/* ── Accessibility utilities ────────────────────────────────────────────── */
.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-2); top: -100px;
  z-index: var(--z-tooltip);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  color: var(--brand);
  font-weight: 600;
  border: 2px solid var(--brand);
  border-radius: var(--r-sm);
  box-shadow: var(--e-3);
  transition: top var(--d-pop) var(--ease-out);
}
.skip-link:focus { top: var(--s-2); }

/* ── Motion floor. Reduced motion means fewer and gentler animations, not
   zero: colour and opacity transitions that aid comprehension survive.
   Movement does not.                                                       */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Opacity/colour crossfades stay, at a shortened but non-zero duration,
     because they carry state. */
  .keep-motion, .keep-motion * {
    transition-duration: 120ms !important;
    transition-property: opacity, color, background-color, border-color !important;
  }
}

/* ── Hover is gated. The carer surface has no pointer. ──────────────────── */
@media (hover: hover) and (pointer: fine) {
  .hoverable:hover { background: var(--surface-3); }
}

/* ── Layout atoms used everywhere. Not components. ──────────────────────── */
.row   { display: flex; align-items: center; gap: var(--s-2); }
.row-b { display: flex; align-items: baseline; gap: var(--s-2); }
.col   { display: flex; flex-direction: column; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.wrap  { flex-wrap: wrap; }
.grow  { flex: 1 1 auto; min-width: 0; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); } .gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mt-8 { margin-top: var(--s-8); } .mt-10 { margin-top: var(--s-10); }
.mt-12 { margin-top: var(--s-12); } .mt-16 { margin-top: var(--s-16); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }

/* ── Layout grids. Used by every surface, including the pages that do
   not load the console shell. ─────────────────────────────────────── */
.grid { display: grid; gap: var(--gutter); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.split { display: grid; gap: var(--gutter); grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.split-even { display: grid; gap: var(--gutter); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: var(--gutter); min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }

[hidden] { display: none !important; }
