/* ============================================================
   Garconn — Galeries en SLIDER horizontal + legendes EN DESSOUS
   Couche custom appliquee par-dessus le CSS WordPress d'origine.
   (demande Regis : "galerie en slide avec ecriture en dessous")
   ============================================================ */

/* Conteneur slider (injecte par gallery-slider.js autour de chaque galerie) */
.g-slider {
  position: relative;
  margin: 1.5rem 0;
}

/* La galerie devient une rangee horizontale qui defile (scroll-snap) */
.g-slider .wp-block-gallery.has-nested-images {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

/* Chaque image = une "slide". Mobile : ~1 image (avec un apercu de la suivante) */
.g-slider .wp-block-gallery.has-nested-images figure.wp-block-image {
  flex: 0 0 86% !important;
  width: 86% !important;
  max-width: 86% !important;
  margin: 0 !important;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  .g-slider .wp-block-gallery.has-nested-images figure.wp-block-image {
    flex-basis: 48% !important;
    width: 48% !important;
    max-width: 48% !important;
  }
}

/* Image : ratio homogene, coins arrondis */
.g-slider .wp-block-gallery.has-nested-images figure.wp-block-image > a,
.g-slider .wp-block-gallery.has-nested-images figure.wp-block-image img {
  width: 100% !important;
  height: auto !important;
  display: block;
}
.g-slider .wp-block-gallery.has-nested-images figure.wp-block-image img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
}

/* Legende EN DESSOUS (on annule la surimpression WP) */
.g-slider .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
  position: static !important;
  inset: auto !important;
  background: none !important;
  color: #444 !important;
  text-shadow: none !important;
  padding: 10px 4px 0 !important;
  margin: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  text-align: center;
  font-size: 14px;
  line-height: 1.35;
}
/* supprime le degrade/flou d'overlay WP */
.g-slider .wp-block-gallery.has-nested-images figure.wp-block-image:has(figcaption)::before {
  content: none !important;
  display: none !important;
}

/* Fleches prev/next */
.g-slider .g-arrow {
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  color: #d60707;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
}
.g-slider .g-arrow:hover { background: #fff; }
.g-slider .g-prev { left: 6px; }
.g-slider .g-next { right: 6px; }
.g-slider .g-arrow:active { transform: translateY(-50%) scale(.92); }

/* masque les fleches s'il n'y a rien a faire defiler (1 seule image) */
.g-slider.g-no-scroll .g-arrow { display: none; }
