/* Docs layout + content styling. Uses the site's design tokens from shared.css. */
body { margin: 0; background: var(--bg); color: var(--text); }

.docs-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 92px 32px 96px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 52px;
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────────── */
.docs-side {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 6px;
}
.docs-side::-webkit-scrollbar { width: 6px; }
.docs-side::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.docs-search {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  margin-bottom: 18px;
  outline: none;
  transition: border-color .15s;
}
.docs-search:focus { border-color: var(--accent); }
.docs-search::placeholder { color: var(--muted); }

.docs-group { margin-bottom: 6px; }
.docs-group-h {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: 0;
  padding: 7px 8px;
  font-family: 'Inter Tight', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
}
.docs-group-h:hover { color: var(--text); }
.docs-group-h .chev { transition: transform .18s; flex-shrink: 0; opacity: .7; }
.docs-group.open .docs-group-h .chev { transform: rotate(90deg); }

.docs-group-items { display: none; padding: 2px 0 6px; }
.docs-group.open .docs-group-items { display: block; }

.docs-link {
  display: block;
  padding: 6px 10px 6px 14px;
  margin-left: 6px;
  border-left: 1.5px solid var(--border);
  font-size: 13.5px;
  color: var(--muted2);
  text-decoration: none;
  transition: color .12s, border-color .12s;
}
.docs-link:hover { color: var(--text); border-left-color: var(--border2); }
.docs-link.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.docs-link .ext { opacity: .5; font-size: 11px; }

.docs-nav-toggle { display: none; }

/* ── Main content ────────────────────────────────────── */
.docs-main { min-width: 0; }
.docs-eyebrow { font-family: 'Geist Mono', monospace; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.docs-main h1 { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: 44px; line-height: 1.08; letter-spacing: -.01em; margin: 0 0 16px; text-wrap: balance; }
.docs-main h1 em { color: var(--accent); font-style: italic; }
.docs-main h2 { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: 28px; letter-spacing: -.01em; margin: 48px 0 14px; scroll-margin-top: 90px; }
.docs-main h3 { font-family: 'Inter Tight', sans-serif; font-weight: 600; font-size: 17px; margin: 30px 0 10px; }
.docs-lede { font-size: 18px; color: var(--muted2); line-height: 1.6; max-width: 66ch; margin: 0 0 8px; }
.docs-main p { font-size: 15.5px; color: var(--muted2); line-height: 1.7; max-width: 68ch; margin: 0 0 16px; }
.docs-main p b, .docs-main li b { color: var(--text); font-weight: 600; }
.docs-main a { color: var(--accent); text-decoration: none; }
.docs-main a:hover { text-decoration: underline; }
.docs-main ul, .docs-main ol { font-size: 15.5px; color: var(--muted2); line-height: 1.7; max-width: 68ch; padding-left: 22px; margin: 0 0 16px; }
.docs-main li { margin-bottom: 7px; }
.docs-main code { font-family: 'Geist Mono', monospace; font-size: .88em; background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--text); }

/* Code blocks */
.codewrap { position: relative; margin: 0 0 18px; }
.codewrap pre { background: #17140e; border: 1px solid #2b2620; border-radius: 12px; padding: 16px 18px; overflow-x: auto; margin: 0; }
.codewrap pre code { font-family: 'Geist Mono', monospace; font-size: 13px; line-height: 1.65; background: none; border: 0; padding: 0; color: #e6e6ea; white-space: pre; }
.codewrap .copy { position: absolute; top: 9px; right: 9px; appearance: none; border: 1px solid var(--border2); background: var(--bg3); color: var(--muted2); font-family: 'Geist Mono', monospace; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 7px; cursor: pointer; opacity: 0; transition: opacity .15s, color .12s; }
.codewrap:hover .copy { opacity: 1; }
.codewrap .copy:hover { color: var(--text); border-color: var(--accent); }
.codewrap .copy.ok { color: #4ade80; border-color: #4ade80; opacity: 1; }
.codewrap pre code .c { color: #6b7280; }
.codewrap pre code .k { color: #8ab4f8; }
.codewrap pre code .s { color: #86efac; }

/* Callout */
.callout { display: flex; gap: 12px; background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 12px; padding: 15px 18px; margin: 0 0 18px; font-size: 14.5px; color: var(--muted2); line-height: 1.6; max-width: 68ch; }
.callout b { color: var(--text); }

/* Tables */
.docs-table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--border); border-radius: 12px; }
table.docs-tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
table.docs-tbl th, table.docs-tbl td { text-align: left; padding: 11px 15px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.docs-tbl thead th { font-family: 'Inter Tight', sans-serif; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
table.docs-tbl tr:last-child td { border-bottom: 0; }
table.docs-tbl td b { color: var(--text); }

/* Cards (e.g. on the intro page) */
.docs-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin: 4px 0 20px; }
a.docs-card { display: block; text-decoration: none; background: var(--bg2); border: 1px solid var(--border); border-radius: 13px; padding: 18px 20px; transition: border-color .15s, transform .1s; }
a.docs-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.docs-card h3 { margin: 0 0 5px; font-size: 16px; color: var(--text); }
.docs-card p { margin: 0; font-size: 13.5px; }

/* Prev / next */
.docs-pager { display: flex; justify-content: space-between; gap: 12px; margin: 56px 0 0; padding-top: 24px; border-top: 1px solid var(--border); }
.docs-pager a { display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; text-decoration: none; min-width: 0; max-width: 48%; transition: border-color .15s; }
.docs-pager a:hover { border-color: var(--accent); text-decoration: none; }
.docs-pager a.next { text-align: right; margin-left: auto; }
.docs-pager .dir { font-family: 'Geist Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.docs-pager .lbl { font-size: 15px; font-weight: 600; color: var(--text); }

@media (max-width: 960px) {
  .docs-shell { grid-template-columns: 1fr; padding: 84px 20px 64px; gap: 0; }
  .docs-side { position: relative; top: 0; max-height: none; overflow: visible; margin-bottom: 24px; padding-right: 0; }
  .docs-nav-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    box-sizing: border-box; padding: 12px 15px; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 11px; color: var(--text);
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  }
  .docs-nav-toggle svg { transition: transform .18s; color: var(--muted); }
  .docs-side.open .docs-nav-toggle svg { transform: rotate(180deg); }
  .docs-nav-body { display: none; margin-top: 12px; max-height: 62vh; overflow-y: auto; padding: 2px 2px 0; }
  .docs-side.open .docs-nav-body { display: block; }
  .docs-main h1 { font-size: 36px; }
  .docs-cards { grid-template-columns: 1fr; }
  .docs-pager a { max-width: 100%; }
}

/* API reference (rendered by docs-api.js) */
.api-op { border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin: 0 0 16px; background: var(--bg2); }
.api-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.api-m { font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.api-path { font-family: 'Geist Mono', monospace; font-size: 13.5px; background: none; border: 0; padding: 0; color: var(--text); }
.api-sum { margin: 0 0 4px; font-size: 14.5px; }
.api-op h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.m-get { color: #075985; background: rgba(2,132,199,0.14); }
.m-post { color: #14532d; background: rgba(22,163,74,0.16); }
.m-patch { color: #78350f; background: rgba(217,119,6,0.18); }
.m-delete { color: #7f1d1d; background: rgba(220,38,38,0.16); }
.m-put { color: #581c87; background: rgba(147,51,234,0.16); }
:root[data-theme='dark'] .m-get { color: #7dd3fc; background: rgba(56,189,248,0.14); }
:root[data-theme='dark'] .m-post { color: #86efac; background: rgba(74,222,128,0.14); }
:root[data-theme='dark'] .m-patch { color: #fcd34d; background: rgba(251,191,36,0.16); }
:root[data-theme='dark'] .m-delete { color: #fca5a5; background: rgba(248,113,113,0.16); }
:root[data-theme='dark'] .m-put { color: #d8b4fe; background: rgba(192,132,252,0.16); }

/* ── API reference: resource sections + deep endpoint pages ── */
.api-res { margin: 0 0 8px; }
.api-res-h { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: 30px; margin: 44px 0 6px; scroll-margin-top: 90px; }
.api-op { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; margin: 18px 0 0; background: var(--bg2); scroll-margin-top: 84px; }
.api-op h4 { font-family: 'Inter Tight', sans-serif; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 9px; }
.api-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.api-m { font-family: 'Geist Mono', monospace; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.api-path { font-family: 'Geist Mono', monospace; font-size: 14px; background: none; border: 0; padding: 0; color: var(--text); }
.api-sum { margin: 0 0 4px; font-size: 15px; color: var(--text); font-weight: 500; }

/* field tables */
table.api-fields td { vertical-align: top; }
.api-req { font-family: 'Geist Mono', monospace; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); background: var(--accent-soft, rgba(234,88,12,.1)); padding: 1px 6px; border-radius: 5px; margin-left: 4px; vertical-align: middle; }
.api-type { font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--muted); }
.api-enum { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.api-enum code { font-size: 11px; padding: 0 5px; }

/* responses */
.api-ex-label { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.api-resp { margin: 0 0 12px; }
.api-resp-h { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 14px; color: var(--muted2); }
.api-code { font-family: 'Geist Mono', monospace; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; }
.api-code.ok { color: #14532d; background: rgba(22,163,74,.16); }
.api-code.warn { color: #78350f; background: rgba(217,119,6,.18); }
.api-code.err { color: #7f1d1d; background: rgba(220,38,38,.16); }
:root[data-theme='dark'] .api-code.ok { color: #86efac; background: rgba(74,222,128,.14); }
:root[data-theme='dark'] .api-code.warn { color: #fcd34d; background: rgba(251,191,36,.16); }
:root[data-theme='dark'] .api-code.err { color: #fca5a5; background: rgba(248,113,113,.16); }

/* curl/JS tabs */
.api-tabs { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.api-tabbar { display: flex; gap: 2px; background: var(--bg3); padding: 5px 6px 0; border-bottom: 1px solid var(--border); }
.api-tab { appearance: none; border: 0; background: none; font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--muted); padding: 7px 13px; border-radius: 8px 8px 0 0; cursor: pointer; }
.api-tab.active { color: var(--text); background: var(--bg2); }
.api-tabpane .codewrap { margin: 0; }
.api-tabpane .codewrap pre { border: 0; border-radius: 0; }

/* method chips (page + sidebar) */
.m-get { color: #075985; background: rgba(2,132,199,0.14); }
.m-post { color: #14532d; background: rgba(22,163,74,0.16); }
.m-patch { color: #78350f; background: rgba(217,119,6,0.18); }
.m-delete { color: #7f1d1d; background: rgba(220,38,38,0.16); }
.m-put { color: #581c87; background: rgba(147,51,234,0.16); }
:root[data-theme='dark'] .m-get { color: #7dd3fc; background: rgba(56,189,248,0.14); }
:root[data-theme='dark'] .m-post { color: #86efac; background: rgba(74,222,128,0.14); }
:root[data-theme='dark'] .m-patch { color: #fcd34d; background: rgba(251,191,36,0.16); }
:root[data-theme='dark'] .m-delete { color: #fca5a5; background: rgba(248,113,113,0.16); }
:root[data-theme='dark'] .m-put { color: #d8b4fe; background: rgba(192,132,252,0.16); }

/* sidebar: endpoint list under API reference */
.api-navgroup { margin: 2px 0 8px; }
.api-navlabel { font-family: 'Geist Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint, var(--muted)); padding: 6px 10px 3px 14px; }
.docs-link.api { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 14px; font-family: 'Geist Mono', monospace; font-size: 12px; }
.api-mini { font-size: 8.5px; font-weight: 600; letter-spacing: .02em; padding: 2px 5px; border-radius: 4px; flex-shrink: 0; width: 34px; text-align: center; text-transform: uppercase; }
