/* ============================================
   TOC Wrapper - FIXED con Sticky Sentinel
   ============================================ */
.toc-wrapper {
    position: sticky;
    /*top: 100px; /* Se actualizará con JS: 100px desktop / 75px mobile */
    left: 0;
    right: 0;
    z-index: 10;
    background: white;
    transition: box-shadow 0.3s ease;
}

/* Sombra cuando está stuck */
.toc-wrapper.is-stuck {
    box-shadow: 0 0 12px rgba(43, 60, 106, .25);
}

/* ============================================
   Sentinel (invisible, solo para detección)
   ============================================ */
.toc-sentinel {
    position: absolute;
    height: 1px;
    width: 100%;
    pointer-events: none;
    visibility: hidden;
}

/* ============================================
   Table of Contents Container
   ============================================ */
/*.table-of-contents {
    padding: 0.75rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}*/

/* ============================================
   Mobile Dropdown Toggle
   ============================================ */
.toc-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--color-white);
    border: 1px solid var(--color-light-blue);
    border-radius: 26px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1rem;
    color: var(--color-blue-buk);
    font-weight: 500;
}

.toc-dropdown-label {
    flex: 1;
    text-align: left;
}

.toc-dropdown-icon {
    transition: transform 0.3s ease;
    color: var(--color-blue-buk);
    flex-shrink: 0;
}

.toc-dropdown-toggle[aria-expanded="true"] .toc-dropdown-icon {
    transform: rotate(180deg);
}

/* ============================================
   TOC List - Mobile (Dropdown)
   ============================================ */
.toc-list {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                margin-top 0.3s ease;
    margin: 0;
    padding: 0;
}

.toc-list.is-open {
    max-height: 500px;
    opacity: 1;
    padding: 0.5rem;
    border-left: 1px solid var(--color-light-blue);
    border-bottom: 1px solid var(--color-light-blue);
    border-right: 1px solid var(--color-light-blue);
    border-radius: 0px 0px 26px 26px;
}

/* Fix border del toggle cuando está abierto */
.toc-dropdown-toggle[aria-expanded="true"] {
    border-bottom: 1px solid transparent;
    border-radius: 26px 26px 0px 0px;
}

/* ============================================
   TOC Items
   ============================================ */
/*.toc-item {
    margin-bottom: 0.5rem;
}*/
/*
.toc-item:last-child {
    margin-bottom: 0;
}*/

.toc-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--color-blue-buk);
    border-radius: 26px;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

/*.toc-link:hover,
.toc-link:focus {
    border: 1px solid var(--color-blue-buk);
    font-weight: 600;
}*/

/*.toc-link:focus {
    background: var(--wb-bg-modules);
    border-radius: 26px;
}*/

/* Estado activo */
.toc-link.active,
.toc-link:hover{
    font-weight: 600;
}

.toc-link.active .toc-number,
.toc-link:hover .toc-number,
.toc-link:focus .toc-number{
    background: var(--color-blue-buk);
    color: var(--color-white);
 font-weight: 600;
}

/* ============================================
   TOC Number Circle
   ============================================ */
.toc-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-blue-buk);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

/* ============================================
   TOC Text
   ============================================ */
.toc-text {
    flex: 1;
    transition: all 0.15s ease;
}

/* ============================================
   DESKTOP STYLES - Min-width: 1020px
   ============================================ */
@media (min-width: 1020px) {
    .table-of-contents {
       /* padding: 1rem;*/
			display:flex;
			justify-content: center;
    }
    
    /* Ocultar el toggle en desktop */
    .toc-dropdown-toggle {
        display: none;
    }
    
    /* Mostrar lista horizontal en desktop */
    .toc-list {
        display: flex;
        justify-content: space-between;
        align-items: center;
        max-height: none;
        opacity: 1;
        /*margin-top: 0;*/
        overflow: visible;
        /*padding: 0;*/
        border: 1px solid var(--color-light-blue);
			  border-radius:16px;
width: fit-content;
    }

.toc-text {
    font-size: 15.5px
}
    
   /* .toc-item {
        margin-bottom: 0;
        padding: 0px 2px;
    }*/
    
    .toc-link {
        white-space: nowrap;
        padding: 0.6rem;
    }
    
   /* .toc-link:focus {
        outline: 2px solid var(--color-light-blue);
        outline-offset: 2px;
        background: unset;
    }*/
    
   /* .toc-number {
        min-width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }*/
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.toc-link:focus-visible {
    outline: 1px solid var(--color-blue-buk);
    outline-offset: 2px;
}

.toc-dropdown-toggle:focus-visible {
    background: var(--wb-bg-modules);
}

.hs_cos_wrapper:has(> .toc-wrapper) {
    display: contents;
}