:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #15171a;
    --muted: #6b7280;
    --border: #e6e8eb;
    --accent: #2563eb;
    --accent-soft: #eef2ff;
    --code-bg: #f1f3f5;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .04);
    --sidebar-w: 268px;
    --topbar-h: 60px;
}

html[data-theme="dark"] {
    --bg: #0e0f12;
    --card: #17191d;
    --text: #f2f3f5;
    --muted: #9aa0a6;
    --border: #262a30;
    --accent: #3b82f6;
    --accent-soft: #1c2435;
    --code-bg: #20242b;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --bg: #0e0f12;
        --card: #17191d;
        --text: #f2f3f5;
        --muted: #9aa0a6;
        --border: #262a30;
        --accent: #3b82f6;
        --accent-soft: #1c2435;
        --code-bg: #20242b;
        --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Topbar ===== */
.docs-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.docs-topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}

.docs-topbar .brand:hover {
    text-decoration: none;
}

.docs-topbar .brand img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.docs-topbar .spacer {
    flex: 1;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.topbar-btn:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.lang-pill {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 9px;
}

.menu-toggle {
    display: none;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    color: var(--text);
    align-items: center;
    justify-content: center;
}

/* ===== Shell ===== */
.docs-shell {
    display: flex;
    max-width: 1180px;
    margin: 0 auto;
    align-items: flex-start;
}

.docs-sidebar {
    position: sticky;
    top: var(--topbar-h);
    width: var(--sidebar-w);
    flex-shrink: 0;
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding: 24px 14px 60px;
    border-right: 1px solid var(--border);
}

.docs-sidebar .nav-group {
    margin-bottom: 22px;
}

.docs-sidebar .nav-group h4 {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 700;
    padding: 0 12px;
    margin-bottom: 8px;
}

.docs-sidebar a {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 9px;
    transition: background .12s, color .12s;
}

.docs-sidebar a:hover {
    background: var(--accent-soft);
    text-decoration: none;
}

.docs-sidebar a.active {
    background: var(--accent);
    color: #fff;
}

/* ===== Content ===== */
.docs-main {
    flex: 1;
    min-width: 0;
}

.docs-content {
    max-width: 760px;
    padding: 40px 28px 90px;
}

.docs-content .eyebrow {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.docs-content h1 {
    font-size: 32px;
    font-weight: 750;
    letter-spacing: -.02em;
    margin-bottom: 12px;
}

.docs-content .lead {
    font-size: 17px;
    color: var(--muted);
    margin-bottom: 28px;
}

.docs-content h2 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 36px 0 12px;
    scroll-margin-top: 80px;
}

.docs-content h3 {
    font-size: 16.5px;
    font-weight: 650;
    margin: 22px 0 8px;
}

.docs-content p {
    margin-bottom: 14px;
}

.docs-content ul,
.docs-content ol {
    margin: 0 0 16px 22px;
}

.docs-content li {
    margin-bottom: 7px;
}

.docs-content code {
    background: var(--code-bg);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 13.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.docs-content strong {
    font-weight: 650;
}

.callout {
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 18px 0;
    font-size: 14.5px;
}

.callout.pro {
    border-left-color: #7c3aed;
}

.kbd {
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 12.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--card);
}

/* Cards grid (hub) */
.doc-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.doc-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    color: var(--text);
    transition: transform .14s, border-color .14s;
}

.doc-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    text-decoration: none;
}

.doc-card .ic {
    font-size: 22px;
    margin-bottom: 8px;
}

.doc-card h3 {
    font-size: 15.5px;
    font-weight: 650;
    margin-bottom: 4px;
}

.doc-card p {
    font-size: 13.5px;
    color: var(--muted);
    margin: 0;
}

.page-nav {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 48px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.page-nav a {
    font-size: 14px;
    font-weight: 600;
}

.docs-footer {
    border-top: 1px solid var(--border);
    padding: 22px 28px;
    color: var(--muted);
    font-size: 13px;
    max-width: 760px;
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 45;
}

@media (max-width: 860px) {
    .menu-toggle {
        display: inline-flex;
    }

    .docs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        background: var(--card);
        z-index: 50;
        transform: translateX(-100%);
        transition: transform .22s ease;
        padding-top: 24px;
    }

    .docs-shell.sidebar-open .docs-sidebar {
        transform: translateX(0);
    }

    .docs-shell.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .docs-content {
        padding: 28px 20px 70px;
    }

    .hide-sm {
        display: none;
    }
}
