:root {
    --bg: #110f0d;
    --bg-elevated: #161310;
    --surface: #1a1714;
    --surface-2: #211d19;
    --surface-3: #29231e;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #f0ebe5;
    --text-muted: rgba(240, 235, 229, 0.62);
    --text-dim: rgba(240, 235, 229, 0.34);
    --accent: oklch(66% 0.14 44);
    --accent-soft: oklch(62% 0.14 44 / 0.18);
    --accent-strong: oklch(72% 0.14 44);
    --code-bg: #0c0a09;
    --code-border: rgba(255, 255, 255, 0.06);
    --kbd-bg: #221d18;
    --tag-bg: rgba(196, 117, 24, 0.16);
    --tag-text: #e6b884;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-width: 248px;
    --topbar-height: 56px;
    --content-max: 1040px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--topbar-height) + 16px);
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(196, 117, 24, 0.08), transparent 32%),
        radial-gradient(circle at bottom left, rgba(196, 117, 24, 0.05), transparent 28%),
        linear-gradient(180deg, #120f0c 0%, #0f0d0b 100%);
    background-attachment: fixed;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
    border-bottom: 1px dotted rgba(229, 184, 132, 0.35);
    transition: border-color 120ms;
}
a:hover {
    border-bottom-color: var(--accent-strong);
}

.mono, code, pre, kbd {
    font-family: "DM Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

::selection {
    background: rgba(212, 125, 36, 0.32);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

/* ---------- Top bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
    background: rgba(15, 13, 11, 0.86);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.4px;
    border: 0;
    color: var(--text);
}
.brand .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-strong);
    box-shadow: 0 0 14px var(--accent-strong);
}
.brand-icon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: block;
}
.brand small {
    font-weight: 400;
    color: var(--text-dim);
    font-size: 12px;
    letter-spacing: 0.3px;
}
.topbar-spacer { flex: 1; }
.topbar-links {
    display: flex;
    gap: 18px;
    font-size: 13.5px;
}
.topbar-links a {
    color: var(--text-muted);
    border: 0;
}
.topbar-links a:hover { color: var(--text); }

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
}

/* ---------- Layout ---------- */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0 64px 0;
}

.sidebar {
    position: sticky;
    top: var(--topbar-height);
    align-self: start;
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    padding: 26px 18px 80px 22px;
    border-right: 1px solid var(--border);
    background: rgba(17, 15, 13, 0.45);
}
.sidebar h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    font-weight: 600;
    margin: 22px 8px 8px;
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar ul {
    list-style: none;
}
.sidebar li a {
    display: block;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    border: 0;
    line-height: 1.4;
}
.sidebar li a:hover {
    color: var(--text);
    background: var(--surface);
}
.sidebar li a.active {
    color: var(--accent-strong);
    background: var(--accent-soft);
    font-weight: 500;
}

main {
    padding: 36px 56px 64px;
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
}

/* ---------- Typography ---------- */
main h1 {
    font-size: 34px;
    line-height: 1.2;
    margin: 4px 0 12px;
    letter-spacing: -0.01em;
}
main h2 {
    font-size: 22px;
    margin: 36px 0 12px;
    padding-top: 12px;
    line-height: 1.3;
    letter-spacing: -0.005em;
}
main h3 {
    font-size: 17px;
    margin: 26px 0 8px;
    color: var(--text);
}
main p, main li {
    color: var(--text-muted);
    font-size: 15px;
}
main p { margin-bottom: 12px; }
main ul, main ol {
    margin: 8px 0 16px 22px;
}
main li { margin-bottom: 4px; }
main strong { color: var(--text); }

.lead {
    font-size: 16.5px;
    color: var(--text);
    margin-bottom: 20px;
}

.tabs {
    margin: 14px 0 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.tab-bar {
    display: flex;
    gap: 0;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--border);
}
.tab-btn {
    background: none;
    border: 0;
    color: var(--text-muted);
    padding: 9px 16px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    border-right: 1px solid var(--border);
    transition: color 0.15s, background 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--accent-strong);
    border-bottom-color: var(--accent-strong);
    background: var(--accent-soft);
}
.tabs > .tab-panel { display: none; padding: 4px 12px 4px; }
.tabs > .tab-panel.active { display: block; }
.tabs > .tab-panel pre {
    margin: 12px 0;
    border: 0;
    background: transparent;
}

/* ---------- Code ---------- */
:not(pre) > code {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    color: #e6b884;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.88em;
}
pre {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    overflow-x: auto;
    margin: 8px 0 18px;
    font-size: 13.5px;
    line-height: 1.55;
    position: relative;
}
pre code {
    color: #e8dcc8;
    font-family: inherit;
    background: none;
    padding: 0;
    border: 0;
}
pre .hl-key { color: #c98c4a; }
pre .hl-str { color: #95c882; }
pre .hl-comment { color: var(--text-dim); font-style: italic; }
pre .hl-num { color: #b08be0; }

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    padding: 3px 9px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 120ms;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text); }
.copy-btn.copied { color: #95c882; }

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
    margin: 10px 0 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: top;
}
th {
    font-weight: 600;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    letter-spacing: 0.02em;
}
tr:last-child td { border-bottom: 0; }
td code, th code { font-size: 0.92em; }

/* ---------- Callouts ---------- */
.note, .warn, .tip {
    margin: 16px 0 18px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 14px;
}
.note strong, .warn strong, .tip strong { color: var(--text); }
.warn { border-left-color: #ef4444; background: rgba(239,68,68,0.06); }
.tip { border-left-color: #22c55e; background: rgba(34,197,94,0.05); }

/* ---------- Hero (landing) ---------- */
.hero {
    padding: 56px 0 28px;
    text-align: left;
}
.hero h1 {
    font-size: 44px;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}
.hero h1 .accent { color: var(--accent-strong); }
.hero .lead {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 620px;
}
.hero-actions {
    display: flex;
    gap: 12px;
    margin: 22px 0 6px;
    flex-wrap: wrap;
}
.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}
.btn-primary {
    background: var(--accent-strong);
    color: #1a0d04;
    border: 0;
}
.btn-primary:hover { background: oklch(75% 0.14 44); border: 0; }
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-outline:hover { border-color: var(--accent-strong); color: var(--accent-strong); }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 22px 0 40px;
}
.feature {
    position: relative;
    min-height: 166px;
    padding: 20px 20px 22px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
    counter-increment: feat;
}
.feature::before {
    content: counter(feat, decimal-leading-zero);
    position: absolute;
    top: 18px;
    right: 18px;
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}
.feature::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 18px;
    width: 26px;
    height: 2px;
    background: var(--accent-strong);
    opacity: 0.9;
}
.feature:hover {
    border-color: var(--border-strong);
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
    transform: translateY(-1px);
}
.feature span {
    display: block;
    margin: 14px 0 12px;
    color: var(--accent-strong);
    font-family: "DM Mono", ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.feature h3 {
    font-size: 18px;
    line-height: 1.25;
    margin: 0 0 10px;
    color: var(--text);
}
.feature p {
    font-size: 14px;
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}
.feature-grid { counter-reset: feat; }

/* ---------- Page nav (next/prev) ---------- */
.page-nav {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 48px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 14px;
}
.page-nav a {
    color: var(--text-muted);
    border: 0;
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
}
.page-nav a:hover { color: var(--accent-strong); border-color: var(--border-strong); }
.page-nav a.next { text-align: right; }
.page-nav a small {
    display: block;
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}

/* ---------- Method tags ---------- */
.method {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: "DM Mono", monospace;
    letter-spacing: 0.04em;
    margin-right: 4px;
}
.m-get { background: rgba(34, 197, 94, 0.16); color: #95e0a5; }
.m-post { background: rgba(196, 117, 24, 0.18); color: #e6b884; }
.m-patch { background: rgba(176, 139, 224, 0.16); color: #c8aff0; }
.m-delete { background: rgba(239, 68, 68, 0.16); color: #f4a3a3; }

/* ---------- Mobile ---------- */
@media (max-width: 880px) {
    .shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        width: 280px;
        height: calc(100vh - var(--topbar-height));
        border-right: 1px solid var(--border-strong);
        background: var(--bg-elevated);
        transform: translateX(-100%);
        transition: transform 180ms;
        z-index: 40;
    }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: inline-block; }
    main {
        padding: 26px 22px 50px;
    }
    .hero { padding: 36px 0 18px; }
    .hero h1 { font-size: 32px; }
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .feature {
        min-height: 0;
    }
    .topbar-links { display: none; }
    .scrim {
        position: fixed;
        inset: var(--topbar-height) 0 0 0;
        background: rgba(0,0,0,0.4);
        z-index: 35;
    }
}
