/* ---------------------------------------------------------------
   Crimson Pro (SIL Open Font License 1.1) - self-hosted.
   Variable font: one file spans weights 200-900, so every weight
   used on the site costs a single ~48KB download.
   font-display: swap renders fallback text immediately, then swaps.
   --------------------------------------------------------------- */
@font-face {
  font-family: "Crimson Pro";
  src: url("/css/fonts/crimson-pro-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                 U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
                 U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Crimson Pro";
  src: url("/css/fonts/crimson-pro-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                 U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
                 U+FEFF, U+FFFD;
}

:root {
  --measure: 45rem;
  --ink: #1c1f24;
  --ink-muted: #5c6470;
  --rule: #dfe3e8;
  --accent: #2f5d50;
  --bg: #ffffff;

  /* Fallbacks are old-style serifs with similar proportions, so the
     swap from fallback to Crimson Pro shifts the text as little as
     possible. */
  --font-serif: "Crimson Pro", Charter, "Iowan Old Style", "Palatino Linotype",
                Palatino, Georgia, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6e8ea;
    --ink-muted: #a2abb6;
    --rule: #333a42;
    --accent: #8fc9b6;
    --bg: #16181b;
  }
}

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

/* ---------------------------------------------------------------
   Type scale. body is the single anchor (1.4rem = 22.4px); every
   other size is expressed in em RELATIVE TO IT, so changing the body
   size below rescales the whole page proportionally.
   Do not reintroduce rem for headings - that was the original bug:
   rem resolves against the root element, so headings ignored body
   entirely and h3 ended up smaller than the paragraphs under it.
     h1 2.15em | h2 1.55em | h3 1.22em | body 1.00 |
     footnotes 0.78em | meta 0.72em | caption 0.70em | eyebrow 0.62em
   --------------------------------------------------------------- */
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

/* ---- Shared column ---- */
.post, .page {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 3rem 1.25rem 4rem;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* ---- Post header ---- */
.post__eyebrow {
  font-family: var(--font-sans);
  font-size: 0.62em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 1rem;
}
.post__eyebrow a { color: var(--ink-muted); text-decoration: none; }
.post__eyebrow a:hover { color: var(--accent); text-decoration: underline; }

.post__title { font-size: clamp(2rem, 6vw, 2.15em); margin: 0 0 0.5rem; }

.post__meta {
  font-family: var(--font-sans);
  font-size: 0.72em;
  color: var(--ink-muted);
  margin: 0 0 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.post__body > h2 { margin-top: 2.6rem; font-size: 1.55em; }
.post__body > h3 { margin-top: 2rem; font-size: 1.22em; }
.post__body > p { margin: 0 0 1.35rem; }

blockquote {
  margin: 2rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-muted);
  font-style: italic;
}
blockquote p { margin: 0 0 0.5rem; }
blockquote p:last-child { margin-bottom: 0; }

/* ---- Figures ---- */
.figure {
  margin: 2.5rem 0;
}
.figure picture, .figure img { display: block; }
.figure img {
  width: 100%;
  height: auto;
  border-radius: 3px;
  background: var(--rule);
}
.figure figcaption {
  margin-top: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.7em;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* ---- Footnotes ---- */
.footnotes {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78em;
  color: var(--ink-muted);
}
.footnotes ol { padding-left: 1.1rem; }
.footnotes li { margin-bottom: 0.5rem; }
.footnotes p { margin: 0; }
.footnote-backref { text-decoration: none; }

sup.footnote-ref a {
  text-decoration: none;
  padding: 0 0.15em;
  font-family: var(--font-sans);
  font-size: 0.75em;
}

.post__nav {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 0 1.25rem 4rem;
  font-family: var(--font-sans);
  font-size: 0.72em;
}
.post__nav a { text-decoration: none; }
.post__nav a:hover { text-decoration: underline; }

/* ---- Writing index ---- */
.page__header { margin-bottom: 3rem; }
.page__header h1 { font-size: clamp(2rem, 6vw, 2.15em); margin: 0 0 0.5rem; }
.page__lede { color: var(--ink-muted); margin: 0; }

.postlist { list-style: none; margin: 0; padding: 0; }
.postlist__item {
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.postlist__item:last-child { border-bottom: 0; }
.postlist__date {
  font-family: var(--font-sans);
  font-size: 0.62em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.postlist__title { font-size: 1.35em; margin: 0.4rem 0 0.5rem; }
.postlist__title a { text-decoration: none; color: var(--ink); }
.postlist__title a:hover { color: var(--accent); text-decoration: underline; }
.postlist__desc { margin: 0; color: var(--ink-muted); font-size: 0.95em; }
