/* =========================================================================
   Element-level defaults — reset + sensible HTML element styling.

   Applies tokens (see tokens.css) to body, headings, paragraphs, code, links,
   etc. Component classes belong in components.css; article typography in
   prose.css.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }

/* Headlines — monospace, tight, heavy */
h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  color: var(--fg);
  margin: 0 0 var(--s-4) 0;
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); line-height: var(--lh-h1); letter-spacing: var(--ls-h1); }
h2 { font-size: var(--t-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); }
h3 { font-size: var(--t-h3); line-height: var(--lh-h3); letter-spacing: var(--ls-h3); }
h4 { font-size: var(--t-h4); line-height: var(--lh-h4); }

p {
  margin: 0 0 var(--s-4) 0;
  color: var(--fg-muted);
  text-wrap: pretty;
  max-width: 62ch;
}

small { font-size: var(--t-small); line-height: var(--lh-small); color: var(--fg-muted); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9375em;
}
code {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  color: var(--fg);
}
pre {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  overflow-x: auto;
  color: var(--fg);
  line-height: 1.55;
}
pre code { background: none; border: 0; padding: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
/* Hover underlines are opted-into per context (e.g. .prose a) — never
   global, otherwise card/list anchors that wrap mixed content (titles,
   excerpts, tag chips, meta) get every nested text underlined on hover. */

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--s-7) 0;
}

img, svg { display: block; max-width: 100%; }

button { font-family: inherit; }

/* Selection, focus */
::selection { background: var(--accent); color: var(--accent-fg); }
h1 ::selection, h2 ::selection, h3 ::selection { background: var(--accent); color: var(--accent-fg); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Visually hidden, still read by screen readers (WP's conventional name). */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion — respect user preference */
@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;
  }
}
