/* Leading Content Flex Layout */
.leading-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 100vh;
    position: relative;
}

/* Table of Contents Aside Component */
.toc-aside {
    position: relative;
    background: transparent;
    max-width: 100%;
}

.toc-aside-container {
    width: 100%;
}

.toc-aside-title {
    color: var(--color-light);
    font-size: 1.125rem;
    font-weight: 300;
    margin-bottom: 1.5rem;
}

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

.toc-aside-item {
    margin-bottom: 0;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.toc-aside-item:hover {
    background-color: var(--color-primary) !important;
}

.toc-aside-item:hover .toc-aside-link {
    color: var(--color-white) !important;
    opacity: 0.75 !important;
}

.toc-aside-item:last-child {
    border-bottom: none;
}

.toc-aside-link {
    color: var(--color-light);
    opacity: 0.75 !important;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.4;
    transition: all 0.3s ease;
    display: block;
    padding: 0;
}

/* Override any Bootstrap link styles */
a.toc-aside-link:hover,
a.toc-aside-link:focus,
a.toc-aside-link:active {
    color: var(--color-white) !important;
    text-decoration: none !important;
}

/* Active state for scroll-based highlighting */
.toc-aside-item.active {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-left: 4px solid var(--color-white) !important;
    transition: all 0.3s ease !important;
    position: relative;
}

.toc-aside-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--color-white);
    z-index: 1;
}

.toc-aside-item.active .toc-aside-link {
    color: var(--color-white) !important;
    font-weight: 600 !important;
    opacity: 1 !important;
}

@media (min-width: 1200px) {
    .leading-content {
        flex-direction: row;
        position: relative;
        align-items: flex-start;
    }
    
    .leading-content .aside-table-of-contents {
        flex: 0 0 33.333333%; /* 1/3 width */
        order: 1;
        position: sticky;
        top: 4rem;
        align-self: flex-start;
        height: fit-content;
        z-index: 100;
        overflow: visible;
        background-color: var(--color-black) !important;
    }

    .leading-content .main-content {
        flex: 1; /* Takes remaining space */
        order: 2;
        min-height: 200vh; /* Ensure there's enough content to scroll */
    }

    .leading-content .aside-right {
        flex: 0 0 75px; /* Fixed 75px width */
        order: 3;
    }
}
