/* Horizontal Table of Contents Block */

.horizontal-toc {
    position: relative;
    z-index: 200;
    background-color: #ffffff;
    width: 100%;
    transition: box-shadow 0.2s ease;
}

/*
 * JS-managed fixed positioning is used instead of CSS position:sticky —
 * the theme applies `overflow: hidden` to <section> wrappers site-wide,
 * which silently breaks native sticky whenever the block sits inside one
 * (i.e. on any page template other than Landing Page v2). top/left/width
 * are set inline by view.js to match the block's natural in-flow box.
 */
.horizontal-toc.is-fixed {
    position: fixed;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Reserves the flow space the TOC vacates while fixed, avoiding a page jump */
.horizontal-toc__placeholder {
    display: none;
}

.horizontal-toc__placeholder.is-active {
    display: block;
}

.horizontal-toc__inner {
    max-width: 100%;
    padding: 0 1rem 0.75rem;
}

.horizontal-toc__nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.horizontal-toc__nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.horizontal-toc__link {
    display: inline-flex;
    align-items: center;
    padding: 1rem 2.25rem;
    color: #8a9ab0 !important;
    text-decoration: none !important;
    font-size: 1.0625rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.horizontal-toc__link:hover {
    color: #0070B9 !important;
    text-decoration: none !important;
}

.horizontal-toc__link.active:not(.traveling), .horizontal-toc__link.targeted {
    color: #152c47 !important;
    font-weight: 700;
    border-bottom-color: #0070B9;
    text-decoration: none !important;
}

/* Responsive: allow horizontal scroll on small screens */
@media (max-width: 768px) {
    .horizontal-toc__inner {
        padding: 0 0.5rem;
    }

    .horizontal-toc__link {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    /* Scrolling layout should start flush left, not centered (which clips the first item) */
    .horizontal-toc__nav {
        justify-content: flex-start;
    }

    /* "Stack 2 Across" mobile layout option: wrap into a 2-column grid instead of scrolling */
    .horizontal-toc[data-mobile-layout="stack2"] .horizontal-toc__nav {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .horizontal-toc[data-mobile-layout="stack2"] .horizontal-toc__link {
        flex: 0 0 50%;
        box-sizing: border-box;
        justify-content: center;
        text-align: center;
    }

    /* Odd item count: let the trailing item span the full row instead of leaving a gap */
    .horizontal-toc[data-mobile-layout="stack2"] .horizontal-toc__link:last-child:nth-child(odd) {
        flex-basis: 100%;
    }
}
