/**
 * Boutique (archive produits, catégories, étiquettes) — design dédié.
 *
 * Override la grille 4-col par 3-col, ajoute le hero d'archive, pills
 * catégories, ratio 1:1 sur les vignettes, badges, empty state.
 * Reprend les variables CSS du thème enfant — pas de couleur hardcodée.
 *
 * Chargé conditionnellement via functions.php sur :
 *   is_shop() || is_product_category() || is_product_tag()
 */

/* ============================================================
 * Cadre général : on s'imbrique dans le wrapper .sfc-shop-wrap
 * ============================================================ */
.sfc-shop-archive {
    margin: 0;
}

/* ============================================================
 * Hero d'archive (titre + sous-titre + filet doré)
 * ============================================================ */
.sfc-shop-archive__hero {
    text-align: center;
    margin: 0 auto 32px;
    max-width: 760px;
    padding-inline: 16px;
}

.sfc-shop-archive__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--color-gold);
    margin-bottom: 12px;
}

.sfc-shop-archive__eyebrow::before,
.sfc-shop-archive__eyebrow::after {
    content: "";
    width: 24px;
    height: 1px;
    background: var(--color-gold);
}

.sfc-shop-archive__title.page-title,
.sfc-shop-archive__title.woocommerce-products-header__title {
    font-family: var(--font-heading);
    font-size: clamp(28px, 3.6vw, 44px);
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
}

.sfc-shop-archive__subtitle {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
}

.sfc-shop-archive__subtitle p:last-child { margin-bottom: 0; }

/* Cache la description de catégorie native quand on l'a déjà rendue dans le subtitle */
.sfc-shop-archive .term-description { display: none; }

/* ============================================================
 * Pills catégories
 * ============================================================ */
/* Conteneur : positionne les flèches desktop de part et d'autre du carrousel. */
.sfc-shop-pills-wrap {
    position: relative;
    margin: 0 auto 36px;
}

/* Barre de catégories — carrousel une seule ligne à défilement latéral.
 * Centrée quand elle tient (justify: safe center), bascule en scroll dès
 * qu'elle déborde — sans jamais rendre les premiers items inaccessibles.
 * Fondus dégradés aux bords (mask) pour signaler le défilement. */
.sfc-shop-pills {
    display: flex;
    flex-wrap: nowrap;
    justify-content: safe center;
    gap: 10px;
    margin: 0;
    padding: 6px 28px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 28px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge legacy */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}

.sfc-shop-pills::-webkit-scrollbar { /* Chrome/Safari */
    display: none;
}

.sfc-shop-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    scroll-snap-align: center;
    white-space: nowrap;
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--color-white);
    color: var(--color-primary);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: background-color 200ms ease, color 200ms ease,
                border-color 200ms ease, transform 200ms ease,
                box-shadow 200ms ease;
}

/* Icône Lucide de la pill : dorée, pour ressortir aussi bien sur blanc
 * que sur le navy de l'état actif. */
.sfc-shop-pill__icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: var(--color-gold);
    /* Normalise l'épaisseur de trait (certaines icônes réutilisées de la home
       sont en 1.2) : le CSS prime sur l'attribut SVG et s'hérite aux <path>. */
    stroke-width: 1.5;
    transition: color 200ms ease, transform 200ms ease;
}

.sfc-shop-pill:hover .sfc-shop-pill__icon,
.sfc-shop-pill:focus-visible .sfc-shop-pill__icon {
    transform: scale(1.08);
}

/* Flèches de navigation — desktop uniquement (sur mobile/tablette : scroll
 * tactile). Affichées/masquées par le JS selon le débordement et la position
 * de scroll (attribut [hidden]). */
.sfc-shop-pills__arrow {
    display: none; /* activé en desktop via media query */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1.5px solid var(--color-secondary);
    border-radius: 10px;
    background: var(--color-white);
    color: var(--color-primary);
    cursor: pointer;
    box-shadow: 0 6px 18px -8px rgba(34, 34, 34, 0.35);
    transition: background-color 200ms ease, color 200ms ease,
                border-color 200ms ease, box-shadow 200ms ease, opacity 200ms ease;
}

.sfc-shop-pills__arrow--prev { left: -6px; }
.sfc-shop-pills__arrow--next { right: -6px; }

.sfc-shop-pills__arrow:hover,
.sfc-shop-pills__arrow:focus-visible {
    background: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
    box-shadow: 0 8px 20px -6px rgba(247, 99, 9, 0.45);
    outline: none;
}

.sfc-shop-pills__arrow svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
}

/* Le bouton n'apparaît qu'en desktop ET seulement quand le JS l'a démasqué. */
@media (min-width: 1025px) {
    .sfc-shop-pills__arrow:not([hidden]) {
        display: inline-flex;
    }
    /* Réserve un peu d'espace pour que les flèches ne couvrent pas le contenu. */
    .sfc-shop-pills-wrap {
        padding-inline: 12px;
    }
}

.sfc-shop-pill:hover,
.sfc-shop-pill:focus-visible {
    background: var(--color-cream);
    border-color: var(--color-gold);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px -4px rgba(248, 152, 80, 0.4);
    outline: none;
}

.sfc-shop-pill.is-active {
    background: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
    box-shadow:
        0 0 0 3px rgba(247, 99, 9, 0.15),
        0 8px 20px -6px rgba(247, 99, 9, 0.35);
}

/* ============================================================
 * Result-count + ordering — toolbar sous les pills
 * ============================================================ */
.woocommerce .woocommerce-result-count,
.woocommerce-page .woocommerce-result-count {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-text-muted);
    font-style: italic;
    margin-bottom: 24px;
}

.woocommerce .woocommerce-ordering,
.woocommerce-page .woocommerce-ordering {
    margin-bottom: 24px;
}

.woocommerce .woocommerce-ordering select,
.woocommerce-page .woocommerce-ordering select {
    appearance: none;
    -webkit-appearance: none;
    padding: 10px 36px 10px 16px;
    border: 1.5px solid rgba(34, 34, 34, 0.1);
    border-radius: 100px;
    background-color: var(--color-white);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23C9A961' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 6 8 10 12 6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px 14px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-primary);
    cursor: pointer;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.woocommerce .woocommerce-ordering select:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(248, 152, 80, 0.18);
}

/* ============================================================
 * Grille produits — 3 col desktop / 2 tablette / 1 mobile
 * Override de la grille 4-col définie dans woocommerce.css
 * ============================================================ */
.woocommerce ul.products,
.woocommerce-page ul.products {
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(20px, 2.5vw, 36px);
    margin: 0 0 40px;
}

/* Neutralise les pseudo-éléments clearfix du parent Storefront
   (ul.products::before / ::after) qui, en mode grid, deviennent
   des grid items fantômes et déforment la disposition (2-3-3-2). */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
    content: none;
    display: none;
}

/* ============================================================
 * Card produit
 * ============================================================ */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.sfc-product-card {
    display: flex;
    flex-direction: column;
    text-align: left;
    background: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(34, 34, 34, 0.04),
        0 12px 28px -18px rgba(34, 34, 34, 0.18);
    transition: transform 350ms ease, box-shadow 350ms ease;
    position: relative;
    margin: 0;
}

.woocommerce ul.products li.product:hover,
.sfc-product-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 1px 2px rgba(34, 34, 34, 0.04),
        0 20px 40px -16px rgba(34, 34, 34, 0.25);
}

.woocommerce ul.products li.product > a.woocommerce-LoopProduct-link,
.sfc-product-card > a.woocommerce-LoopProduct-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

/* ============================================================
 * Zone media (badges + image) — ratio carré 1:1
 * ============================================================ */
.sfc-product-card__media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--color-cream);
    overflow: hidden;
}

.woocommerce ul.products li.product .sfc-product-card__media img,
.sfc-product-card__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
    margin: 0;
    padding: 0;
    border-radius: 0;
}

.sfc-product-card:hover .sfc-product-card__media img,
.woocommerce ul.products li.product:hover .sfc-product-card__media img {
    transform: scale(1.06);
}

/* ============================================================
 * Badges (Sélection, Nouveau) — superposés en haut à gauche
 * ============================================================ */
.sfc-product-card__media .onsale,
.sfc-product-card__media .sfc-badge {
    position: absolute;
    z-index: 2;
    top: 12px;
    margin: 0;
    min-height: auto;
    min-width: auto;
    padding: 5px 12px;
    border-radius: 100px;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.3;
}

/* Badge "Sélection" — terracotta à gauche */
.sfc-product-card__media .onsale,
.sfc-product-card__media .sfc-badge--selection {
    left: 12px;
    background: var(--color-accent);
    color: var(--color-white);
    box-shadow: 0 4px 12px -2px rgba(247, 99, 9, 0.45);
}

/* ============================================================
 * Body (titre + prix + note)
 * ============================================================ */
.sfc-product-card__body {
    display: flex;
    flex-direction: column;
    padding: 18px 18px 14px;
    flex: 1;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2,
.woocommerce ul.products li.product h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-primary);
    padding: 0;
    margin: 0 0 6px;
    line-height: 1.25;
    text-align: left;
    transition: color 200ms ease;
}

.woocommerce ul.products li.product:hover .woocommerce-loop-product__title {
    color: var(--color-accent);
}

.woocommerce ul.products li.product .price {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-accent);
    padding: 0;
    margin: 0;
    display: block;
    text-align: left;
}

.woocommerce ul.products li.product .price del {
    color: var(--color-text-muted);
    font-weight: 400;
    margin-right: 6px;
}

.woocommerce ul.products li.product .price ins {
    background: transparent;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

/* Note moyenne (étoiles) */
.woocommerce ul.products li.product .star-rating {
    font-size: 12px;
    margin: 4px 0 6px;
    color: var(--color-gold);
}

/* ============================================================
 * Bouton "Ajouter au panier"
 * ============================================================ */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .added_to_cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center; /* centrage horizontal dans la carte (flex column), tous écrans */
    gap: 6px;
    width: calc(100% - 36px);
    margin: 0 18px 18px;
    padding: 12px 18px;
    background: var(--color-accent);
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    border: 0;
    border-radius: 100px;
    text-decoration: none;
    box-shadow: 0 6px 16px -8px rgba(247, 99, 9, 0.45);
    transition: background-color 220ms ease, transform 220ms ease,
                box-shadow 220ms ease, color 220ms ease;
}

.woocommerce ul.products li.product .button:hover,
.woocommerce ul.products li.product .button:focus-visible,
.woocommerce ul.products li.product .added_to_cart:hover {
    background: var(--color-accent);
    color: var(--color-white);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -8px rgba(247, 99, 9, 0.5);
    outline: none;
}

/* État "Ajouté !" */
.woocommerce ul.products li.product .button.added,
.woocommerce ul.products li.product .button.loading {
    background: var(--color-accent);
    color: var(--color-white);
}

.woocommerce ul.products li.product .button.loading::before {
    margin-right: 6px;
}

.woocommerce ul.products li.product .added_to_cart {
    background: var(--color-accent);
}

/* ============================================================
 * Pagination
 * ============================================================ */
.woocommerce nav.woocommerce-pagination {
    margin: 32px 0 16px;
    text-align: center;
}

.woocommerce nav.woocommerce-pagination ul {
    border: 0;
    display: inline-flex;
    gap: 4px;
}

.woocommerce nav.woocommerce-pagination ul li {
    border: 0;
    margin: 0;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    transition: background-color 200ms ease, color 200ms ease;
}

.woocommerce nav.woocommerce-pagination ul li a:hover,
.woocommerce nav.woocommerce-pagination ul li a:focus-visible {
    background: var(--color-cream);
    color: var(--color-primary);
    outline: none;
}

.woocommerce nav.woocommerce-pagination ul li span.current {
    background: var(--color-accent);
    color: var(--color-white);
}

/* ============================================================
 * Empty state (catégorie vide ou recherche sans résultat)
 * ============================================================ */
.sfc-shop-empty {
    text-align: center;
    padding: 56px 24px;
    background: var(--color-white);
    border-radius: 14px;
    max-width: 560px;
    margin: 0 auto;
    box-shadow:
        0 1px 2px rgba(34, 34, 34, 0.05),
        0 20px 40px -22px rgba(34, 34, 34, 0.18);
}

.sfc-shop-empty__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--color-gold);
    display: block;
    opacity: 0.75;
}

.sfc-shop-empty__title {
    font-family: var(--font-heading);
    font-size: clamp(20px, 2.4vw, 26px);
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 8px;
}

.sfc-shop-empty__text {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin: 0 0 22px;
}

.sfc-shop-empty__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-accent);
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 12px 24px;
    border-radius: 100px;
    text-decoration: none;
    box-shadow: 0 8px 20px -8px rgba(247, 99, 9, 0.5);
    transition: background-color 220ms ease, transform 220ms ease,
                box-shadow 220ms ease;
}

.sfc-shop-empty__cta:hover {
    background: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -8px rgba(247, 99, 9, 0.45);
}

.sfc-shop-empty__cta svg { transition: transform 200ms ease; }
.sfc-shop-empty__cta:hover svg { transform: translateX(3px); }

/* ============================================================
 * Responsive
 * 3 col : desktop & laptop (>900px)
 * 2 col : tablette (≤900px)
 * 1 col : mobile (≤640px)
 * ============================================================ */
@media (max-width: 900px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .sfc-shop-pill { padding: 8px 14px; font-size: 12px; }
}

@media (max-width: 640px) {
    .sfc-shop-archive__hero { margin-bottom: 24px; }

    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: 1fr;
        max-width: 420px;
        margin-inline: auto;
        gap: 16px;
    }

    /* Catégories : on conserve le carrousel 1 ligne à défilement latéral.
       Aligné à gauche (la pill « Toutes » démarre au bord) et fondus réduits. */
    .sfc-shop-pills {
        justify-content: flex-start;
        gap: 8px;
        padding: 4px 20px;
        scroll-padding-inline: 20px;
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
                mask-image: linear-gradient(to right, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
    }

    .sfc-shop-pill__icon { width: 15px; height: 15px; }

    .woocommerce ul.products li.product .button,
    .woocommerce ul.products li.product .added_to_cart {
        width: calc(100% - 28px);
        margin: 0 14px 14px;
    }

    .sfc-product-card__body { padding: 14px 14px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .woocommerce ul.products li.product,
    .sfc-product-card,
    .sfc-product-card__media img,
    .sfc-shop-pill,
    .sfc-shop-pill__icon,
    .sfc-shop-empty__cta,
    .woocommerce ul.products li.product .button {
        transition: none;
    }
    .sfc-shop-pills { scroll-behavior: auto; }
}

/* ============================================================
 * Encart « Découvrir les coffrets » (boutique principale)
 * ============================================================ */
.sfc-shop-coffrets {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    margin: 4px 0 36px;
    padding: 30px 36px;
    overflow: hidden;
    background: var(--color-cream);
    border: 1px solid rgba(248, 152, 80, 0.4);
    border-radius: var(--radius-ui);
}

.sfc-shop-coffrets::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-gold);
}

.sfc-shop-coffrets__content {
    min-width: 0;
}

.sfc-shop-coffrets__eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--color-gold);
    margin-bottom: 6px;
}

.sfc-shop-coffrets__title {
    font-family: var(--font-heading);
    font-size: clamp(22px, 2.6vw, 30px);
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 6px;
    line-height: 1.15;
}

.sfc-shop-coffrets__text {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: rgba(34, 34, 34, 0.8);
    margin: 0;
    max-width: 520px;
}

.sfc-shop-coffrets__cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-primary);
    background: var(--color-gold);
    border: 1px solid var(--color-gold);
    border-radius: var(--radius-ui);
    text-decoration: none;
    transition: var(--transition-base);
}

.sfc-shop-coffrets__cta:hover {
    background: transparent;
    color: var(--color-gold);
}

.sfc-shop-coffrets__cta svg {
    transition: transform 200ms ease;
}

.sfc-shop-coffrets__cta:hover svg {
    transform: translateX(4px);
}

@media (max-width: 640px) {
    .sfc-shop-coffrets { padding: 24px; }
    .sfc-shop-coffrets__cta { width: 100%; justify-content: center; }
}
