:root {
  --bg: #f7f5f0;
  --bg-card: #ffffff;
  --bg-code: #1e1e1e;
  --fg: #1a1714;
  --fg-muted: #6b6560;
  --fg-dim: #9e9890;
  --border: rgba(0,0,0,0.08);
  --accent: #c8522a;
  --accent-bg: rgba(200,82,42,0.08);
  --green: #2e7d4f;
  --green-bg: rgba(46,125,79,0.08);
  --red: #c0392b;
  --red-bg: rgba(192,57,43,0.08);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --code-bg: #282c34;
  --code-fg: #abb2bf;
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12100e;
    --bg-card: #1c1a17;
    --fg: #f0ede6;
    --fg-muted: #9e9890;
    --fg-dim: #6b6560;
    --border: rgba(255,255,255,0.07);
    --accent: #e06b3a;
    --accent-bg: rgba(224,107,58,0.12);
    --green: #4caf78;
    --green-bg: rgba(76,175,120,0.12);
    --red: #ef4444;
    --red-bg: rgba(239,68,68,0.12);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAV ── */
nav {
  position: sticky; top: 0; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px; z-index: 100;
}
.nav-logo { font-family: var(--font-display); font-size: 22px; font-weight: 900; color: var(--fg); text-decoration: none; }

.nav-link { font-weight: 500; color: var(--fg-muted); font-size: 14px; }
.nav-link:hover { color: var(--fg); text-decoration: none; }

/* ── LAYOUT ── */
.layout { display: flex; max-width: 1200px; margin: 0 auto; width: 100%; flex: 1; padding: 40px 24px; gap: 48px; }

/* ── SIDEBAR ── */
.sidebar { width: 240px; flex-shrink: 0; position: sticky; top: calc(var(--nav-h) + 40px); height: max-content; }
.sidebar-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-dim); margin-bottom: 12px; }
.sidebar ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.sidebar a { display: block; padding: 6px 0; font-size: 14px; font-weight: 500; color: var(--fg-muted); border-left: 2px solid transparent; padding-left: 12px; margin-left: -14px; transition: all 0.15s; }
.sidebar a:hover { color: var(--fg); text-decoration: none; border-left-color: var(--border); }
.sidebar a.active { color: var(--accent); border-left-color: var(--accent); }

/* ── MAIN CONTENT ── */
main { flex: 1; min-width: 0; }
h1 { font-family: var(--font-display); font-size: 36px; font-weight: 900; margin-bottom: 12px; }
.lead { font-size: 18px; color: var(--fg-muted); margin-bottom: 40px; max-width: 600px; }
h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin: 48px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h3 { font-size: 16px; font-weight: 600; margin: 24px 0 12px; }
p { margin-bottom: 16px; color: var(--fg-muted); }
p strong { color: var(--fg); font-weight: 600; }

/* ── TABLES ── */
table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 14px; }
th { text-align: left; padding: 12px; font-weight: 600; color: var(--fg); border-bottom: 2px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--fg-muted); }
tr:last-child td { border-bottom: none; }
td strong { color: var(--fg); }

/* ── CODE BLOCKS ── */
.code-block { position: relative; background: var(--code-bg); border-radius: 8px; margin: 16px 0 24px; overflow: hidden; }
.code-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; background: rgba(0,0,0,0.2); border-bottom: 1px solid rgba(255,255,255,0.05); }
.code-lang { font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; }
.btn-copy { background: rgba(255,255,255,0.1); color: #fff; border: none; border-radius: 4px; padding: 4px 8px; font-size: 12px; cursor: pointer; transition: background 0.2s; }
.btn-copy:hover { background: rgba(255,255,255,0.2); }
pre { padding: 16px; overflow-x: auto; margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; color: var(--code-fg); }
span.token-string { color: #98c379; }
span.token-keyword { color: #c678dd; }
span.token-function { color: #61afef; }
span.token-comment { color: #5c6370; font-style: italic; }

/* ── BADGES ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; margin-right: 8px; }
.badge-get { background: var(--green-bg); color: var(--green); }
.badge-post { background: var(--accent-bg); color: var(--accent); }
.badge-free { background: var(--bg-card); border: 1px solid var(--border); color: var(--fg-muted); }
.badge-starter { background: #e6f0ff; color: #1e50a2; }
.badge-pro { background: var(--accent-bg); color: var(--accent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-starter { background: #1a2c4a; color: #6ea8fe; }
}

/* ── ENDPOINT HEADER ── */
.endpoint { display: flex; align-items: center; gap: 12px; background: var(--bg-card); border: 1px solid var(--border); padding: 12px 16px; border-radius: 8px; margin: 24px 0 16px; font-family: ui-monospace, monospace; font-size: 15px; font-weight: 600; }
.endpoint-path { color: var(--fg); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .layout { flex-direction: column; gap: 32px; padding: 24px 16px; }
  .sidebar { position: static; width: 100%; border-bottom: 1px solid var(--border); padding-bottom: 24px; }
  .sidebar ul { flex-direction: row; flex-wrap: wrap; }
  .sidebar a { border-left: none; border-bottom: 2px solid transparent; padding: 4px 8px; margin: 0; }
  .sidebar a.active { border-bottom-color: var(--accent); }
}

.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--fg); color: var(--bg);
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 9999; white-space: nowrap;
}

