/* =========================================================
   Camila — boutique (woocommerce/archive-product.php)
   Filtres dans une colonne rose à gauche (fixe au défilement),
   cartes des bijoux à droite (product-card.css).
   Sous 900px : filtres repliés derrière un bouton (shop.js).
   ========================================================= */

.shop-main {
    padding-block: clamp(2rem, 1rem + 4vw, 5rem) clamp(3rem, 2rem + 3vw, 5rem);
}

.shop {
    --container: 1300px;
}

.shop-intro {
    max-width: 42em;
    margin: -1rem auto 2.5rem;
    color: #000;
    text-align: center;
}

.shop-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 2rem clamp(2rem, 4vw, 3.5rem);
    align-items: start;
}

/* ---------- Filtres ---------- */

.shop-filters-panel {
    position: sticky;
    top: calc(var(--wp-admin--admin-bar--height, 0px) + 115px); /* sous le header */
    max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - 135px);
    overflow-y: auto;
    padding: 1.4rem 1.3rem 1.5rem;
    border-radius: 6px;
    background: var(--c-surface);
    scrollbar-width: thin;
}

.shop-filters-title {
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.shop-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.shop-group + .shop-group {
    margin-top: 1.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid #f6d6d3;
}

/* Flottant : sinon la légende se poserait à cheval sur le trait de séparation du groupe */
.shop-group-title {
    float: left;
    width: 100%;
    margin-bottom: .45rem;
    padding: 0;
    color: var(--c-accent-ink);
    font-family: var(--f-title);
    font-size: 1.375rem;
}

.shop-options {
    clear: both;
    display: grid;
    gap: .1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.shop-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-inline: -.45rem;
    padding: .3rem .45rem;
    border-radius: 6px;
    color: #000;
    font-size: 1.25rem; /* 20px, comme le texte des cartes */
    line-height: 1.3;
    cursor: pointer;
    transition: background-color .2s;
}

.shop-option:hover {
    background: #fff;
}

/* Option sans bijou avec les autres filtres cochés */
.shop-option.is-empty {
    opacity: .45;
    cursor: default;
}

.shop-option.is-empty:hover {
    background: none;
}

/* Case à cocher dessinée : la vraie case reste là (clavier, lecteurs d'écran), invisible */
.shop-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.shop-check {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--c-accent);
    border-radius: 4px;
    background: #fff;
    transition: background-color .2s, border-color .2s;
}

.shop-check::after {
    content: "";
    width: 6px;
    height: 11px;
    margin-top: -2px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .2s cubic-bezier(.22, .61, .36, 1);
}

.shop-input:checked + .shop-check {
    border-color: var(--c-accent-ink);
    background: var(--c-accent-ink);
}

.shop-input:checked + .shop-check::after {
    transform: rotate(45deg) scale(1);
}

.shop-input:focus-visible + .shop-check {
    outline: 2px solid var(--c-accent-ink);
    outline-offset: 2px;
}

.shop-swatch {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / .14);
}

/* Au-delà de 5 options, les suivantes sont repliées derrière « Voir plus » (shop.js),
   sauf celles qui sont cochées */
.shop-group:not(.is-open) .shop-options > .is-more:not(:has(.shop-input:checked)) {
    display: none;
}

.shop-more {
    margin-top: .3rem;
    padding: .2rem 0;
    border: 0;
    background: none;
    color: var(--c-accent-ink);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: .2em;
    cursor: pointer;
}

.shop-more:hover {
    color: var(--c-accent-dark);
}

.shop-option-count {
    margin-left: auto;
    color: var(--c-text-soft);
    font-size: 1rem;
}

.shop-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    margin-top: 1.4rem;
}

.shop-reset {
    font-size: 1.125rem;
    font-weight: 700;
}

/* Avec le script, les filtres s'appliquent tout seuls : bouton « Afficher » inutile sur
   grand écran (sur mobile, il ferme le panneau et montre les bijoux) */
.shop--js .shop-apply {
    display: none;
}

/* Bouton du panneau, sur mobile seulement */
.shop-filters-toggle {
    display: none;
}

/* ---------- Bijoux ---------- */

.shop-total {
    margin-bottom: 1rem;
    color: var(--c-text-soft);
    font-size: .9375rem;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 2.25rem 1.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Bijou qui ne correspond pas aux filtres : après les autres, estompé
   (le glissement des cartes à leur nouvelle place est fait par shop.js) */
.shop-grid > li {
    transition: opacity .35s ease;
}

.shop-grid > li.is-dimmed {
    opacity: .2;
}

.shop-empty {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 6px;
    background: var(--c-surface);
    color: #000;
    text-align: center;
}

.shop-empty .btn {
    margin-top: 1rem;
}

/* ---------- Tablette et mobile ---------- */

@media (max-width: 899px) {
    .shop-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .shop-filters-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .shop--js .shop-filters-toggle {
        display: inline-flex;
        align-items: center;
        gap: .5rem;
        padding: .55rem 1.1rem;
        border: 1.5px solid var(--c-accent-ink);
        border-radius: 999px;
        background: #fff;
        color: var(--c-accent-ink);
        font: inherit;
        font-size: 1.25rem;
        font-weight: 700;
        cursor: pointer;
    }

    .shop--js .shop-filters-toggle[aria-expanded="true"] {
        background: var(--c-accent-ink);
        color: #fff;
    }

    .shop-filters-badge {
        display: grid;
        place-items: center;
        min-width: 1.4em;
        height: 1.4em;
        padding: 0 .35em;
        border-radius: 999px;
        background: var(--c-accent-ink);
        color: #fff;
        font-size: .75rem;
    }

    .shop-filters-toggle[aria-expanded="true"] .shop-filters-badge {
        background: #fff;
        color: var(--c-accent-ink);
    }

    .shop-filters-badge[hidden] {
        display: none;
    }

    /* Panneau replié tant que le bouton n'est pas ouvert */
    .shop--js .shop-filters:not(.shop-filters--open) .shop-filters-panel {
        display: none;
    }

    .shop--js .shop-filters-panel {
        margin-top: 1rem;
    }

    .shop--js .shop-filters-title {
        display: none;
    }

    .shop--js .shop-apply {
        display: inline-flex;
        border: none;
    }
}

/* Téléphone : deux cartes par ligne, texte des cartes réduit pour tenir dans la largeur */
@media (max-width: 599px) {
    .shop-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem .75rem;
    }

    .shop-grid .product-card-body {
        gap: .2rem;
        padding: .7rem .65rem .8rem;
        font-size: .875rem;
    }

    .shop-grid .product-card-title,
    .shop-grid .product-card-price {
        font-size: 1rem;
    }

    .shop-grid .product-card-btn {
        padding: .25rem .6rem;
        font-size: .875rem;
    }
}
