/* =========================
   GALERIE WORDPRESS CLASSIQUE
   ========================= */
.gallery-item {
  float: none !important;
}
.gallery {
  display: grid;
  gap: 14px;
  margin: 32px 0;
}

.gallery.gallery-columns-1 {
  grid-template-columns: 1fr;
}

.gallery.gallery-columns-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery.gallery-columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery.gallery-columns-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gallery.gallery-columns-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.gallery.gallery-columns-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.gallery-item {
  margin: 0 !important;
  width: 100% !important;
}

.gallery-icon {
  width: 100%;
}

.gallery-icon a {
  display: block;
  width: 100%;
  max-width: 320px; /* miniatures réduites */
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  background: #f3f3f3;
  text-decoration: none;
}

.gallery-icon a::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.25s ease;
}

.gallery-icon a:hover::after {
  background: rgba(0, 0, 0, 0.08);
}

.gallery-icon img {
  display: block;
  width: 100%;
  height: 220px; /* plus petit qu’avant */
  object-fit: cover;
  border: 0 !important;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.gallery-icon a:hover img {
  transform: scale(1.035);
}

.gallery-caption {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.45;
  color: #666;
  text-align: left;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* =========================
   LIGHTBOX / SLIDER
   ========================= */

.custom-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  z-index: 99999;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.custom-lightbox[hidden] {
  display: none;
}

.custom-lightbox-inner {
  width: min(1200px, 100%);
  max-height: 100%;
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  gap: 18px;
}

.custom-lightbox-topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  gap: 16px;
}

.custom-lightbox-counter {
  font-size: 14px;
  opacity: 0.85;
}

.custom-lightbox-close {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-lightbox-stage {
  width: 100%;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 16px;
}

.custom-lightbox-nav {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-lightbox-media-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.custom-lightbox-image {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 16px;
  display: block;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

.custom-lightbox-caption {
  color: white;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  max-width: 780px;
  opacity: 0.92;
}

.custom-lightbox-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 4px;
}

.custom-lightbox-thumb {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease;
  flex: 0 0 auto;
}

.custom-lightbox-thumb:hover,
.custom-lightbox-thumb.is-active {
  opacity: 1;
  transform: translateY(-1px);
}

.custom-lightbox-thumb img {
  display: block;
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 12px;
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 1100px) {
  .gallery.gallery-columns-4,
  .gallery.gallery-columns-5,
  .gallery.gallery-columns-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .gallery.gallery-columns-3,
  .gallery.gallery-columns-4,
  .gallery.gallery-columns-5,
  .gallery.gallery-columns-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery {
    gap: 10px;
  }

  .gallery-icon a,
  .gallery-caption {
    max-width: 100%;
  }

  .gallery-icon img {
    height: 150px;
  }

  .custom-lightbox-stage {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 8px;
  }

  .custom-lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }
}

@media (max-width: 640px) {
  .gallery,
  .gallery.gallery-columns-2,
  .gallery.gallery-columns-3,
  .gallery.gallery-columns-4,
  .gallery.gallery-columns-5,
  .gallery.gallery-columns-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 20px 0;
  }

  .gallery-item {
    width: 100% !important;
    margin: 0 !important;
  }

  .gallery-icon a {
    max-width: 100%;
    border-radius: 14px;
  }

  .gallery-icon img {
    width: 100%;
    height: 120px;
    aspect-ratio: auto;
    object-fit: cover;
  }

  .gallery-caption {
    display: none;
  }

  .custom-lightbox {
    padding: 10px;
  }

  .custom-lightbox-inner {
    gap: 10px;
  }

  .custom-lightbox-image {
    max-height: 52vh;
    border-radius: 12px;
  }

  .custom-lightbox-thumb img {
    width: 54px;
    height: 54px;
  }

  .custom-lightbox-caption {
    font-size: 13px;
    line-height: 1.4;
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .gallery,
  .gallery.gallery-columns-2,
  .gallery.gallery-columns-3,
  .gallery.gallery-columns-4,
  .gallery.gallery-columns-5,
  .gallery.gallery-columns-6 {
    grid-template-columns: 1fr;
  }

  .gallery-icon img {
    height: auto;
    aspect-ratio: 4 / 3;
  }
}