/**
 * Article TOC (Table of Contents) + Sections Layout
 */

/* Layout: TOC sidebar + main content */
.article-with-toc {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 48px;
    align-items: start;
}

/* TOC sidebar */
.article-toc {
    position: sticky;
    top: 130px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding: 20px 0;
}

.article-toc__title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 16px;
    padding-left: 16px;
}

.article-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 2px solid #e2e8f0;
}

.article-toc__list li {
    margin: 0;
}

.article-toc__link {
    display: block;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #64748b;
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.article-toc__link:hover {
    color: #334155;
    background: #f8fafc;
}

.article-toc__link.active {
    color: #5b4fc4;
    border-left-color: #5b4fc4;
    font-weight: 600;
    background: #f5f3ff;
}

/* Section content area */
.article-sections-content {
    min-width: 0;
}

.article-section {
    margin-bottom: 48px;
    scroll-margin-top: 100px;
}

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

.article-section__title {
    font-size: 26px;
    font-weight: 700;
    color: #0C0A08;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
    line-height: 1.35;
}

/* Section content inherits .article-content styles */
.article-section .article-content {
    font-size: 17px;
    line-height: 1.8;
    color: #333;
}

/* Responsive: stack on mobile */
@media (max-width: 860px) {
    .article-with-toc {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .article-toc {
        position: relative;
        top: auto;
        max-height: none;
        background: #f8fafc;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 32px;
        border: 1px solid #e2e8f0;
    }

    .article-toc__title {
        padding-left: 0;
        margin-bottom: 12px;
    }

    .article-toc__list {
        border-left: none;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .article-toc__link {
        border-left: none;
        margin-left: 0;
        padding: 6px 14px;
        border-radius: 999px;
        background: #fff;
        border: 1px solid #e2e8f0;
        font-size: 13px;
    }

    .article-toc__link.active {
        background: #5b4fc4;
        color: #fff;
        border-color: #5b4fc4;
    }

    .article-toc__link:hover {
        background: #ede9fe;
        border-color: #c4b5fd;
    }

    .article-toc__link.active:hover {
        background: #4c3fb5;
        color: #fff;
    }

    .article-section__title {
        font-size: 22px;
    }
}

/* TOC scrollbar styling */
.article-toc::-webkit-scrollbar {
    width: 3px;
}

.article-toc::-webkit-scrollbar-track {
    background: transparent;
}

.article-toc::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
