/* base.css — reset, typography, self-hosted fonts, behavioural utilities.
 *
 * Reads var(--*) from tokens.css only. NO raw colour or px literals here
 * (TestCSS_NoRawValues enforces this; the only px values permitted outside
 * tokens.css are 0 / 1px / 2px / 999px / 50% in the gate whitelist, plus
 * 480/768/1024 inside @media conditions).
 */

/* ---------- Self-hosted Geist + Geist Mono (SIL OFL 1.1) ----------
 * Weight numbers in filenames mirror the font-weight values they declare,
 * making the contract trivially auditable. */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/Geist-400.woff2") format("woff2");
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/Geist-500.woff2") format("woff2");
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/Geist-600.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/GeistMono-400.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/GeistMono-500.woff2") format("woff2");
}

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

html,
body,
h1, h2, h3, h4, h5, h6,
p, ul, ol, dl, figure {
  margin: 0;
}

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

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

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

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

/* ---------- Document defaults ---------- */
html {
  background-color: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Headings ---------- */
h1 { font-size: var(--fs-3xl); font-weight: var(--fw-bold);   line-height: var(--lh-tight); }
h2 { font-size: var(--fs-2xl); font-weight: var(--fw-bold);   line-height: var(--lh-tight); }
h3 { font-size: var(--fs-xl);  font-weight: var(--fw-medium); line-height: var(--lh-tight); }
h4 { font-size: var(--fs-lg);  font-weight: var(--fw-medium); line-height: var(--lh-tight); }
h5 { font-size: var(--fs-md);  font-weight: var(--fw-medium); line-height: var(--lh-tight); }
h6 { font-size: var(--fs-sm);  font-weight: var(--fw-medium); line-height: var(--lh-tight); }

/* ---------- Code / monospace ---------- */
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

/* ---------- Links ----------
 * Minimal default — components (added in C2) override per intent. */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---------- Accessibility primitives ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- Behavioural utilities ----------
 * .is-hidden is the class form of style="display:none" — used to replace
 * the inline htmx-indicator spinner hides during C4–C9 page migrations.
 * Behavioural, not cosmetic — explicitly whitelisted out of the
 * cosmetic-style gate (RFC §4.6). */
.is-hidden {
  display: none !important;
}

/* ---------- Honour user motion preference (RFC §4.7) ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
