:root {
  color-scheme: light;
  --bg: #f8f7f4;
  --fg: #181817;
  --muted: #686762;
  --line: #d8d5ce;
  --link: #145ea8;
  --code: #ece9e1;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111210;
  --fg: #ecece7;
  --muted: #aaa9a1;
  --line: #3b3c38;
  --link: #86bdf4;
  --code: #20221f;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.65 ui-sans-serif, system-ui, sans-serif; }
main { width: min(920px, calc(100% - 40px)); margin: 72px auto 120px; }
h1 { margin: 0 0 1.4rem; font-size: clamp(2.1rem, 6vw, 4.2rem); line-height: 1.04; letter-spacing: -.045em; }
h2 { margin: 3.2rem 0 1rem; font-size: 1.65rem; line-height: 1.2; }
h3 { margin: 2.2rem 0 .7rem; font-size: 1.2rem; }
p, li { max-width: 75ch; }
header { margin-bottom: 2.4rem; }
header h1 { margin-bottom: 1rem; }
.subtitle { margin: 0 0 1rem; font: 1.3rem/1.5 Georgia, "Iowan Old Style", serif; }
.byline { margin: 0; color: var(--muted); font-size: .95rem; }
a { color: var(--link); text-underline-offset: 3px; }
blockquote { margin: 1.6rem 0; padding: .1rem 1.2rem; border-left: 3px solid var(--fg); color: var(--muted); }
pre, code { background: var(--code); font-family: ui-monospace, SFMono-Regular, monospace; }
code { padding: .12em .3em; border-radius: 4px; }
pre { overflow: auto; padding: 1rem; border-radius: 8px; }
pre code { padding: 0; }
table { width: 100%; margin: 1.6rem 0; border: 1px solid var(--line); border-radius: 8px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { padding: .62rem .72rem; border-bottom: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; }
th { line-height: 1.3; }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: 0; }
nav { position: fixed; top: 18px; right: 18px; display: flex; gap: 8px; }
#theme, #posts { height: 42px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg); cursor: pointer; }
#theme { width: 42px; font-size: 20px; }
#posts { display: flex; align-items: center; padding: 0 16px; font-size: 15px; text-decoration: none; }
.posts { padding: 0; list-style: none; }
.posts li { display: flex; gap: 1.2rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.posts time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
img { max-width: 100%; }
main img { cursor: zoom-in; }
#lightbox { max-width: none; max-height: none; width: 100vw; height: 100vh; margin: 0; padding: 0; border: 0; background: rgb(0 0 0 / .85); cursor: zoom-out; }
#lightbox[open] { display: flex; align-items: center; justify-content: center; }
#lightbox::backdrop { background: transparent; }
#lightbox img { max-width: 96vw; max-height: 96vh; object-fit: contain; }
p:has(> img:only-child) { margin: 2rem 0 0; }
p:has(> img:only-child) + p:has(> em:only-child) { margin: .5rem 0 2rem; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.chart { margin: 2rem 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font: 13px ui-sans-serif, system-ui, sans-serif; }
.chart .axis { stroke: var(--line); }
.chart .point { fill: var(--link); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  main { width: min(100% - 28px, 920px); margin-top: 64px; }
}
