/* ========================================
   TABLE OF CONTENTS
   Right sidebar with page TOC
   ======================================== */

.toc-sidebar {
    width: 280px;
    position: fixed;
    right: 0;
    top: 60px;
    bottom: 0;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
    transition: transform 0.3s ease, right 0.3s ease;
}

.toc-sidebar.hidden {
    transform: translateX(100%);
    right: -280px;
    display: block !important;
}

.toc-container {
    position: sticky;
    top: 2rem;
}

.toc-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.toc-content ul {
    list-style: none;
    padding-left: 0;
}

.toc-content li {
    margin-bottom: 0.5rem;
}

.toc-content a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    display: block;
    padding: 0.25rem 0;
}

.toc-content a:hover {
    color: var(--accent-color);
}

.toc-content a.active {
    color: var(--primary-color);
    font-weight: 600;
    border-left: 2px solid var(--primary-color);
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

/* Nested heading indentation */
.toc-content ul ul {
    padding-left: 1rem;
}

.toc-content ul ul ul {
    padding-left: 1rem;
}

/* Class-based indentation for flat list TOC output */
.toc-content li.toc-level-2 {
    padding-left: 1rem;
}

.toc-content li.toc-level-3 {
    padding-left: 2rem;
}

[data-theme="light"] .toc-sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(244, 252, 251, 0.96));
}

[data-theme="light"] .toc-content a:hover {
    color: #0f766e;
}

[data-theme="light"] .toc-content a.active {
    color: #0f766e;
    font-weight: 600;
    border-left-color: #0f766e;
}
