:root {
  color-scheme: light dark;
  --bg: #fdfdfc;
  --fg: #1f2023;
  --muted: #6b6f76;
  --line: #e3e3e0;
  --link: #2f5fd0;
  --code-bg: #f4f4f2;
  --accent: #0f7b6c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --fg: #e6e6e4;
    --muted: #9aa0a8;
    --line: #2c2e33;
    --link: #7aa2f7;
    --code-bg: #1e2024;
    --accent: #4bb3a0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

header.site {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

header.site .brand {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

header.site nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.1rem;
  font-size: 0.94rem;
}

header.site nav a:hover,
header.site nav a[aria-current="page"] { color: var(--fg); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.7rem; line-height: 1.3; margin: 0 0 0.4rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 2.4rem 0 0.6rem; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 1.8rem 0 0.4rem; }

.lede { color: var(--muted); margin: 0 0 2.5rem; }

.meta { color: var(--muted); font-size: 0.88rem; margin: 0 0 2rem; }

ul.notes { list-style: none; padding: 0; margin: 0; }

ul.notes li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

ul.notes li:last-child { border-bottom: none; }

ul.notes .title { font-weight: 500; display: block; margin-bottom: 0.15rem; }
ul.notes .excerpt { color: var(--muted); font-size: 0.94rem; display: block; }
ul.notes .date { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.5;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

pre code { background: none; padding: 0; font-size: 1em; }

blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

table { border-collapse: collapse; width: 100%; font-size: 0.92rem; margin: 1.4rem 0; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); }
th { font-weight: 600; }

figure { margin: 1.8rem 0; }
figure img, figure svg { max-width: 100%; height: auto; display: block; }
figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 0.5rem; }

footer.site {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.notfound { text-align: center; padding: 4rem 0 2rem; }
.notfound .code { font-size: 3.4rem; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 0.3rem; }
