/* Option B: Quiet. White page, graphite text, one deep green; serif display over a calm sans body. */
:root {
  --bg: #ffffff;
  --soft: #f4f6f5;
  --ink: #1d1f22;
  --text: #34373c;
  --muted: #6f737a;
  --rule: #e6e8e7;
  --accent: #2c5d4f;
  --display: "Newsreader", Georgia, serif;
  --body: "Figtree", system-ui, sans-serif;
  --measure: 37rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151716; --soft: #1d201f; --ink: #f0f2f1; --text: #cfd3d1; --muted: #8e9592; --rule: #2a2e2c; --accent: #8cc4b1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151716; --soft: #1d201f; --ink: #f0f2f1; --text: #cfd3d1; --muted: #8e9592; --rule: #2a2e2c; --accent: #8cc4b1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

main, .site-header, .site-footer { width: min(var(--measure), 100% - 2rem); margin-inline: auto; }

.site-header { padding: 2.5rem 0 0; }
.site-header a { text-decoration: none; font-weight: 600; font-size: 0.9375rem; color: var(--ink); }
.site-header a:hover { color: var(--accent); }
.site-footer { margin-top: 7rem; padding: 2rem 0 3rem; color: var(--muted); font-size: 0.875rem; display: flex; gap: 1.5rem; }

/* Home: the bio is the hero */
.intro { padding: 7rem 0 0; }
.intro h1 { font-family: var(--body); font-size: 1rem; font-weight: 600; color: var(--ink); margin: 0 0 0.25rem; letter-spacing: 0; }
.intro .role { font-size: 1rem; color: var(--muted); margin: 0 0 2.5rem; }
.intro .role a { color: var(--accent); text-decoration: none; }
.intro .role a:hover { text-decoration: underline; }
.intro .statement {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.6vw, 1.9rem);
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 2.5rem;
  text-wrap: pretty;
}
.intro .bio p { margin: 0 0 1rem; text-wrap: pretty; }
.intro .bio p:last-child { margin-bottom: 0; color: var(--muted); }
.section-label { font-family: var(--body); font-size: 0.9375rem; font-weight: 600; color: var(--ink); margin: 6rem 0 0.5rem; }
.essays { list-style: none; padding: 0; margin: 0; }
.essays li { border-top: 1px solid var(--rule); }
.essays a { display: block; padding: 1.25rem 0; text-decoration: none; }
.essays .title { font-family: var(--display); font-size: 1.5rem; line-height: 1.25; color: var(--ink); }
.essays a:hover .title { color: var(--accent); }
.essays .meta { color: var(--muted); font-size: 0.875rem; margin-top: 0.3rem; }

/* Essay header */
.essay-head { padding: 5.5rem 0 3rem; }
.essay-head h1 {
  font-family: var(--display);
  font-size: clamp(2.3rem, 6vw, 3.4rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 1.25rem;
  text-wrap: balance;
}
.essay-head .subtitle { font-size: 1.125rem; line-height: 1.55; color: var(--muted); margin: 0 0 2rem; text-wrap: pretty; }
.byline { display: flex; flex-direction: column; font-size: 0.875rem; color: var(--muted); margin: 0; line-height: 1.5; }
.byline .author { color: var(--ink); font-weight: 600; }
.byline::before { content: ""; width: 2.5rem; height: 2px; background: var(--accent); margin-bottom: 1.25rem; }

/* Contents */
.toc { font-size: 0.9375rem; line-height: 1.45; margin: 0 0 3.5rem; padding: 1.5rem; background: var(--soft); border-radius: 6px; }
.toc-label { font-weight: 600; color: var(--ink); margin: 0 0 0.75rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 0.4rem; }
.toc a { text-decoration: none; color: var(--muted); display: grid; grid-template-columns: 1.6rem 1fr; }
.toc a:not(:has(.num)) { padding-left: 1.6rem; }
.toc a:hover, .toc a.active { color: var(--ink); }
.toc a.active { color: var(--accent); }
@media (min-width: 1180px) {
  .toc {
    position: fixed;
    top: 6rem;
    left: calc(50% + var(--measure) / 2 + 4rem);
    width: 14rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    background: none;
    font-size: 0.8125rem;
  }
}

/* Prose */
.prose h2 { font-family: var(--display); font-size: 1.85rem; font-weight: 400; letter-spacing: -0.01em; line-height: 1.2; color: var(--ink); margin: 4.5rem 0 1.1rem; scroll-margin-top: 2rem; }
.prose h2 .num { color: var(--accent); margin-right: 0.35rem; }
.prose h3 { font-size: 1.0625rem; font-weight: 600; color: var(--ink); margin: 2.25rem 0 0.4rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.15rem; text-wrap: pretty; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.3rem; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 600; color: var(--ink); }
.prose code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; background: var(--soft); padding: 0.1em 0.35em; border-radius: 4px; }
.prose blockquote {
  margin: 2.75rem 0;
  padding: 0;
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.prose blockquote strong { font-weight: 400; }
.prose blockquote p { margin: 0; }

.table-wrap { overflow-x: auto; margin: 2rem 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.875rem; line-height: 1.5; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 0.7rem 0.75rem 0.7rem 0; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 600; color: var(--ink); }
.prose td:first-child { font-weight: 600; color: var(--ink); }
@media (max-width: 560px) { .prose th, .prose td { min-width: 8.5rem; } }

figure { margin: 3rem 0; }
.diagram { width: 100%; height: auto; display: block; font-family: var(--body); }
.diagram .d-ink { fill: var(--ink); }
.diagram .d-quiet { fill: var(--muted); }
.diagram .d-edge-fill { fill: var(--muted); }
.diagram .d-line, .diagram .d-line * { fill: none; stroke: var(--muted); stroke-width: 1; }
.diagram .d-tint { fill: var(--soft); stroke: var(--muted); stroke-width: 1; }
.diagram .d-accent { fill: color-mix(in srgb, var(--accent) 9%, var(--bg)); stroke: var(--accent); stroke-width: 1.5; }
figcaption { color: var(--muted); font-size: 0.8125rem; margin-top: 0.75rem; text-align: center; }
@media (min-width: 900px) { figure.wide { margin-inline: -6rem; } }
@media (max-width: 560px) {
  figure.wide { margin-inline: -1rem; overflow-x: auto; }
  figure.wide .diagram { min-width: 560px; padding: 0 1rem; }
}

@media print { .site-header, .site-footer, .toc { display: none; } }
