/* Base: reset, typography, layout primitives. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 450;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main { flex: 1 0 auto; }

h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
:where(ul[class], ol[class]) { padding: 0; list-style: none; }

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); line-height: 1.05; letter-spacing: -0.03em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.015em; }
h4 { font-size: var(--fs-h4); letter-spacing: -0.01em; }
p, li { text-wrap: pretty; }

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-color: var(--thread); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
strong, b { font-weight: 650; color: var(--ink); }
::selection { background: var(--stone); color: var(--ink); }

/* Focus: one visible style everywhere. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--thread); outline-offset: 3px; }
.on-dark :focus-visible { outline-color: var(--thread-light); }

/* ---------- Type roles ---------- */
.label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: 0;
  color: var(--ink);
}
.lead { font-size: var(--fs-lead); line-height: 1.55; color: var(--ink-soft); }
.small { font-size: var(--fs-sm); line-height: 1.55; }
.muted { color: var(--muted); }
.serif-accent { font-family: var(--font-serif); font-style: italic; font-weight: 500; letter-spacing: 0; }

.prose { max-width: var(--max-text); }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 { font-size: var(--fs-h3); margin-top: var(--s-7); }
.prose h3 { font-size: var(--fs-h4); margin-top: var(--s-6); }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: var(--s-2); }
.prose a { text-decoration-line: underline; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section); }
.stack > * + * { margin-top: var(--stack, var(--s-4)); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; z-index: 100; top: var(--s-2); left: var(--s-2);
  padding: var(--s-3) var(--s-4); background: var(--ink); color: var(--paper);
  text-decoration: none; transform: translateY(-300%);
}
.skip-link:focus-visible { transform: none; }

[hidden] { display: none !important; }
