/* Lets `height` animate to/from `auto` (used by the mobile submenu).
   Unsupported browsers simply open/close without the animation. */
:root {
    interpolate-size: allow-keywords;
}

/* ============ MOBILE / TABLET (≤960px) ============ */
@media (max-width: 960px) {
    .content-width {
        padding: 0 1.5rem;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(10, 14, 19, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
        z-index: 90;
    }

    .nav-overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .site-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(320px, 82vw);
        background: var(--bg);
        border-left: 1px solid var(--line);
        box-shadow: -12px 0 32px rgba(20, 24, 31, 0.18);
        padding: 2.4rem 2rem;
        overflow-y: auto;
        overscroll-behavior: contain; /* don't scroll the page behind the drawer */
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }

    .site-nav.is-open {
        transform: translateX(0);
    }

    .site-nav__close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 3.5rem;
        height: 3.5rem;
        margin-left: auto;
        margin-bottom: 2rem;
        background: var(--bg-panel);
        border: 1px solid var(--line);
        border-radius: 3px;
        cursor: pointer;
        color: var(--dark);
        font-size: 1.8rem;
    }

    .site-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .site-nav__list > a {
        display: inline-flex;
    }

    .site-nav__list li a,
    .site-nav__list li .site-nav__link {
        padding: .8rem 0;
        font-size: 1.4rem;
    }

    .site-nav__item-head > .site-nav__link {
        flex: 1;
        padding-right: 1rem;
        align-items: center;
    }

    .site-nav__list > li > a,
    .site-nav__list > li > .site-nav__item-head > .site-nav__link {
        padding: 1rem 0;
    }

    /* Arrow button, vertically centered on the row */
    .site-nav__item-head > .site-nav__caret-btn {
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        height: 29px;
        width: 29px;
    }

    .site-nav__caret {
        font-size: 17px;
    }

    /* Desktop hover bridge is not needed on mobile */
    .menu-item-has-children::after {
        display: none;
    }

    .menu-item-has-children {
        position: relative;
    }

    /* Submenu becomes an inline accordion (animated via height) */
    .sub-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        height: 0;
        overflow: hidden;
        padding: 0 0 0 1.2rem;
        transition: height 0.3s ease, padding 0.3s ease;
    }

    .menu-item-has-children.is-open .sub-menu {
        height: auto;
        padding: 0;
    }

    /* Items fade/slide in one after another when opening */
    .sub-menu__item {
        opacity: 0;
        transform: translateY(-6px);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .menu-item-has-children.is-open .sub-menu__item {
        opacity: 1;
        transform: none;
        transition-duration: 0.3s;
    }

    /* Stagger delays only apply on open; extra items share the last delay */
    .menu-item-has-children.is-open .sub-menu__item:nth-child(1) {
        transition-delay: 0.05s;
    }

    .menu-item-has-children.is-open .sub-menu__item:nth-child(2) {
        transition-delay: 0.10s;
    }

    .menu-item-has-children.is-open .sub-menu__item:nth-child(3) {
        transition-delay: 0.15s;
    }

    .menu-item-has-children.is-open .sub-menu__item:nth-child(4) {
        transition-delay: 0.20s;
    }

    .menu-item-has-children.is-open .sub-menu__item:nth-child(n+5) {
        transition-delay: 0.25s;
    }

    .sub-menu__item:not(:last-child) {
        margin-bottom: 4px;
    }

    .sub-menu__item + .sub-menu__item {
        padding-top: 4px;
    }

    .sub-menu__title {
        font-size: 1.4rem;
        color: #444;
    }
}

/* Respect users who prefer reduced motion */
@media (max-width: 960px) and (prefers-reduced-motion: reduce) {
    .site-nav,
    .sub-menu,
    .sub-menu__item {
        transition: none;
    }
}

@media screen and ( max-width: 720px ) {

    .main {
        padding: 0 1.5rem;
    }

    .site-branding img {
        height: 5rem;
        width: auto;
    }

    /* SECTION LEADER MESSAGE */
    .section-leader-message {
        padding: 5rem 0;
    }

    .leader-message__title {
        font-size: 2.9rem;
    }

    .leader-message__body {
        font-size: 1.6rem;
    }

    .leader-message__body p:first-of-type {
        font-size: 1.8rem;
        line-height: 1.5;
    }

}