/* ==========================================================================
   Section sub-navigation — labelled chip rail
   Loaded by includes/subnav.php after style.css, so it wins the cascade.
   Desktop keeps the existing pill row. At <=768px style.css used to hide
   each item's <span> and leave 34x30 icons with no name (audit N3/A1/M6);
   here every chip keeps its word, sits on a 44px target and scrolls
   horizontally with snap. Active item also carries aria-current="page".
   ========================================================================== */

.study-subnav-item[aria-current="page"],
.section-subnav-item[aria-current="page"] {
    font-weight: 600;
}

@media (max-width: 768px) {
    .study-subnav,
    .section-subnav {
        position: relative;
    }

    /* Scroll rail — full-bleed inside the container, edge padding = gutter */
    .study-subnav-inner,
    .section-subnav-inner {
        justify-content: flex-start;
        gap: 0.375rem;
        padding: 0.5rem 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 1rem;
        scrollbar-width: none;
        /* soften the clipped edges without hiding the last chip */
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 0.75rem, #000 calc(100% - 1.25rem), transparent 100%);
                mask-image: linear-gradient(to right, transparent 0, #000 0.75rem, #000 calc(100% - 1.25rem), transparent 100%);
    }

    .study-subnav-inner::after,
    .section-subnav-inner::after {
        /* trailing gutter so the last chip can scroll clear of the fade */
        content: "";
        flex: 0 0 0.75rem;
    }

    /* Chip */
    .study-subnav-item,
    .section-subnav-item {
        flex: 0 0 auto;
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem 0.875rem;
        gap: 0.375rem;
        font-size: 0.8125rem;
        line-height: 1.2;
        border: 1px solid #e4e4e7;
        border-radius: 999px;
        background: #fff;
        scroll-snap-align: start;
        white-space: nowrap;
    }

    /* Undo style.css's `display: none` — the word is the accessible name */
    .study-subnav-item span,
    .section-subnav-item span {
        display: inline;
    }

    .study-subnav-item svg,
    .section-subnav-item svg {
        width: 16px;
        height: 16px;
    }

    .study-subnav-item.active,
    .study-subnav-item[aria-current="page"] {
        background: var(--color-purple, #4b2679);
        border-color: var(--color-purple, #4b2679);
        color: #fff;
    }

    .section-subnav-item.active,
    .section-subnav-item[aria-current="page"] {
        background: var(--color-magenta, #eb008b);
        border-color: var(--color-magenta, #eb008b);
        color: #fff;
    }

    .study-subnav-item:focus-visible,
    .section-subnav-item:focus-visible {
        outline: 2px solid var(--color-magenta, #eb008b);
        outline-offset: 2px;
    }

    /* Log In / Sign Up stay as chips at the end of the rail */
    .study-subnav-auth {
        gap: 0.375rem;
        margin-left: 0.25rem;
    }

    .study-subnav-item.register,
    .section-subnav-item.register {
        border-color: var(--color-primary, #eb008b);
    }
}

@media (max-width: 768px) {
    [data-theme="dark"] .study-subnav-item,
    [data-theme="dark"] .section-subnav-item {
        background: #26262c;
        border-color: #34343a;
    }
}

@media (prefers-reduced-motion: reduce) {
    .study-subnav-inner,
    .section-subnav-inner {
        scroll-behavior: auto;
    }
}

/* --------------------------------------------------------------------------
   Footer headings — h4 became h2 (audit A2) so every page's outline runs
   h1 → h2 → h2 with no skip. Keep the small-caps look the h4 had.
   -------------------------------------------------------------------------- */
h2.footer-heading {
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.3;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1.25rem;
}
