:root {
  --bg: #fbfaf8; --bg-soft: #f3f1ed; --bg-elev: #ffffff; --text: #1f1e1c; --muted: #6d6a64;
  --faint: #a39f97; --line: #e5e1da; --accent: #8a5a2b; --accent-soft: #f2e7da; --mark: #fbe9a8;
  --code-bg: #f1eee8; --radius: 8px; --sidebar: 16.5rem; --toc: 14rem; --measure: 44rem;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --read: "Iowan Old Style", "New York", "Charter", "Georgia", ui-serif, serif;
  --mono: "SF Mono", ui-monospace, "Menlo", "Cascadia Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #19191b; --bg-soft: #202023; --bg-elev: #242428; --text: #e8e6e3; --muted: #a09c96;
    --faint: #6f6c68; --line: #313136; --accent: #d9a86c; --accent-soft: #3a2f22; --mark: #5c4b16; --code-bg: #242428; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--ui); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 50; background: var(--bg-elev); padding: .5rem .8rem; border-radius: var(--radius); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; height: 3.5rem;
  padding: 0 1.25rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.site-title { font-weight: 650; color: var(--text); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle { display: none; width: 2.25rem; height: 2.25rem; border: 0; background: transparent; border-radius: var(--radius); padding: .55rem .5rem; cursor: pointer; flex-direction: column; justify-content: space-between; }
.nav-toggle span { display: block; height: 2px; border-radius: 1px; background: var(--text); }
.search { position: relative; margin-left: auto; width: min(22rem, 45vw); }
.search input { width: 100%; height: 2.1rem; padding: 0 2rem 0 .8rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-elev); color: var(--text); font: inherit; font-size: .9rem; outline: none; -webkit-appearance: none; appearance: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-hint { position: absolute; right: .6rem; top: .42rem; font: 600 .7rem var(--mono); color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; }
.search-results { position: absolute; right: 0; top: 2.6rem; width: min(30rem, 92vw); max-height: 70vh; overflow: auto; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.16); padding: .35rem; }
.search-results a { display: block; padding: .55rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--accent-soft); }
.search-results .r-title { font-weight: 600; font-size: .95rem; }
.search-results .r-snippet { color: var(--muted); font-size: .82rem; line-height: 1.45; margin-top: .15rem; }
.search-results .r-empty { padding: .8rem; color: var(--muted); font-size: .9rem; }
.search-results mark { background: var(--mark); color: inherit; border-radius: 2px; }

.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc); gap: 0 2.5rem; max-width: 86rem; margin: 0 auto; }
.sidebar { position: sticky; top: 3.5rem; align-self: start; height: calc(100vh - 3.5rem); overflow: auto; padding: 1.5rem .75rem 3rem 1.25rem; font-size: .9rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar ul ul { padding-left: .75rem; border-left: 1px solid var(--line); margin-left: .5rem; }
.sidebar a { display: block; padding: .28rem .6rem; border-radius: 6px; color: var(--muted); text-decoration: none; line-height: 1.35; }
.sidebar a:hover { color: var(--text); background: var(--bg-soft); }
.sidebar a.active { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.sidebar summary { cursor: pointer; padding: .35rem .6rem; color: var(--text); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::before { content: "›"; display: inline-block; width: 1em; transition: transform .15s; color: var(--faint); }
.sidebar details[open] > summary::before { transform: rotate(90deg); }
.sidebar .folder { margin-top: .5rem; }

.content { min-width: 0; padding: 2.5rem 0 6rem; }
.note { max-width: var(--measure); font-family: var(--read); font-size: 1.1rem; line-height: 1.7; }
.note h1, .note h2, .note h3, .note h4, .note h5, .note h6 { font-family: var(--ui); line-height: 1.25; letter-spacing: -0.015em; margin: 2.2em 0 .6em; }
.note h1 { font-size: 2.15rem; margin-top: 0; letter-spacing: -0.025em; }
.note h2 { font-size: 1.5rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.note h3 { font-size: 1.22rem; }
.note h4 { font-size: 1.05rem; }
.note h5, .note h6 { font-size: .95rem; color: var(--muted); }
.note p, .note ul, .note ol, .note blockquote, .note pre, .note .table-wrap, .note .callout { margin: 0 0 1.1em; }
.note li { margin: .25em 0; }
.note li > p { margin: .3em 0; }
.note ul.task-list { list-style: none; padding-left: .3rem; }
.note li.task input { margin: 0 .5rem 0 0; transform: translateY(1px); accent-color: var(--accent); }
.note blockquote { border-left: 3px solid var(--line); padding: .1rem 0 .1rem 1.1rem; color: var(--muted); font-style: italic; }
.note code { font-family: var(--mono); font-size: .84em; background: var(--code-bg); padding: .12em .35em; border-radius: 5px; }
.note pre { background: var(--code-bg); padding: 1rem 1.15rem; border-radius: var(--radius); overflow: auto; line-height: 1.5; }
.note pre code { background: none; padding: 0; font-size: .82rem; }
.note pre.raw-html { opacity: .8; }
.note img { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 1.2rem auto; }
.note hr { border: 0; height: 1px; background: var(--line); margin: 2.5rem 0; }
.note mark { background: var(--mark); color: inherit; padding: 0 .15em; border-radius: 3px; }
.note .tag, .page-tags .tag { font-family: var(--ui); font-size: .78em; color: var(--accent); background: var(--accent-soft); padding: .1em .5em; border-radius: 999px; white-space: nowrap; }
.page-tags { margin: -.4rem 0 1.6rem; }
.note .unavailable-link, .note .unavailable-image { color: var(--muted); border-bottom: 1px dashed var(--faint); cursor: help; }
.note .table-wrap { overflow-x: auto; }
.note table { border-collapse: collapse; font-family: var(--ui); font-size: .92rem; min-width: 50%; }
.note th, .note td { border-bottom: 1px solid var(--line); padding: .5rem .8rem; text-align: left; vertical-align: top; }
.note th { font-weight: 650; border-bottom-width: 2px; }
.note .align-center { text-align: center; } .note .align-right { text-align: right; }
.note .callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--bg-soft); border-radius: var(--radius); padding: .8rem 1rem .2rem; font-family: var(--ui); font-size: .98rem; }
.note .callout-title { font-weight: 650; margin-bottom: .4rem; }
.note .callout[data-callout="warning"], .note .callout[data-callout="caution"] { border-left-color: #c9822b; }
.note .callout[data-callout="danger"], .note .callout[data-callout="error"] { border-left-color: #c2453d; }
.note .callout[data-callout="tip"], .note .callout[data-callout="success"] { border-left-color: #3f8f5c; }
.page-title { margin-top: 0; }
.index-list { list-style: none; padding: 0; }
.index-list li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.index-list a { font-family: var(--ui); font-weight: 600; text-decoration: none; }
.index-list p { margin: .2rem 0 0; color: var(--muted); font-size: .95rem; }
.backlinks { max-width: var(--measure); margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .92rem; }
.backlinks-title, .toc-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 0 0 .6rem; }
.backlinks ul { margin: 0; padding-left: 1.1rem; }

.toc { position: sticky; top: 3.5rem; align-self: start; max-height: calc(100vh - 3.5rem); overflow: auto; padding: 2.6rem 1rem 2rem 0; font-size: .84rem; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: .22rem 0 .22rem .8rem; margin-left: -1px; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; line-height: 1.35; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.toc .toc-l3 a { padding-left: 1.5rem; } .toc .toc-l4 a { padding-left: 2.2rem; }
.scrim { position: fixed; inset: 3.5rem 0 0 0; background: rgba(0,0,0,.3); z-index: 9; }

@media (max-width: 1180px) { .layout { grid-template-columns: var(--sidebar) minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  body { font-size: 16px; }
  .layout { display: block; }
  .nav-toggle { display: flex; }
  .sidebar { position: fixed; z-index: 10; top: 3.5rem; left: 0; bottom: 0; width: min(20rem, 85vw); height: auto; background: var(--bg);
    border-right: 1px solid var(--line); transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  .content { padding: 1.6rem 1.25rem 4rem; }
  .note { font-size: 1.05rem; }
  .note h1 { font-size: 1.8rem; }
  .search { width: auto; flex: 1; }
  .search-hint { display: none; }
}
@media print { .topbar, .sidebar, .toc, .scrim { display: none !important; } .layout { display: block; } }