:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --panel: #f7f8fb;
    --text: #172033;
    --muted: #5f6b7a;
    --border: #d8dee8;
    --link: #1f5fbf;
    --accent: #6d28d9;
    --code: #f1f4f8;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1115;
        --panel: #171a21;
        --text: #eef1f6;
        --muted: #aab2c0;
        --border: #2d3440;
        --link: #78a8ff;
        --accent: #a78bfa;
        --code: #222734;
    }
}

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
}

.page-shell {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr) 14rem;
    margin: 0 auto;
    max-width: 96rem;
}

.sidebar {
    align-self: start;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
}

.section-nav {
    align-self: start;
    overflow-y: auto;
    padding: 2rem 1.25rem;
    position: sticky;
    top: 0;
}

.nav-section + .nav-section {
    margin-top: 2rem;
}

.section-nav h2,
.nav-section h2 {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    margin: 0 0 0.5rem;
    text-transform: uppercase;
}

.nav-section h2 {
    align-items: center;
    display: flex;
    gap: 0.45rem;
}

.nav-section h2::before {
    color: var(--link);
    content: "◆";
    font-size: 0.7rem;
    letter-spacing: 0;
}

.section-nav ul,
.nav-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-section ul {
    padding-left: 0.75rem;
}

.section-nav a,
.nav-section a {
    border: 1px solid transparent;
    color: var(--muted);
    display: block;
    padding: 0.4rem 0.55rem;
    text-decoration: none;
}

.section-nav a:hover,
.nav-section a:hover {
    background: var(--code);
    border-color: var(--border);
    color: var(--text);
}

.section-nav a[aria-current="page"],
.nav-section a[aria-current="page"] {
    background: var(--code);
    border-left: 4px solid var(--accent);
    color: var(--text);
}

.section-nav .level-3 {
    padding-left: 1.35rem;
}

.content {
    display: flex;
    flex-direction: column;
    max-width: 56rem;
    min-height: 100vh;
    padding: 2rem 3rem 2rem;
}

.doc-content {
    padding-bottom: 3rem;
}

.build-info {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 3rem;
    margin-left: auto;
    padding: 0.6rem 1rem;
    text-align: right;
}

.view-md {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
}

.content h1,
.content h2,
.content h3 {
    line-height: 1.25;
}

.content h1 {
    font-size: 2.4rem;
    margin-top: 0;
}

.content h2 {
    border-top: 1px solid var(--border);
    font-size: 1.55rem;
    margin-top: 2.4rem;
    padding-top: 1.6rem;
}

.content h3 {
    font-size: 1.2rem;
    margin-top: 2rem;
}

.content a {
    color: var(--link);
}

.content img {
    border-radius: 0.75rem;
    height: auto;
    max-width: 100%;
}

.content pre,
.content code {
    background: var(--code);
    border-radius: 0.35rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}

.content code {
    padding: 0.12rem 0.3rem;
}

.content pre {
    overflow-x: auto;
    padding: 1rem;
}

.content pre code {
    padding: 0;
}

.content blockquote {
    --quote-bg: #eef4ff;
    background: var(--quote-bg);
    border-left: 5px solid var(--link);
    border: 1px solid var(--border);
    border-left: 5px solid var(--link);
    color: var(--text);
    font-style: italic;
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
}

@media (prefers-color-scheme: dark) {
    .content blockquote {
        --quote-bg: #1a2236;
    }
}

.content blockquote p {
    margin: 0.4rem 0;
}

.content blockquote p:first-child {
    margin-top: 0;
}

.content blockquote p:last-child {
    margin-bottom: 0;
}

.content table {
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
    width: 100%;
}

.site-notice {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: auto;
    padding: 1rem 1.15rem;
}

.site-notice.alert {
    --alert-bg: #fff8e1;
    --alert-border: #f0b400;
    --alert-text: #6b4e00;
    --alert-link: #8a5a00;
    background: var(--alert-bg);
    border: 2px solid var(--alert-border);
    border-radius: 0.5rem;
    color: var(--alert-text);
    margin-bottom: 1.5rem;
    margin-top: 0;
    padding: 0.85rem 1.15rem;
}

.site-notice.alert a {
    color: var(--alert-link);
    font-weight: bold;
}

@media (prefers-color-scheme: dark) {
    .site-notice.alert {
        --alert-bg: #3a2f0a;
        --alert-border: #f0b400;
        --alert-text: #ffe9a8;
        --alert-link: #ffd060;
    }
}

.site-notice a {
    color: var(--link);
}

.content th,
.content td {
    border: 1px solid var(--border);
    padding: 0.55rem 0.7rem;
    text-align: left;
}

.content th {
    background: var(--panel);
}

@media (max-width: 760px) {
    .page-shell {
        display: block;
    }

    .section-nav,
    .sidebar {
        border-bottom: 1px solid var(--border);
        border-right: 0;
        max-height: none;
        overflow-y: visible;
        padding: 1rem;
        position: static;
    }

    .content {
        padding: 1.25rem 1rem 3rem;
    }
}

/* Compact sidebar styles */
.sidebar.compact {
    padding: 1rem 0.75rem;
}
.sidebar.compact .nav-section + .nav-section {
    margin-top: 1rem;
}
.sidebar.compact .nav-section h2 {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}
.sidebar.compact .nav-section a {
    padding: 0.3rem 0.4rem;
    font-size: 0.88rem;
}
