/* =========================================================================
   2-primitives — reset and base typography. No components yet.
   ========================================================================= */

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

html { font-size: var(--fs-root); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--text-color);
  /* A couple of the theme serifs (CMU Serif, Cormorant, Playfair
     Display) are thin-stroked at body weight and wash out on screen
     without this — it's not just a font-size problem. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Never actually visible — the sidebar and .content-wrap together
     tile the full viewport at every width. Plain fallback only. */
  background-color: var(--bg-color);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 var(--sp-3);
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4, h5, h6 { font-size: var(--fs-base); }

p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 0.15em;
}
a:hover { text-decoration-color: var(--accent); }
a:visited { color: var(--link-visited); }

ul, ol { margin: 0 0 var(--sp-3); padding-left: 1.4em; }
li { margin-bottom: var(--sp-1); }

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--sp-5) 0;
}

blockquote {
  margin: var(--sp-4) 0;
  padding: var(--sp-2) var(--sp-4);
  border-left: 3px solid var(--border-color);
  color: var(--text-muted);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0.1em 0.35em;
}
pre {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: var(--sp-3);
  overflow-x: auto;
}
pre code { background: none; padding: 0; }

img { max-width: 100%; height: auto; }

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.no-js .js-only { display: none !important; }
.no-js-note { display: none; }
.no-js .no-js-note { display: block; }

/* ---- utilities ----------------------------------------------------------
   Small, load-bearing across many templates: muted/mono text, a spacing
   step, a plain flex row. */
.text-muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.mb-1 { margin-bottom: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
