:root {
  color-scheme: light;
  --paper: #faf9f6;
  --ink: #242e36;
  --muted: #57636a;
  --link: #1b5b76;
  --line: #d8ddd9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 18px; line-height: 1.65; }
.page { max-width: 48rem; margin: 0 auto; padding: 2rem 1.75rem 3rem; overflow-wrap: break-word; }
.site-header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 3.5rem; font-size: 0.8rem; }
.site-header a { text-decoration: none; }
.series-link { color: var(--muted); }
.repo-link { white-space: nowrap; font-weight: 600; }

h1 { margin: 0 0 1.1rem; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.1rem, 5.5vw, 3.15rem); font-weight: 500; letter-spacing: -0.035em; line-height: 1.14; text-wrap: balance; }
.landing h1 { max-width: 25ch; }
.article h1 { font-size: clamp(2rem, 4.7vw, 2.9rem); line-height: 1.18; }
p { margin: 0 0 1.15rem; }

.landing h2 { margin: 2.75rem 0 1.35rem; padding-top: 1.1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; font-weight: 650; letter-spacing: 0.13em; line-height: 1.4; text-transform: uppercase; }
.landing h3 { margin: 1.65rem 0 0.45rem; font-size: 1.18rem; font-weight: 600; letter-spacing: -0.015em; line-height: 1.45; }
.landing h2 + h3 { margin-top: 0; }
.landing h3 + p { color: var(--muted); }
.article h2 { margin: 2.8rem 0 1rem; font-family: Georgia, "Times New Roman", serif; font-size: 1.7rem; font-weight: 500; line-height: 1.3; letter-spacing: -0.02em; }
.article h3 { margin: 2rem 0 0.8rem; font-size: 1.12rem; line-height: 1.4; }
.article li { margin-bottom: 0.5rem; }
.article ul, .article ol { padding-left: 1.4rem; }
.article blockquote { margin: 1.5rem 0; padding: 0.15rem 0 0.15rem 1.2rem; border-left: 3px solid var(--line); color: var(--muted); }
.article blockquote p:last-child { margin-bottom: 0; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; border-radius: 1px; }
img, video, svg { max-width: 100%; height: auto; }
.article p:has(> img), .article p:has(> a > img) { margin: 1.7rem 0; text-align: center; }
.article img { vertical-align: middle; }
.article p:has(> img) + p:has(> em:only-child), .article p:has(> a > img) + p:has(> em:only-child) { margin-top: -0.8rem; color: var(--muted); font-size: 0.85rem; }
code { padding: 0.12em 0.3em; border-radius: 3px; background: #eceeea; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.84em; }
pre { max-width: 100%; overflow-x: auto; padding: 1.15rem; border: 1px solid var(--line); border-radius: 5px; background: #f0f1ed; line-height: 1.5; }
pre code { padding: 0; background: none; }
.diagram { margin: 1.8rem 0; text-align: center; }
.diagram svg { width: 100%; }
.diagram a { cursor: zoom-in; }

hr { height: 0; margin: 2.75rem 0 1.4rem; border: 0; border-top: 1px solid var(--line); }
.landing hr ~ p { color: var(--muted); font-size: 0.95rem; }
.essay-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.essay-navigation a { text-decoration: none; font-size: 0.95rem; line-height: 1.5; }
.essay-navigation span { display: block; margin-bottom: 0.4rem; color: var(--muted); font-size: 0.75rem; }
.essay-navigation .next { text-align: right; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem 1.5rem; margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }
.site-footer a { color: var(--muted); }
.skip-link { position: absolute; top: 0; left: 1rem; padding: 0.5rem 0.75rem; transform: translateY(-150%); background: var(--paper); z-index: 1; }
.skip-link:focus { transform: translateY(0); }

@media (max-width: 520px) {
  body { font-size: 17px; }
  .page { padding: 1.25rem 1.25rem 2rem; }
  .site-header { margin-bottom: 2.6rem; gap: 0.75rem; font-size: 0.72rem; }
  h1 { letter-spacing: -0.025em; }
  .landing h2 { margin-top: 2rem; }
  .article h2 { font-size: 1.5rem; }
  .essay-navigation { grid-template-columns: 1fr; gap: 1.3rem; }
  .essay-navigation .next { text-align: left; }
}
@media print {
  body { background: white; font-size: 11pt; }
  .page { padding: 0; max-width: none; }
  h1 { font-size: 26pt; }
  h2, h3 { break-after: avoid; }
  .site-header, .essay-navigation, .site-footer, .skip-link { display: none; }
}
