:root {
    --bg: #060606;
    --panel: #0d0d0f;
    --panel-alt: #0f0f13;
    --border: #1b1b1f;
    --text: #e8e8ea;
    --muted: #9b9ca1;
    --accent: #ff1f3d;
    --accent-soft: #ff4a5f;
    --max: 1280px;
    --sidebar-w: 280px;
    --radius: 14px;
    --shadow: 0 18px 38px rgba(0, 0, 0, .5);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Smooth scrolling with reduced motion respect */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

.docs-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.docs-header .container {
    max-width: var(--max);
    margin: 0 auto;
    padding: .9rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.brand-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: .6rem;
    align-items: center;
}

.lang-switch {
    display: flex;
    gap: .5rem;
    text-transform: uppercase;
    font-size: .8rem;
    letter-spacing: .12em;
}

.lang-switch a[aria-current="page"] {
    color: var(--accent);
}

.search {
    position: relative;
}

.search input {
    background: #0b0b0d;
    border: 1px solid var(--border);
    color: var(--text);
    padding: .55rem .9rem;
    border-radius: 10px;
    min-width: 220px;
}

.docs-layout {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 1rem;
    display: grid;
    gap: 1.6rem;
    grid-template-columns: minmax(0, var(--sidebar-w)) minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 64px;
    align-self: start;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    max-height: calc(100vh - 80px);
    overflow: auto;
}

.sidebar h2 {
    margin: .2rem 0 1rem;
    font-size: .95rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--muted);
}

.toc {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .2rem;
}

.toc a {
    display: block;
    padding: .4rem .5rem;
    border-radius: 8px;
    color: var(--muted);
}

.toc a.active,
.toc a:hover {
    color: var(--text);
    background: var(--panel-alt);
}

.toc .toc-group {
    margin-top: .4rem;
}

.toc .toc-group>.toc-title {
    margin: .4rem 0 .2rem;
    font-weight: 700;
    color: var(--text);
}

.content {
    padding: 1.2rem 0 2.6rem;
}

.doc-title {
    margin: 1rem 0 .6rem;
    font-size: clamp(1.6rem, 2.8vw, 2.1rem);
}

.doc-intro {
    color: var(--muted);
    margin: 0 0 1.2rem;
}

.doc-section {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.doc-section h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.doc-section h3 {
    margin-bottom: .4rem;
}

/* Typography */
.content h1,
.content h2,
.content h3 {
    line-height: 1.25;
}

.content p {
    margin: .6rem 0 1rem;
}

.content ul {
    margin: .4rem 0 1rem;
    padding-left: 1.2rem;
}

.content ol {
    margin: .4rem 0 1rem;
    padding-left: 1.2rem;
}

.content code {
    background: #0b0b0d;
    border: 1px solid var(--border);
    padding: .12rem .35rem;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.content pre {
    background: #0b0b0d;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .9rem;
    overflow: auto;
}

/* Footer */
.docs-footer {
    border-top: 1px solid var(--border);
    background: #0a0a0c;
    color: var(--muted);
    text-align: center;
    padding: 1.2rem;
}

/* Reveal animations */
.reveal { opacity: 0; transform: translateY(10px); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }

/* Timing and transitions */
:root { --ease: cubic-bezier(.22,.61,.36,1); }
.reveal { transition: opacity .5s var(--ease), transform .6s var(--ease); }

/* Subtle hover and focus treatments */
.doc-section { transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.doc-section:hover { transform: translateY(-2px); box-shadow: 0 22px 44px rgba(0,0,0,.55); }
.toc a { transition: background-color .2s var(--ease), color .2s var(--ease); }
.toc a:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Reduced motion safety */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
    .reveal { opacity: 1 !important; transform: none !important; }
}

@media (max-width: 920px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
        max-height: none;
    }

    .site-header .container {
        padding: 1rem 1.25rem;
    }
}

@media (max-width: 700px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 0 1.25rem;
    }

    .docs-layout {
        gap: 1.5rem;
    }

    .content {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .sidebar {
        padding: 1.25rem;
    }

    pre {
        padding: 1rem;
        font-size: 13px;
    }

    code {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .content {
        padding: 1.25rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    pre {
        font-size: 12px;
    }

    .sidebar {
        padding: 1rem;
    }
}