h2.rb-galerie-titre {
  text-align: center;
  margin-top: var(--wp--preset--spacing--70, 54px) !important;
}

.rb-galerie-bloc {
  max-width: 1100px;
  margin: 0 auto;
}

.rb-galerie {
  display: grid;
  gap: 14px;
}

.rb-galerie-item {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: #e5e9ed;
}

.rb-galerie-item img,
.rb-galerie-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 4 / 3;
}

.rb-galerie-item a {
  display: block;
  height: 100%;
}

.rb-galerie-item figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 14px 10px;
  background: linear-gradient(transparent, rgba(31, 64, 95, 0.85));
  color: #fff;
  font-size: 0.88rem;
}

.rb-galerie-item[hidden] {
  display: none;
}

.rb-mep-grille {
  grid-template-columns: 1fr;
}

.rb-mep-grille.rb-page-droite {
  animation: rbg-droite 0.45s ease-out;
}

.rb-mep-grille.rb-page-gauche {
  animation: rbg-gauche 0.45s ease-out;
}

@keyframes rbg-droite {
  from {
    opacity: 0.55;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rbg-gauche {
  from {
    opacity: 0.55;
    transform: translateX(-18px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.rb-mep-carrousel {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--rbg-lignes-m, 1), auto);
  grid-auto-columns: 86%;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  cursor: grab;
}

.rb-mep-carrousel::-webkit-scrollbar {
  display: none;
}

.rb-mep-carrousel.rb-drag-scroll {
  cursor: grabbing;
  scroll-snap-type: none;
}

.rb-mep-carrousel .rb-galerie-item {
  scroll-snap-align: start;
}

.rb-mep-mosaique {
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 110px;
  grid-auto-flow: dense;
  gap: 2px;
}

.rb-mep-mosaique .rb-galerie-item {
  border-radius: 0;
}

.rb-mep-mosaique .rb-galerie-item img,
.rb-mep-mosaique .rb-galerie-item video {
  aspect-ratio: auto;
  height: 100%;
}

.rb-mep-mosaique .rb-galerie-item:nth-child(10n + 1) {
  grid-column: span 2;
  grid-row: span 2;
}

.rb-mep-mosaique .rb-galerie-item:nth-child(10n + 3) {
  grid-row: span 2;
}

.rb-mep-mosaique .rb-galerie-item:nth-child(10n + 5) {
  grid-column: span 2;
}

.rb-mep-mosaique .rb-galerie-item:nth-child(10n + 8) {
  grid-row: span 2;
}

.rb-mep-mosaique .rb-galerie-item:nth-child(10n + 10) {
  grid-column: span 2;
  grid-row: span 2;
}

.rb-anim-zoom .rb-galerie-item img {
  transition: transform 0.35s ease;
}

.rb-anim-zoom .rb-galerie-item:hover img {
  transform: scale(1.06);
}

.rb-anim-fondu .rb-galerie-item img {
  transition: opacity 0.35s ease;
}

.rb-anim-fondu .rb-galerie-item:hover img {
  opacity: 0.75;
}

.rb-anim-elevation .rb-galerie-item {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.rb-anim-elevation .rb-galerie-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 30px rgba(31, 64, 95, 0.25);
}

.rb-galerie-prog-ligne {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 420px;
  margin: 18px auto 0;
}

.rb-galerie-fleche {
  flex-shrink: 0;
  width: 52px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: #1f405f;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.rb-galerie-fleche:hover {
  background: #2e6fa3;
}

.rb-galerie-fleche:disabled {
  opacity: 0.35;
  cursor: default;
}

.rb-galerie-prec svg {
  transform: rotate(180deg);
}

.rb-galerie-prog {
  flex: 1;
  height: 4px;
  background: #e5e9ed;
  border-radius: 2px;
  overflow: hidden;
}

.rb-galerie-prog span {
  display: block;
  height: 100%;
  width: 0;
  background: #2e6fa3;
  border-radius: 2px;
  transition: width 0.25s ease, margin-left 0.25s ease;
}

.rb-galerie-lb {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(31, 31, 31, 0.94);
  align-items: center;
  justify-content: center;
  padding: 16px;
  overscroll-behavior: contain;
}

body .rb-galerie-lb {
  margin: 0;
}

html:has(.rb-galerie-lb:target),
html:has(.rb-galerie-lb.rb-lb-ouverte) {
  overflow-y: hidden;
}

.rb-galerie-lb:target,
.rb-galerie-lb.rb-lb-ouverte {
  display: flex;
}

.rb-galerie-lb img {
  max-width: 92vw;
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: 8px;
}

.rb-galerie-lb a {
  position: absolute;
  color: #fff;
  text-decoration: none;
  font-size: 2.6rem;
  line-height: 1;
  padding: 10px 16px;
  opacity: 0.85;
}

.rb-galerie-lb a:hover {
  opacity: 1;
}

.rb-lb-fermer {
  top: 10px;
  right: 10px;
}

.rb-lb-prec {
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3.4rem;
}

.rb-lb-suiv {
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3.4rem;
}

.rb-lb-legende {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  margin: 0;
  font-size: 0.9rem;
  text-align: center;
  max-width: 90vw;
}

@media (min-width: 600px) {
  .rb-mep-grille.rb-col-2,
  .rb-mep-grille.rb-col-3,
  .rb-mep-grille.rb-col-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .rb-mep-carrousel {
    grid-template-rows: repeat(var(--rbg-lignes, 1), auto);
    grid-auto-columns: calc(50% - 7px);
  }
}

@media (min-width: 900px) {
  .rb-mep-grille.rb-col-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .rb-mep-grille.rb-col-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .rb-mep-carrousel.rb-col-2 {
    grid-auto-columns: calc(50% - 7px);
  }

  .rb-mep-carrousel.rb-col-3 {
    grid-auto-columns: calc(33.333% - 9.34px);
  }

  .rb-mep-carrousel.rb-col-4 {
    grid-auto-columns: calc(25% - 10.5px);
  }

  .rb-mep-mosaique {
    grid-auto-rows: 130px;
  }

  .rb-mep-mosaique.rb-col-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .rb-mep-mosaique.rb-col-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}
