/* =================================
Desktop TOC function 
====================================*/
.toc__list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.toc__item {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--color-border);
}

.toc__item:first-child {
    border-top: 0;
}

.toc__item a {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    width: 100%;
    box-sizing: border-box;
    padding: 11px 0;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.45;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.toc__item a:hover {
    color: var(--color-primary);
}

.sidebar-toc .toc__item a.is-active {
    color: var(--color-primary);
    font-weight: 600;
}


/* ========================================
   MOBILE TOC
======================================== */
.mobile-toc {
    display: none;
}

@media (max-width: 901px) {
    .mobile-toc {
        display: block;
    }

}

.mobile-toc__summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: default;
    list-style: none;
    padding-left: 5px;
    justify-content: space-between;
}

.mobile-toc__summary::-webkit-details-marker {
    display: none;
}

.mobile-toc__nav {
    margin-top: 8px;
}

/* Mobile Table of Contents */
.mobile-toc {
    margin-bottom: var(--space-4);
    padding: 10px 10px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    box-shadow: var(--shadow-sm);
}

.mobile-toc .toc__list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: mobile-toc-item;
}

.mobile-toc .toc__item {
    position: relative;
    margin: 0;
    padding: 0;
    border: 0;
}

.mobile-toc .toc__item a {
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 24px;
    align-items: center;
    column-gap: 5px;
    width: 100%;
    min-height: 30px;
    padding: 3px 0;
    box-sizing: border-box;
    color: var(--color-text);
    font-size: var(--font-size-xs);
    line-height: 1.4;
    text-decoration: none;
    counter-increment: mobile-toc-item;
}

/* numbering for mobile TOC */
.mobile-toc .toc__item a::before {
    content: counter(mobile-toc-item, decimal-leading-zero);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: var(--font-size-2xs);
    font-weight: 400;
    line-height: 1;
    box-sizing: border-box;
}

/* Right-side arrow */
.mobile-toc .toc__item a::after {
    content: "›";
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: var(--color-primary);
    font-size: var(--font-size-base);
    font-weight: 600;
    line-height: 1;
    z-index: 2;
}

/* heading level indentation */
.mobile-toc__title {
    margin: 0 0 5px;
    padding: 0;
    color: var(--color-text);
    font-size: var(--font-size-xs);
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

/*Mobile TOC Toggle Button*/
.mobile-toc__summary::after {
    content: "+";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--color-primary);
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

.mobile-toc[open] .mobile-toc__summary::after {
    content: "−";
}