:root {
  color-scheme: light dark;
  --fg: #212121;
  --muted: #5c5c5c;
  --bg: #f5f3f1;
  --code-bg: #ebe7e3;
  --block: #57524c;
  --block-dim: #8a847d;
  --link: #a8501f;
  --heading: #121212;
  --mono: "Berkeley Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="light"] { color-scheme: light; }

/* ashen */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg: #b4b4b4;
    --muted: #949494;
    --bg: #121212;
    --code-bg: #1d1d1d;
    --block: #b4b4b4;
    --block-dim: #949494;
    --link: #d87c4a;
    --heading: #e5e5e5;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --fg: #b4b4b4;
  --muted: #949494;
  --bg: #121212;
  --code-bg: #1d1d1d;
  --block: #b4b4b4;
  --block-dim: #949494;
  --link: #d87c4a;
  --heading: #e5e5e5;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  box-sizing: border-box;
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  font: 18px/1.7 var(--mono);
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--link); }
strong { color: var(--heading); }
h1, h2, h3, h4 { color: var(--heading); font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.5em; }
h2 { margin-top: 3rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--muted); font-size: 1em; }
h3 { font-size: 1em; margin-top: 2rem; }
h4 { font-size: 1em; color: var(--link); }
blockquote { margin: 1.5rem 0; padding: 0.5rem 1rem; border-left: 1px solid var(--muted); font-size: 0.95em; }
blockquote p { margin: 0; }
header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3rem; padding-bottom: 0.9rem; border-bottom: 3px double var(--muted); }
nav { display: flex; gap: 1.5rem; }
nav a, footer a, #theme { color: var(--muted); font: inherit; text-decoration: none; }
#theme { width: 10ch; padding: 0; letter-spacing: 0.08em; text-transform: uppercase; border: 0; background: none; font-size: 0.85em; cursor: pointer; }
#theme::before { content: "["; }
#theme::after { content: "]"; }
nav a:hover, footer a:hover, #theme:hover { color: var(--fg); }
nav a.current { color: var(--link); text-decoration: underline; text-underline-offset: 0.3em; }
time { color: var(--muted); font-size: 0.9em; }
img, video { max-width: 100%; }
figure { margin: 1.5rem 0; }
figcaption { color: var(--muted); font-size: 0.9em; text-align: center; }
table { border-collapse: collapse; font-size: 0.9em; }
th, td { padding: 0.3rem 1rem 0.3rem 0; text-align: left; }
th { color: var(--heading); border-bottom: 1px solid var(--muted); }
.tagline { margin: 3rem 0 4rem; color: var(--muted); font-size: 1.1em; font-style: oblique 8deg; line-height: 1.6; text-align: center; }
.tagline::after { content: ""; display: block; width: 2.5rem; margin: 3rem auto 0; border-top: 1px solid var(--muted); opacity: 0.5; }
main { flex: 1; }
footer { display: flex; gap: 1.5rem; margin-top: 4rem; padding-top: 0.9rem; border-top: 3px double var(--muted); }

.posts { list-style: none; padding: 0; }
.posts li { margin: 0.5rem 0; }

pre, code { font-family: var(--mono); font-size: 0.9em; }
pre { padding: 1rem; overflow-x: auto; background: var(--code-bg); }
:not(pre) > code { padding: 0.1em 0.3em; background: var(--code-bg); }

details { margin: 1.5rem 0; padding-left: 1rem; border-left: 1px solid var(--muted); }
summary { color: var(--muted); cursor: pointer; }
summary:hover { color: var(--fg); }
details[open] summary { margin-bottom: 1rem; }

.footnote-reference { font-size: 0.75em; line-height: 0; }
.footnote-reference a, .footnotes a { text-decoration: none; }
.footnotes { margin-top: 3rem; padding-top: 0.3rem; border-top: 1px solid var(--muted); color: var(--muted); font-size: 0.9em; }
.footnotes ol { padding-left: 1.5rem; }
.footnotes p { margin: 0.5rem 0; }
.footnotes li:target { color: var(--fg); }
/* figures that break out of the text column, centered and never wider than the screen */
.bleed { width: min(calc(100vw - 2rem), 88rem); margin-left: 50%; transform: translateX(-50%); }
.bleed img, .bleed video { width: 100%; }
.pair, .split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  nav, footer { gap: 1rem; }
  #theme { width: auto; }
}
