/* ===== catalog: archivio (filtri, barra, chip, paginazione EPS), ricerca, radice del catalogo ===== */

.archive__layout {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 44px;
    align-items: start;
    margin-top: 28px
}

/* filtri */
.filters {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line2) transparent;
    padding: 0 8px 16px 0
}

.filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px
}

/* titolo V2 piccolo (come .home-heading--small) */
/* barra a 4px dal bordo: inclinata sporge di ~4px in basso a sinistra e .filters (overflow-y: auto) la taglierebbe */
.filters__head h2 {
    position: relative;
    padding-left: 23px;
    font-size: 20px;
    font-stretch: 85%;
    line-height: 1.05;
    letter-spacing: -.005em;
    text-transform: none;
    white-space: nowrap
}

.filters__head h2::before {
    content: "";
    position: absolute;
    left: 4px;
    top: calc(.525em - 11px);
    width: 7px;
    height: 22px;
    background: var(--red);
    transform: skewX(-18deg)
}

.filters__close,
.filters__foot,
.filters-toggle,
.filters__backdrop {
    display: none
}

.filter-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    border-top: 1px solid var(--ink);
    font-weight: 600;
    cursor: pointer
}

.filter-switch .filter-option__label {
    flex: 1
}

.filter-switch input {
    order: 3;
    flex: none;
    width: 44px;
    height: 26px;
    margin: 0;
    border-radius: 999px;
    background: var(--field) radial-gradient(circle, #fff 8px, transparent 8.5px) no-repeat left center / 26px 26px;
    appearance: none;
    cursor: pointer;
    transition: background-color .2s, background-position .25s var(--ease)
}

.filter-switch input:checked {
    background-color: var(--red);
    background-position: right center
}

.filter-switch input:disabled {
    opacity: .45;
    cursor: default
}

.filter-switch i,
.filter-option i {
    font-style: normal;
    font-size: 14px;
    font-weight: 500;
    color: var(--mut);
    font-variant-numeric: tabular-nums
}

.filter-group {
    border-top: 1px solid var(--line2)
}

.filter-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    font: 700 19px/1 var(--d);
    font-stretch: 78%;
    text-transform: uppercase;
    letter-spacing: .02em;
    list-style: none;
    cursor: pointer
}

.filter-group summary::-webkit-details-marker {
    display: none
}

.filter-group summary::after {
    content: "";
    width: 12px;
    height: 8px;
    background: var(--chev) no-repeat center;
    transition: transform .25s var(--ease)
}

.filter-group[open] summary::after {
    transform: rotate(180deg)
}

.filter-group summary:hover {
    color: var(--red)
}

.filter-group fieldset {
    min-width: 0;
    margin: -4px 0 0;
    padding: 0 0 14px;
    border: 0
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    cursor: pointer
}

.filter-option .filter-option__label {
    flex: 1
}

.filter-option input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1.5px solid #8f958f;
    border-radius: 4px;
    background: #fff no-repeat center / 14px;
    appearance: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, box-shadow .15s
}

.filter-option input[type=radio] {
    border-radius: 50%
}

.filter-option:hover input:not(:disabled) {
    border-color: var(--ink)
}

.filter-option input[type=checkbox]:checked {
    background-color: var(--ink);
    border-color: var(--ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
}

.filter-option input[type=radio]:checked {
    background-color: var(--ink);
    border-color: var(--ink);
    box-shadow: inset 0 0 0 4px #fff
}

.filter-option:has(input:checked) {
    font-weight: 600
}

.filter-option:has(input:disabled),
.filter-switch:has(input:disabled) {
    color: #8f958f;
    cursor: default
}

.filter-option:has(input:disabled) i {
    color: inherit
}

/* barra sopra la griglia */
.archive__bar {
    display: flex;
    align-items: center;
    gap: 12px 20px;
    min-height: 56px;
    padding-bottom: 12px;
}

.archive__count {
    font-weight: 600
}

.archive__sort {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    font-size: 15px;
    color: var(--mut)
}

/* stesso select del trova batteria in HomeV2 (.home-duo .finder select) */
.archive__sort select {
    height: 44px;
    padding: 0 28px 0 10px;
    border: 1.5px solid var(--line2);
    border-radius: var(--r-sm);
    background: #fff var(--chev) no-repeat right 10px center;
    appearance: none;
    font: 500 15px var(--f);
    color: var(--ink);
    text-overflow: ellipsis;
    cursor: pointer
}

.archive__sort select:hover {
    border-color: var(--ink)
}

.archive__sort select:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 1px var(--ink)
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px
}

.active-filters[hidden] {
    display: none
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 10px 0 14px;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    background: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s, color .2s
}

.filter-chip svg {
    width: 16px;
    height: 16px
}

.filter-chip:hover {
    background: var(--ink);
    color: #fff
}

.filter-chips-clear {
    height: 40px;
    padding: 0 6px;
    border: 0;
    background: none;
    font-size: 15px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer
}

.filter-chips-clear:hover {
    color: var(--red)
}

.load-more {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin-top: 36px
}

.load-more[hidden] {
    display: none
}

.load-more p {
    font-size: 14px;
    color: var(--mut);
    font-variant-numeric: tabular-nums
}

.load-more__bar {
    width: 200px;
    height: 2px;
    background: var(--line2)
}

.load-more__bar i {
    display: block;
    height: 100%;
    background: var(--ink);
    transform-origin: left;
    transition: transform .4s var(--ease)
}

.archive+.call-band {
    margin-top: 88px
}

/* EPS: sottocategorie della categoria aperta, rientrate sotto di lei */
.filter-option.filter-option--sub {
    padding-left: 32px
}

/* EPS: numeri di pagina del catalogo sotto "Mostra altri prodotti" */
.load-more__pages {
    font-size: 14px;
    color: var(--mut);
    font-variant-numeric: tabular-nums
}

.load-more__pages a,
.load-more__pages span {
    display: inline-block;
    min-width: 32px;
    padding: 6px 4px;
    text-align: center
}

.load-more__pages a:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px
}

.load-more__pages .catalog_navigation_selected {
    color: var(--ink);
    font-weight: 700
}

/* EPS: radice del catalogo, le categorie della home nella colonna dei risultati (come sotto 1180px) */
/* la fila .category-grid che scorre sul telefono non deve allargare la colonna 1fr */
.archive__results {
    min-width: 0
}

.archive__results .category-grid {
    margin-bottom: 24px
}

@media (min-width:701px) {
    .archive__results .category-grid {
        grid-template-columns: repeat(4, 1fr)
    }
}

@media (max-width:1180px) {
    .archive__layout {
        grid-template-columns: 232px minmax(0, 1fr);
        gap: 32px
    }

    /* qui l'intestazione ha la ricerca su una riga sua (~174px) */
    .filters {
        top: 190px;
        max-height: calc(100vh - 206px)
    }
}

/* sotto 900px i filtri diventano un pannello che entra da sinistra */
@media (max-width:900px) {

    .archive__layout {
        grid-template-columns: 1fr;
        margin-top: 16px
    }

    .filters {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 90;
        display: flex;
        flex-direction: column;
        width: min(420px, 100%);
        max-height: none;
        padding: 0;
        overflow: hidden;
        background: #fff;
        box-shadow: 12px 0 40px rgba(13, 23, 23, .18);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform .4s var(--ease), visibility 0s .4s
    }

    .filters.is-open {
        transform: none;
        visibility: visible;
        transition: transform .4s var(--ease)
    }

    .filters__head {
        padding: 10px 10px 10px 20px;
        border-bottom: 1px solid var(--line)
    }

    .filters__close {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        border: 0;
        background: none;
        cursor: pointer
    }

    .filters__close svg {
        width: 24px;
        height: 24px
    }

    .filters__body {
        flex: 1;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0 20px 20px
    }

    .filter-switch {
        border-top: 0
    }

    .filter-option {
        min-height: 44px
    }

    .filters__foot {
        display: flex;
        gap: 10px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line)
    }

    .filters__foot .btn--solid {
        flex: 1
    }

    .filters__backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 89;
        background: var(--veil)
    }

    .filters__backdrop[hidden] {
        display: none
    }

    .is-scroll-locked {
        overflow: hidden
    }

    .filters-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        height: 44px;
        padding: 0 16px;
        border: 1.5px solid var(--ink);
        border-radius: 999px;
        background: #fff;
        font: 600 15px var(--f);
        cursor: pointer
    }

    .filters-toggle svg {
        width: 18px;
        height: 18px
    }

    .filters-toggle:hover {
        background: var(--ink);
        color: #fff
    }

    .filters-toggle i {
        display: grid;
        place-items: center;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        border-radius: 999px;
        background: var(--red);
        color: #fff;
        font-style: normal;
        font-size: 12px;
        font-weight: 700
    }

    .filters-toggle i[hidden] {
        display: none
    }

    .archive__bar {
        border-top: 0;
        padding-top: 4px
    }
}

@media (max-width:700px) {

    .archive__bar {
        flex-wrap: wrap;
        gap: 10px
    }

    /* conteggio sotto, a tutta riga: filtri e ordinamento restano affiancati */
    .archive__count {
        order: 3;
        width: 100%;
        font-size: 15px
    }

    .archive__sort>span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0)
    }

    .archive__sort {
        flex: 1;
        min-width: 0
    }

    .archive__sort select {
        width: 100%
    }
}
