/* Gallery Swiper riutilizzabile. Dipendenze: swiper-bundle.min.css + site-gallery.js */
.site-gallery {
  --site-gallery-height: clamp(22rem, 32vw, 38rem);
  --site-gallery-gap: 1rem;
  --site-gallery-control-size: clamp(1.8rem, 2.2vw, 2.7rem);
  position: relative;
  overflow: hidden;
  /* background: var(--bg-dark, #181818); */
  background: var(--body-bg);
  color: #fff;
}

.swiper-button-next, .swiper-button-prev {
  & svg {
    width: 50% !important;
  }
}

.site-gallery--fullwidth {
  width: 100vw;
  max-width: 100vw;
  margin-top: 0;
  margin-inline: calc(50% - 50vw);
}

.site-gallery__viewport,
.site-gallery__slide,
.site-gallery__picture,
.site-gallery__image {
  height: var(--site-gallery-height);
}

.site-gallery__viewport {
  width: 100%;
  overflow: hidden;
}

.site-gallery__slide {
  position: relative;
  width: auto;
  max-width: 100vw;
  overflow: hidden;
  background: #111;
}

.site-gallery__picture {
  display: block;
  width: auto;
}

.site-gallery__image {
  display: block;
  width: auto;
  max-width: none;
  object-fit: cover;
}

.site-gallery__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-gallery__caption {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .48), rgba(0, 0, 0, .08) 68%, transparent);
}

.site-gallery__caption > .container,
.site-gallery__caption > .container-fluid {
  width: 100%;
}

.site-gallery__caption-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(42rem, 72%);
  padding-block: 2rem;
}

.site-gallery__caption h3,
.site-gallery__caption h4,
.site-gallery__caption p {
  width: fit-content;
  margin: 0 0 .75rem;
  color: inherit;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .7);
}

.site-gallery__caption h3 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: .98;
}

.site-gallery__caption h4 {
  font-size: clamp(1rem, 1.4vw, 1.35rem);
}

.site-gallery__caption p {
  max-width: 42rem;
  font-size: clamp(.95rem, 1vw, 1.1rem);
}

.site-gallery__cta {
  margin-top: .5rem;
  pointer-events: auto;
}

.site-gallery .slide-center .site-gallery__caption-content {
  align-items: center;
  margin-inline: auto;
  text-align: center;
}

.site-gallery .slide-right .site-gallery__caption-content {
  align-items: flex-end;
  margin-left: auto;
  text-align: right;
}

.site-gallery .slide-top .site-gallery__caption {
  align-items: flex-start;
}

.site-gallery .slide-bottom .site-gallery__caption {
  align-items: flex-end;
}

.site-gallery .site-gallery--style2 .site-gallery__caption-content {
  padding-inline: clamp(1rem, 3vw, 3rem);
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(4px);
}

.site-gallery .site-gallery--style3 .site-gallery__caption {
  background: linear-gradient(0deg, rgba(0, 0, 0, .68), transparent 72%);
}

.site-gallery .swiper-button-prev,
.site-gallery .swiper-button-next {
  width: var(--site-gallery-control-size);
  height: var(--site-gallery-control-size);
  margin-top: calc(var(--site-gallery-control-size) / -2);
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.25);
  /* background: transparent; */
  color: #fff;
  transition: background-color .2s ease, opacity .2s ease;
  --swiper-navigation-size: 1.25rem;
}

.site-gallery .swiper-button-prev:hover,
.site-gallery .swiper-button-next:hover,
.site-gallery .swiper-button-prev:focus-visible,
.site-gallery .swiper-button-next:focus-visible {
  background: rgba(0, 0, 0, .5);
}

.site-gallery .swiper-button-prev {
  left: clamp(.4rem, 1.8vw, 1.5rem);
}
.site-gallery .swiper-button-prev svg{
  margin-right: 0.2rem;
}

.site-gallery .swiper-button-next {
  right: clamp(.4rem, 1.8vw, 1.5rem);
}
.site-gallery .swiper-button-next svg{
  margin-left: 0.2rem;
}

.site-gallery .swiper-pagination {
  bottom: .8rem;
}

.site-gallery .swiper-pagination-bullet {
  width: .75rem;
  height: .5rem;
  border-radius: 999px;
  background: var(--bg-light);
  opacity: .85;
  transition: width .2s ease, opacity .2s ease;
}

.site-gallery .swiper-pagination-bullet-active {
  width: 2rem;
  background: var(--theme-primary);
  opacity: 1;
}

.site-gallery[data-gallery-preset="fade"] .site-gallery__slide,
.site-gallery[data-gallery-preset="fade"] .site-gallery__picture,
.site-gallery[data-gallery-preset="fade"] .site-gallery__image,
.site-gallery[data-gallery-preset="standard"] .site-gallery__picture,
.site-gallery[data-gallery-preset="standard"] .site-gallery__image {
  width: 100%;
}

.site-gallery[data-gallery-preset="standard"] .site-gallery__slide {
  width: 100%;
}

@media (max-width: 767.98px) {
  .site-gallery {
    --site-gallery-height: clamp(26rem, 68svh, 42rem);
  }

  .site-gallery__slide {
    max-width: 88vw;
  }

  /* Fullpage autoWidth: ritaglio centrale entro la slide mobile. */
  .slider-fullpage .site-gallery[data-gallery-preset="autoWidth"] .site-gallery__slide {
    width: 88vw;
  }

  .slider-fullpage .site-gallery[data-gallery-preset="autoWidth"] .site-gallery__picture,
  .slider-fullpage .site-gallery[data-gallery-preset="autoWidth"] .site-gallery__image {
    width: 100%;
    max-width: 100%;
  }

  .slider-fullpage .site-gallery[data-gallery-preset="autoWidth"] .site-gallery__image {
    object-fit: cover;
    object-position: center center;
  }

  .site-gallery__caption {
    align-items: flex-end;
    background: linear-gradient(0deg, rgba(0, 0, 0, .72), transparent 78%);
  }

  .site-gallery__caption-content,
  .site-gallery .slide-right .site-gallery__caption-content {
    align-items: flex-start;
    max-width: 100%;
    margin: 0;
    padding: 1.5rem 1rem 3.25rem;
    text-align: left;
  }

  .site-gallery__caption h3 {
    font-size: clamp(2rem, 11vw, 3.5rem);
  }

  .site-gallery .swiper-button-prev,
  .site-gallery .swiper-button-next {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-gallery *,
  .site-gallery *::before,
  .site-gallery *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .site-gallery {
    display: none !important;
  }
}
