:root {
    --sidebar-width: 260px;
}

/* Layout */
.docs-layout {
    position: relative;
    z-index: 10;
    display: flex;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 2rem 4rem;
    gap: 3rem;
    flex: 1;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 2rem;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding-right: 1rem;
    align-self: flex-start;
}

.sidebar::-webkit-scrollbar {
    width: 3px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 106, 0, 0.2);
    border-radius: 3px;
}

.sidebar-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.2em;
    color: var(--orange);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav > ul > li {
    margin-bottom: 0.25rem;
}

.sidebar nav a {
    display: block;
    font-size: 0.82rem;
    font-weight: 300;
    color: var(--gray-light);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-left: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    line-height: 1.4;
}

.sidebar nav a:hover {
    color: #fff;
    border-left-color: rgba(255, 106, 0, 0.4);
}

.sidebar nav a.active {
    color: var(--orange);
    border-left-color: var(--orange);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 900;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--orange-dim);
    background: var(--black-lighter);
    color: var(--orange);
    font-size: 1.4rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.sidebar-toggle:hover {
    background: var(--orange);
    color: var(--black);
}

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

.docs-content .page-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.docs-content .page-subtitle {
    font-size: 1rem;
    font-weight: 300;
    color: var(--gray-light);
    line-height: 1.6;
    margin-bottom: 3rem;
    max-width: 600px;
}

.docs-content .page-subtitle span {
    color: var(--orange);
}

/* Title row */
.docs-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Section styles */
.docs-section {
    margin-bottom: 3rem;
    scroll-margin-top: 2rem;
}

.docs-section h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    letter-spacing: 0.12em;
    color: var(--orange);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 106, 0, 0.12);
}

.docs-section h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 0.12em;
    color: var(--orange-light);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

.docs-section p {
    font-size: 0.92rem;
    font-weight: 300;
    color: var(--gray-light);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.docs-section ul {
    list-style: none;
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.docs-section ul li {
    font-size: 0.92rem;
    font-weight: 300;
    color: var(--gray-light);
    line-height: 1.8;
    position: relative;
    padding-left: 1rem;
}

.docs-section ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--orange-dim);
}

/* Tables */
.docs-section table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.docs-section thead th {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: var(--orange);
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(255, 106, 0, 0.2);
    font-weight: normal;
}

.docs-section tbody td {
    font-weight: 300;
    color: var(--gray-light);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    line-height: 1.6;
}

.docs-section tbody tr:hover td {
    background: rgba(255, 106, 0, 0.03);
}

/* Keyboard shortcut badges */
kbd {
    display: inline-block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 0.1em 0.45em;
    line-height: 1.5;
    white-space: nowrap;
}

/* Inline code */
.docs-section code {
    font-size: 0.82rem;
    color: var(--orange-light);
    background: rgba(255, 106, 0, 0.08);
    border-radius: 3px;
    padding: 0.15em 0.4em;
}

/* Inline links */
.docs-section a {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.4);
    text-underline-offset: 0.15em;
    transition: text-decoration-color 0.2s;
}

.docs-section a:hover {
    text-decoration-color: #fff;
}

/* Section divider */
.section-divider {
    border: none;
    height: 1px;
    background: rgba(255, 106, 0, 0.12);
    margin: 3rem 0;
}

/* Printer-friendly button */
.print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--gray-light);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 0.45em 1em;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.print-btn:hover {
    color: var(--orange);
    border-color: var(--orange-dim);
    background: rgba(255, 106, 0, 0.06);
}

.print-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Print styles */
@media print {
    body::before,
    .glow,
    .grid-bg,
    .watermark,
    .sidebar,
    .sidebar-toggle,
    .sidebar-overlay,
    .back-link,
    .header-line,
    .print-btn,
    footer,
    .copyright { display: none !important; }

    body {
        background: #fff;
        color: #000;
    }

    header {
        padding: 0.5rem 0;
        border-bottom: 2px solid #000;
        margin-bottom: 1rem;
    }

    .logo-number { color: #000; }
    .logo-text { color: #555; }

    .docs-layout {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .docs-content .page-title {
        color: #000;
        font-size: 2rem;
    }

    .docs-content .page-subtitle {
        color: #444;
    }

    .docs-content .page-subtitle span {
        color: #000;
        font-weight: 500;
    }

    .docs-section h2 {
        color: #000;
        border-bottom-color: #ccc;
        font-size: 1.3rem;
    }

    .docs-section h3 {
        color: #333;
        font-size: 1rem;
    }

    .docs-section p,
    .docs-section ul li,
    .docs-section tbody td {
        color: #222;
    }

    .docs-section thead th {
        color: #000;
        border-bottom-color: #999;
    }

    .docs-section tbody td {
        border-bottom-color: #ddd;
    }

    .docs-section code {
        color: #333;
        background: #eee;
        border: 1px solid #ccc;
    }

    kbd {
        color: #000;
        background: #eee;
        border-color: #999;
    }

    .section-divider {
        background: #ccc;
    }

    a { color: #000; text-decoration: none; }

    .docs-section a {
        color: #000;
        text-decoration: underline;
        text-decoration-color: #999;
    }
}

/* Responsive — tablet */
@media (max-width: 900px) {
    .docs-layout {
        flex-direction: column;
        padding: 1rem 1.5rem 3rem;
        gap: 0;
        z-index: auto;
    }

    .docs-content {
        position: relative;
        z-index: 10;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        min-width: 280px;
        max-height: 100vh;
        height: 100vh;
        background: var(--black-lighter);
        border-right: 1px solid rgba(255, 106, 0, 0.12);
        z-index: 500;
        padding: 2rem 1.5rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 499;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .docs-title-row {
        margin-bottom: 1rem;
    }
}
