/* ==========================================================================
   Galerie produit — grille éditoriale « masonry » (rangées à motif) + lightbox.
   Motif cyclique de colonnes : 1 grande, 2 petites, 1 grande, 3 moyennes, 2…
   Chaque rangée (.pg-row--N) est une grille de N colonnes égales.
   Accent doré : --theme-color-default.
   ========================================================================== */

.product-gallery {
  --pg-accent: var(--theme-color-default, #ba933e);
  --pg-radius: 10px;
  --pg-gap: 12px;

  margin-bottom: 30px;
}

/* --- Empilement des rangées --- */
.product-gallery--masonry {
  display: flex;
  flex-direction: column;
  gap: var(--pg-gap);
}

/* --- Rangée : grille de N colonnes égales --- */
.pg-row {
  display: grid;
  gap: var(--pg-gap);
}

.pg-row--1 { grid-template-columns: 1fr; }
.pg-row--2 { grid-template-columns: repeat(2, 1fr); }
.pg-row--3 { grid-template-columns: repeat(3, 1fr); }

/* --- Vignette / image (sans cadre) --- */
.product-gallery__item {
  position: relative;
  display: block;
  cursor: zoom-in;
  overflow: hidden;
  border-radius: var(--pg-radius);
  background: #fff;
  transition: opacity 0.2s ease;
}

.product-gallery__item:hover {
  opacity: 0.92;
}

.product-gallery__item picture {
  display: block;
  height: 100%;
}

.product-gallery__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Rangée « grande » (pleine largeur) : format paysage, hauteur maîtrisée. */
.pg-row--1 .product-gallery__item img {
  aspect-ratio: 16 / 10;
  max-height: 520px;
}

/* Rangées « petites » (2 col.) et « moyennes » (3 col.) : tuiles carrées. */
.pg-row--2 .product-gallery__item img,
.pg-row--3 .product-gallery__item img {
  aspect-ratio: 1 / 1;
}

/* 1 seule image : proportions naturelles, plafonnée et centrée. */
.product-gallery--single .pg-row--1 .product-gallery__item img {
  aspect-ratio: auto;
  width: auto;
  max-width: 100%;
  max-height: 560px;
  margin: 0 auto;
}

/* 2 images : composition décalée (haut à droite, bas à gauche) plutôt qu'empilée. */
.product-gallery--pair {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0;
}

.product-gallery--pair .pg-row {
  display: block;
}

/* Image du haut : calée à droite (~75 %). */
.product-gallery--pair .pg-row:nth-child(1) {
  grid-column: 4 / 13;
  grid-row: 1;
}

/* Image du bas : calée à gauche (~75 %), légèrement remontée pour l'effet décalé. */
.product-gallery--pair .pg-row:nth-child(2) {
  grid-column: 1 / 10;
  grid-row: 2;
  position: relative;
  z-index: 2;
  margin-top: -6%;
}

.product-gallery--pair .product-gallery__item img {
  aspect-ratio: 1 / 1;
  max-height: none;
}

/* Mobile : on retombe sur un empilement simple pleine largeur. */
@media (max-width: 767px) {
  .product-gallery--pair {
    display: flex;
    flex-direction: column;
    gap: var(--pg-gap);
  }
  .product-gallery--pair .pg-row:nth-child(1),
  .product-gallery--pair .pg-row:nth-child(2) {
    grid-column: auto;
    grid-row: auto;
    margin-top: 0;
  }
}

/* --- Responsive : les rangées « moyennes » repassent à 2 colonnes --- */
@media (max-width: 575px) {
  .pg-row--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Colonne de droite : carte alignée sur le style du panier (dscustomcss)
   (fond blanc, bordure légère #ececec, coins arrondis 12px, sans ombre)
   ========================================================================== */

.card.product-info-card {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 12px;
  box-shadow: none;
}

.card.product-info-card .card-block {
  padding: 28px 30px;
}

/* Évite la double ligne : .social-sharing et .product-actions ont chacun un
   border-bottom, adjacents => double trait. On garde la ligne sous « Partager »
   (.social-sharing) et on retire le trait flottant de bas de bloc (.product-actions). */
.product-info-card .product-actions {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .card.product-info-card .card-block {
    padding: 20px;
  }
}

/* Onglets pleine largeur (description / détails) : plus d'air au-dessus */
.product-tabs-fullwidth {
  margin-top: 50px;
}

@media (max-width: 767px) {
  .product-tabs-fullwidth {
    margin-top: 30px;
  }
}

/* ==========================================================================
   Lightbox maison (Swiper) : fond blanc, miniatures verticales à gauche,
   image plein hauteur, navigation + zoom.
   ========================================================================== */

.pg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #fff;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pg-lightbox.is-open {
  opacity: 1;
}

.pg-lightbox__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 28px 72px;
  box-sizing: border-box;
}

/* Miniatures (colonne de gauche) */
.pg-lightbox__thumbs {
  flex: 0 0 104px;
  width: 104px;
  height: 100%;
  overflow: hidden;
}

.pg-lightbox__thumbs .swiper-slide {
  height: auto;
  cursor: pointer;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 8px;
  padding: 6px;
  box-sizing: border-box;
  overflow: hidden;
  opacity: 0.6;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.pg-lightbox__thumbs .swiper-slide:hover {
  opacity: 0.9;
}

.pg-lightbox__thumbs .swiper-slide-thumb-active {
  opacity: 1;
  border-color: var(--theme-color-default, #ba933e);
}

.pg-lightbox__thumbs img {
  display: block;
  width: 100%;
  height: auto;
}

/* Image principale : occupe toute la hauteur disponible */
.pg-lightbox__main {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
}

.pg-lightbox__main .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-lightbox__main .swiper-zoom-container {
  width: 100%;
  height: 100%;
}

.pg-lightbox__main img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.pg-lightbox__caption {
  flex: 0 0 auto;
  text-align: center;
  padding: 10px 16px 22px;
  color: #1a1a1a;
  font-weight: 600;
}

/* Boutons fermer / zoom (haut droite) */
.pg-lightbox__btn {
  position: absolute;
  top: 18px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.pg-lightbox__btn:hover {
  background: rgba(0, 0, 0, 0.12);
  color: var(--theme-color-default, #ba933e);
}

.pg-lightbox .js-lb-close { right: 20px; }
.pg-lightbox .js-lb-zoom { right: 74px; }

/* Flèches précédent / suivant */
.pg-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.pg-lightbox__nav:hover {
  background: rgba(0, 0, 0, 0.12);
  color: var(--theme-color-default, #ba933e);
}

.pg-lightbox__prev { left: 14px; }
.pg-lightbox__next { right: 14px; }

.pg-lightbox__nav.swiper-button-disabled {
  opacity: 0.25;
  cursor: default;
}

/* Responsive : miniatures horizontales sous l'image */
@media (max-width: 767px) {
  .pg-lightbox__body {
    flex-direction: column-reverse;
    gap: 10px;
    padding: 16px;
  }
  .pg-lightbox__thumbs {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    max-height: 84px;
  }
  .pg-lightbox__thumbs .swiper-wrapper {
    flex-direction: row;
  }
  .pg-lightbox__thumbs .swiper-slide {
    width: 64px;
  }
  .pg-lightbox__nav {
    display: none;
  }
}
