@font-face {
  font-family: "EB Garamond";
  src: url("eb-garamond-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: rgb(6 5 12);
  --bg-2: rgb(15 8 15);
  --card: rgb(20 12 19);
  --line: rgb(58 30 44);
  --text: rgb(226 220 224);
  --dim: rgb(150 146 162);
  --accent: rgb(232 112 122);
  --peach: rgb(234 160 116);
  --code-bg: rgb(26 17 26);
  --ok: rgb(112 196 142);
  --warn: rgb(234 176 96);
  --stub: rgb(157 170 193);
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "EB Garamond", Garamond, "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --side: 290px;
  --bar: 56px;
}
:root[data-theme="light"] {
  --bg: rgb(250 247 244);
  --bg-2: rgb(243 237 233);
  --card: rgb(255 255 255);
  --line: rgb(224 210 208);
  --text: rgb(36 26 34);
  --dim: rgb(104 94 108);
  --accent: rgb(176 44 70);
  --peach: rgb(168 88 40);
  --code-bg: rgb(240 232 230);
  --ok: rgb(30 124 70);
  --warn: rgb(160 100 10);
  --stub: rgb(84 100 130);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: rgb(250 247 244);
    --bg-2: rgb(243 237 233);
    --card: rgb(255 255 255);
    --line: rgb(224 210 208);
    --text: rgb(36 26 34);
    --dim: rgb(104 94 108);
    --accent: rgb(176 44 70);
    --peach: rgb(168 88 40);
    --code-bg: rgb(240 232 230);
    --ok: rgb(30 124 70);
    --warn: rgb(160 100 10);
    --stub: rgb(84 100 130);
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--bar) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.bar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand span { font: 600 20px/1 var(--serif); letter-spacing: .04em; }
.brand em { font-style: normal; color: var(--dim); font-size: 14px; }
.bar button {
  background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; height: 34px; min-width: 34px; font-size: 16px; cursor: pointer;
}
.bar button:hover { border-color: var(--accent); }
.menu { display: none; }

.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; height: 36px; padding: 0 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 15px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.results {
  position: absolute; left: 0; right: 0; top: 42px;
  max-height: 70vh; overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 32px rgb(0 0 0 / .35);
}
.results a { display: block; padding: 9px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a.sel { background: var(--bg-2); text-decoration: none; }
.results b { display: block; font-weight: 600; }
.results small { color: var(--dim); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .none { padding: 12px; color: var(--dim); }

.shell { display: flex; align-items: flex-start; }
.side {
  position: sticky; top: var(--bar);
  width: var(--side); flex: none;
  height: calc(100vh - var(--bar)); overflow: auto;
  padding: 16px 10px 40px 16px;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 14.5px;
}
.side a {
  display: block; padding: 5px 10px; border-radius: 6px;
  color: var(--text); line-height: 1.35;
}
.side a:hover { background: var(--card); text-decoration: none; }
.side a.on { background: var(--card); color: var(--accent); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.navtop { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.side details { margin: 2px 0; }
.side summary {
  cursor: pointer; padding: 7px 10px; border-radius: 6px;
  font: 600 17px/1.2 var(--serif); letter-spacing: .02em; color: var(--peach);
}
.side summary:hover { background: var(--card); }
.side details a { margin-left: 8px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 7px; vertical-align: middle; }
.dot.checked { background: var(--ok); }
.dot.partial { background: var(--warn); }
.dot.stub { background: var(--stub); }

main { flex: 1; min-width: 0; max-width: 980px; padding: 28px 40px 80px; }
.crumbs { color: var(--dim); font-size: 14px; }
.crumbs a { color: var(--dim); }
.crumbs span { margin: 0 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: .01em; }
h1 { font-size: 38px; margin: 8px 0 10px; }
h2 { font-size: 27px; margin: 40px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
h3 { font-size: 21px; margin: 28px 0 8px; color: var(--peach); }
h4 { margin: 20px 0 6px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--dim); font-size: 14px; }
.chip { padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; font-weight: 600; font-size: 13px; }
.chip.checked { color: var(--ok); }
.chip.partial { color: var(--warn); }
.chip.stub { color: var(--stub); }
.toc {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  padding: 10px 14px; margin: 0 0 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: 14.5px;
}
.toc b { width: 100%; color: var(--dim); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

article p, article li { max-width: 78ch; }
article li { margin: 4px 0; }
article ol > li { margin: 8px 0; }
code { font: 13.5px/1.5 var(--mono); background: var(--code-bg); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
pre {
  position: relative;
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow: auto;
}
pre code { background: none; padding: 0; overflow-wrap: normal; }
pre .copy {
  position: absolute; top: 6px; right: 6px;
  font: 12px var(--sans); color: var(--dim);
  background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 2px 8px; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
pre:hover .copy, pre .copy:focus { opacity: 1; }
.tbl { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--bg-2); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
blockquote { margin: 14px 0; padding: 4px 16px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 8px 8px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

.sources { margin-top: 48px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: 14.5px; }
.sources summary { cursor: pointer; color: var(--dim); }
.sources ul { margin: 10px 0; padding-left: 20px; }
footer { margin-top: 28px; color: var(--dim); font-size: 13px; }

@media (max-width: 900px) {
  .menu { display: block; }
  .brand em { display: none; }
  .side {
    position: fixed; left: 0; top: var(--bar); z-index: 15;
    transform: translateX(-100%); transition: transform .2s;
    width: min(88vw, 320px);
  }
  body.nav-open .side { transform: none; box-shadow: 12px 0 32px rgb(0 0 0 / .4); }
  main { padding: 20px 16px 64px; }
  h1 { font-size: 30px; }
  h2 { font-size: 23px; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
}
