:root {
  --bg: #fff;
  --fg: #222832;
  --muted: #48566b;
  --border: #d1d5da;
  --accent: #0a7d91;
  --accent-hover: #06616f;
  --surface: #f3f4f5;
  --heading: #14181e;
  --inline-code: #912583;
  --reading-width: 48rem;
  --font-sans: -apple-system, "BlinkMacSystemFont", "Segoe UI", "Helvetica Neue", "Arial", sans-serif;
  --font-mono: "SFMono-Regular", "Menlo", "Consolas", "Monaco", "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181e;
    --fg: #ced6dd;
    --muted: #9ca4af;
    --border: #48566b;
    --accent: #3fb1c5;
    --accent-hover: #6ac7d8;
    --surface: #29313d;
    --heading: #fff;
    --inline-code: #f3c7ee;
  }
}
*, :before, :after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
}
.wrap { width: 100%; max-width: var(--reading-width); margin-inline: auto; padding-inline: 1.5rem; }
main { flex: 1; padding-block: 1.5rem 4rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-decoration-thickness: max(3px, .1875rem, .12em); text-decoration-skip-ink: none; }
h1, h2, h3, h4, h5, h6 {
  color: var(--heading);
  text-wrap: balance;
  margin: 2.75rem 0 1.05rem;
  font-weight: 400;
  line-height: 1.15;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
img, video { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin-block: 2.5rem; }
blockquote { border-left: .25rem solid var(--accent); background: var(--surface); color: var(--fg); margin-inline: 0; padding: .6rem 1rem; }
blockquote > :first-child { margin-top: 0; }
blockquote > :last-child { margin-bottom: 0; }
code { font-family: var(--font-mono); color: var(--inline-code); font-size: .875em; }
pre {
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: .25rem;
  padding: .8rem 1rem;
  font-size: .875rem;
  line-height: 1.55;
  position: relative;
  overflow-x: auto;
  background: var(--surface) !important;
}
pre code { color: inherit; font-size: inherit; }
.copy-btn {
  font-family: var(--font-sans);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  opacity: 0;
  border-radius: .25rem;
  padding: .15rem .45rem;
  font-size: .7rem;
  transition: opacity .12s;
  position: absolute;
  top: .35rem;
  right: .35rem;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn[data-copied=true] { opacity: 1; color: var(--accent); border-color: var(--accent); }
@media (hover: none) { .copy-btn { opacity: 1; } }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; border: 1px solid var(--border); padding: .5rem .65rem; }
th { background: var(--surface); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: .82rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
mjx-container[jax=SVG] { color: var(--fg); }
mjx-container[jax=SVG][display=true] { text-align: center; margin-block: 1rem; padding-block: .2rem; display: block; overflow: auto hidden; }
mjx-container[jax=SVG] svg { max-width: none; }
.visually-hidden { clip-path: inset(50%); white-space: nowrap; width: 1px; height: 1px; position: absolute; overflow: hidden; }

header.site { border-bottom: 1px solid var(--border); }
.bar { flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1.5rem; padding-block: 1.25rem; display: flex; }
.brand { color: var(--fg); letter-spacing: -.01em; font-size: 1.05rem; font-weight: 600; text-decoration: none; }
.brand:hover { color: var(--fg); text-decoration: none; }
nav.site { gap: 1.15rem; font-size: .95rem; display: flex; }
nav.site a { color: var(--muted); text-decoration: none; }
nav.site a:hover { color: var(--fg); }
nav.site a[aria-current=page] { color: var(--fg); font-weight: 500; }

footer.site { border-top: 1px solid var(--border); color: var(--muted); font-size: .875rem; }
footer.site .inner { flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding-block: 1.5rem; display: flex; }
footer.site .links { gap: 1rem; display: flex; }

/* Post page */
.post-header { margin-bottom: 1.5rem; }
.post-header h1 { margin-top: 0; margin-bottom: .75rem; }
.meta { color: var(--muted); margin: 0; font-size: .9rem; }
.tags { flex-wrap: wrap; gap: .35rem; margin: .75rem 0 0; padding: 0; list-style: none; display: flex; }
.tags li { font-family: var(--font-mono); color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: .25rem; padding: .1rem .4rem; font-size: .75rem; }
.prose h2 { border-top: 1px solid var(--border); margin-top: 3.25rem; padding-top: 1.5rem; font-size: 1.6rem; font-weight: 600; }
.prose h3 { margin-top: 2.25rem; margin-bottom: .75rem; font-size: 1.2rem; font-weight: 600; }
.prose p, .prose ul, .prose ol { margin-block: 0 1rem; }
.prose img { border: 1px solid var(--border); background: #fff; border-radius: .25rem; width: 100%; margin-block: 1.5rem .5rem; padding: .5rem; display: block; }
.prose p > em:only-child { color: var(--muted); font-size: .875rem; font-style: normal; display: block; }
.prose li { margin-bottom: .3rem; }
.prose table { margin-block: 1.25rem; }
.prose th.n, .prose td.n { text-align: right; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: .25rem; padding: .9rem 1.1rem; margin-block: 1.5rem 2rem; font-size: .92rem; }
.toc p { margin: 0 0 .5rem; font-weight: 600; color: var(--heading); }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 1.5rem; }
.toc li { margin-bottom: .25rem; break-inside: avoid; }
@media (max-width: 640px) { .toc ol { columns: 1; } }
.prose .note { border-left: .25rem solid var(--accent); background: var(--surface); padding: .7rem 1rem; margin-block: 1.5rem; }
.prose .note > :first-child { margin-top: 0; }
.prose .note > :last-child { margin-bottom: 0; }
.back { border-top: 1px solid var(--border); margin-top: 3.5rem; padding-top: 1.25rem; font-size: .9rem; }
.refs { font-size: .9rem; }
.refs li { margin-bottom: .5rem; }

/* Index */
.intro { color: var(--muted); border-bottom: 1px solid var(--border); max-width: 34rem; margin: 0 0 2.5rem; padding-bottom: 1.5rem; font-size: 1rem; }
.post-list { flex-direction: column; gap: 1.75rem; margin: 0; padding: 0; list-style: none; display: flex; }
.post-list a { font-size: 1.15rem; font-weight: 400; }
.date { color: var(--muted); font-size: .78rem; font-family: var(--font-mono); margin: .15rem 0 0; }
.desc { color: var(--muted); margin: .4rem 0 0; font-size: .95rem; }
.empty { color: var(--muted); }
