/**
 * GSBF media carousel
 *
 * Single visual and interaction contract for all consumers.
 */

.gsbf-carousel {
  --gsbf-carousel-gap: 1rem;
  --gsbf-carousel-control-size: 2.5rem;
  --gsbf-carousel-button-background: currentColor;
  --gsbf-carousel-button-foreground: Canvas;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  width: 100%;
}

.gsbf-carousel__viewport {
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.gsbf-carousel__viewport::-webkit-scrollbar {
  display: none;
}

.gsbf-carousel__track {
  display: flex;
  gap: var(--gsbf-carousel-gap);
  width: max-content;
  min-width: 100%;
  padding: .25rem;
}

.gsbf-carousel__slide {
  flex: 0 0 calc((100vw - var(--gsbf-carousel-gap) * 2) / 3);
  max-width: 24rem;
  min-width: 0;
  cursor: zoom-in;
  outline: none;
}

.gsbf-carousel__slide:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 4px;
}

.gsbf-carousel__slide > * {
  max-width: 100%;
}

.gsbf-carousel__button {
  display: inline-grid;
  place-items: center;
  width: var(--gsbf-carousel-control-size);
  height: var(--gsbf-carousel-control-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--gsbf-carousel-button-background);
  color: var(--gsbf-carousel-button-foreground);
  position: relative;
  z-index: 10;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: opacity .2s ease, transform .2s ease;
}

.gsbf-carousel__button:hover:not(:disabled) {
  transform: scale(1.06);
}

.gsbf-carousel__button:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

.gsbf-carousel__button:disabled {
  cursor: default;
  opacity: .35;
}

.gsbf-carousel[data-gsbf-carousel-loop="true"] .gsbf-carousel__button:disabled {
  opacity: .75;
}

.gsbf-carousel > .gallery-zoom {
  position: absolute;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #07552d;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: scale(.92);
  transition: opacity .15s ease, transform .15s ease, background-color .15s ease;
}

.gsbf-carousel > .gallery-zoom[hidden] {
  display: none;
}

.gsbf-carousel[data-gsbf-zoom-visible="true"] > .gallery-zoom {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.gsbf-carousel > .gallery-zoom:hover,
.gsbf-carousel > .gallery-zoom:focus-visible {
  background: #d7a72a;
  color: #07552d;
}

@media (min-width: 1100px) {
  .gsbf-carousel__slide {
    flex-basis: calc((100vw - var(--gsbf-carousel-gap) * 4) / 4);
  }
}

@media (max-width: 700px) {
  .gsbf-carousel {
    gap: .35rem;
  }

  .gsbf-carousel__slide {
    flex-basis: min(82vw, 22rem);
  }

  .gsbf-carousel__button {
    --gsbf-carousel-control-size: 2.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gsbf-carousel__viewport {
    scroll-behavior: auto;
  }

  .gsbf-carousel__button,
  .gsbf-carousel > .gallery-zoom {
    transition: none;
  }
}

.gsbf-carousel.is-coverflow {
  perspective: 1200px;
}

.gsbf-carousel.is-coverflow .gsbf-carousel__viewport {
  overflow: hidden;
  touch-action: pan-y;
  height: clamp(280px, 34vw, 390px);
  padding: 1rem .25rem;
  scroll-snap-type: none;
}

.gsbf-carousel.is-coverflow .gsbf-carousel__track {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.gsbf-carousel.is-coverflow .gsbf-carousel__slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(70%, 23rem);
  max-width: none;
  min-width: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translate3d(-50%, -50%, -280px) rotateY(0deg) scale(.58);
  transform-origin: center center;
  transition:
    transform .55s cubic-bezier(.22, .61, .36, 1),
    opacity .55s ease,
    filter .55s ease,
    box-shadow .55s ease;
  will-change: transform, opacity;
}

.gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="active"] {
  z-index: 4;
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(-50%, -50%, 35px) rotateY(0deg) scale(1.03);
}

.gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="previous"] {
  z-index: 3;
  opacity: .82;
  pointer-events: auto;
  transform: translate3d(calc(-50% - 60%), -50%, -105px) rotateY(34deg) scale(.82);
  filter: saturate(.8) brightness(.9);
}

.gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="next"] {
  z-index: 3;
  opacity: .82;
  pointer-events: auto;
  transform: translate3d(calc(-50% + 60%), -50%, -105px) rotateY(-34deg) scale(.82);
  filter: saturate(.8) brightness(.9);
}

.gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="far-previous"] {
  z-index: 2;
  opacity: .56;
  pointer-events: auto;
  transform: translate3d(calc(-50% - 116%), -50%, -235px) rotateY(48deg) scale(.62);
  filter: saturate(.52) brightness(.72);
}

.gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="far-next"] {
  z-index: 2;
  opacity: .56;
  pointer-events: auto;
  transform: translate3d(calc(-50% + 116%), -50%, -235px) rotateY(-48deg) scale(.62);
  filter: saturate(.52) brightness(.72);
}

.gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="hidden"] {
  visibility: hidden;
}

@media (max-width: 700px) {
  .gsbf-carousel.is-coverflow .gsbf-carousel__viewport {
    height: 330px;
  }

  .gsbf-carousel.is-coverflow .gsbf-carousel__slide {
    width: min(76%, 21rem);
  }

  .gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="previous"] {
    transform: translate3d(calc(-50% - 46%), -50%, -100px) rotateY(24deg) scale(.78);
  }

  .gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="next"] {
    transform: translate3d(calc(-50% + 46%), -50%, -100px) rotateY(-24deg) scale(.78);
  }

  .gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="far-previous"],
  .gsbf-carousel.is-coverflow .gsbf-carousel__slide[data-gsbf-carousel-state="far-next"] {
    opacity: .42;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gsbf-carousel.is-coverflow .gsbf-carousel__slide {
    transition: none;
  }
}


/* Lightbox plein écran pour les médias. */

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

.gsbf-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) 4rem;
  align-items: center;
  gap: 1rem;
  padding: 4vh 4vw;
  background: rgba(0, 20, 12, .9);
}

.gsbf-lightbox__backdrop {
  position: absolute;
  inset: 0;
}

.gsbf-lightbox__content {
  position: relative;
  z-index: 1;
  grid-column: 2;
  max-width: 94vw;
  max-height: 92vh;
  justify-self: center;
}

.gsbf-lightbox__media-container {
  display: grid;
  place-items: center;
}

.gsbf-lightbox__image {
  display: block;
  max-width: 82vw;
  max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .5);
}

.gsbf-lightbox__close {
  position: absolute;
  top: -1rem;
  right: -1rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #07552d;
  color: #fff;
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
}

.gsbf-lightbox__prev,
.gsbf-lightbox__next {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #07552d;
  color: #fff;
  cursor: pointer;
  font-size: 2.3rem;
  line-height: 1;
}

.gsbf-lightbox__prev {
  grid-column: 1;
}

.gsbf-lightbox__next {
  grid-column: 3;
}

.gsbf-lightbox__prev:hover,
.gsbf-lightbox__next:hover,
.gsbf-lightbox__close:hover {
  background: #d7a72a;
  color: #07552d;
}

.gsbf-lightbox button:focus-visible,
.gsbf-carousel__view-toggle:focus-visible,
.gsbf-carousel__filter:focus-visible {
  outline: 3px solid #d7a72a;
  outline-offset: 3px;
}

body.gsbf-lightbox-open {
  overflow: hidden;
}

.gsbf-carousel__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.25rem;
}

.gsbf-carousel__view-toggle {
  padding: .7rem 1rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.gsbf-carousel__filter-label {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: inherit;
  font-size: .9rem;
  font-weight: 700;
}

.gsbf-carousel__filter-label[hidden] {
  display: none;
}

.gsbf-carousel__filter {
  padding: .65rem .8rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: Canvas;
  color: inherit;
  font: inherit;
}

.gsbf-carousel.is-gallery .gsbf-carousel__viewport {
  height: auto;
  overflow: visible;
  padding: 0;
}

.gsbf-carousel.is-gallery .gsbf-carousel__track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 0;
}

.gsbf-carousel.is-gallery .gsbf-carousel__slide,
.gsbf-carousel.is-gallery .gsbf-carousel__slide[hidden] {
  position: relative;
  inset: auto;
  display: block;
  width: auto;
  max-width: none;
  margin: 0;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: none;
}

.gsbf-carousel.is-gallery .gsbf-carousel__slide[hidden] {
  display: none;
}

.gsbf-carousel.is-gallery .gsbf-carousel__button {
  display: none;
}

@media (max-width: 800px) {
  .gsbf-carousel.is-gallery .gsbf-carousel__track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .gsbf-carousel__toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .gsbf-carousel.is-gallery .gsbf-carousel__track {
    grid-template-columns: 1fr;
  }

  .gsbf-lightbox {
    grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
    gap: .4rem;
    padding: 3vh 2vw;
  }

  .gsbf-lightbox__prev,
  .gsbf-lightbox__next {
    width: 2.5rem;
    height: 2.5rem;
  }

  .gsbf-lightbox__image {
    max-width: 92vw;
  }
}
