.nav-menu a[aria-current="page"] {
    color: var(--accent);
}

.docs-layout {
    width: min(100%, 1400px);
    min-height: 100vh;
    min-width: 0;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    margin: 0 auto;
    padding-top: 77px;
}

.docs-sidebar {
    position: sticky;
    top: 77px;
    height: calc(100vh - 77px);
    overflow-y: auto;
    background: var(--gray-900);
    border-right: 1px solid var(--gray-800);
}

.sidebar-content {
    padding: 2.25rem 1.5rem;
}

.sidebar-section {
    margin-bottom: 2.25rem;
}

.sidebar-section h3 {
    margin-bottom: 0.75rem;
    color: var(--gray-500);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.sidebar-link {
    display: block;
    min-height: 38px;
    margin-bottom: 0.2rem;
    padding: 0.5rem 0.75rem;
    border-left: 2px solid transparent;
    color: var(--gray-300);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.sidebar-link:hover {
    color: var(--white);
    background: var(--gray-800);
}

.sidebar-link.active {
    border-left-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 255, 136, 0.05);
    font-weight: 600;
}

.sidebar-link:focus-visible,
.copy-btn:focus-visible,
.tab-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.docs-content {
    width: min(100%, 960px);
    min-width: 0;
    padding: 5rem clamp(2rem, 5vw, 5rem) 7rem;
}

.doc-section {
    min-width: 0;
    margin-bottom: 6rem;
    scroll-margin-top: 110px;
}

.doc-section:last-child {
    margin-bottom: 0;
}

.doc-section h1,
.doc-section h2,
.doc-section h3 {
    color: var(--white);
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.02em;
}

.doc-section h1 {
    max-width: 760px;
    margin-bottom: 1rem;
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.05;
}

.doc-section h2 {
    margin: 3rem 0 1rem;
    font-size: clamp(1.55rem, 3vw, 2.1rem);
    font-weight: 600;
}

.doc-section h3 {
    margin: 2rem 0 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.doc-section p {
    max-width: 72ch;
    margin-bottom: 1.25rem;
    color: var(--gray-300);
    font-size: 1.025rem;
    line-height: 1.8;
}

.doc-section .lead {
    max-width: 620px;
    margin-bottom: 2.5rem;
    color: var(--gray-300);
    font-size: 1.2rem;
}

.code-block {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 1.5rem 0;
    overflow: hidden;
    background: var(--gray-900);
    border: 1px solid var(--gray-800);
    border-radius: 8px;
}

.code-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem 0.75rem 1.25rem;
    border-bottom: 1px solid var(--gray-800);
    color: var(--gray-400);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.copy-btn {
    min-height: 36px;
    padding: 0.45rem 0.85rem;
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 6px;
    color: var(--gray-200);
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.copy-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.copy-btn.copied {
    border-color: var(--accent);
    color: var(--accent);
}

.code-block pre {
    margin: 0;
    padding: 1.5rem 1.25rem;
    overflow-x: auto;
}

.code-block code,
.model-card code,
.params-table code {
    font-family: "JetBrains Mono", monospace;
}

.code-block code {
    color: var(--gray-100);
    font-size: 0.85rem;
    line-height: 1.75;
}

.tabs {
    display: flex;
    gap: 1.5rem;
    margin: 2.25rem 0 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--gray-800);
}

.tab-btn {
    min-height: 44px;
    padding: 0.75rem 0;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--gray-400);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.tab-btn:hover {
    color: var(--white);
}

.tab-btn.active {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.callout {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--gray-900);
    border: 1px solid var(--gray-800);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    color: var(--gray-200);
}

.callout-warning {
    border-left-color: #f6b94a;
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.model-card {
    padding: 1.5rem;
    background: var(--gray-900);
    border: 1px solid var(--gray-800);
    border-radius: 8px;
}

.model-card h3 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.model-card ul {
    padding: 0;
    list-style: none;
}

.model-card li {
    margin-bottom: 0.75rem;
    color: var(--gray-300);
}

.model-card code,
.params-table code {
    padding: 0.2rem 0.4rem;
    background: rgba(0, 255, 136, 0.07);
    color: var(--accent);
    font-size: 0.8rem;
}

.params-table {
    width: 100%;
    margin: 1.75rem 0;
    overflow: hidden;
    border: 1px solid var(--gray-800);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    background: var(--gray-900);
}

.params-table th,
.params-table td {
    padding: 1rem 1.15rem;
    text-align: left;
}

.params-table th {
    color: var(--gray-400);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.params-table td {
    border-top: 1px solid var(--gray-800);
    color: var(--gray-300);
    line-height: 1.6;
}

@media (max-width: 980px) {
    .docs-layout {
        grid-template-columns: 1fr;
        padding-top: 73px;
    }

    .docs-sidebar {
        position: sticky;
        top: 73px;
        z-index: 20;
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        height: auto;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--gray-800);
        scrollbar-width: none;
    }

    .docs-sidebar::-webkit-scrollbar {
        display: none;
    }

    .sidebar-content {
        display: flex;
        width: max-content;
        min-width: 100%;
        padding: 0.65rem 1rem;
    }

    .sidebar-section {
        display: contents;
    }

    .sidebar-section h3 {
        display: none;
    }

    .sidebar-link {
        min-height: 40px;
        margin: 0 0.2rem 0 0;
        padding: 0.6rem 0.8rem;
        border: 0;
        border-radius: 6px;
        white-space: nowrap;
    }

    .sidebar-link.active {
        background: var(--gray-800);
    }

    .docs-content {
        width: 100%;
        padding: 4rem 2rem 6rem;
    }

    .doc-section {
        scroll-margin-top: 140px;
    }
}

@media (max-width: 640px) {
    .docs-layout {
        padding-top: 69px;
    }

    .docs-sidebar {
        top: 69px;
    }

    .docs-content {
        padding: 3.5rem 1.5rem 5rem;
    }

    .doc-section {
        margin-bottom: 4.5rem;
    }

    .doc-section h1 {
        font-size: 2.4rem;
    }

    .model-grid {
        grid-template-columns: 1fr;
    }

    .code-block pre {
        padding: 1.15rem 1rem;
    }

    .params-table {
        display: block;
        overflow-x: auto;
    }

    .params-table thead,
    .params-table tbody {
        min-width: 560px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-link,
    .copy-btn {
        transition: none;
    }
}
