/* NHD 2.5.7 - ONLY the mobile archive filter drawers, not the desktop grid. */
/* Own copies remain hidden at larger widths even before JS restores the DOM. */
.nhd-mobile-catalog-copy { display: none !important; }

@media only screen and (max-width: 767px) {
    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy {
        display: block !important;
        box-sizing: border-box !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 18px 24px !important;
        color: #152239 !important;
    }

    /* Retain the old nodes for desktop and for Elessi's template/AJAX lifecycle. */
    .nhd-mobile-filter-panel #nasa-mobile-cat-filter.nhd-mobile-catalog-host > .nasa-top-cat-filter,
    .nhd-mobile-filter-panel #nasa-mobile-cat-filter.nhd-mobile-catalog-host > .nasa-tmpl,
    .nhd-mobile-filter-panel .nasa-top-sidebar-off-canvas.nhd-mobile-catalog-host .nasa-widget-cat-wrap,
    .nhd-mobile-filter-panel .nasa-top-sidebar-off-canvas.nhd-mobile-catalog-host .widget_product_categories {
        display: none !important;
    }

    /* Scroll the content, not the close button, including on small-height phones. */
    .nasa-top-cat-filter-wrap-mobile.nhd-mobile-filter-panel #nasa-mobile-cat-filter {
        position: absolute !important;
        top: 80px !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px)) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        box-sizing: border-box !important;
    }

    .nasa-top-sidebar.nhd-mobile-filter-panel .nasa-top-sidebar-off-canvas {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)) !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .nhd-catalog-filter-label {
        display: none !important;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .nhd-catalog-filter-group {
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .nhd-catalog-filter-group + .nhd-catalog-filter-group {
        margin-top: 20px !important;
        padding-top: 18px !important;
        border-top: 1px solid #e8ebef !important;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy h3 {
        margin: 0 0 10px !important;
        padding: 0 0 9px !important;
        font-size: 15px !important;
        line-height: 1.35 !important;
        font-weight: 700 !important;
        color: #152239 !important;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy :is(ul, li) {
        display: block !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
    }

    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy li::before,
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy li::after {
        content: none !important;
        display: none !important;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy a {
        display: block !important;
        box-sizing: border-box !important;
        min-height: 38px !important;
        margin: 0 !important;
        padding: 10px 4px !important;
        color: #465468 !important;
        font-size: 13.5px !important;
        font-weight: 400 !important;
        line-height: 1.4 !important;
        white-space: normal !important;
        overflow-wrap: break-word;
        text-decoration: none !important;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .nhd-cat-row {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        width: 100% !important;
    }

    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .nhd-cat-toggle {
        flex: 0 0 36px !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .nhd-subcategory-list {
        margin: 0 0 6px 6px !important;
        padding: 0 0 0 10px !important;
        border-left: 1px solid #e8ebef !important;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .nhd-subcategory-list[hidden] {
        display: none !important;
    }

    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy a:focus-visible,
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy button:focus-visible {
        outline: 2px solid #152239 !important;
        outline-offset: 1px;
    }

    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .is-active > a,
    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nhd-mobile-filter-panel .nhd-mobile-catalog-copy .is-active > .nhd-cat-row > a {
        color: #152239 !important;
        background: #fff8d7 !important;
        font-weight: 600 !important;
    }
}

/* NHD 2.5.8 - remove ONLY the duplicate entry from the mobile bottom bar.
 * The category drawer and all filter contents stay available as before.
 * The marker is applied only while the funnel/sidebar action is available.
 */
@media only screen and (max-width: 767px) {
    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nasa-bottom-bar .nasa-bottom-bar-icons.nhd-mobile-single-filter-nav > .ns-bot-cats {
        display: none !important;
    }

    /* Share the released space among the remaining entries; no empty slot.
     * Do not change display on other items (e.g. Search stays hidden if it was).
     */
    body:is(.woocommerce-shop, .post-type-archive-product, .tax-product_cat, .tax-product_tag)
    .nasa-bottom-bar .nasa-bottom-bar-icons.nhd-mobile-single-filter-nav > .nasa-bot-item:not(.ns-bot-cats) {
        flex: 1 1 0 !important;
        width: auto !important;
        min-width: 0 !important;
    }
}
