/* =====================================
   CUSTOM PRODUCT GRID
   Elementor + WooCommerce
===================================== */


/* =====================================
   GRID PRINCIPALE
===================================== */

.custom-product-grid-list {
    display: grid !important;

    grid-template-columns: repeat(
        var(--cpg-columns, 4),
        minmax(0, 1fr)
    );

    column-gap: var(--cpg-column-gap, 20px);

    row-gap: var(--cpg-row-gap, 30px);

    width: 100%;

    margin: 0 !important;
    padding: 0 !important;

    list-style: none !important;
}


/* =====================================
   ELEMENT PRODUIT
===================================== */

/*
 * Elementor / WooCommerce peut appliquer
 * des styles float / width / margin.
 *
 * On les neutralise uniquement dans notre
 * custom grid.
 */

.custom-product-grid-list > li {
    float: none !important;

    width: auto !important;
    max-width: none !important;

    margin: 0 !important;
    padding: 0 !important;

    min-width: 0;

    list-style: none !important;
}


.custom-product-grid-list > li::before {
    content: none !important;
}


/* =====================================
   CARTE PRODUIT SIMPLE
===================================== */

.ma-carte-produit {
    position: relative;

    width: 100%;

    overflow: hidden;

    background: #fff;

    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}


.ma-carte-produit:hover {
    transform: translateY(-1px);
}


/* =====================================
   IMAGE WRAP
===================================== */

.product-image-wrap {
    position: relative;

    width: 100%;

    display: block;
}


/* =====================================
   STACK IMAGES
===================================== */

.variation-images-stack {
    position: relative;

    width: 100%;

    aspect-ratio: 3 / 4;

    overflow: hidden;
}


/* =====================================
   COUCHES IMAGE
===================================== */

.variation-layer {
    position: absolute;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    opacity: 0;

    transition:
        opacity 0.35s ease;
}


/* =====================================
   IMAGE ACTIVE
===================================== */

.variation-layer[data-active="true"] {
    opacity: 1;

    z-index: 2;
}


/* =====================================
   IMAGES
===================================== */

.variation-layer img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: contain;

    transition:
        transform 0.35s ease;
}


/* =====================================
   HOVER ZOOM
===================================== */

.variation-images-stack:hover
.variation-layer[data-active="true"] img {
    transform: scale(1.03);
}


/* =====================================
   HOVER IMAGE PRINCIPALE
===================================== */

.ma-carte-produit:hover
.variation-layer[data-image-type="main"] {
    opacity: 0;

    z-index: 1;
}


/* =====================================
   HOVER IMAGE SECONDAIRE
===================================== */

.ma-carte-produit:hover
.variation-layer[data-image-type="secondary"] {
    opacity: 1;

    z-index: 2;
}


/* =====================================
   INFOS PRODUIT
===================================== */

.product-details-wrap {
    width: 100%;

    padding-top: 15px;

    display: flex;

    flex-direction: column;

    justify-content: space-between;
    align-items: center;

    min-height: 105px;

    text-align: center;
}


/* =====================================
   TITRE PRODUIT
===================================== */

.woocommerce-loop-product__title {
    width: 100%;

    min-width: 0;

    margin: 0;
    padding: 0;

    font-size: 0.9em !important;

    line-height: 1.3;

    font-weight: inherit;

    text-align: center;

    color: #000;

    text-wrap: balance;

    overflow-wrap: break-word;
    word-break: break-word;

    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;

    display: -webkit-box;

    -webkit-box-orient: vertical;

    -webkit-line-clamp: 2;

    overflow: hidden;
}


/* =====================================
   MARQUE
===================================== */

.eael-brandname-shortcode {
    font-family: "Inter";

    font-size: 0.8em;

    font-weight: 700;

    color: #000;
}


/* =====================================
   PRODUIT AVEC VARIATION IMAGE
===================================== */

.ma-carte-produit-variation {
    position: relative;

    width: 100%;

    margin: 0 !important;
    padding: 20px !important;

    background: #fff;

    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}


.ma-carte-produit-variation:hover {
    transform: translateY(-1px);
}


/* =====================================
   IMAGE VARIATION
===================================== */

.ma-carte-produit-variation
.product-image-wrap {
    position: relative;

    width: 100%;
}


.variation-image-single {
    position: relative;

    width: 100%;

    aspect-ratio: 3 / 4;

    overflow: hidden;
}


/* =====================================
   IMAGE FULL
===================================== */

.variation-image-single img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: contain;

    transition:
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}


/* =====================================
   HOVER IMAGE
===================================== */

.ma-carte-produit-variation:hover
.variation-image-single img {
    transform: scale(1.015);
}


/* =====================================
   INFOS VARIATION
===================================== */

.ma-carte-produit-variation
.product-details-wrap {
    width: 100%;

    padding-top: 15px;

    min-height: 105px;

    text-align: center;
}


.ma-carte-produit-variation
.detailswrap {
    width: 100%;
}


/* =====================================
   MARQUE VARIATION
===================================== */

.ma-carte-produit-variation
.eael-brandname-shortcode {
    font-family: "Inter";

    font-size: 0.8em;

    font-weight: 700;

    color: #000;
}


/* =====================================
   NOM VARIATION
===================================== */

.ma-carte-produit-variation
.woocommerce-loop-product__title {
    margin: 0;
    padding: 0;

    font-size: 0.9em !important;

    line-height: 1.3;

    font-weight: inherit;

    color: #000;
}


.ma-carte-produit-variation
.woocommerce-loop-product__title a {
    color: #000;

    font-weight: 300;

    text-decoration: none;
}


/* =====================================
   PRODUIT SWATCHES
===================================== */

.ma-carte-produit-swatches {
    position: relative;

    width: 100%;

    margin: 0 !important;
    padding: 20px !important;

    background: #fff;

    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}


.ma-carte-produit-swatches:hover {
    transform: translateY(-1px);
}


/* =====================================
   IMAGE SWATCHES
===================================== */

.ma-carte-produit-swatches
.product-image-wrap {
    position: relative;

    width: 100%;
}


.ma-carte-produit-swatches
.variation-image-single {
    position: relative;

    width: 100%;

    aspect-ratio: 3 / 4;

    overflow: hidden;
}


/* =====================================
   IMAGE
===================================== */

.ma-carte-produit-swatches
.variation-image-single img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: contain;

    transition:
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}


/* =====================================
   HOVER IMAGE
===================================== */

.ma-carte-produit-swatches:hover
.variation-image-single img {
    transform: scale(1.015);
}


/* =====================================
   INFOS SWATCHES
===================================== */

.ma-carte-produit-swatches
.product-details-wrap {
    width: 100%;

    padding-top: 15px;

    min-height: 105px;

    text-align: center;
}


.ma-carte-produit-swatches
.detailswrap {
    width: 100%;
}


/* =====================================
   MARQUE SWATCHES
===================================== */

.ma-carte-produit-swatches
.eael-brandname-shortcode {
    font-family: "Inter";

    font-size: 0.8em;

    font-weight: 700;

    color: #000;
}


/* =====================================
   NOM SWATCHES
===================================== */

.ma-carte-produit-swatches
.woocommerce-loop-product__title {
    margin: 0;
    padding: 0;

    font-size: 0.9em !important;

    line-height: 1.3;

    font-weight: inherit;

    color: #000;
}


.ma-carte-produit-swatches
.woocommerce-loop-product__title a {
    color: #000;

    font-weight: 300;

    text-decoration: none;
}


/* =====================================
   SWATCHES COULEURS
===================================== */

.colors-swatches-only {
    width: 100%;

    z-index: 5;

    align-items: center;
    justify-content: center;
}


.color-swatches {
    display: flex;

    justify-content: center;
    align-items: center;

    gap: 4px;

    margin: 0;
    padding: 0;

    list-style: none;
}


.swatch-item {
    width: 20px;
    height: 20px;

    border-radius: 50%;

    cursor: pointer;

    border: 1px solid #ddd;

    transition:
        transform 0.2s ease,
        border 0.2s ease;
}


.swatch-item.active {
    transform: scale(1.15);
}


/* =====================================
   INFINITE SCROLL
===================================== */

.infinite-scroll-trigger {
    text-align: center;

    padding: 20px;

    font-size: 14px;

    color: #888;
}


.infinite-scroll-trigger.is-loading::after {
    content: "";

    display: inline-block;

    width: 18px;
    height: 18px;

    margin-left: 10px;

    border: 3px solid #ddd;

    border-top-color: #30363d;

    border-radius: 50%;

    animation:
        cpg-spin 1s linear infinite;
}


@keyframes cpg-spin {

    to {
        transform: rotate(360deg);
    }

}


/* =====================================
   FUTURE :
   TAILLE INDIVIDUELLE PRODUIT
===================================== */

/*
 * Ces classes pourront être utilisées
 * lorsque les contrôles Elementor
 * "Colonnes occupées" et "Lignes occupées"
 * seront ajoutés.
 *
 * Exemple :
 *
 * .cpg-item-span-2 {
 *     grid-column: span 2;
 * }
 *
 * .cpg-item-row-2 {
 *     grid-row: span 2;
 * }
 */


/* =====================================
   TABLETTE
===================================== */

@media (max-width: 1024px) {

    .custom-product-grid-list {
        grid-template-columns: repeat(
            var(--cpg-columns-tablet, 3),
            minmax(0, 1fr)
        );

        column-gap: var(--cpg-column-gap-tablet, 15px);

        row-gap: var(--cpg-row-gap-tablet, 25px);
    }

}



/* =====================================
   MOBILE
===================================== */

@media (max-width: 767px) {


    .custom-product-grid-list {
        grid-template-columns: repeat(
            var(--cpg-columns-mobile, 2),
            minmax(0, 1fr)
        );

        column-gap: var(--cpg-column-gap-mobile, 10px);

        row-gap: var(--cpg-row-gap-mobile, 20px);
    }


    .product-details-wrap {
        min-height: 90px;
    }

}


/* =====================================
   TRÈS PETITS ÉCRANS
===================================== */

@media (max-width: 480px) {

    .custom-product-grid-list {
        column-gap: 8px;

        /*
         * On conserve la valeur Elementor mobile.
         * Pas de valeur fixe qui écrase le contrôle.
         */
        row-gap: var(--cpg-row-gap-mobile, 20px);
    }

}
