/* =============================================================================
   MEGA MENU — Desktop + Mobile Nav
   Breakpoint: desktop ≥ 1024px, mobile < 1024px
   ============================================================================= */

/* =============================================================================
   DESKTOP NAV
   ============================================================================= */

@media ( min-width: 1024px ) {

    .mobile-menu-toggle {
        display: none;
    }

    /* Header needs relative positioning so mega panels can anchor to it */
    #header {
        overflow: visible;
    }

    /* Top-level menu list */
    .desktop-nav .menu {
        display: flex;
        align-items: center;
        list-style: none;
        margin: 0;
        padding: 0;
        gap: 0;
    }

    .desktop-nav .menu > .menu-item > a {
        display: block;
        padding: 0.75rem 1rem;
        color: #333745;
        text-decoration: none;
        font-family: 'Work Sans', sans-serif;
        font-weight: 500;
        font-size: 0.95rem;
        white-space: nowrap;
    }

    .desktop-nav .menu > .menu-item > a:hover {
        color: #333745;
        text-decoration: underline;
    }

    /* Sub-menu links */

    .desktop-nav .sub-menu a {
        opacity: 0.7;
        transition: opacity 0.15s ease;
    }

    .desktop-nav .sub-menu a:hover {
        opacity: 1;
        font-weight: 700;
    }

    /* Items that trigger a mega panel */
    .desktop-nav .menu-item--has-mega {
        position: static;
    }

    .desktop-nav .menu-item--has-mega > a {
        cursor: default;
        user-select: none;
    }

    /* ── Mega panel base ─────────────────────────────────────────────── */

    .mega-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--color-dark_green);
        z-index: 100;
        box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.15);
    }

    .menu-item--has-mega.is-open > .mega-menu {
        display: block;
    }

    .mega-menu__inner {
        max-width: var(--container-max-width);
        margin: 0 auto;
        padding: 2.5rem 2rem;
    }

    /* ── Services mega panel ─────────────────────────────────────── */

    .mega-menu--services {
        background-color: var(--color-tan);
    }

    .mega-menu--services .mega-menu__inner {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    /* Two-panel grid: left = parent names, right = sub-service panels */

    .mega-menu__service-grid {
        min-height: 160px;
        margin-bottom: 0;
        padding: 2rem 0;
    }

    #header .mega-menu__service-grid .container {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        max-width: var(--container-max-width);
        margin: 0 auto;
        padding: 0 20px;
    }

    /* Left column */

    .mega-menu__parents-col {
        display: flex;
        flex-direction: column;
        flex: 0 0 300px;
    }

    .mega-menu__parent-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        width: 100%;
        padding: 1.25rem 1.5rem;
        background: none;
        border: none;
        text-align: left;
        font-family: 'Work Sans', sans-serif;
        font-size: 1.2rem;
        font-weight: 600;
        color: var(--color-dark_green);
        opacity: 0.6;
        cursor: pointer;
        transition: opacity 0.15s ease, color 0.15s ease;
    }

    .mega-menu__parent-btn:hover,
    .mega-menu__parent-btn.is-active {
        opacity: 1;
    }

    /* Right column — sub-panels, one shown at a time */

    .mega-menu__sub-panels {
        padding: 0 0 0 2rem;
        display: flex;
        align-items: flex-start;
        flex: 1;
        max-width: 600px;
    }

    .mega-menu__sub-panel {
        display: none;
        flex-direction: column;
        gap: 2rem;
        width: 100%;
    }

    .mega-menu__sub-panel.is-active {
        display: flex;
    }

    /* Sub-service pill buttons — white, green on hover */

    .mega-menu__children-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat( 2, 1fr );
        gap: 0.5rem 1rem;
        width: 100%;
    }

    .mega-menu__children-list li a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        /* No fixed height — min-height keeps 1- and 2-line buttons the same size */
        min-height: 54px;
        padding: 10px 25px;
        box-sizing: border-box;
        background-color: var(--color-white);
        color: var(--color-dark_green);
        text-decoration: none;
        font-size: 0.88rem;
        font-weight: 500;
        border-radius: 50px;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .mega-menu__child-arrow {
        flex-shrink: 0;
    }

    .mega-menu__children-list li a.mega-menu__learn-more {
        justify-content: center;
    }

    .mega-menu__children-list li a:hover {
        background-color: var(--color-dark_green);
        color: var(--color-white);
    }

    /* Learn More — sits in the grid as a list item, maroon override */

    .mega-menu__children-list li a.mega-menu__learn-more {
        background-color: var(--color-maroon);
        color: var(--color-white);
    }

    .mega-menu__children-list li a.mega-menu__learn-more:hover {
        background-color: var(--color-maroon);
        opacity: 0.85;
    }

    /* Featured service — blue background */

    .mega-menu__featured-service {
        padding: 1.5rem 0;
        background-color: var(--color-blue);
    }

    .mega-menu__featured-service .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        max-width: var(--container-max-width);
        margin: 0 auto;
        padding: 0 20px;
    }

    .mega-menu__parent-col {
        flex: 0 0 220px;
        padding: 1.25rem 1.5rem;
    }

    .mega-menu__parent-link {
        display: block;
        color: var(--color-dark_green);
        text-decoration: none;
        font-size: 1.2rem;
        font-weight: 700;
        line-height: 1.3;
        transition: opacity 0.15s ease;
    }

    .mega-menu__parent-link:hover {
        opacity: 0.8;
    }

    .mega-menu__children-col {
        flex: 0 1 600px;
        padding-left: 2rem;
    }

    .mega-menu__featured-service .mega-menu__children-list li a {
        background-color: var(--color-white);
        color: var(--color-dark_green);
    }

    .mega-menu__featured-service .mega-menu__children-list li a:hover {
        background-color: var(--color-dark_green);
        color: var(--color-white);
    }

    .mega-menu__featured-service .mega-menu__learn-more {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        min-height: 54px;
        width: 292px;
        padding: 10px 25px;
        background-color: var(--color-maroon);
        color: var(--color-white);
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 500;
        border-radius: 50px;
        flex-shrink: 0;
        transition: opacity 0.15s ease;
    }

    .mega-menu__featured-service .mega-menu__learn-more:hover {
        opacity: 0.85;
    }

}


/* =============================================================================
   MOBILE MENU
   ============================================================================= */

@media ( max-width: 1023px ) {

    .desktop-nav {
        display: none;
    }

}

/* Overlay behind the panel */
#mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 199;
}

#mobile-menu-overlay.is-visible {
    display: block;
}

/* The slide-in panel container */
#mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: min( 360px, 92vw );
    height: 100dvh;
    background-color: var(--color-white);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX( 100% );
    transition: transform 0.3s ease;
}

#mobile-menu.is-open {
    transform: translateX( 0 );
}

/* Individual panels stack on top of each other */
.mobile-menu__panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--color-white);
    transform: translateX( 100% );
    transition: transform 0.25s ease;
    overflow: hidden;
}

.mobile-menu__panel.is-active {
    transform: translateX( 0 );
}

/* Panels being exited (going back) slide left */
.mobile-menu__panel.is-exiting {
    transform: translateX( -30% );
}

/* ── Panel header ─────────────────────────────────────────────────────── */

.mobile-menu__panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.mobile-menu__panel-header--root {
    justify-content: flex-end;
}

.mobile-menu__panel-title {
    font-family: 'Work Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-dark_green);
}

.mobile-menu__close,
.mobile-menu__back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--color-dark_green);
    font-size: 0.9rem;
    font-weight: 500;
}

.mobile-menu__close {
    margin-left: auto;
    color: var(--color-dark_green);
}

/* ── Nav list ────────────────────────────────────────────────────────── */

.mobile-menu__panel nav {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu__list {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
}

.mobile-menu__item {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-menu__link,
.mobile-menu__drill-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    padding: 0.9rem 1.25rem;
    color: var(--color-dark_green);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    gap: 0.5rem;
}

.mobile-menu__link:hover,
.mobile-menu__drill-btn:hover {
    background-color: #f7f7f7;
    color: var(--color-maroon);
}

.mobile-menu__chevron {
    flex-shrink: 0;
    color: var(--color-maroon);
}

/* ── Featured service item in mobile services list ───────────────────── */

.mobile-menu__item--featured {
    background-color: var(--color-blue);
    margin-top: 0.25rem;
}

.mobile-menu__item--featured .mobile-menu__link,
.mobile-menu__item--featured .mobile-menu__drill-btn {
    font-weight: 700;
    color: var(--color-dark_green);
}

/* ── Panel footer ─────────────────────────────────────────────────────── */

.mobile-menu__panel-footer {
    padding: 1.25rem;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.mobile-menu__panel-footer .btn {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
}