/* Galerie v2 — viewport fixe + grille scrollable */
section#galerie.gallery {
  --gallery-nav-offset: 56px;
  position: relative;
  height: calc(100vh - var(--gallery-nav-offset)) !important;
  height: calc(100dvh - var(--gallery-nav-offset)) !important;
  min-height: 0 !important;
  max-height: calc(100dvh - var(--gallery-nav-offset));
  padding: 1.25rem 0 3.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery__inner {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.gallery__header {
  flex: 0 0 auto;
  margin-bottom: 0.85rem;
}

.gallery__lead {
  max-width: 36rem;
  margin: 0.35rem 0 0;
  font-family: Montserrat, sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

.gallery__filters {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 2rem;
  align-items: baseline;
  margin: 0 0 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: static;
  background: transparent;
  backdrop-filter: none;
}

.gallery__chip {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.3rem 0.15rem;
  margin: 0;
  font-family: "Poiret One", cursive;
  font-size: 1.5em;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.gallery__chip:hover,
.gallery__chip:focus-visible {
  color: #fff;
  outline: none;
}

.gallery__chip.is-active {
  color: #fff;
  border-bottom-color: #fff;
}

.gallery__chip-count {
  font-family: Montserrat, sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.75;
  margin-left: 0.25rem;
  vertical-align: super;
}

.gallery__scroller {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0.35rem 1rem 0;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.45) rgba(255, 255, 255, 0.08);
}

.gallery__scroller:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.gallery__scroller::-webkit-scrollbar {
  width: 8px;
}

.gallery__scroller::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.gallery__scroller::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 4px;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem 1rem;
}

@media (max-width: 767px) {
  .gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 0.75rem;
  }
}

.gallery__item {
  margin: 0;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery__item.is-hidden {
  display: none;
}

.gallery__link {
  display: block;
  position: relative;
  color: inherit;
  text-decoration: none;
  background: transparent;
  padding: 0;
  overflow: visible;
}

.gallery__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: transparent;
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 1;
}

.gallery__img.is-loading {
  opacity: 0.35;
}

.gallery__img.is-loaded {
  opacity: 1;
}

.gallery__link:hover .gallery__img,
.gallery__link:focus-visible .gallery__img {
  transform: scale(1.03);
}

.gallery__caption {
  display: block;
  text-align: center;
  padding: 0.55rem 0.25rem 0.15rem;
  font-family: Montserrat, sans-serif;
}

.gallery__caption-title {
  display: block;
  font-family: "Poiret One", cursive;
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.gallery__caption-meta {
  display: none;
}

.gallery__empty {
  display: none;
  margin: 2rem 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-family: Montserrat, sans-serif;
}

.gallery__empty[hidden] {
  display: none !important;
}

.gallery__empty:not([hidden]) {
  display: block;
}

.gallery__next {
  position: absolute;
  right: 1.25rem;
  bottom: 0.75rem;
  z-index: 2;
}

/* PhotoSwipe : image plus contenue + légende */
.pswp {
  --pswp-bg: rgba(8, 18, 26, 0.82);
}

.pswp__anic-caption {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  width: min(36rem, calc(100% - 2rem));
  padding: 0.9rem 1.1rem 1rem;
  background: rgba(12, 24, 32, 0.82);
  color: #fff;
  font-family: Montserrat, sans-serif;
  pointer-events: none;
  text-align: center;
}

.pswp__anic-caption h3 {
  margin: 0 0 0.3rem;
  font-family: "Poiret One", cursive;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pswp__anic-caption p {
  margin: 0.12rem 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

.pswp__anic-caption .pswp__anic-comment {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.4;
  opacity: 0.85;
}

@media (max-width: 575px) {
  section#galerie.gallery {
    --gallery-nav-offset: 48px;
    padding: 0.85rem 0 3.25rem;
  }

  .gallery__filters {
    gap: 0.35rem 1.35rem;
  }

  .gallery__chip {
    font-size: 1em;
  }
}
