:root {
  --bg: #faf7f2;
  --text: #2b2824;
  --muted: #6b645b;
  --rule: #e3ddd3;
  --accent: #8a4b2a;
  --code-bg: #f0ebe3;
  --measure: 38rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a17;
    --text: #ece6dc;
    --muted: #a39b8f;
    --rule: #37332d;
    --accent: #e0a07a;
    --code-bg: #2a2723;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: 0.5rem; }

header.site, main, footer.site {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1rem;
}

header.site {
  padding-top: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9375rem;
}

header.site .name {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.375rem;
  text-decoration: none;
  letter-spacing: 0.01em;
}

header.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

header.site nav a {
  color: var(--muted);
  text-decoration: none;
}
header.site nav a:hover { color: var(--text); }
header.site nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }

main { padding-top: 2rem; padding-bottom: 3rem; }

h1, h2, h3 { line-height: 1.25; font-weight: 600; position: relative; }
h1 { font-size: 2rem; margin: 0 0 1.5rem; }
h2 { font-size: 1.4rem; margin: 2.75rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }

.anchor {
  position: absolute;
  left: -1.1em;
  width: 1em;
  color: var(--rule);
  text-decoration: none;
  opacity: 0;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }

p, ul, ol, blockquote, pre, table { margin: 0 0 1.1rem; }
li { margin: 0.25rem 0; }
strong { font-weight: 650; }

blockquote {
  margin-left: 0;
  padding-left: 1.1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
a code { color: inherit; }

pre {
  overflow-x: auto;
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 4px;
}
pre code { background: none; padding: 0; }

pre.legal {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

table { border-collapse: collapse; width: 100%; font-size: 0.95em; display: block; overflow-x: auto; }
th, td { border-bottom: 1px solid var(--rule); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }

details.toc {
  margin: 0 0 2rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.95rem;
}
details.toc summary { cursor: pointer; color: var(--muted); }
details.toc ol { margin: 0.75rem 0 0; padding-left: 1.5rem; }
details.toc li { margin: 0.2rem 0; }

footer.site {
  padding-top: 1.25rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.5;
}
footer.site a { color: inherit; }
footer.site code { background: none; padding: 0; }

@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  h1 { font-size: 1.65rem; }
  .anchor { display: none; }
}

@media print {
  header.site nav, .toc, .anchor, .skip { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}
