/* Colors come from /tokens.css (generated from design/tokens.css; edit that
   file, then run scripts/sync-tokens.mjs). Only docs-specific roles are
   defined here, and they are built from the shared tokens. */
:root {
  --code-bg: var(--surface);
  --code-border: var(--border);
  --get-fg: var(--info);      --get-bg: var(--info-bg);
  --post-fg: var(--success);  --post-bg: var(--success-bg);
  --patch-fg: var(--warning); --patch-bg: var(--warning-bg);
  --delete-fg: var(--danger); --delete-bg: var(--danger-bg);
  --logo-bg: var(--bg); --logo-glyph: var(--accent);
}
:root[data-theme="light"] { --code-bg: var(--surface-2); --logo-bg: var(--accent); --logo-glyph: oklch(14.5% 0.003 118); }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Geist", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  transition: background .15s, color .15s;
}
.mono { font-family: "Geist Mono", ui-monospace, monospace; }
a { color: inherit; }

/* ── Top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 58px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 22px; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.logo-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--logo-bg); color: var(--logo-glyph);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo .docs-tag {
  font-family: "Geist Mono", monospace; font-size: 11px; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; margin-left: 2px;
}
.topbar-nav { display: flex; align-items: center; gap: 4px; }
.topbar-nav a {
  text-decoration: none; color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  padding: 7px 12px; border-radius: 6px; transition: color .15s, background .15s;
}
.topbar-nav a:hover { color: var(--text); background: var(--surface-2); }
.topbar-nav a.active { color: var(--accent-ink); background: var(--accent-bg); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.menu-toggle {
  display: none; width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); align-items: center; justify-content: center; cursor: pointer; color: var(--text);
}
.theme-toggle {
  width: 46px; height: 26px; border-radius: 999px; padding: 2px;
  border: 1px solid var(--border); background: var(--surface-2);
  display: inline-flex; align-items: center; cursor: pointer; flex-shrink: 0;
  transition: border-color .15s ease, background .15s ease;
}
.theme-toggle:hover { border-color: var(--text-muted); }
.theme-toggle .toggle-thumb {
  position: relative; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent);
  transform: translateX(0); transition: transform .2s cubic-bezier(.4,0,.2,1);
}
:root[data-theme="dark"] .theme-toggle .toggle-thumb { transform: translateX(20px); }
.theme-toggle .toggle-thumb svg {
  position: absolute; top: 50%; left: 50%; width: 12px; height: 12px;
  transform: translate(-50%, -50%); color: var(--accent-fg);
  transition: opacity .15s ease; opacity: 0;
}
.theme-toggle .toggle-thumb .sun-only { opacity: 1; }
:root[data-theme="dark"] .theme-toggle .toggle-thumb .sun-only { opacity: 0; }
:root[data-theme="dark"] .theme-toggle .toggle-thumb .moon-only { opacity: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 600; text-decoration: none; letter-spacing: -0.01em;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: var(--accent-fg);
  border: 1px solid var(--accent-border);
  }
.btn-primary:hover { background: var(--accent-dim); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-muted); }

.sidebar-backdrop { display: none; }

/* ── Layout ── */
.layout { display: flex; max-width: 1400px; margin: 0 auto; align-items: flex-start; }
.sidebar {
  width: 260px; flex-shrink: 0; position: sticky; top: 58px;
  height: calc(100dvh - 58px); overflow-y: auto;
  padding: 28px 16px 60px 20px; border-right: 1px solid var(--border);
}
.sidebar-group { margin-bottom: 22px; }
.sidebar-group-label {
  font-family: "Geist Mono", monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 0 10px; margin-bottom: 6px;
}
.sidebar a {
  display: block; text-decoration: none; color: var(--text-secondary); font-size: 13.5px;
  padding: 6px 10px; border-radius: 6px; transition: color .12s, background .12s;
}
.sidebar a:hover { color: var(--text); background: var(--surface-2); }
.sidebar a.active { color: var(--accent-ink); background: var(--accent-bg); font-weight: 600; }

.content { flex: 1; min-width: 0; padding: 40px 48px 100px; max-width: 880px; }
.content h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.content > .lede { font-size: 16px; color: var(--text-secondary); margin-bottom: 36px; max-width: 640px; }
.content h2 {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 52px 0 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
  scroll-margin-top: 74px;
}
.content h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.content h3 { font-size: 17px; font-weight: 700; margin: 28px 0 10px; scroll-margin-top: 74px; }
.content h4 { font-size: 14px; font-weight: 700; margin: 18px 0 8px; color: var(--text); scroll-margin-top: 74px; }
.content p { font-size: 15px; color: var(--text-secondary); margin-bottom: 14px; max-width: 680px; }
.content p code, .content li code, td code { font-family: "Geist Mono", monospace; }
.content ul, .content ol { margin: 0 0 16px 20px; color: var(--text-secondary); font-size: 15px; }
.content li { margin-bottom: 6px; }
.content li strong { color: var(--text); }
.section-desc { font-size: 15px; color: var(--text-secondary); margin-bottom: 20px; max-width: 680px; }

code {
  background: var(--surface-2); color: var(--text);
  padding: 2px 6px; border-radius: 4px; font-size: 0.88em;
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 10px;
  padding: 16px 76px 16px 18px; overflow-x: auto; margin: 14px 0 22px; position: relative;
}
pre code { background: none; border: none; padding: 0; font-size: 13px; line-height: 1.65; color: var(--text); white-space: pre; }
.code-block { position: relative; }
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary);
  font-family: "Geist Mono", monospace; font-size: 11px; padding: 5px 9px; border-radius: 6px;
  cursor: pointer; transition: color .12s, border-color .12s;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-muted); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

/* ── Endpoint card ── */
.endpoint {
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  margin: 16px 0 26px; overflow: hidden; scroll-margin-top: 74px;
}
.endpoint-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.method {
  font-family: "Geist Mono", monospace; font-size: 11.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 5px; letter-spacing: 0.02em;
}
.method.get { background: var(--get-bg); color: var(--get-fg); }
.method.post { background: var(--post-bg); color: var(--post-fg); }
.method.patch { background: var(--patch-bg); color: var(--patch-fg); }
.method.put { background: var(--patch-bg); color: var(--patch-fg); }
.method.delete { background: var(--delete-bg); color: var(--delete-fg); }
.endpoint-path { font-family: "Geist Mono", monospace; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.auth-badge {
  font-family: "Geist Mono", monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); margin-left: auto;
}
.auth-badge.public { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, var(--border)); }
.auth-badge.admin { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.endpoint-body { padding: 4px 18px 16px; }
.endpoint-body p { margin: 10px 0; }
.endpoint-body pre { margin: 10px 0; }

/* ── Reference table ── */
.ref-table { width: 100%; border-collapse: collapse; margin: 14px 0 28px; font-size: 13.5px; }
.ref-table th {
  text-align: left; font-family: "Geist Mono", monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--text-muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.ref-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: top; }
.ref-table tr:last-child td { border-bottom: none; }
.ref-table td:first-child, .ref-table td.path-cell { font-family: "Geist Mono", monospace; color: var(--text); font-size: 12.5px; }
/* Method, path, and auth are exact strings — breaking `/api/auth/request-otp`
   across three lines to save width makes it harder to read, not easier. They
   hold their line and the wrapper scrolls; only the description column wraps. */
.ref-table th:nth-child(1), .ref-table th:nth-child(2), .ref-table th:nth-child(3),
.ref-table td:nth-child(1), .ref-table td:nth-child(2), .ref-table td:nth-child(3) {
  white-space: nowrap;
}
.ref-table td:nth-child(4), .ref-table th:nth-child(4) { min-width: 220px; }

/* Reference tables carry route paths that cannot always break small enough to
   fit a phone. They scroll inside their own column rather than widening the
   page — the wrapper is what scrolls, so the surrounding prose stays put. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin: 14px 0 28px;
}
.table-scroll .ref-table { margin: 0; }
.ref-table a.jump { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--text-muted); }
.ref-table a.jump:hover { color: var(--accent-ink); border-color: var(--accent-ink); }

/* ── Callouts ── */
/* Callouts are tinted all the way round rather than carrying a colored edge
   stripe; the tint and border carry the kind (note / warning / danger). */
.callout {
  --tone: var(--info);
  border: 1px solid color-mix(in oklch, var(--tone) 35%, var(--border));
  background: color-mix(in oklch, var(--tone) 7%, var(--surface));
  border-radius: 8px; padding: 12px 16px; margin: 16px 0 24px; font-size: 14px; color: var(--text-secondary); max-width: 680px;
}
.callout strong { color: var(--text); }
.callout ul { margin: 8px 0 8px 18px; font-size: inherit; color: inherit; }
.callout li { margin-bottom: 4px; }
.callout.warn { --tone: var(--warning); }
.callout.danger { --tone: var(--danger); }

/* ── CLI command block ── */
.cmd-block { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin: 16px 0 26px; padding: 16px 18px; scroll-margin-top: 74px; }
.cmd-block .cmd-line { font-family: "Geist Mono", monospace; font-size: 14px; color: var(--text); margin-bottom: 8px; }
.cmd-block .cmd-line .flag { color: var(--text-secondary); }
.cmd-block p { margin: 6px 0; }
.opt-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.opt-table td { padding: 5px 10px 5px 0; color: var(--text-secondary); vertical-align: top; }
.opt-table td:first-child { font-family: "Geist Mono", monospace; color: var(--text); }
@media (min-width: 641px) {
  .opt-table td:first-child { white-space: nowrap; }
}

.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 20px 0 30px; }
.nav-card {
  display: block; text-decoration: none; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); padding: 20px; transition: border-color .15s, transform .15s;
}
.nav-card:hover { border-color: var(--text-muted); transform: translateY(-1px); }
.nav-card h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.nav-card p { font-size: 13px; color: var(--text-secondary); margin: 0; }
.nav-card .mono-tag { font-family: "Geist Mono", monospace; font-size: 11px; color: var(--text-muted); margin-top: 10px; display: block; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 30px; }
.quick-step { border: 1px solid var(--border); border-radius: 10px; padding: 16px; background: var(--surface); }
.quick-step .n { font-family: "Geist Mono", monospace; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.quick-step h4 { margin: 0 0 6px; }
.quick-step p { font-size: 13px; margin: 0; }

@media (max-width: 980px) {
  .sidebar {
    position: fixed; left: 0; top: 58px; bottom: 0; z-index: 55; background: var(--bg);
    transform: translateX(-100%); transition: transform .2s cubic-bezier(0.22, 1, 0.36, 1);
    width: min(280px, 85vw); height: auto;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-pop); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 58px 0 0 0; z-index: 54;
    background: var(--overlay); opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: inline-flex; }
  .topbar-nav { display: none; }
  .content { padding: 28px 22px 80px; }
  .card-grid, .quick-grid { grid-template-columns: 1fr; }
}

.cta-short { display: none; }

/* The topbar runs out of room before the sidebar does. The "deploro.com" link
   moves into the drawer (see .sidebar-extra) rather than being dropped, the
   docs tag goes, and the primary CTA loses the word it can spare. */
@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .topbar-left { gap: 12px; min-width: 0; }
  .logo { font-size: 15px; }
  .logo .docs-tag { display: none; }
  .topbar-right .btn-ghost { display: none; }
  .cta-full { display: none; }
  .cta-short { display: inline; }
  .btn { padding: 7px 11px; }
}

/* Only shown once the topbar has handed its secondary link to the drawer. */
.sidebar-extra { display: none; }
@media (max-width: 760px) {
  .sidebar-extra { display: block; }
}

@media (max-width: 420px) {
  .content { padding: 24px 16px 72px; }
  .content h1 { font-size: 26px; }
  .endpoint-head { padding: 12px 14px; }
  .endpoint-body { padding: 4px 14px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Accessibility helpers ── */
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-fg); padding: 8px 12px; border-radius: 6px;
  font-weight: 600; text-decoration: none; transition: top .15s;
}
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Search ── */
.search { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search input {
  width: 220px; height: 34px; padding: 0 30px 0 30px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; transition: border-color .15s, width .2s;
}
.search input::placeholder { color: var(--text-muted); }
.search input:focus { border-color: var(--border-strong); outline: 2px solid var(--accent-ink); outline-offset: 1px; }
.search input::-webkit-search-cancel-button { display: none; }
.search-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: "Geist Mono", monospace; font-size: 11px; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; line-height: 16px;
}
.search input:focus ~ .search-kbd, .search input:not(:placeholder-shown) ~ .search-kbd { display: none; }
.search-results {
  list-style: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 70;
  width: min(440px, calc(100vw - 24px)); max-height: min(420px, 70vh); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-pop); padding: 6px;
}
.search-results li a { display: block; text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.search-results li[aria-selected="true"] a, .search-results li a:hover { background: var(--surface-2); }
.search-results .r-title { display: block; color: var(--text); font-size: 13.5px; font-weight: 500; }
.search-results .r-title code { font-size: 12.5px; background: none; border: 0; padding: 0; }
.search-results .r-meta { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .r-empty { padding: 10px; color: var(--text-muted); font-size: 13px; }
.search-results mark { background: var(--accent-bg); color: var(--accent-ink); border-radius: 2px; }
@media (max-width: 1100px) { .search input { width: 170px; } }
@media (max-width: 760px) {
  .search input { width: 38px; padding: 0; color: transparent; cursor: pointer; }
  .search input::placeholder { color: transparent; }
  .search-icon { left: 12px; }
  .search-kbd { display: none; }
  .search input:focus { width: calc(100vw - 150px); padding: 0 10px 0 30px; color: var(--text); cursor: text; }
  .search:focus-within ~ .btn { display: none; }
}
