:root {
  --bg: #fbfaf7;
  --fg: #1b1b1a;
  --muted: #6e6b65;
  --rule: #e3e0d9;
  --accent: #9b2c2c;
  --code-bg: #f1efe9;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Source Serif Pro", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --fg: #e6e3dc;
    --muted: #8f8b83;
    --rule: #2a2927;
    --accent: #e07a6b;
    --code-bg: #1c1b19;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 var(--serif);
}
header.site, main, footer { width: min(680px, calc(100% - 32px)); margin-inline: auto; }
::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

/* chrome */
header.site {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px;
  padding: 28px 0 12px; border-bottom: 1px solid var(--rule);
  font: 14px var(--mono);
}
.brand { font-weight: 600; text-decoration: none; }
nav a { margin-left: 16px; color: var(--muted); text-decoration: none; }
nav a:first-child { margin-left: 0; }
nav a:hover { color: var(--fg); }
main { padding: 48px 0 64px; }
footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  border-top: 1px solid var(--rule); padding: 16px 0 40px;
  font: 12px var(--mono); color: var(--muted);
}

/* type */
h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 8px; }
.meta, .tags, time { font: 13px var(--mono); color: var(--muted); }
.meta { margin: 0; }
.kicker { font: 12px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin: 0 0 10px; }
.kicker a { text-decoration: none; }
.lede { color: var(--muted); margin: 0 0 6px; }

/* index */
.head { margin-bottom: 8px; }
.year {
  font: 400 13px var(--mono); color: var(--muted);
  border-bottom: 1px solid var(--fg); padding-bottom: 6px; margin: 40px 0 0;
}
ol.index { list-style: none; margin: 0; padding: 0; }
ol.index li {
  display: grid; grid-template-columns: 4em 1fr auto; gap: 16px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
ol.index a { text-decoration: none; }
ol.index a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
@media (max-width: 560px) {
  ol.index li { grid-template-columns: 3.2em 1fr; }
  ol.index .tags { display: none; }
}
ul.taglist { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px; font: 14px var(--mono); }
ul.taglist li { border: 1px solid var(--rule); padding: 4px 10px; }
ul.taglist a { text-decoration: none; }
ul.taglist span { color: var(--muted); margin-left: 8px; }

/* note */
header.doc { margin-bottom: 28px; }
.cover { display: block; width: 100%; height: auto; margin: 0 0 28px; border: 1px solid var(--rule); }
.abstract { border-left: 2px solid var(--accent); padding: 2px 0 2px 16px; margin: 0 0 28px; color: var(--muted); font-style: italic; }
.abstract span { display: block; font: normal 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
details.toc { border: 1px solid var(--rule); padding: 10px 14px; margin: 0 0 32px; font: 14px/1.7 var(--mono); }
details.toc summary { cursor: pointer; color: var(--muted); }
details.toc ul { margin: 8px 0 0; padding-left: 18px; }
details.toc a { text-decoration: none; }

.prose h2 { font-size: 1.3rem; margin: 2.2em 0 0.6em; }
.prose h3 { font-size: 1.05rem; margin: 1.8em 0 0.4em; }
.prose img { max-width: 100%; height: auto; }
.prose blockquote { margin: 1.5em 0; padding-left: 16px; border-left: 2px solid var(--rule); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }
code { font-family: var(--mono); font-size: 0.86em; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 3px; }
pre { background: var(--code-bg); padding: 14px 16px; overflow-x: auto; border-radius: 4px; font-size: 14px; line-height: 1.5; }
table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 15px; margin: 1.5em 0; }
th, td { border-bottom: 1px solid var(--rule); padding: 6px 12px 6px 0; text-align: left; vertical-align: top; }
th { font: 11px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom-color: var(--fg); }

.pager {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--rule);
  font: 13px var(--mono);
}
.pager a { margin: 0; color: var(--muted); }
.pager a:last-child { text-align: right; }
