/* Block 5.3 — JetSmartFilters sidebar / off-canvas drawer.
 * Tokens from design-system.css only. No !important — specificity via
 * .w-archive wrappers (0,2,0+) over JSF's single-class selectors (0,1,0).
 */

/* ---------- Layout ---------- */

.w-archive {
    display: flex;
    align-items: flex-start;
    gap: var(--w-gutter);
}

.w-archive__filters {
    flex: 0 0 264px;
    max-width: 264px;
}

.w-archive__content {
    flex: 1 1 auto;
    min-width: 0; /* grid blowout guard */
}

/* ---------- Toolbar (chips + mobile toggle) ---------- */

.w-archive__toolbar {
    display: flex;
    align-items: center;
    gap: var(--w-space-3);
    margin-bottom: var(--w-space-3);
    min-height: 1px;
}

.w-archive__chips:empty {
    margin: 0;
}

.w-filters-toggle {
    display: none; /* < 1024px only */
    align-items: center;
    gap: var(--w-space-2);
    padding: var(--w-space-2) var(--w-space-4);
    font: 600 var(--w-small-size) var(--w-font);
    color: #fff;
    background: var(--w-navy);
    border: 1px solid var(--w-navy);
    border-radius: var(--w-radius);
    cursor: pointer;
}

.w-filters-toggle:hover {
    background: var(--w-aqua-dark);
    border-color: var(--w-aqua-dark);
}

/* ---------- Sidebar chrome ---------- */

.w-archive__filters-head {
    display: none; /* drawer-only, shown < 1024px */
}

.w-filter {
    padding: var(--w-space-4);
    margin-bottom: var(--w-space-4);
    background: #fff;
    border: 1px solid var(--w-line-light);
    border-radius: var(--w-radius-card);
}

.w-filter__heading {
    margin: 0 0 var(--w-space-3);
    font: 700 var(--w-small-size) var(--w-font);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--w-navy);
}

/* ---------- JSF element refinement (out-specify single-class selectors) ---------- */

.w-archive__filters .jet-checkboxes-list__row {
    margin: 0;
}

.w-archive__filters .jet-checkboxes-list__item {
    display: flex;
    align-items: center;
    gap: var(--w-space-2);
    padding: 6px 0;
    font-size: var(--w-small-size);
    color: var(--w-slate);
    cursor: pointer;
}

.w-archive__filters .jet-checkboxes-list__item:hover {
    color: var(--w-navy);
}

.w-archive__filters .jet-checkboxes-list__decorator {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--w-line);
    border-radius: var(--w-radius-sm);
}

.w-archive__filters .jet-checkboxes-list__input:checked + .jet-checkboxes-list__button .jet-checkboxes-list__decorator,
.w-archive__filters .jet-checkboxes-list__item.jet-filter-row-checked .jet-checkboxes-list__decorator {
    background: var(--w-cta);
    border-color: var(--w-cta);
}

/* Search-within-filter (Priemer) */
.w-archive__filters .jet-filter-items-search {
    margin-bottom: var(--w-space-2);
}

.w-archive__filters .jet-filter-items-search__input {
    width: 100%;
    padding: 8px 10px;
    font-size: var(--w-small-size);
    border: 1px solid var(--w-line);
    border-radius: var(--w-radius);
}

.w-archive__filters .jet-filter-items-search__input:focus {
    outline: none;
    border-color: var(--w-aqua-dark);
    box-shadow: 0 0 0 2px var(--w-aqua-pale);
}

/* Scroll container (enabled via scroll_height arg) */
.w-archive__filters .jet-checkboxes-list-wrapper.jet-filter-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--w-line) transparent;
}

/* Range filter */
.w-archive__filters .jet-range__inputs {
    font-size: var(--w-small-size);
    color: var(--w-slate);
}

/* ---------- Chips ---------- */

.w-archive__chips .jet-active-filters__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin: 0 6px 6px 0;
    font-size: var(--w-small-size);
    color: var(--w-navy);
    background: var(--w-aqua-pale);
    border: 1px solid var(--w-aqua);
    border-radius: 999px;
}

/* ---------- Off-canvas drawer (< 1024px) ---------- */

@media (max-width: 1023.98px) {

    .w-filters-toggle {
        display: inline-flex;
    }

    .w-archive__filters {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 10001;
        width: 320px;
        max-width: 88vw;
        height: 100dvh;
        padding: var(--w-space-4);
        overflow-y: auto;
        background: var(--w-bg-soft);
        box-shadow: var(--w-shadow-lg);
        transform: translateX(-105%);
        transition: transform 0.28s ease;
    }

    .w-archive__filters.is-open {
        transform: translateX(0);
    }

    .w-archive__filters-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: var(--w-space-4);
    }

    .w-archive__filters-title {
        font: 700 var(--w-h3-size) var(--w-font);
        color: var(--w-navy);
    }

    .w-filters-close {
        padding: 4px 10px;
        font-size: 22px;
        line-height: 1;
        color: var(--w-slate);
        background: none;
        border: none;
        cursor: pointer;
    }

    .w-filters-close:hover {
        color: var(--w-cta);
    }

    .w-filters-overlay {
        position: fixed;
        inset: 0;
        z-index: 10000;
        background: rgba(26, 54, 93, 0.45); /* --w-navy at 45% */
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s ease;
    }

    .w-filters-overlay.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    body.w-filters-locked {
        overflow: hidden;
    }
}

@media (min-width: 1024px) {
    .w-filters-overlay {
        display: none;
    }
}

/* Active-filter chips (rendered by filters.js) */
.w-archive__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.w-archive__chips--empty { display: none; }
.w-archive__chips .w-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--w-line);
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: var(--w-navy);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}
.w-archive__chips .w-chip:hover {
    border-color: var(--w-cta);
    color: var(--w-cta);
}
.w-archive__chips .w-chip__x {
    font-size: 14px;
    line-height: 1;
    color: var(--w-muted);
}
.w-archive__chips .w-chip:hover .w-chip__x { color: var(--w-cta); }
.w-archive__chips .w-chip__filter { color: var(--w-muted); font-weight: 400; }

/* Grid density with the sidebar (George, 2026-08-09: buy row must stay one
   line). The card buy row (104px qty + 8px gap + ~100px CTA) needs ≥ ~212px
   inner width. Full-width archives keep the standard 4-cap from
   product-card.css; the sidebar layout drops density instead of squeezing
   cards: 3 tracks ≥1280px (inner ≈244px), 2 tracks 1024–1279px (inner
   ≈330px), with a slightly narrower sidebar in the lower band.
   Specificity (0,4,1)+element beats product-card.css's (0,3,1)+element. */
@media (min-width: 1280px) {
    .w-archive .w-archive__content ul.products[class*="columns-"] { --w-cols: 3; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
    .w-archive__filters { flex-basis: 240px; max-width: 240px; }
    .w-archive .w-archive__content ul.products[class*="columns-"] { --w-cols: 2; }
}
