.page-layout {
    flex-direction: row;
}


.left-sidebar, 
.subtopics-nav {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-color) transparent;

    &::-webkit-scrollbar {
        width: 4px;
    }
    &::-webkit-scrollbar-track {
        background: transparent;
    }
    &::-webkit-scrollbar-thumb {
        background: var(--scrollbar-color);
    }

    h1 {
        margin: 0 0 12px;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-muted-color);
    }
}


.subtopics-nav {
    opacity: 0;
        &.katex-ready {
        opacity: 1;
        transition: opacity 0.35s ease;
    }
}



/* ---------- Левый сайдбар (все темы) ---------- */

.left-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 155px);
    overflow-y: auto;
    padding: 0 20px 0 0;
    margin: 0 20px 0 0;
}

.topics-side-list {
    list-style: none;
    margin: 0;
    padding: 0;
}


.topic-side-item {
    border: none;
    border-radius: 0px;
    margin-bottom: 7px;
}

.topic-side-link {
    display: flex;
    align-items: baseline;
    padding: 12px 6px;
    text-decoration: none;
    color: var(--text-main-color);
    font-size: 13pt;
    line-height: 1.35;
    transition: background 0.12s ease, color 0.12s ease;
    border-radius: 0px;
    border-left: solid 5px var(--highlight-color);
    margin-bottom: 7px;

    &:hover {
        background: var(--highlight-color);
        border-left: solid 5px var(--accent-color);
        color: var(--highlight-text-color);

        .topic-side-number {
            color: var(--highlight-text-color);
        }
    }

    &:focus-visible {
        border-left: solid 5px var(--accent-color);
        outline: none;
        text-decoration: underline;
        text-decoration-color: var(--text-main-color);

        .topic-side-number {
            color: var(--highlight-text-color);
        }
    }

    &.active {
        background: var(--accent-color);
        color: var(--accent-text-color);
        border-left: solid 5px var(--accent-color);
        text-decoration-color: var(--accent-text-color);

        .topic-side-number {
            color: var(--accent-text-color);
        }
    }
}


.topic-side-name
{
    flex-shrink: 0;
}

.topic-side-number {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-main-color);
    font-variant-numeric: tabular-nums;
    min-width: 20px;
}

/* ---------- Основной контент ---------- */

.problems {
    display: flex;
    flex: 1;
    flex-grow: 1;
    min-width: 0;
    opacity: 0;
    flex-direction: column;

    & > h2 {
        margin: 16px 0 28px 0;
        font-size: 16px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--page-text-color);
    }


    & h2:not(:first-of-type) {
        margin-top: 28px;
    }

    &.katex-ready {
        opacity: 1;
        transition: opacity 0.35s ease;
    }
}


.subtopic-heading {
    scroll-margin-top: 120px;
}



/* ---------- Правый сайдбар (подтемы) ---------- */

.right-sidebar {
    width: 224px;
    flex-shrink: 0;
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 155px);
    overflow-y: auto;
    padding-left: 22px;
    margin: 0px 0 0 22px;
    /* border-left: 2px solid var(--light-border-color); */
    opacity: 0;

    &.katex-ready {
        opacity: 1;
        transition: opacity var(--transition-fade);
    }

    h2 {
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-muted-color);
        padding: 0 0 0 8px;
        margin-bottom: 12px;
    }
}

.subtopics-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.subtopic-nav-link {
    display: block;
    padding: 5px 8px;
    text-decoration: none;
    color: var(--text-main-color);
    font-size: 1rem;
    line-height: 1.4;
    transition: background var(--transition-fast), color var(--transition-fast);
    position: relative;

    &:hover {
        background: var(--highlight-color);
        color: var(--highlight-text-color);
    }

    &:focus-visible {
        outline: none;
        text-decoration: underline;
        text-decoration-color: var(--text-main-color);
    }

    &.active {
        color: var(--accent-text-color);
        background: var(--accent-color);
        text-decoration-color: var(--accent-text-color);
    }
}



/* ---------- Адаптив ---------- */


@media (max-width: 1152px) {
    
    .right-sidebar {
        display: none;
    }
}


@media (max-width: 918px) {
    
    .left-sidebar {
        display: none;
    }
}


