/**
 * Mobile / tablet header interaction — must win over main.css overlays.
 */

@media (max-width: 1024px) {
    #masthead.site-header {
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 2147483000 !important;
        pointer-events: auto !important;
        isolation: isolate;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    #masthead.site-header .header-container,
    #masthead.site-header .header-main-wrapper,
    #masthead.site-header .header-mobile-actions,
    #masthead.site-header .site-logo {
        position: relative !important;
        z-index: 2 !important;
        pointer-events: auto !important;
    }

    #masthead .header-main-wrapper {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 20px !important;
    }

    #masthead .site-logo {
        flex: 0 0 auto !important;
        margin-right: 4px !important;
    }

    /* Always use blue logo on mobile / tablet */
    #masthead .site-logo .custom-logo--default {
        display: none !important;
    }

    #masthead .site-logo .custom-logo--sticky,
    #masthead .site-logo img.custom-logo--sticky {
        display: block !important;
        width: 48px !important;
        height: 44px !important;
        object-fit: contain !important;
    }

    /* Logo ..... Menu | CONTACT US | Search */
    #masthead .header-mobile-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-end !important;
        margin-left: auto !important;
        gap: 0 !important;
        column-gap: 0 !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        flex: 0 1 auto !important;
    }

    #masthead .header-mobile-actions.d-lg-none,
    #masthead .header-mobile-actions.d-lg-none.d-flex {
        display: flex !important;
        justify-content: flex-end !important;
        gap: 0 !important;
    }

    #masthead #mobile-menu-trigger,
    #masthead .header-mobile-menu-trigger {
        position: relative !important;
        z-index: 2147483001 !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(0, 59, 144, 0.15);
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 40px !important;
        min-width: 36px !important;
        min-height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
        border: 0 !important;
        background: transparent !important;
        cursor: pointer !important;
        opacity: 1 !important;
        visibility: visible !important;
        color: #003B90 !important;
    }

    #masthead #mobile-menu-trigger svg,
    #masthead .header-mobile-menu-trigger svg {
        width: 24px !important;
        height: 24px !important;
        pointer-events: none !important;
    }

    #masthead #mobile-menu-trigger svg path {
        stroke: #003B90 !important;
    }

    #masthead #search-trigger-mobile,
    #masthead .header-mobile-search-trigger {
        position: relative !important;
        z-index: 3 !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 40px !important;
        min-width: 36px !important;
        min-height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
        color: #003B90 !important;
    }

    #masthead #search-trigger-mobile svg,
    #masthead .header-mobile-search-trigger svg {
        width: 24px !important;
        height: 24px !important;
        pointer-events: none !important;
    }

    #masthead #search-trigger-mobile svg path {
        stroke: #003B90 !important;
    }

    #masthead .header-mobile-contact {
        position: relative !important;
        z-index: 3 !important;
        pointer-events: auto !important;
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        height: 36px !important;
        padding: 0 14px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        background: #003B90 !important;
        color: #EDEDED !important;
        font-family: "Archivo", sans-serif !important;
        font-weight: 600 !important;
        font-size: 13px !important;
        line-height: 1 !important;
        border-radius: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-decoration: none !important;
        box-sizing: border-box !important;
    }

    #masthead .header-mobile-contact::before,
    #masthead .header-mobile-search-trigger::before {
        content: none !important;
        display: none !important;
    }

    /* Decorative vertical rules — equal side gaps */
    #masthead .header-mobile-divider {
        display: block !important;
        flex: 0 0 1px !important;
        width: 1px !important;
        min-width: 1px !important;
        height: 26px !important;
        margin: 0 14px !important;
        padding: 0 !important;
        background: rgba(0, 0, 0, 0.14) !important;
        border: 0 !important;
        pointer-events: none !important;
        align-self: center !important;
    }

    /* Kill inactive full-screen layers completely */
    .mobile-drawer-overlay:not(.is-active),
    .scene-title-drawer-overlay:not(.is-active),
    .svc-mobile-menu-overlay:not(.active),
    #full-width-search.search-overlay.d-none,
    #full-width-search.search-overlay:not(.is-open) {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        z-index: -1 !important;
    }

    .mobile-drawer:not(.is-active),
    .scene-title-drawer:not(.is-active),
    .svc-mobile-menu-drawer:not(.active) {
        display: none !important;
        pointer-events: none !important;
        visibility: hidden !important;
        z-index: -1 !important;
    }

    .mobile-drawer-overlay.is-active {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 2147483002 !important;
        background-color: rgba(0, 0, 0, 0.4) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
    }

    #mobile-drawer.mobile-drawer.is-active {
        display: flex !important;
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        height: min(85vh, 100%) !important;
        max-height: 85vh !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 2147483003 !important;
        background: #fff !important;
    }

    /* Ensure child panels sit above root items and receive taps */
    #mobile-drawer.is-submenu-active #mobile-menu-container {
        position: relative !important;
        overflow: hidden !important;
    }

    #mobile-drawer.is-submenu-active .mobile-nav-menu > li > a {
        pointer-events: none !important;
    }

    #mobile-drawer.is-submenu-active .mobile-nav-menu > li.is-open > .dropdown-menu-wrapper,
    #mobile-drawer.is-submenu-active .sub-menu li.is-open > .dropdown-menu-wrapper {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: auto !important;
        z-index: 50 !important;
        pointer-events: auto !important;
        background: #fff !important;
    }

    #mobile-drawer .sub-menu.is-active,
    #mobile-drawer .sub-menu.is-active a {
        pointer-events: auto !important;
        visibility: visible !important;
        touch-action: manipulation !important;
    }

    #mobile-drawer .sub-menu.is-active a {
        position: relative !important;
        z-index: 2 !important;
        display: block !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    #masthead .header-main-wrapper {
        gap: 28px !important;
    }

    #masthead .site-logo .custom-logo--sticky,
    #masthead .site-logo img.custom-logo--sticky {
        width: 52px !important;
        height: 48px !important;
    }

    #masthead .header-mobile-contact {
        height: 40px !important;
        padding: 0 18px !important;
        font-size: 14px !important;
    }

    #masthead .header-mobile-divider {
        height: 30px !important;
        margin: 0 18px !important;
    }
}

@media (max-width: 389.98px) {
    #masthead .header-main-wrapper {
        gap: 14px !important;
    }

    #masthead .site-logo .custom-logo--sticky,
    #masthead .site-logo img.custom-logo--sticky {
        width: 42px !important;
        height: 38px !important;
    }

    #masthead .header-mobile-contact {
        height: 34px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
    }

    #masthead .header-mobile-divider {
        height: 24px !important;
        margin: 0 10px !important;
    }
}
