@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Syne:wght@700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #FFFFFF;
  --side: #FBFBFB;
  --paper: #FFFFFF;
  --ink: #0A0A0A;
  --body: #3B3B3B;
  --muted: #6A6A6A;
  --faint: #9A9A9A;
  --line: #ECECEC;
  --line-2: #F4F4F4;
  --accent: #0A0A0A;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sidew: 260px;
  --tocw: 220px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--body); font-family: var(--font); font-size: 15.5px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
::selection { background: #0A0A0A; color: #fff; }

/* ---- layout ---- */
.shell { display: grid; grid-template-columns: var(--sidew) minmax(0,1fr); min-height: 100vh; }
@media (min-width: 1240px) { .shell { grid-template-columns: var(--sidew) minmax(0,1fr) var(--tocw); } }
.sidebar { background: var(--side); border-right: 1px solid var(--line); position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 18px 14px 40px; }
.sidebar > .brand { display: none; } /* brand now lives in the top header */
.content { min-width: 0; }

/* ---- persistent GitBook-style top header ---- */
.topbar { display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(255,255,255,.88); backdrop-filter: saturate(160%) blur(12px); z-index: 40; }
.db-brand { display: flex; align-items: center; gap: 9px; font-family: 'Syne', var(--font); font-weight: 800; font-size: 17px; letter-spacing: -.03em; color: var(--ink); white-space: nowrap; }
.db-brand .db-mark { height: 21px; width: auto; display: block; }
.db-brand b { font-weight: 700; color: var(--faint); }
.db-search { flex: 0 1 380px; margin-left: 6px; }
.db-search input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px 0 34px; font-family: var(--font); font-size: 13.5px; color: var(--ink); background: #FAFAFA url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%239A9A9A' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat 11px center; }
.db-search input:focus { outline: none; border-color: #C9C9C9; background-color: #fff; }
.db-app { margin-left: auto; font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.db-app:hover { color: var(--ink); }

/* ---- brand ---- */
.brand { display: flex; align-items: center; gap: 9px; font-family: 'Syne', var(--font); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; padding: 2px 10px 22px; color: var(--ink); }
.brand .mark { height: 28px; width: auto; }

/* ---- sidebar nav ---- */
.nav-group { margin-top: 20px; }
.nav-group .gl { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 0 10px 8px; }
.nav-group a { display: block; padding: 7px 10px; border-radius: 8px; font-size: 14px; color: var(--muted); font-weight: 500; transition: color .12s, background .12s; }
.nav-group a:hover { background: #F0F0F0; color: var(--ink); }
.nav-group a.active { background: #0A0A0A; color: #fff; font-weight: 600; }
.side-foot { margin-top: 30px; padding: 16px 10px 0; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--faint); line-height: 1.9; }
.side-foot a { color: var(--muted); }
.side-foot a:hover { color: var(--ink); }

/* ---- content ---- */
.doc-wrap { max-width: 740px; margin: 0 auto; padding: 60px 56px 120px; }
.doc { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.doc h1 { color: var(--ink); font-family: var(--font); font-weight: 800; font-size: 40px; letter-spacing: -0.035em; margin: 0 0 18px; line-height: 1.08; }
.doc h2 { color: var(--ink); font-family: var(--font); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; margin: 52px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.doc h3 { color: var(--ink); font-family: var(--font); font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; margin: 30px 0 8px; }
.doc p { color: var(--body); margin: 0 0 15px; }
.doc .lede { font-size: 19px; line-height: 1.55; color: var(--ink); font-weight: 400; margin-bottom: 10px; letter-spacing: -0.01em; }
.doc a:not(.doc-nav a) { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: #cfcfcf; }
.doc a:hover { text-decoration-color: var(--ink); }
.doc ul { margin: 0 0 18px; padding-left: 0; list-style: none; }
.doc ul li { position: relative; padding-left: 22px; margin: 9px 0; color: var(--body); }
.doc ul li::before { content: ''; position: absolute; left: 3px; top: 11px; width: 6px; height: 6px; border-radius: 2px; background: var(--ink); }
.doc strong { font-weight: 600; color: var(--ink); }
.doc code { font-family: var(--mono); font-size: 12.5px; background: #F3F3F3; border: 1px solid var(--line); border-radius: 5px; padding: 1.5px 6px; color: #0A0A0A; }
.doc hr { border: none; border-top: 1px solid var(--line); margin: 40px 0; }

/* callouts */
.note { border: 1px solid var(--line); border-left: 3px solid var(--ink); background: #FAFAFA; border-radius: 0 12px 12px 0; padding: 16px 18px; margin: 22px 0; font-size: 14.5px; color: var(--muted); }
.note.warn { border-left-color: #C99700; background: #FFFCF3; }
.note b { color: var(--ink); }

/* code blocks */
.code { position: relative; background: #0C0C0C; border-radius: 12px; margin: 18px 0; overflow: hidden; border: 1px solid #1c1c1c; }
.code::before { content: ''; display: block; height: 38px; background: #141414; border-bottom: 1px solid #232323; }
.code .dots { position: absolute; top: 14px; left: 16px; display: flex; gap: 7px; }
.code .dots i { width: 10px; height: 10px; border-radius: 50%; background: #2e2e2e; }
.code pre { margin: 0; padding: 16px 20px 20px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: #E6E6E6; }
.code .copy { position: absolute; top: 8px; right: 9px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #B6B6B6; font-family: var(--mono); font-size: 11px; padding: 4px 10px; border-radius: 7px; cursor: pointer; z-index: 2; }
.code .copy:hover { background: rgba(255,255,255,.14); color: #fff; }
.tok-c { color: #7C7C7C; } .tok-s { color: #B8B8B8; } .tok-k { color: #fff; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; display: block; overflow-x: auto; }
.tbl th { text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 0 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; color: var(--body); }
.tbl tr:hover td { background: #FAFAFA; }
.tbl td.m { font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.tbl td .method { font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.method.get { background: #F0F0F0; color: #0A0A0A; } .method.post { background: #0A0A0A; color: #fff; } .method.any { background: #fff; color: #0A0A0A; border: 1px solid #DADADA; }

/* doc footer nav */
.doc-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 60px; border-top: 1px solid var(--line); padding-top: 26px; }
.doc-nav a { display: block; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; min-width: 0; flex: 0 1 48%; transition: border-color .14s, box-shadow .14s, transform .14s; }
.doc-nav a:hover { border-color: #C9C9C9; box-shadow: 0 12px 28px -18px rgba(0,0,0,.25); transform: translateY(-2px); }
.doc-nav .dir { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.doc-nav .t { font-family: var(--font); font-weight: 700; color: var(--ink); margin-top: 4px; letter-spacing: -0.01em; }
.doc-nav a.next { text-align: right; margin-left: auto; }

/* ---- right TOC ---- */
.toc { display: none; }
@media (min-width: 1240px) {
  .toc { display: block; position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); overflow-y: auto; padding: 30px 22px 40px; }
  .toc-l { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-bottom: 14px; }
  .toc a { display: block; font-size: 13px; color: var(--muted); padding: 5px 0 5px 12px; border-left: 2px solid var(--line); line-height: 1.4; transition: color .12s, border-color .12s; }
  .toc a.t-h3 { padding-left: 24px; font-size: 12.5px; }
  .toc a:hover { color: var(--ink); }
  .toc a.on { color: var(--ink); border-left-color: var(--ink); font-weight: 600; }
}

/* ---- responsive ---- */
.menu-btn { display: none; }
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 20px 60px -20px rgba(0,0,0,.4); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; width: 38px; height: 38px; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto; }
  .db-search { display: none; }
  .db-brand { font-size: 16px; }
  .doc-wrap { padding: 34px 22px 90px; }
  .doc h1 { font-size: 32px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; display: none; }
  .scrim.on { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* quick-link cards */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0 8px; }
@media (max-width: 560px) { .card-grid { grid-template-columns: 1fr; } }
.dcard { display: block; border: 1px solid var(--line); border-radius: 13px; padding: 16px 18px; text-decoration: none; transition: border-color .12s, transform .12s; }
.dcard:hover { border-color: #c9c9c9; transform: translateY(-1px); }
.dc-t { font-weight: 700; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.dc-d { color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* heading anchors */
.doc h2, .doc h3 { position: relative; }
.doc h2 .anchor, .doc h3 .anchor { opacity: 0; text-decoration: none; color: var(--faint); margin-left: 8px; font-weight: 400; transition: opacity .12s; }
.doc h2:hover .anchor, .doc h3:hover .anchor { opacity: 1; }

/* sidebar search states */
.nav-group.hide { display: none; }
.nav-group a.hide { display: none; }
.nav-empty { display: none; padding: 10px; font-size: 13px; color: var(--faint); font-family: var(--mono); }
.nav-empty.on { display: block; }

/* header github link */
.db-gh { margin-left: auto; font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.db-gh:hover { color: var(--ink); }
.db-gh + .db-app { margin-left: 18px; }
@media (max-width: 880px) { .db-gh { display: none; } }
