/* Smart TOC - Styles */

.smart-toc {
    background: #f9f9fb;
    border: 1px solid #e2e4e7;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
    padding: 1rem 1.25rem 1rem 1rem;
    margin: 1.5em 0 2em;
    font-size: 0.95em;
    line-height: 1.6;
    max-width: 600px;
}

/* Header row */
.smart-toc__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
    margin-bottom: 0.6em;
}

.smart-toc__title {
    font-weight: 700;
    font-size: 1em;
    margin: 0;
    padding: 0;
}

/* Toggle button */
.smart-toc__toggle {
    background: none;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    padding: 2px 10px;
    color: #555;
    line-height: 1.6;
    white-space: nowrap;
    transition: background 0.15s;
}
.smart-toc__toggle:hover {
    background: #e9ecef;
}

/* Collapsed state */
.smart-toc--collapsible .smart-toc__body[hidden] {
    display: none;
}

/* List styles */
.smart-toc__body ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.smart-toc__body > ul {
    padding: 0;
}
.smart-toc__body ul ul {
    padding-left: 1.25em;
    margin-top: 0.15em;
}

.smart-toc__body li {
    margin: 0.25em 0;
}

.smart-toc__body a {
    color: #2271b1;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s, color 0.15s;
}
.smart-toc__body a:hover,
.smart-toc__body a:focus {
    color: #135e96;
    border-bottom-color: #135e96;
    outline: none;
}

/* Active link highlight */
.smart-toc__body a.is-active {
    color: #000;
    font-weight: 600;
    border-bottom-color: transparent;
}

/* Dark-mode support */
@media (prefers-color-scheme: dark) {
    .smart-toc {
        background: #1e2025;
        border-color: #3c4049;
        border-left-color: #4fa7e8;
        color: #d0d3d9;
    }
    .smart-toc__toggle {
        border-color: #555;
        color: #aaa;
    }
    .smart-toc__toggle:hover {
        background: #2d3039;
    }
    .smart-toc__body a {
        color: #4fa7e8;
    }
    .smart-toc__body a:hover,
    .smart-toc__body a:focus {
        color: #7dc3f5;
        border-bottom-color: #7dc3f5;
    }
    .smart-toc__body a.is-active {
        color: #fff;
    }
}

/* Print: show TOC fully expanded */
@media print {
    .smart-toc__toggle { display: none; }
    .smart-toc__body[hidden] { display: block !important; }
}
