body.docs-page {
    min-height: 100vh;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a.active::after {
    width: 100%;
}

.docs-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 7.5rem 2rem 2.5rem;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    min-height: calc(100vh - 200px);
}

.sidebar-toggle {
    position: fixed;
    top: 5.5rem;
    left: 1.25rem;
    z-index: 130;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    background: rgba(15, 15, 19, 0.78);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.sidebar-toggle:hover {
    transform: translateY(-1px);
    background: rgba(30, 30, 40, 0.9);
}

.feature-sidebar {
    position: sticky;
    top: 6rem;
    max-height: calc(100vh - 7rem);
    overflow: hidden;
    border-radius: 24px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.sidebar-head {
    padding: 1.3rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
}

.sidebar-head h1 {
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.sidebar-head p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.feature-tree {
    max-height: calc(100vh - 11rem);
    overflow: auto;
    padding: 0.7rem;
}

.feature-group {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 14px;
    margin-bottom: 0.65rem;
    overflow: hidden;
}

.group-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 0.9rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.group-toggle .chevron {
    color: var(--text-secondary);
    transition: transform 0.25s ease;
}

.feature-group.open .group-toggle .chevron {
    transform: rotate(180deg);
}

.group-items {
    margin: 0;
    list-style: none;
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 0.45rem;
    gap: 0.25rem;
}

.feature-group.open .group-items {
    display: grid;
}

.group-items a {
    display: block;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.group-items a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.group-items a.active {
    color: #e5f4ff;
    border-color: rgba(56, 189, 248, 0.35);
    background: linear-gradient(120deg, rgba(56, 189, 248, 0.2), rgba(139, 92, 246, 0.15));
}

.feature-content {
    min-width: 0;
}

.feature-detail {
    padding: 2rem;
    border-radius: 24px;
}

.detail-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.detail-category {
    color: var(--text-secondary);
    font-size: 0.88rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.detail-title {
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.detail-description {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    max-width: 78ch;
}

.detail-block {
    margin-bottom: 1.5rem;
}

.detail-block h3 {
    font-size: 1.06rem;
    margin-bottom: 0.65rem;
}

.step-list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-secondary);
}

.step-list li {
    margin-bottom: 0.5rem;
    line-height: 1.65;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.85rem;
}

.demo-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(165deg, rgba(12, 14, 22, 0.95), rgba(20, 23, 35, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 250px;
}

.demo-container--square {
    aspect-ratio: 1 / 1;
}

.demo-iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 16px !important;
}

.demo-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    height: 100%;
    background: linear-gradient(165deg, rgba(12, 14, 22, 0.95), rgba(20, 23, 35, 0.92));
}

.demo-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(56, 189, 248, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.demo-loading p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.media-placeholder {
    background: linear-gradient(165deg, rgba(12, 14, 22, 0.95), rgba(20, 23, 35, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    padding: 1rem;
    min-height: 185px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.75rem;
}

.placeholder-badge {
    display: inline-flex;
    width: fit-content;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #93c5fd;
    background: rgba(30, 64, 175, 0.25);
    border: 1px solid rgba(147, 197, 253, 0.35);
}

.media-caption {
    color: #d4d4d8;
    font-weight: 500;
    font-size: 0.95rem;
}

.media-file {
    color: #a1a1aa;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    word-break: break-word;
}

.tip-list {
    margin: 0;
    list-style: none;
    display: grid;
    gap: 0.55rem;
}

.tip-list li {
    border-left: 2px solid rgba(139, 92, 246, 0.55);
    padding-left: 0.6rem;
    color: var(--text-secondary);
}

.detail-pagination {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    margin-top: 1.8rem;
}

.page-link {
    text-decoration: none;
    color: var(--text-primary);
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.page-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
}

body.docs-page:not(.docs-sidebar-open) .docs-main {
    grid-template-columns: minmax(0, 1fr);
}

body.docs-page:not(.docs-sidebar-open) .feature-sidebar {
    position: fixed;
    left: 1rem;
    top: 6rem;
    width: min(320px, calc(100vw - 2rem));
    max-height: calc(100vh - 7rem);
    transform: translateX(-120%);
    opacity: 0;
    pointer-events: none;
}

body.docs-page.docs-sidebar-open .feature-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 980px) {
    .docs-main {
        grid-template-columns: minmax(0, 1fr);
        padding-inline: 1rem;
    }

    .feature-sidebar {
        position: fixed;
        left: 1rem;
        width: min(320px, calc(100vw - 2rem));
        z-index: 120;
    }

    body.docs-page:not(.docs-sidebar-open) .feature-sidebar {
        transform: translateX(-120%);
        opacity: 0;
    }

    body.docs-page.docs-sidebar-open .feature-sidebar {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 700px) {
    .feature-detail {
        padding: 1.2rem;
    }

    .demo-container {
        aspect-ratio: auto;
        min-height: 300px;
        max-height: 400px;
    }

    .demo-container--square {
        aspect-ratio: 1 / 1;
        min-height: 0;
        max-height: none;
    }

    .detail-pagination {
        flex-direction: column;
    }

    .sidebar-toggle {
        top: 5rem;
        left: 0.75rem;
    }
}
