@font-face { font-family: "PP Eiko"; src: url("/fonts/PPEiko-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #efebe3;
  --ink: #1c1a17;
  --ink-2: #57524a;
  --ink-3: #8a847a;
  --line: rgba(28, 26, 23, 0.12);
  --accent: #2554d6;
  --accent-soft: rgba(37, 84, 214, 0.1);
  --code-bg: #f0ece3;
  --note: #2554d6; --tip: #18794e; --warning: #b45309; --important: #7c3aed; --caution: #c2410c;
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.06), 0 12px 32px rgba(28, 26, 23, 0.1);
  --display: "PP Eiko", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14130f; --surface: #1b1a15; --surface-2: #24221c; --ink: #f0ede6; --ink-2: #b9b4a8; --ink-3: #847f74;
    --line: rgba(240, 237, 230, 0.13); --accent: #7aa2ff; --accent-soft: rgba(122, 162, 255, 0.13); --code-bg: #211f19;
    --note: #7aa2ff; --tip: #4ade80; --warning: #fbbf24; --important: #c4b5fd; --caution: #fb923c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14130f; --surface: #1b1a15; --surface-2: #24221c; --ink: #f0ede6; --ink-2: #b9b4a8; --ink-3: #847f74;
  --line: rgba(240, 237, 230, 0.13); --accent: #7aa2ff; --accent-soft: rgba(122, 162, 255, 0.13); --code-bg: #211f19;
  --note: #7aa2ff; --tip: #4ade80; --warning: #fbbf24; --important: #c4b5fd; --caution: #fb923c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font: 12px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--surface); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-mark { font: 500 26px/1 var(--display); letter-spacing: -0.01em; }
.brand-docs { font-size: 13px; color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-link { font-size: 14px; color: var(--ink-2); text-decoration: none; padding: 6px 8px; }
.top-link:hover { color: var(--ink); }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 8px; width: 36px; height: 36px; font-size: 18px; }
.icon-btn:hover { background: var(--surface-2); }
.nav-toggle { display: none; }
.search-open { display: flex; align-items: center; gap: 24px; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-3); font-size: 14px; min-width: 220px; justify-content: space-between; }
.search-open:hover { border-color: var(--ink-3); }
.btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--ink-3); }
.btn-ask { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-ask:hover { opacity: 0.9; border-color: var(--ink); }
.btn-quiet { height: 30px; padding: 0 10px; font-size: 13px; color: var(--ink-2); background: transparent; }

.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 232px; max-width: 1360px; margin: 0 auto; }
.side { position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); overflow-y: auto; padding: 24px 12px 40px 20px; border-right: 1px solid var(--line); }
.side-group { margin-bottom: 22px; }
.side-title { margin: 0 0 6px 10px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.side ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; padding: 5px 10px; border-radius: 8px; font-size: 14.5px; line-height: 1.4; color: var(--ink-2); text-decoration: none; }
.side a:hover { background: var(--surface-2); color: var(--ink); }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.main { min-width: 0; padding: 40px 48px 96px; }
.doc { max-width: 760px; margin: 0 auto; }
.toc { position: sticky; top: 60px; align-self: start; max-height: calc(100vh - 60px); overflow-y: auto; padding: 40px 20px 40px 8px; font-size: 13.5px; }
.toc-title { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.toc a { display: block; padding: 3px 8px; border-radius: 6px; color: var(--ink-3); text-decoration: none; line-height: 1.4; }
.toc .toc-3 a { padding-left: 20px; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.doc-head { position: relative; margin-bottom: 28px; }
.eyebrow { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.doc-head h1 { margin: 0; font: 500 clamp(34px, 5vw, 48px)/1.08 var(--display); letter-spacing: -0.015em; }
.lede { margin: 12px 0 0; font-size: 19px; line-height: 1.55; color: var(--ink-2); }
.badges { margin: 12px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.badge-plan { background: var(--accent-soft); color: var(--accent); }
.badge-status { background: rgba(180, 83, 9, 0.12); color: var(--warning); }
.page-actions { position: absolute; right: 0; top: -4px; display: flex; gap: 6px; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: 36px; z-index: 20; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.menu-list a { display: block; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 14px; }
.menu-list a:hover { background: var(--surface-2); }

.prose > :first-child { margin-top: 0; }
.prose h2 { font: 500 30px/1.2 var(--display); letter-spacing: -0.01em; margin: 52px 0 12px; }
.prose h3 { font-size: 19px; line-height: 1.3; margin: 34px 0 8px; }
.prose h4 { font-size: 16px; margin: 24px 0 6px; }
.prose h2, .prose h3, .prose h4 { position: relative; }
.anchor { position: absolute; left: -22px; top: 0; color: var(--ink-3); text-decoration: none; opacity: 0; font-weight: 400; }
.prose :is(h2, h3, h4):hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin: 5px 0; }
.prose li > ul, .prose li > ol { margin: 6px 0 4px; }
.prose li > p { margin: 8px 0; }
.prose ol > li::marker { color: var(--ink-3); font-weight: 600; }
.prose code { font: 0.88em var(--mono); background: var(--code-bg); padding: 2px 6px; border-radius: 6px; }
.prose pre { position: relative; margin: 0 0 18px; padding: 14px 16px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: 13.5px; }
.copy-code { position: absolute; right: 8px; top: 8px; height: 26px; padding: 0 9px; font-size: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink-2); opacity: 0; }
.prose pre:hover .copy-code, .copy-code:focus { opacity: 1; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.prose img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.prose blockquote { margin: 0 0 16px; padding: 10px 16px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); }
.prose blockquote > :last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 14px; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.callout { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--callout, var(--note)) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--callout, var(--note)) 28%, transparent); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 4px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--callout, var(--note)); }
.callout-tip { --callout: var(--tip); } .callout-warning { --callout: var(--warning); } .callout-important { --callout: var(--important); } .callout-caution { --callout: var(--caution); }

.doc-foot { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-3); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; min-width: 160px; }
.pager a:hover { border-color: var(--ink-3); }
.pager span { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.pager-next { margin-left: auto; text-align: right; }

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 19, 15, 0.45); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.overlay[hidden] { display: none; }
.search-box { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.search-box input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 16px 18px; font: 17px var(--sans); color: var(--ink); outline: none; }
.search-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.search-results a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--accent-soft); }
.search-results strong { display: block; font-size: 15px; }
.search-results small { display: block; color: var(--ink-3); font-size: 13px; }
.search-results p { margin: 0; padding: 18px; color: var(--ink-3); }
.search-ask { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: var(--surface-2); padding: 12px 18px; font-size: 14px; color: var(--ink-2); }

.ask { position: fixed; right: 0; top: 0; bottom: 0; z-index: 70; width: min(440px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); }
.ask[hidden] { display: none; }
.ask-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ask-head h2 { margin: 0; font: 500 22px var(--display); }
.ask-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; font-size: 15px; line-height: 1.55; }
.msg-user { align-self: flex-end; background: var(--ink); color: var(--bg); padding: 8px 13px; border-radius: 14px 14px 4px 14px; }
.msg-bot { align-self: flex-start; }
.msg-bot > :first-child { margin-top: 0; } .msg-bot p { margin: 0 0 10px; } .msg-bot ul, .msg-bot ol { margin: 0 0 10px; padding-left: 20px; }
.msg-bot pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; font-size: 13px; }
.msg-bot code { font: 0.9em var(--mono); background: var(--code-bg); padding: 1px 5px; border-radius: 5px; }
.msg-bot pre code { background: none; padding: 0; }
.msg-error { color: var(--caution); }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sources a { font-size: 12.5px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; color: var(--ink-2); }
.sources a:hover { border-color: var(--accent); color: var(--accent); }
.ask-suggest { display: flex; flex-direction: column; gap: 8px; }
.ask-suggest p { margin: 0; color: var(--ink-3); font-size: 14px; }
.ask-suggest button { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 14px; }
.ask-suggest button:hover { border-color: var(--accent); }
.ask-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.ask-form textarea { flex: 1; resize: none; height: 44px; max-height: 140px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font: 15px/1.4 var(--sans); color: var(--ink); }
.ask-form .btn { height: 44px; }
.ask-note { padding: 0 14px 10px; font-size: 12px; color: var(--ink-3); }

@media (max-width: 1180px) { .shell { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-block; }
  .side { position: fixed; z-index: 40; left: 0; top: 60px; bottom: 0; width: min(320px, 86vw); height: auto; background: var(--bg); transform: translateX(-100%); transition: transform 0.18s; }
  body.nav-open .side { transform: none; box-shadow: var(--shadow); }
  .main { padding: 28px 16px 72px; }
  .search-open span, .search-open kbd, .top-link { display: none; }
  .search-open { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-open::before { content: "⌕"; font-size: 18px; color: var(--ink-2); }
  .page-actions { position: static; margin-bottom: 8px; }
  .anchor { display: none; }
  .prose h2 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
