/*
 * Catalogue filter sidebar.
 *
 * Separate file for now because the main stylesheet is being edited in
 * parallel; nothing here depends on being separate, only on the tokens
 * storefront.css defines. Fold it in once that settles.
 */

/* Catalogue layout ------------------------------------------------------- */

/*
 * Ten pixels between the sidebar and the grid, and between the cards.
 *
 * Asked for directly, and it is the right call for this catalogue: 49 small
 * bottles read as one shelf when the cards sit close together, where a wide
 * gutter made each one look like an isolated tile. The override lives here
 * rather than in storefront.css because that file is being edited in parallel;
 * the selectors carry one extra class each only to outrank the responsive
 * rules there, not because the nesting means anything.
 */
.client-with-aside { gap: 10px; }
.client-with-aside .client-grid:not(.client-grid--wide):not(.client-grid--tight) { gap: 10px; }

/*
 * Four cards a row on a catalogue page, not the five a home-page shelf gets.
 *
 * A shelf on the home page is a strip to skim; a catalogue is a page to read,
 * and beside a 260px sidebar the fifth column left each card 178px wide — a
 * product name and a price in a column narrower than the phone layout gives
 * them. Same breakpoint the five-column rule uses, so exactly one of the two
 * ever applies; below it the auto-fill and the two-up phone grid stay in
 * charge, which is why this is inside the query rather than outranking it
 * everywhere.
 */
@media (min-width: 1100px) {
    .client-with-aside .client-grid:not(.client-grid--wide):not(.client-grid--tight) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Filter sidebar --------------------------------------------------------- */

/*
 * The sticky offset belongs on the grid item, not on the panel inside it: a
 * sticky element can only travel within its parent's box, and the parent here
 * is exactly as tall as the panel, so it would not move at all.
 *
 * Bounded to the viewport so a tall list cannot outgrow it, and the scrollbar
 * is hidden rather than the overflow — the groups are collapsed by default, so
 * the panel normally fits and a permanent gutter would only add noise.
 */
.client-catalog-aside {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.client-catalog-aside::-webkit-scrollbar { width: 0; height: 0; }

.client-filters {
    border-radius: var(--client-radius);
    background: var(--client-surface);
    padding: 0 18px 16px;
    box-shadow: var(--client-shadow-sm);
}

/* A title for the panel, and the escape hatch beside it: with filters applied,
   "clear everything" is the one control a visitor hunts for first. */
.client-filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 0 13px;
    border-bottom: 1px solid var(--client-line);
}

.client-filters__heading { font-size: 15px; margin: 0; letter-spacing: -.01em; }

.client-filters__reset {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--client-accent);
    text-decoration: none;
}

.client-filters__reset:hover { text-decoration: underline; }

.client-filters__block { padding: 14px 0; }
.client-filters__block + .client-filters__block,
.client-filters__form + .client-filters__block { border-top: 1px solid var(--client-line); }

.client-filters__title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--client-muted);
    margin: 0 0 10px;
}

/* Keyword ---------------------------------------------------------------- */

.client-filters__search { position: relative; }

.client-filters__search .client-input {
    /* Asked for: 4px 11px. The right side is overridden after it because the
       submit icon sits inside the field and needs the room. */
    padding: 4px 11px;
    padding-right: 42px;
}

.client-filters__submit {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--client-accent);
    cursor: pointer;
}

/* Price ------------------------------------------------------------------ */

.client-filters__range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.client-filters__range .client-input { padding: 9px 10px; text-align: center; }
.client-filters__range span { color: var(--client-muted); }

/* Custom range ----------------------------------------------------------- */

.client-filters__custom { margin-top: 10px; }

.client-filters__custom-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--client-muted);
    cursor: pointer;
    list-style: none;
}

.client-filters__custom-toggle::-webkit-details-marker { display: none; }
.client-filters__custom-toggle:hover { color: var(--client-accent); }
.client-filters__custom[open] .client-filters__custom-toggle { margin-bottom: 8px; }
.client-filters__custom[open] .client-filters__chevron { rotate: 180deg; }

/* Applied filters -------------------------------------------------------- */

.client-filters__suggest,
.client-filters__chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
}

.client-filters__chips { margin: 0; }

/*
 * Sidebar-sized chips. Deliberately not .client-chip: that one dresses the
 * variant buttons on a product page and is far too large for a 260px column,
 * and changing it there to suit here would break both.
 */
.client-filters__chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: 1px solid var(--client-line);
    border-radius: 999px;
    background: var(--client-soft);
    font-size: 12.5px;
    color: var(--client-ink);
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.client-filters__chip:hover {
    border-color: var(--client-accent);
    background: var(--client-surface);
    color: var(--client-accent);
}

.client-filters__chip.is-active {
    border-color: var(--client-accent);
    background: rgba(179, 25, 92, .07);
    color: var(--client-accent);
    font-weight: 600;
}

/* An applied filter is removed by clicking it, so the cross is the affordance
   that says so — the chip is a link, not a label. */
.client-filters__chip--applied {
    border-color: var(--client-accent);
    background: rgba(179, 25, 92, .07);
    color: var(--client-accent-ink);
}

.client-filters__chip--applied svg { opacity: .6; }
.client-filters__chip--applied:hover svg { opacity: 1; }

/* Price bands ------------------------------------------------------------ */

/*
 * Two to a row. Four full-width rows cost 170px of a panel that has to leave
 * room for the category list underneath, and the labels are abbreviated
 * precisely so they fit half of a 260px column without wrapping.
 */
.client-filters__bands {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.client-filters__band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 9px;
    border: 1px solid var(--client-line);
    border-radius: 10px;
    background: var(--client-surface);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--client-ink);
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.client-filters__band:hover { border-color: var(--client-accent); color: var(--client-accent); }

.client-filters__band.is-active {
    border-color: var(--client-accent);
    background: rgba(179, 25, 92, .07);
    color: var(--client-accent);
}

.client-filters__band .client-filters__count { padding: 1px 6px; font-size: 11px; }

.client-filters__band.is-active .client-filters__count {
    background: var(--client-surface);
    color: var(--client-accent);
}

/* Categories ------------------------------------------------------------- */

.client-filters__all,
.client-filters__group-link,
.client-filters__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--client-ink);
    text-decoration: none;
    cursor: pointer;
}

.client-filters__all { font-weight: 600; }

.client-filters__all:hover,
.client-filters__group-link:hover,
.client-filters__summary:hover { color: var(--client-accent); }

.client-filters__all.is-active,
.client-filters__group-link.is-active,
.client-filters__summary.is-active { color: var(--client-accent); }

.client-filters__group { border-top: 1px solid var(--client-soft); }

.client-filters__summary { list-style: none; }
.client-filters__summary::-webkit-details-marker { display: none; }

.client-filters__chevron { flex: 0 0 auto; opacity: .55; transition: rotate .16s ease; }
.client-filters__group[open] .client-filters__chevron { rotate: 180deg; }

.client-filters__list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0 0 0 2px;
}

.client-filters__list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0 6px 12px;
    border-left: 2px solid transparent;
    font-size: 14px;
    color: var(--client-muted);
    text-decoration: none;
}

.client-filters__list a:hover { color: var(--client-accent); border-left-color: var(--client-line); }

.client-filters__list a.is-active {
    color: var(--client-accent);
    border-left-color: var(--client-accent);
    font-weight: 600;
}

.client-filters__count {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--client-muted);
    background: var(--client-soft);
    border-radius: 999px;
    padding: 1px 8px;
}

@media (max-width: 1024px) {
    /* Stacked, a sticky panel would cover the grid it filters. */
    .client-catalog-aside {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .client-catalog-hero h1 { font-size: 26px; }
    .client-catalog-hero__inner { padding-block: 12px 22px; }
}

@media (max-width: 560px) {
    .client-catalog-hero h1 { font-size: 23px; }

    /* On a phone the shell is barely wider than the wash, so the photograph
       would sit under the text rather than beside it. Pushed further right and
       whitened harder, it stays a backdrop. */
    .client-catalog-hero {
        background-image:
            linear-gradient(180deg,
                rgba(255, 255, 255, .95) 0%,
                rgba(255, 255, 255, .88) 60%,
                rgba(255, 255, 255, .78) 100%),
            url("../images/promo/iaso-featured-skin-ritual.png");
    }

    /* Edge to edge, so the row reads as scrollable rather than as a list that
       happens to be clipped. */
    .client-catalog-shelf {
        margin-inline: -20px;
        padding-inline: 20px;
    }
}

/* ==========================================================================
   Mobile Category Filter Button & Bottom Sheet Drawer
   ========================================================================== */

.client-mobile-filter-btn {
    display: none;
}

.client-filter-drawer {
    display: none;
}

@media (max-width: 860px) {
    /* Hide the catalog sidebar on mobile because the bottom sheet filter is used instead */
    .client-catalog-aside {
        display: none !important;
    }

    .client-listbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: wrap;
    }

    .client-listbar__controls {
        display: inline-flex;
        align-items: center;
        gap: 10px;
    }

    .client-mobile-filter-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        height: 38px;
        padding: 0 14px;
        border-radius: 10px;
        background: #fff5f6;
        border: 1px solid #f6dbe0;
        color: #8b1d3d;
        font-family: inherit;
        font-size: 13.5px;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
        -webkit-tap-highlight-color: transparent;
        white-space: nowrap;
        box-shadow: 0 1px 2px rgba(139, 29, 61, 0.04);
        flex-shrink: 0;
    }

    .client-mobile-filter-btn:hover,
    .client-mobile-filter-btn:active {
        background: #fde8ec;
        border-color: #f1c2cb;
    }

    .client-mobile-filter-btn.is-filtered {
        background: #fff0f2;
        border-color: #eec5cd;
    }

    .client-mobile-filter-btn__icon {
        flex-shrink: 0;
        color: #8b1d3d;
    }

    /* Style the sort select inside listbar to cleanly match the screenshot */
    .client-listbar__sort {
        position: relative;
        display: inline-flex;
        align-items: center;
        margin: 0;
    }

    .client-listbar__sort .client-select {
        height: 38px;
        padding: 0 34px 0 14px;
        border-radius: 10px;
        font-size: 13.5px;
        font-weight: 500;
        color: #1f2937;
        border: 1px solid #e5e7eb;
        background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b1d3d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat calc(100% - 10px) center;
        appearance: none;
        -webkit-appearance: none;
        cursor: pointer;
    }

    .client-listbar__sort::after {
        content: "";
        position: absolute;
        right: 28px;
        top: 50%;
        transform: translateY(-50%);
        width: 1px;
        height: 18px;
        background: #f0f0f0;
        pointer-events: none;
    }

    /* Bottom Sheet Container */
    .client-filter-drawer {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 10000;
        pointer-events: none;
        visibility: hidden;
        transition: visibility 0.3s;
    }

    .client-filter-drawer.is-open {
        pointer-events: auto;
        visibility: visible;
    }

    /* Backdrop Overlay */
    .client-filter-drawer__overlay {
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        opacity: 0;
        transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        -webkit-tap-highlight-color: transparent;
    }

    .client-filter-drawer.is-open .client-filter-drawer__overlay {
        opacity: 1;
    }

    /* Bottom Sheet Dialog */
    .client-filter-drawer__sheet {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 84vh;
        background: #ffffff;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
        overflow: hidden;
        overscroll-behavior: contain;
    }

    .client-filter-drawer.is-open .client-filter-drawer__sheet {
        transform: translateY(0);
    }

    /* Touch Drag Handle */
    .client-filter-drawer__handle-bar {
        display: flex;
        justify-content: center;
        padding-top: 10px;
        padding-bottom: 4px;
        flex-shrink: 0;
    }

    .client-filter-drawer__handle {
        width: 38px;
        height: 4px;
        background: #e2e8f0;
        border-radius: 999px;
    }

    /* Sheet Header */
    .client-filter-drawer__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 18px 14px;
        border-bottom: 1px solid #f1f3f5;
        flex-shrink: 0;
    }

    .client-filter-drawer__title {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
        font-size: 16px;
        font-weight: 700;
        color: var(--client-ink);
    }

    .client-filter-drawer__title-icon {
        color: #8b1d3d;
    }

    .client-filter-drawer__current {
        display: block;
        font-size: 12px;
        color: var(--client-muted);
        margin-top: 2px;
    }

    .client-filter-drawer__current strong {
        color: #8b1d3d;
    }

    .client-filter-drawer__close {
        width: 32px;
        height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        border: none;
        background: #f3f4f6;
        color: #6b7280;
        cursor: pointer;
        transition: background-color 0.15s, color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }

    .client-filter-drawer__close:hover,
    .client-filter-drawer__close:active {
        background: #e5e7eb;
        color: #111827;
    }

    /* Scrollable Content */
    .client-filter-drawer__content {
        padding: 16px 18px 24px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    .client-filter-drawer__section {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .client-filter-drawer__section--all {
        padding-bottom: 12px;
        border-bottom: 1px dashed #e5e7eb;
    }

    .client-filter-drawer__group-title {
        margin: 0;
        font-size: 12.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #6b7280;
    }

    .client-filter-drawer__tags {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Tag Chips */
    .client-filter-tag {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 7px 14px;
        border-radius: 999px;
        font-size: 13.5px;
        line-height: 1.35;
        font-weight: 500;
        color: #374151;
        background: #f4f5f7;
        border: 1px solid #e5e7eb;
        text-decoration: none;
        transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .client-filter-tag:hover,
    .client-filter-tag:active {
        background: #eaedf1;
        border-color: #d1d5db;
        color: #111827;
    }

    .client-filter-tag.is-active {
        background: #8b1d3d;
        border-color: #8b1d3d;
        color: #ffffff;
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(139, 29, 61, 0.28);
    }

    .client-filter-tag__count {
        font-size: 11.5px;
        padding: 1px 7px;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.06);
        color: #6b7280;
        font-weight: 600;
    }

    .client-filter-tag.is-active .client-filter-tag__count {
        background: rgba(255, 255, 255, 0.28);
        color: #ffffff;
    }

    .client-filter-tag__dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

    /* Footer */
    .client-filter-drawer__footer {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 18px max(14px, env(safe-area-inset-bottom, 14px));
        border-top: 1px solid #f1f3f5;
        background: #fafafa;
        flex-shrink: 0;
    }

    .client-filter-drawer__btn-reset {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 42px;
        border-radius: 10px;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        color: #4b5563;
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        transition: background-color 0.15s, color 0.15s;
    }

    .client-filter-drawer__btn-reset:hover {
        background: #f3f4f6;
        color: #111827;
    }

    .client-filter-drawer__btn-close {
        flex: 2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 42px;
        border-radius: 10px;
        background: #8b1d3d;
        border: 1px solid #8b1d3d;
        color: #ffffff;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.15s;
    }

    .client-filter-drawer__btn-close:hover {
        background: #731731;
    }
}

/* Lock body scrolling when bottom sheet is open */
body.client-sheet-locked {
    overflow: hidden !important;
    touch-action: none;
}

