
:root {
  --bg: #ffffff; --bg-soft: #f7f7f5; --bg-code: #f4f3ef; --border: #e7e5df; --text: #1f2328; --muted: #5f6670;
  --accent: #c2620a; --accent-strong: #a35208; --accent-soft: #fdf0e3; --link: #a35208;
  --callout-bg: #fff7e6; --callout-border: #f2c26b; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --bg-soft: #17181b; --bg-code: #1d1f23; --border: #2a2c31; --text: #e8e6e3; --muted: #9aa0a8;
    --accent: #f7b548; --accent-strong: #f9c86e; --accent-soft: #2a2213; --link: #f5b544;
    --callout-bg: #221c10; --callout-border: #6b5222; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214; --bg-soft: #17181b; --bg-code: #1d1f23; --border: #2a2c31; --text: #e8e6e3; --muted: #9aa0a8;
  --accent: #f7b548; --accent-strong: #f9c86e; --accent-soft: #2a2213; --link: #f5b544;
  --callout-bg: #221c10; --callout-border: #6b5222; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand em { font-style: normal; font-weight: 600; font-size: 13px; letter-spacing: .04em; color: var(--muted);
  padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; margin-top: 4px; }
.logo { height: 40px; width: auto; display: block; }
/* The wordmark has a light and a dark version; show the one for the current theme. */
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search input { width: 100%; height: 38px; padding: 0 40px 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: 14px; outline: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search kbd { position: absolute; right: 10px; top: 9px; font: 12px/18px ui-monospace, monospace; padding: 0 6px;
  border: 1px solid var(--border); border-radius: 5px; color: var(--muted); }
.results { position: absolute; top: 44px; left: 0; right: 0; max-height: 70vh; overflow: auto; background: var(--bg);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.results a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.results a:hover, .results a.active { background: var(--accent-soft); text-decoration: none; }
.results small { display: block; color: var(--muted); font-size: 12px; }
.results .snippet { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: 2px; }
.results mark { background: transparent; color: var(--accent-strong); font-weight: 700; }
.results .empty { padding: 12px; color: var(--muted); font-size: 14px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text); display: grid; place-items: center; cursor: pointer; font-size: 18px; flex: none; }
.icon-btn:hover { border-color: var(--accent); }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}
.menu-btn { display: none; }

.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr) 230px; max-width: 1440px; margin: 0 auto; }
.sidebar { position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto; padding: 24px 16px 40px 20px;
  border-right: 1px solid var(--border); }
.nav-group { margin-bottom: 22px; }
.nav-group p { margin: 0 0 6px 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text); font-size: 15px; }
.nav-group a:hover { background: var(--bg-soft); text-decoration: none; }
.nav-group a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.scrim { display: none; }

.content { padding: 36px 56px 80px; min-width: 0; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.doc { max-width: 820px; }
.doc h1 { font-size: 36px; line-height: 1.2; margin: 0 0 24px; letter-spacing: -.02em; }
.doc h2 { font-size: 24px; line-height: 1.3; margin: 48px 0 14px; padding-top: 8px; border-top: 1px solid var(--border); letter-spacing: -.01em; }
.doc h3 { font-size: 19px; margin: 32px 0 10px; }
.doc h2:first-of-type { border-top: 0; }
.anchor { margin-left: 8px; color: var(--muted); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.doc p, .doc li { color: var(--text); }
.doc ul, .doc ol { padding-left: 24px; }
.doc li { margin: 4px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0; }
.doc strong { font-weight: 650; }
.doc em { color: var(--text); }
.doc code { font: 0.88em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg-code); padding: 2px 6px; border-radius: 6px; }
.doc pre { background: var(--bg-code); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; overflow: auto; line-height: 1.5; }
.doc pre code { background: none; padding: 0; font-size: 14px; }
.doc pre.diagram { background: var(--bg-soft); }
.doc table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom-width: 2px; }
.doc tr:hover td { background: var(--bg-soft); }
.doc figure { margin: 18px 0 26px; }
.doc figure img { display: block; max-width: 100%; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.doc figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.doc li figure { margin: 12px 0 18px; }
.doc .video { padding: 14px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 16px; }
.doc .video video { display: block; width: 100%; border-radius: 10px; background: #000; aspect-ratio: 16 / 10; }
.callout { display: flex; gap: 12px; margin: 18px 0; padding: 14px 16px; border-radius: 12px; background: var(--callout-bg);
  border: 1px solid var(--callout-border); }
.callout > div > :first-child { margin-top: 0; }
.callout > div > :last-child { margin-bottom: 0; }
.callout-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #1a1204; font-weight: 800; font-size: 13px; margin-top: 2px; }
.doc input[type="checkbox"] { width: 16px; height: 16px; margin: 0 8px 0 0; vertical-align: -2px; accent-color: var(--accent); }
.doc li:has(> input[type="checkbox"]) { list-style: none; margin-left: -22px; }

.pager { max-width: 820px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .next { text-align: right; }
.pager small { display: block; color: var(--muted); font-size: 12px; }
.pager span { font-weight: 600; color: var(--accent-strong); }

.toc { position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto; padding: 36px 20px 40px 8px; font-size: 14px; }
.toc p { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; color: var(--muted); border-left: 2px solid transparent; line-height: 1.4; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; }

@media (max-width: 1180px) { .layout { grid-template-columns: 250px minmax(0, 1fr); } .toc { display: none; } .content { padding: 32px 40px 72px; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: grid; }
  .brand em { display: none; }
  .sidebar { position: fixed; top: 60px; left: 0; bottom: 0; width: 280px; height: auto; z-index: 25; background: var(--bg);
    transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 60px 0 0; z-index: 20; background: rgba(0,0,0,.35); }
  .content { padding: 24px 16px 64px; }
  .doc h1 { font-size: 28px; }
  .search kbd { display: none; }
  .pager { grid-template-columns: 1fr; }
}
