/* Base typography, resets, and global element styling.
 *
 * Reads from tokens.css; no literal values. After this file loads, an
 * unstyled HTML page should already feel like the product — cream
 * paper, ink type, confident bold headings.
 */

/* ---------- Web fonts (self-hosted; see fonts/README.md) ---------- */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/SpaceGrotesk-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/SpaceGrotesk-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/JetBrainsMono-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/JetBrainsMono-Bold.woff2") format("woff2");
}

/* ---------- Reset ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--size-3);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
  /* Tabular figures + slashed zero so numbers align and aren't
   * confused with O. Space Grotesk supports both via stylistic sets. */
  font-feature-settings: "tnum", "ss01";
  font-variant-numeric: tabular-nums slashed-zero;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Layout ---------- */

main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-8);
}

/* ---------- Headings ---------- */

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-body);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--size-6); letter-spacing: -0.03em; }
h2 { font-size: var(--size-4); }
h3 { font-size: var(--size-3); }

/* ---------- Body text ---------- */

p { margin: 0; }
p + p { margin-top: var(--space-4); }

strong { font-weight: var(--weight-bold); }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: text-decoration-color 80ms ease, color 80ms ease;
}

a:hover {
  color: var(--accent);
}

em {
  font-style: italic;
  color: var(--ink);
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-feature-settings: "tnum", "zero";
}

/* ---------- Form element resets (component CSS adds the rest) ---------- */

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

button { cursor: pointer; }

textarea { resize: vertical; }

/* ---------- Focus ---------- */
/* Brutalist focus is unambiguous: 3px solid ink, no apology. */

:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- Selection ---------- */

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