/* =========================================================
   CCX Product Cards — scope: .ccx-cards
   Version propre: 1 seule logique / pas de doublons / pas de contradictions
   ========================================================= */

:root{
  --ccx-img: 160px;
  --ccx-pad: 10px;
  --ccx-gap: 14px;
  --ccx-title: 62px;
  --ccx-accent: #ff8a00;
  --ccx-green: #2fbf71;
}

/* =========================================================
   GRILLE
   ========================================================= */
.ccx-cards .woocommerce ul.products{
  --ccx-card-w: calc(var(--ccx-img) + 2*var(--ccx-pad));
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(var(--ccx-card-w), var(--ccx-card-w))) !important;
  gap: var(--ccx-gap) !important;
  justify-content: center !important;
  align-content: start !important;
  grid-auto-flow: row dense !important;

  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  clear: both !important;
}

/* Neutralise clearfix Woo */
.ccx-cards .woocommerce ul.products::before,
.ccx-cards .woocommerce ul.products::after{
  content: none !important;
  display: none !important;
}

/* =========================================================
   CARTE
   ========================================================= */
.ccx-cards .woocommerce ul.products li.product{
  width: var(--ccx-card-w) !important;
  margin: 0 !important;
  padding: var(--ccx-pad) !important;
  box-sizing: border-box !important;

  background: #fff !important;
  border: 1px solid rgba(0,0,0,.08) !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.04) !important;

  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  position: relative !important;

  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  float: none !important;
  clear: none !important;
  z-index: 0 !important;
}

.ccx-cards .woocommerce ul.products li.product:hover{
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0,0,0,.08) !important;
  border-color: var(--ccx-green) !important;
}

/* =========================================================
   IMPORTANT: NE JAMAIS contraindre le lien
   (il englobe image + titre + prix chez toi)
   ========================================================= */
.ccx-cards .woocommerce ul.products li.product a.woocommerce-loop-product__link,
.ccx-cards .woocommerce ul.products li.product a.woocommerce-LoopProduct-link{
  height: auto !important;
  display: block !important;
  overflow: visible !important;
}

/* =========================================================
   CCX — IMAGE (PREMIUM / ZÉRO CROP)
   - frame fixe
   - fond doux + bordure
   - image centrée en "contain" (pas coupée)
   - padding interne + micro-zoom pour homogénéiser visuellement
   ========================================================= */

.ccx-cards .woocommerce ul.products li.product span.et_shop_image{
  width: var(--ccx-img) !important;
  height: var(--ccx-img) !important;
  margin: 0 0 8px !important;
  padding: 10px !important;                 /* ✅ espace interne premium */
  box-sizing: border-box !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  overflow: hidden !important;
  position: relative !important;

  /* look premium */
  background: linear-gradient(180deg, #ffffff 0%, #f6f7fb 100%) !important;
  border: 1px solid rgba(15,23,42,.07) !important;
  border-radius: 14px !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7) !important;
}

/* image: jamais coupée */
.ccx-cards .woocommerce ul.products li.product span.et_shop_image > img,
.ccx-cards .woocommerce ul.products li.product img.attachment-woocommerce_thumbnail,
.ccx-cards .woocommerce ul.products li.product img.wp-post-image{
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;

  object-fit: contain !important;           /* ✅ pas de crop */
  object-position: center !important;

  display: block !important;
  margin: 0 !important;

  /* homogénéise sans déformer */
  transform: scale(1.04) !important;        /* micro-zoom safe */
  filter: drop-shadow(0 6px 10px rgba(15,23,42,.10)) !important;
}

/* kill overlay Divi */
.ccx-cards .woocommerce ul.products li.product .et_overlay,
.ccx-cards .woocommerce ul.products li.product span.et_shop_image .et_overlay{
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* neutralise pseudo-elements potentiels */
.ccx-cards .woocommerce ul.products li.product span.et_shop_image::before,
.ccx-cards .woocommerce ul.products li.product span.et_shop_image::after{
  content: none !important;
  display: none !important;
}

/* Mobile: frame un poil plus compacte */
@media (max-width: 600px){
  .ccx-cards .woocommerce ul.products li.product span.et_shop_image{
    width: 100% !important;
    height: 150px !important;
    padding: 10px !important;
  }
  .ccx-cards .woocommerce ul.products li.product span.et_shop_image > img,
  .ccx-cards .woocommerce ul.products li.product img.attachment-woocommerce_thumbnail,
  .ccx-cards .woocommerce ul.products li.product img.wp-post-image{
    transform: scale(1.03) !important;
  }
}


/* =========================================================
   BADGE -% (onsale) — vert dégradé + texte noir (premium)
   ========================================================= */
.ccx-cards .woocommerce ul.products li.product .onsale{
  position: absolute !important;
  top: 10px !important;
  left: 10px !important;
  z-index: 5 !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  background: linear-gradient(135deg, #00ff6a 0%, #a7ffd3 100%) !important;
  color: #07120c !important; /* noir/vert foncé lisible */

  border-radius: 999px !important;
  padding: 4px 9px !important;

  font-weight: 900 !important;
  font-size: 12px !important;
  letter-spacing: .02em !important;

  border: 1px solid rgba(0,255,106,.55) !important;
  box-shadow:
    0 10px 22px rgba(0,255,106,.16),
    0 10px 22px rgba(0,0,0,.18) !important;
}


/* =========================================================
   TITRE (3 lignes)
   ========================================================= */
.ccx-cards .woocommerce ul.products li.product h2.woocommerce-loop-product__title{
  width: var(--ccx-img) !important;
  font-size: 14px !important;
  line-height: 1.35 !important;

  height: var(--ccx-title) !important;
  min-height: var(--ccx-title) !important;
  max-height: var(--ccx-title) !important;

  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;

  text-align: center !important;
  margin: 4px 0 0 !important;
  overflow: hidden !important;

  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

/* =========================================================
   PRIX (milliers OK)
   ========================================================= */
.ccx-cards .woocommerce ul.products li.product .price{
  width: var(--ccx-img) !important;
  text-align: center !important;
  margin-top: 6px !important;
  line-height: 1.3 !important;
}

.ccx-cards .woocommerce ul.products li.product .price del{
  display: none !important;
}

.ccx-cards .woocommerce ul.products li.product .price::before{
  content: "À partir de : ";
  color: #222;
  font-weight: 600;
  margin-right: 3px;
}

.ccx-cards .woocommerce ul.products li.product .price ins,
.ccx-cards .woocommerce ul.products li.product .price .woocommerce-Price-amount,
.ccx-cards .woocommerce ul.products li.product .price .woocommerce-Price-amount bdi,
.ccx-cards .woocommerce ul.products li.product .price .woocommerce-Price-currencySymbol{
  color: var(--ccx-accent) !important;
  font-weight: 700 !important;
  text-decoration: none !important;

  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

/* =========================================================
   NETTOYAGE Woo
   ========================================================= */
.ccx-cards .woocommerce ul.products li.product .star-rating{
  display: none !important;
}
.ccx-cards .woocommerce-ordering{
  display: none !important;
}

/* =========================================================
   WISHLIST (coeur verre) — conserve ton style (sans doublons ailleurs)
   ========================================================= */
.ccx-cards .ccx-wl-wrap{
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
}

.ccx-cards .ccx-wl-btn{
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  line-height: 1;

  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(1.2) blur(10px);
  border: 1px solid rgba(255,138,0,.85);
  box-shadow: 0 4px 14px rgba(15,23,42,.18);

  color: var(--ccx-accent);
  transition: transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.ccx-cards .ccx-wl-btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.96);
  box-shadow: 0 10px 26px rgba(15,23,42,.22);
}

.ccx-cards .ccx-wl-btn .ccx-wl-ico{
  width: 17px;
  height: 17px;
  display: block;
}

.ccx-cards .ccx-wl-btn .ccx-wl-ico path{
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1px;
}

.ccx-cards .ccx-wl-btn.is-active{
  border-color: var(--ccx-green);
  color: var(--ccx-green);
  background: rgba(255,255,255,.90);
  box-shadow: 0 10px 24px rgba(34,197,94,.26);
}

.ccx-cards .ccx-wl-btn.is-active .ccx-wl-ico path{
  fill: currentColor;
  stroke: currentColor;
}

/* =========================================================
   MOBILE — 2 colonnes
   ========================================================= */
@media (max-width: 600px){
  .ccx-cards .woocommerce ul.products{
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 12px !important;
    justify-content: stretch !important;
  }

  .ccx-cards .woocommerce ul.products li.product{
    width: auto !important;
    min-width: 0 !important;
  }

  /* Image/titre/prix full width */
  .ccx-cards .woocommerce ul.products li.product span.et_shop_image,
  .ccx-cards .woocommerce ul.products li.product h2.woocommerce-loop-product__title,
  .ccx-cards .woocommerce ul.products li.product .price{
    width: 100% !important;
  }

  /* frame un peu plus basse en mobile */
  .ccx-cards .woocommerce ul.products li.product span.et_shop_image{
    height: 150px !important;
  }

  /* "À partir de" sur une ligne à part */
  .ccx-cards .woocommerce ul.products li.product .price{
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 2px !important;
  }
  .ccx-cards .woocommerce ul.products li.product .price::before{
    display: block !important;
    margin: 0 !important;
  }
}

/* Mobile/tactile: pas de hover collant */
@media (hover:none),(pointer:coarse){
  .ccx-cards .woocommerce ul.products li.product,
  .ccx-cards .woocommerce ul.products li.product:hover{
    transform: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.04) !important;
    z-index: auto !important;
  }
}

/* Toolbar / filtres */
.ccx-toolbar,
.ccx-filterbar-wrap{
  margin-bottom: 8px !important;
  padding-bottom: 0 !important;
}
.ccx-cards .woocommerce ul.products{
  margin-top: 0 !important;
}


@supports (content-visibility: auto){
  /* Les premières cartes (au-dessus de la fold) restent normales = LCP plus stable */
  .ccx-cards .woocommerce ul.products li.product{
    content-visibility: visible;
  }

  /* On “skip render” seulement à partir de la 9e carte */
  .ccx-cards .woocommerce ul.products li.product:nth-child(n+9){
    content-visibility: auto;
    contain-intrinsic-size: 200px 320px;
  }
}






