:root {
    --header-h: 80px;
    /*128*/
    --store-notice-h: 3rem;
    /* --header-mobile-info: 112.16px; */
    /* 0 when not shown */
    --adminbar-h-desktop: 32px;
    --adminbar-h-mobile: 46px;

    --scroll-shadow-color: rgba(239, 77, 72, 0.32);
}



/* mobile header */
@media (max-width: 922px) {

    .site-header.header-main-layout-1.ast-primary-menu-enabled.ast-has-mobile-header-logo.ast-logo-title-inline.ast-hide-custom-menu-mobile.ast-builder-menu-toggle-icon.ast-mobile-header-inline {
        padding: 0;
    }


    /* lock page scroll when mobile nav is open */
    html:has(#ast-mobile-site-navigation.toggled),
    body:has(#ast-mobile-site-navigation.toggled) {
        height: 100dvh;
        overflow: hidden !important;
    }

    /* turn the mobile header into a real viewport panel only when open */
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled) {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex !important;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
        background: var(--ast-global-color-5);
    }

    /* top row: logo / burger / account / cart */
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled)>.ast-main-header-wrap {
        flex: 0 0 auto;
        min-height: 0;
    }

    /* panel body */
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled)>.ast-mobile-header-content.content-align-flex-start {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* dynamic content above menu */
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled)>.ast-mobile-header-content.content-align-flex-start>.header-widget-area[data-section="sidebar-widgets-header-widget-2"],
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled)>.ast-mobile-header-content.content-align-flex-start>.ast-header-button-1 {
        flex: 0 0 auto;
    }

    /* menu area gets leftover height */
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled)>.ast-mobile-header-content.content-align-flex-start>.ast-builder-menu-mobile {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled) .ast-builder-menu-mobile>.ast-main-header-bar-alignment,
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled) .ast-builder-menu-mobile .main-header-bar-navigation,
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled) #ast-mobile-site-navigation.toggled {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex !important;
        flex-direction: column;
    }

    /* actual inner scroller */
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled) #ast-mobile-site-navigation.toggled>.main-navigation {
        flex: 1 1 auto;
        min-height: 0;
        height: 100%;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* the UL is just content */
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled) #ast-hf-mobile-menu {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* mobile submenus stay in normal flow */
    #ast-mobile-header:has(#ast-mobile-site-navigation.toggled) #ast-hf-mobile-menu .sub-menu {
        position: static;
    }
}




/* tablet header */
@media (max-width: 1400px) {

    .ast-mobile-header-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element),
    .ast-mobile-popup-content .ast-builder-layout-element:not(.ast-builder-menu):not(.ast-header-divider-element) {
        padding: 0 !important;
    }

    .ast-builder-button-wrap.ast-builder-button-size-sm {
        width: 100%;
        text-align: center;
    }


    /* lock document scroll when tablet menu button is toggled */
    html:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled),
    body:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled) {
        height: 100dvh;
        overflow: hidden !important;
    }

    /* make mobile header a fixed viewport panel while open */
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled) {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex !important;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
        background: var(--ast-global-color-5);
    }

    /* top bar stays natural height */
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled)>.ast-main-header-wrap {
        flex: 0 0 auto;
        min-height: 0;
    }

    /* content panel below top bar */
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled)>.ast-mobile-header-content.content-align-flex-start {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* info/banner/button blocks above menu */
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled)>.ast-mobile-header-content.content-align-flex-start>.header-widget-area[data-section="sidebar-widgets-header-widget-2"],
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled)>.ast-mobile-header-content.content-align-flex-start>.ast-header-button-1 {
        flex: 0 0 auto;
    }

    /* menu wrapper fills remaining height */
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled)>.ast-mobile-header-content.content-align-flex-start>.ast-builder-menu-mobile {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled) .ast-builder-menu-mobile>.ast-main-header-bar-alignment,
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled) .ast-builder-menu-mobile .main-header-bar-navigation,
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled) #ast-mobile-site-navigation {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex !important;
        flex-direction: column;
    }

    /* actual inner scroller */
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled) #ast-mobile-site-navigation>.main-navigation {
        flex: 1 1 auto;
        min-height: 0;
        height: 100%;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* ul is content only */
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled) #ast-hf-mobile-menu {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
    }

    /* keep mobile submenus in normal flow */
    #ast-mobile-header:has(button.menu-toggle.main-header-menu-toggle.ast-mobile-menu-trigger-minimal.toggled) #ast-hf-mobile-menu .sub-menu {
        position: static;
    }

    .ast-builder-menu-mobile .main-navigation .menu-item.menu-item-has-children>.ast-menu-toggle {
        top: 16px !important;
    }

    .mobile-header-social-counters {
        width: 100vw !important;        
    }
}



@media (max-width: 1400px) {
    body.admin-bar.ast-main-header-nav-open {
        height: 100dvh;
        overflow: hidden !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    body.admin-bar.ast-main-header-nav-open #wpadminbar {
        display: none !important;
    }

    body.admin-bar.ast-main-header-nav-open .site-header {
        top: 0 !important;
    }
}