/* =============================================================================
   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: var(--color-navy);
        text-decoration: none;
        font-family: 'Domine', serif;
        font-weight: 500;
        font-size: 0.95rem;
        white-space: nowrap;
    }

    .desktop-nav .menu > .menu-item > a:hover {
        color: var(--color-navy);
        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-navy);
        z-index: 100;
    }

    .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: left parents / right children ─────────────────────── */

    .mega-menu--services .mega-menu__inner {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .mega-menu__parents {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .mega-menu__parent-item {
        list-style: none;
        margin: 0.2rem 0;
    }

    .mega-menu__parent-btn {
        display: inline-flex;
        align-items: center;
        min-width: 40%;
        background: none;
        border: none;
        padding: 0.6rem 0.75rem;
        border-radius: 4px;
        font-family: inherit;
        font-size: 1.2rem;
        font-weight: 500;
        color: var(--color-white);
        cursor: pointer;
        text-align: left;
        opacity: 0.45;
        transition: opacity 0.15s ease;
    }

    .mega-menu__parent-btn:hover,
    .mega-menu__parent-item.is-active .mega-menu__parent-btn {
        opacity: 1;
        font-weight: 700;
    }

    /* Right pane: children list + learn more */

    .mega-menu__panes {
        padding-left: 1rem;
    }

    .mega-menu__pane {
        display: none;
        flex-direction: column;
        gap: 1rem;
    }

    .mega-menu__pane.is-active {
        display: flex;
    }

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

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

    .mega-menu__children-list a:hover {
        background-color: var(--color-gold-light);
        color: var(--color-navy);
    }

    .mega-menu__child-arrow {
        flex-shrink: 0;
        margin-left: 8px;
        transition: transform 0.15s ease;
    }

    .mega-menu__children-list a:hover .mega-menu__child-arrow {
        transform: translateX(3px);
    }

    .mega-menu__learn-more {
        width: calc( 50% - 0.5rem );
        height: 60px;
        justify-content: center;
        margin-top: 0.5rem;
        box-sizing: border-box;
    }

    .mega-menu__learn-more:hover {
        background-color: transparent;
        border-color: var(--color-white);
        color: var(--color-white);
    }

    /* ── Child-drill button (same look as child links) ───────────────── */

    .mega-menu__child-drill {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        /* Match the child links: min-height (not fixed) keeps 1- and 2-line buttons equal */
        min-height: 54px;
        padding: 10px 25px;
        background-color: var(--color-white);
        color: var(--color-navy);
        font-family: inherit;
        font-size: 0.88rem;
        font-weight: 500;
        border: 2px solid var(--color-gold-light);
        border-radius: 999px;
        text-align: center;
        cursor: pointer;
        box-sizing: border-box;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .mega-menu__child-drill:hover {
        background-color: var(--color-gold-light);
        color: var(--color-navy);
    }

    .mega-menu__child-drill:hover .mega-menu__child-arrow {
        transform: translateX(3px);
    }

    /* ── Sub-pane ────────────────────────────────────────────────────── */

    .mega-menu__sub-pane {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .mega-menu__sub-pane[hidden] {
        display: none;
    }

    .mega-menu__sub-pane-header {
        display: flex;
        align-items: center;
        gap: 1.5rem;
    }

    .mega-menu__back-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        background: none;
        border: none;
        color: rgba(255, 255, 255, 0.7);
        font-family: inherit;
        font-size: 0.8rem;
        font-weight: 600;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
        transition: color 0.15s ease;
    }

    .mega-menu__back-btn:hover {
        color: var(--color-white);
    }

    .mega-menu__sub-pane-title {
        font-family: 'Domine', serif;
        font-size: 1rem;
        font-weight: 700;
        color: var(--color-white);
    }

    /* ── Industries: links left, image right ─────────────────────────── */

    .mega-menu--industries .mega-menu__inner {
        display: grid;
        grid-template-columns: 1fr 340px;
        gap: 2rem;
        align-items: stretch;
    }

    /* Multi-column so items flow alphabetically DOWN column A, then column B
       (row-major grid would read across rows instead). */
    .mega-menu__industry-grid {
        list-style: none;
        margin: 0;
        padding: 0;
        columns: 2;
        column-gap: 3rem;
    }

    .mega-menu__industry-grid li {
        break-inside: avoid;
    }

    .mega-menu__industry-grid a {
        display: block;
        padding: 0.4rem 0;
        color: var(--color-white);
        text-decoration: none;
        font-size: 0.95rem;
        opacity: 0.7;
        transition: opacity 0.15s ease;
    }

    .mega-menu__industry-grid a:hover {
        opacity: 1;
        font-weight: 700;
    }

    /* Image panel */

    .mega-menu__industry-image {
        background-color: var(--color-navy);
        background-size: cover;
        background-position: center;
        border-radius: 6px;
        min-height: 200px;
        transition: opacity 0.2s ease;
    }

    .mega-menu__industry-image.is-fading {
        opacity: 0;
    }

}


/* =============================================================================
   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: 'Domine', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-navy);
}

.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-navy);
    font-size: 0.9rem;
    font-weight: 500;
}

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

/* ── 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%;
    padding: 0.9rem 1.25rem;
    color: var(--color-navy);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    gap: 0.5rem;
    box-sizing: border-box;
}

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

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

/* ── 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;
}