/* Mobile filter pills (A/B test variant B). Markup: filter-pills.php | Behaviour: filter-pills.js */

.filter-pills { display: none; }

@media (max-width: 767px) {
    .filter-pills {
        display: block;
        position: sticky;
        /* 1px under the menu edge so no gap shows from subpixel header heights */
        top: calc(var(--filter-pills-top, 0px) - 1px);
        z-index: var(--z-sticky);
        margin-block: calc(-1 * var(--space-3)) var(--space-2);
    }

    /* Full-width white bar; the bottom border appears once the pills stick under the menu */
    .filter-pills::before {
        content: "";
        position: absolute;
        inset-block: 0;
        left: 50%;
        width: 100vw;
        transform: translateX(-50%);
        background: var(--color-white);
        border-bottom: 1px solid transparent;
    }
    .filter-pills.is-stuck::before { border-bottom-color: var(--border-light); }

    .filter-pills__scroll {
        position: relative;
        display: flex;
        gap: var(--space-2);
        padding-block: var(--space-3);
        /* Scroll edge to edge; the first pill still lines up with the page content */
        margin-inline: calc(50% - 50vw);
        padding-inline: calc(50vw - 50%);
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }
    .filter-pills__scroll::-webkit-scrollbar { display: none; }

    /* Border and selected state match the menu search field */
    .filter-pill {
        flex: none;
        display: flex;
        align-items: center;
        gap: var(--space-2);
        padding: var(--space-2) var(--space-3);
        border: 1px solid var(--border-base);
        border-radius: var(--radius-full);
        background: var(--color-white);
        color: var(--text-secondary);
        font-size: var(--text-sm);
        line-height: 1.2;
        cursor: pointer;
        transition: border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast), transform .3s cubic-bezier(.34, 1.56, .64, 1);
    }
    .filter-pill[hidden] { display: none; }
    @media (hover: hover) {
        .filter-pill:hover { border-color: var(--border-dark); color: var(--color-gray-700); }
    }
    /* Shrinks on press and springs back on release */
    .filter-pill:active { transform: scale(.94); }
    .filter-pill.is-selected {
        border-color: var(--text-primary);
        box-shadow: 0 0 0 1px var(--text-primary);
        color: var(--text-primary);
    }
    .filter-pill.is-selected .filter-pill__label { font-weight: var(--font-bold); }
    .filter-pill__chevron { color: var(--color-gray-400); }

    /* Bottom sheet showing a single filter group */
    .woocommerce-sidebar-mobile[data-focus] .filter-wrapper:not(.is-focused),
    .woocommerce-sidebar-mobile[data-focus] .is-focused .filter-header-wrapper { display: none; }
    .woocommerce-sidebar-mobile[data-focus] .is-focused .filters-parent { display: flex !important; }
}
