/* Base: reset, document type, headings, links, focus, layout utilities, the page frame. Tokens only.
   Owned by lib (stage 1) — views must not edit this file; ask for a change instead (public/DESIGN.md). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-ui); font-size: var(--fs-md); line-height: var(--lh);
  font-feature-settings: "tnum" 1;            /* tabular figures everywhere: ages and counts don't jitter */
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
/* Not svg: max-width on an SVG inside a 0×0 positioned anchor (map markers centre on their point that way)
   collapses it to width 0. Inline SVGs carry their own width/height; charts and overlays size themselves. */
img, video { max-width: 100%; }
a { color: var(--accent-ink); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: var(--fw-semibold); line-height: var(--lh-tight); text-wrap: balance; }
h1 { font-size: var(--fs-xl); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-lg); }
/* h3 = the small section label inside cards (Timeline, Contacts…) */
h3 { font-size: var(--fs-xs); color: var(--ink-2); text-transform: uppercase; letter-spacing: var(--tracking-caps); font-weight: var(--fw-semibold); }
p { margin: 0; text-wrap: pretty; }
kbd {
  font-family: var(--font-mono); font-size: var(--fs-xs); padding: 1px 6px; border-radius: var(--r-xs);
  background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: inset 0 -1px 0 var(--line-strong); color: var(--ink);
}
::selection { background: var(--accent-soft); }

/* ---- focus: visible for keyboard users, never for mouse clicks --------------------------------------------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
/* Route-change focus targets (the page title, #main): focusable but not a control — no ring. */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

/* ---- text utilities ---------------------------------------------------------------------------------------- */
.mono { font-family: var(--font-mono); font-size: var(--fs-xs); font-feature-settings: "tnum" 1, "zero" 1; }
.dim { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.amber { color: var(--accent-ink); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- layout utilities ------------------------------------------------------------------------------------- */
.row { display: flex; gap: var(--sp-2); align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: var(--sp-2); }
.sp { justify-content: space-between; }
.stack > * + * { margin-top: var(--sp-3); }
.hidden { display: none !important; }

/* ---- the page frame: every non-full-bleed view renders <div class="page"> into #main --------------------- */
.page { height: 100%; overflow: auto; padding: var(--sp-5) var(--gutter) var(--sp-8); scroll-padding-top: var(--sp-4); }

/* ---- responsive visibility --------------------------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --gutter: var(--sp-3); }
  .page { padding: var(--sp-3) var(--gutter) var(--sp-6); }
  .hide-m { display: none !important; }
}
@media (min-width: 901px) { .show-m { display: none !important; } }
/* .show-d: hints that only make sense with a keyboard (hidden on phones) */
@media (max-width: 900px) { .show-d { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
