/* ===== VARIABILI & BASE (Gallery - Floating Dream) ===== */
:root {
  --bg: #f8f9fb;
  --text: #1e2328;
  --muted: rgba(30, 35, 40, 0.72);
  --border: rgba(30, 35, 40, 0.14);
  --accent: #2f7ea7;
  --accent-2: #7f9b8f;
  --accent-soft: rgba(47, 126, 167, 0.14);
  --radius: 16px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Arial, sans-serif;
  --header-height: 4rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: #000;
  position: relative;
  overflow-x: hidden;
}

/* Gallery: voce attiva in nav (Floating Dream) */
body.page-gallery .nav-list a[href="gallery.php"] {
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.page-gallery .nav-list a[href="gallery.php"]:hover,
body.page-gallery .nav-list a[href="gallery.php"]:focus-visible {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

a:focus-visible {
  outline-offset: 2px;
}

/* ===== VIDEO FULLSCREEN PARALLAX: fixed, z-index 0; visibile da sezione carousel in giù (hero e intro hanno sfondo bianco) ===== */
.gallery-bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  min-width: 100%;
  min-height: 100%;
  z-index: 0;
  pointer-events: none;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

body.page-gallery main {
  position: relative;
  z-index: 1;
}

.gallery-bg-video__el {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-bg-video__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.25) 0%,
    rgba(0, 0, 0, 0.15) 40%,
    rgba(0, 0, 0, 0.2) 100%
  );
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

body.page-gallery .nav-list a[href="gallery.php"]::after {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 100%;
}

body.page-gallery .nav-modal-list a[href="gallery.php"] {
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.page-gallery .nav-modal-list a[href="gallery.php"]:hover,
body.page-gallery .nav-modal-list a[href="gallery.php"]:focus-visible {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ===== HERO come Regala: 30vh, sfondo bianco, titolo e sottotitolo neri ===== */
.gallery-hero {
  height: 50vh;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-height, 80px) + 2rem) 1.5rem 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
  background: #fff;
}

/* (indicatori scroll specifici di Servizi non usati qui) */

.gallery-hero__content {
  max-width: 1000px;
}

.gallery-hero__title {
  margin: 0 0 1rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: #1a1a1a;
}

.gallery-hero__subtitle {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
}

/* Mobile: bottone “scroll” Floating Dream style */
.gallery-scroll-btn {
  display: none;
}

/* ===== SEZIONE INTRO: riga separatrice tra hero e sezione 1 (come Servizi) ===== */
.gallery-intro {
  position: relative;
  padding: 3rem 0 4rem;
  background: transparent;
  z-index: 1;
}

.gallery-intro::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 75%;
  height: 3px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent 0%, var(--accent) 25%, var(--accent-2) 75%, transparent 100%);
}

.gallery-intro__inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.gallery-intro__title {
  margin: 0 0 0.75rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.gallery-intro__desc {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ===== SEZIONE CAROUSEL: sfondo trasparente → video parallax visibile da qui in giù ===== */
.gallery-section {
  background: transparent;
  padding: 0 0 4rem;
  position: relative;
  z-index: 1;
}

.gallery-section__inner {
  min-height: 200px;
}

.gallery-section__title {
  margin: 0 0 2rem;
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.gallery-carousel-wrap {
  width: 100%;
  min-width: 900px;
}

/* Hint swipe (mostrato solo su mobile) */
.gallery-swipe-hint {
  display: none;
}

.gallery-carousel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 3rem;
}

.gallery-carousel__track {
  position: relative;
  width: 100%;
  max-width: 1400px;
  min-height: 700px;
  margin: 0 auto;
  perspective: 1400px;
  transform-style: preserve-3d;
}

/* Transizione “sparisci e riappaia” del carousel */
.gallery-carousel__track {
  opacity: 1;
  transition: opacity 0.32s ease-out;
}

.gallery-carousel__track.is-fading {
  opacity: 0;
}

/* Frecce stile Floating Dream (floating) – visibili solo desktop / tablet landscape */
.gallery-carousel__arrow {
  position: absolute;
  z-index: 20;
  top: 50%;
  margin-top: -24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(47, 126, 167, 0.35);
  background: linear-gradient(135deg, rgba(248, 249, 251, 0.95) 0%, rgba(247, 249, 250, 0.9) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(47, 126, 167, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.gallery-carousel__arrow--prev {
  left: -56px;
}

.gallery-carousel__arrow--next {
  right: -56px;
}

.gallery-carousel__arrow:hover {
  background: linear-gradient(135deg, rgba(47, 126, 167, 0.14) 0%, rgba(127, 155, 143, 0.12) 100%);
  color: var(--accent-2);
  border-color: rgba(47, 126, 167, 0.5);
  transform: scale(1.08);
  box-shadow: 0 14px 36px rgba(47, 126, 167, 0.25), 0 6px 16px rgba(0, 0, 0, 0.1);
}

.gallery-carousel__arrow:focus-visible {
  outline-offset: 2px;
  outline-color: var(--accent);
}

/* Card slide – bordo Floating Dream 4px */
.gallery-slide {
  position: absolute;
  display: block;
  text-decoration: none;
  border-radius: 24px;
  border: 0;
  box-shadow: none;
  overflow: visible;
  transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), top 0.28s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), z-index 0.28s ease, box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
}

.gallery-slide.is-prev {
  transform: scale(0.95);
  transform-origin: right center;
  opacity: 0.92;
  z-index: 1;
  box-shadow: none;
  backface-visibility: hidden;
}

.gallery-slide.is-next {
  transform: scale(0.95);
  transform-origin: left center;
  opacity: 0.92;
  z-index: 1;
  box-shadow: none;
  backface-visibility: hidden;
}

.gallery-slide.is-active {
  transform: scale(1);
  left: 50%;
  margin-left: -320px;
  top: 0;
  z-index: 2;
  box-shadow: none;
}

.gallery-slide__frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.gallery-slide__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  pointer-events: none;
}

/* Non vogliamo alcuno “sfondo”/overlay nel frame */
.gallery-slide__bg {
  display: none;
}

/* Rettangoli verticali: centrale 560x700, laterali 280x350 */
.gallery-slide.is-active .gallery-slide__frame {
  width: 640px;
  height: 780px;
}

.gallery-slide.is-prev .gallery-slide__frame,
.gallery-slide.is-next .gallery-slide__frame {
  width: 320px;
  height: 390px;
}

.gallery-slide.is-prev {
  left: calc(50% - 512px);
  top: 50%;
  margin-top: -195px;
}

.gallery-slide.is-next {
  left: calc(50% + 192px);
  top: 50%;
  margin-top: -195px;
}

/* Animazione carousel: scale + fade (veloce e fluida) */
.gallery-slide.carousel-out {
  opacity: 0;
  transform: scale(0.94);
  transform-origin: center center;
  pointer-events: none;
}

.gallery-slide.carousel-in-from {
  opacity: 0;
  transform: scale(0.94);
  transform-origin: center center;
}

.gallery-slide.carousel-in-to {
  opacity: 1;
  transform: scale(1);
  transform-origin: center center;
}

/* Posizioni finali per dopo l’animazione (usate in JS) */
.gallery-slide.anim-to-prev {
  left: calc(50% - 512px);
  top: 50%;
  margin-left: 0;
  margin-top: -195px;
  transform: scale(0.95);
  transform-origin: right center;
  opacity: 0.92;
  z-index: 1;
  box-shadow: none;
}

.gallery-slide.anim-to-active {
  left: 50%;
  margin-left: -320px;
  top: 0;
  margin-top: 0;
  transform: scale(1);
  opacity: 1;
  z-index: 2;
  box-shadow: none;
}

.gallery-slide.anim-to-next {
  left: calc(50% + 192px);
  top: 50%;
  margin-left: 0;
  margin-top: -195px;
  transform: scale(0.95);
  transform-origin: left center;
  opacity: 0.92;
  z-index: 1;
  box-shadow: none;
}

.gallery-slide__inner {
  position: relative;
  z-index: 1;
  padding: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
  gap: 0 0.75rem;
  min-height: 0;
  overflow: visible;
}

.gallery-slide__col-left {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gallery-slide__header {
  display: none;
}

.gallery-slide__title {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.gallery-slide__phrase {
  margin: 0 0 0.15rem;
  font-size: 0.875rem;
  color: var(--text);
}

.gallery-slide__desc {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Colonna sinistra: griglia 2 img – centrate, più in basso */
.gallery-slide__grid--left {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  margin-top: 0.75rem;
  align-content: center;
  justify-items: center;
  overflow: visible;
}

/* Colonna destra: griglia 3 img – centrate, più in basso */
.gallery-slide__grid--right {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  gap: 1rem;
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
  margin-top: 0.75rem;
  align-content: start;
  justify-items: center;
  overflow: visible;
}

.gallery-slide__grid--left {
  align-content: center;
}

.gallery-slide__grid {
  align-content: start;
}

.gallery-slide__img-wrap {
  position: relative;
  border-radius: 22px;
  border: 0;
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  width: 78%;
  aspect-ratio: 3 / 4;
  height: auto;
  min-height: 0;
  justify-self: center;
  align-self: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.gallery-slide__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Slide laterali sfocate (nitida solo la centrale) */
.gallery-slide.is-prev .gallery-slide__thumb,
.gallery-slide.is-next .gallery-slide__thumb {
  filter: blur(2.5px) saturate(0.95);
  transform: scale(1.03);
}

.gallery-slide.is-active .gallery-slide__thumb {
  filter: none;
  transform: none;
}

/* CTA fissa sotto al carousel (fuori dalle slide) */
.gallery-cta-card {
  margin: -7.25rem auto 0;
  width: min(860px, calc(100% - 2rem));
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: center;
  position: relative;
  z-index: 9999;
}

.gallery-cta-card__title {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 2rem;
  color: #fff;
  text-shadow:
    0 0 6px rgba(0, 0, 0, 0.9),
    0 8px 22px rgba(0, 0, 0, 0.9);
}

.gallery-cta-card__desc {
  margin-top: 0.4rem;
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.6;
  text-shadow:
    0 0 5px rgba(0, 0, 0, 0.9),
    0 6px 18px rgba(0, 0, 0, 0.85);
}

.gallery-cta-card__btn {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.05rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 10px 26px rgba(47, 126, 167, 0.22);
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.gallery-cta-card__btn:hover,
.gallery-cta-card__btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(47, 126, 167, 0.26);
  filter: saturate(1.12);
}

/* Dots (slide indicator) sotto al bottone CTA */
.gallery-cta-card__dots {
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: width 0.22s ease, background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.gallery-dot.is-active {
  width: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 0 0.9rem rgba(47, 126, 167, 0.32), 0 0 2.2rem rgba(127, 155, 143, 0.18);
  transform: translateY(-1px);
}

.gallery-cta-card__dots.is-swipe-anim .gallery-dot.is-active {
  animation: galleryDotsSwipePulse 420ms ease-out;
}

@keyframes galleryDotsSwipePulse {
  0% { transform: translateY(-1px) scale(1); }
  45% { transform: translateY(-1px) scale(1.9); }
  100% { transform: translateY(-1px) scale(1); }
}

.gallery-cta-card.is-updating {
  opacity: 0.55;
  transform: translateY(2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.gallery-cta-card.is-updated {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Slide laterali: contenuto più compatto */
.gallery-slide.is-prev .gallery-slide__inner,
.gallery-slide.is-next .gallery-slide__inner {
  padding: 0.5rem 0.5rem 0.4rem;
}

.gallery-slide.is-prev .gallery-slide__title,
.gallery-slide.is-next .gallery-slide__title {
  font-size: 0.875rem;
}

.gallery-slide.is-prev .gallery-slide__phrase,
.gallery-slide.is-next .gallery-slide__phrase {
  font-size: 0.7rem;
}

.gallery-slide.is-prev .gallery-slide__desc,
.gallery-slide.is-next .gallery-slide__desc {
  font-size: 0.65rem;
}

.gallery-slide.is-prev .gallery-slide__grid--left,
.gallery-slide.is-prev .gallery-slide__grid--right,
.gallery-slide.is-next .gallery-slide__grid--left,
.gallery-slide.is-next .gallery-slide__grid--right {
  gap: 4px;
}

.gallery-slide.is-prev .gallery-slide__grid--left,
.gallery-slide.is-next .gallery-slide__grid--left {
  margin-top: 1.5rem;
}

.gallery-slide.is-prev .gallery-slide__grid--right,
.gallery-slide.is-next .gallery-slide__grid--right {
  margin-top: 1rem;
}


/* ===== LIGHTBOX (popup stile Floating Dream; scroll su/giù per cambiare immagine) ===== */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Sfondo lightbox: parallax della home + overlay leggero */
.gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("../img/principale/backgroung_parallax.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.gallery-lightbox__backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.gallery-lightbox__wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
}

/* Rettangolo con bordi Floating Dream */
.gallery-lightbox__box {
  border-radius: 26px;
  border: 4px solid rgba(47, 126, 167, 0.5);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  width: 92vw;
  max-width: 560px;
  aspect-ratio: 3 / 4;
  max-height: 90vh;
  position: relative;
}

.gallery-lightbox__img-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 22px;
}

.gallery-lightbox__img-slide {
  position: absolute;
  inset: 0;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-lightbox__img-slide.lb-fade-out {
  opacity: 0;
}

.gallery-lightbox__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Allineato al box 26px con bordo 4px (angolo interno ~22px) */
  border-radius: 22px;
}

/* Barra sotto il box: rettangolino centrato, Chiudi a destra */
.gallery-lightbox__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: 560px;
  margin-top: 1rem;
  padding: 0 0.25rem;
}

.gallery-lightbox__scroll-hint {
  grid-column: 2;
  justify-self: center;
  margin: 0;
  padding: 0.5rem 1rem;
  max-width: min(72vw, 320px);
  font-size: clamp(0.7rem, 2.2vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.35;
  text-align: center;
  color: rgba(248, 249, 251, 0.96);
  background: linear-gradient(135deg, rgba(248, 249, 251, 0.14) 0%, rgba(247, 249, 250, 0.08) 100%);
  border: 2px solid rgba(47, 126, 167, 0.5);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

/* Pulsante Chiudi – compatto, stile Floating Dream */
.gallery-lightbox__close {
  grid-column: 3;
  justify-self: end;
  margin: 0;
  padding: 0.28rem 0.58rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid rgba(47, 126, 167, 0.5);
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gallery-lightbox__close:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ===== MEDIA QUERIES (4 breakpoint: come display.css / servizi.css / styles.css) ===== */

/* 1. Mobile portrait */
@media (max-width: 767px) and (orientation: portrait) {
  .gallery-lightbox__backdrop {
    background-image: url("../img/principale/backgroung_parallax_mobile.png");
  }

  .gallery-lightbox__bar {
    margin-top: 0.75rem;
    gap: 0.5rem 0;
  }

  .gallery-lightbox__scroll-hint {
    padding: 0.42rem 0.75rem;
    max-width: min(88vw, 300px);
    font-size: clamp(0.68rem, 3.2vw, 0.82rem);
  }

  .gallery-hero {
    height: auto;
    min-height: 72vh;
    padding: calc(var(--header-height) + 1.5rem) 1rem 3rem;
  }

  .gallery-hero__title {
    font-size: clamp(2rem, 8vw, 2.5rem);
  }

  .gallery-hero__subtitle {
    font-size: 1rem;
  }

  .gallery-scroll-btn {
    display: none !important;
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 60;
    pointer-events: auto;
    border: 1px solid rgba(47, 126, 167, 0.35);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    border-radius: 999px;
    padding: 10px 14px;
    color: rgba(248, 249, 251, 0.96);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.25);
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    animation: swipeHintFloat 1.6s ease-in-out infinite;
    cursor: pointer;
  }

  .gallery-section {
    padding: 2.5rem 0;
  }

  .container,
  .gallery-section__inner {
    padding: 0 1rem;
  }

  .gallery-section__title {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
  }

  .gallery-carousel-wrap {
    min-width: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 90vw;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-carousel {
    padding: 0 0 2rem;
  }

  .gallery-carousel__track {
    min-height: 320px;
    max-width: 90vw;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-carousel__arrow {
    display: none !important;
  }

  .gallery-slide.is-prev,
  .gallery-slide.is-next {
    display: none;
  }

  .gallery-slide.is-active {
    position: relative;
    left: 0;
    top: -0.75rem;
    margin-left: 0;
    width: 90vw;
    max-width: 90vw;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-slide.is-active .gallery-slide__frame {
    width: 90vw;
    max-width: 90vw;
    aspect-ratio: 2 / 3;
    height: auto;
    min-height: 280px;
  }

  .gallery-swipe-hint {
    display: none !important;
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    gap: 10px;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 50;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(47, 126, 167, 0.35);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    color: rgba(248, 249, 251, 0.95);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.25);
    animation: swipeHintFloat 1.6s ease-in-out infinite;
  }

  .gallery-swipe-hint__text {
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .gallery-swipe-hint__arrow {
    display: none !important;
    font-size: 1.1rem;
    color: rgba(127, 155, 143, 0.95);
    animation: swipeHintArrow 1.6s ease-in-out infinite;
  }

  @keyframes swipeHintFloat {
    0%,
    100% { transform: translateX(-50%) translateY(0); opacity: 0.95; }
    50% { transform: translateX(-50%) translateY(-6px); opacity: 1; }
  }

  @keyframes swipeHintArrow {
    0%,
    100% { transform: translateX(0); }
    50% { transform: translateX(6px); }
  }

  .gallery-slide.is-active .gallery-slide__inner {
    overflow: hidden;
    padding: 0.75rem 0.75rem 0.5rem;
  }

  .gallery-slide.is-active .gallery-slide__title {
    font-size: 1rem;
  }

  .gallery-slide.is-active .gallery-slide__grid {
    gap: 4px;
  }

  /* Mobile portrait: collage con skew/rotate leggeri (override transform inline; effetto “casuale” per posizione) */
  .gallery-slide__img-wrap {
    width: 100% !important;
    transform-origin: center center;
  }

  .gallery-slide__grid--left .gallery-slide__img-wrap:nth-child(1) {
    transform: translate(0, 0) rotate(-2.5deg) skew(-1.2deg, 0.6deg) scale(1.06) !important;
  }

  .gallery-slide__grid--left .gallery-slide__img-wrap:nth-child(2) {
    transform: translate(0, 0) rotate(3deg) skew(0.8deg, -0.5deg) scale(1.06) !important;
  }

  .gallery-slide__grid--right .gallery-slide__img-wrap:nth-child(1) {
    transform: translate(0, 0) rotate(-1.8deg) skew(0.5deg, 1deg) scale(1.06) !important;
  }

  .gallery-slide__grid--right .gallery-slide__img-wrap:nth-child(2) {
    transform: translate(0, 0) rotate(3.2deg) skew(-1deg, -0.8deg) scale(1.06) !important;
  }

  .gallery-slide__grid--right .gallery-slide__img-wrap:nth-child(3) {
    transform: translate(0, 0) rotate(-2.8deg) skew(1.1deg, 0.4deg) scale(1.06) !important;
  }

  .gallery-slide__grid--left,
  .gallery-slide__grid--right {
    gap: 0.6rem !important;
  }

  .gallery-slide__inner {
    gap: 0 0.4rem !important;
  }
}

/* 2. Mobile landscape */
@media (max-width: 767px) and (orientation: landscape) {
  .gallery-lightbox__backdrop {
    background-image: url("../img/principale/backgroung_parallax_mobile.png");
  }

  /* Lightbox: in landscape l’altezza è poca → box verticale che si riduce per stare nello schermo */
  .gallery-lightbox {
    padding: 1rem 0.75rem;
  }

  .gallery-lightbox__wrap {
    max-width: 96vw;
  }

  .gallery-lightbox__box {
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 64vh;
    aspect-ratio: auto;
    background: transparent;
  }

  .gallery-lightbox__img {
    object-fit: contain;
    background: transparent;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 64vh;
  }

  .gallery-lightbox__img-viewport {
    background: transparent;
    position: static;
    inset: auto;
    overflow: visible;
    border-radius: 22px;
    width: auto;
    height: auto;
  }

  .gallery-lightbox__img-slide {
    position: static;
    inset: auto;
  }

  .gallery-lightbox__bar {
    max-width: 92vw;
  }

  .gallery-lightbox__bar {
    margin-top: 0.5rem;
  }

  .gallery-lightbox__scroll-hint {
    padding: 0.35rem 0.65rem;
    max-width: min(70vw, 260px);
    font-size: clamp(0.62rem, 2.5vw, 0.78rem);
  }

  .gallery-hero {
    height: auto;
    min-height: 0 !important;
    padding: calc(var(--header-height) + 0.75rem) 1rem 1.3rem !important;
  }

  .gallery-hero__title {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
  }

  .gallery-hero__subtitle {
    font-size: 0.9375rem;
  }

  .gallery-scroll-btn {
    display: flex;
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    z-index: 60;
    pointer-events: auto;
    border: 1px solid rgba(47, 126, 167, 0.35);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    border-radius: 999px;
    padding: 10px 14px;
    color: rgba(248, 249, 251, 0.96);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.25);
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    animation: swipeHintFloat 1.6s ease-in-out infinite;
    cursor: pointer;
  }

  .gallery-section {
    padding: 0.9rem 0 1.6rem !important;
  }

  .gallery-intro {
    padding: 0 !important;
  }

  .container,
  .gallery-section__inner {
    padding: 0 1rem;
  }

  .gallery-section__title {
    margin-bottom: 1.25rem;
    font-size: 1.375rem;
  }

  .gallery-carousel-wrap {
    min-width: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 90vw;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-carousel {
    padding: 0 0 1.5rem;
  }

  .gallery-carousel__track {
    min-height: 240px;
    max-width: 90vw;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-carousel__arrow {
    display: none !important;
  }

  .gallery-slide.is-prev,
  .gallery-slide.is-next {
    display: none;
  }

  .gallery-slide.is-active {
    position: relative;
    left: 0;
    margin-left: 0;
    width: 90vw;
    max-width: 90vw;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-slide.is-active .gallery-slide__frame {
    width: 90vw;
    max-width: 90vw;
    aspect-ratio: 2 / 3;
    height: auto;
    min-height: 200px;
  }

  /* Mobile landscape: riempi meglio lo schermo con la collage */
  .gallery-slide__img-wrap {
    width: 78% !important;
  }

  .gallery-slide__grid--left,
  .gallery-slide__grid--right {
    display: flex;
    flex-direction: row;
    gap: 0;
    justify-content: center;
    align-items: flex-start;
  }

  .gallery-slide__grid--left .gallery-slide__img-wrap,
  .gallery-slide__grid--right .gallery-slide__img-wrap {
    margin-left: -2.1rem;
  }

  .gallery-slide__grid--left .gallery-slide__img-wrap:first-child,
  .gallery-slide__grid--right .gallery-slide__img-wrap:first-child {
    margin-left: 0;
  }

  .gallery-swipe-hint {
    display: flex;
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    gap: 10px;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 50;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(47, 126, 167, 0.35);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    color: rgba(248, 249, 251, 0.95);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.25);
    animation: swipeHintFloat 1.6s ease-in-out infinite;
  }

  .gallery-swipe-hint__text {
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .gallery-swipe-hint__arrow {
    display: inline-flex;
    font-size: 1.1rem;
    color: rgba(127, 155, 143, 0.95);
    animation: swipeHintArrow 1.6s ease-in-out infinite;
  }

  @keyframes swipeHintFloat {
    0%,
    100% { transform: translateX(-50%) translateY(0); opacity: 0.95; }
    50% { transform: translateX(-50%) translateY(-6px); opacity: 1; }
  }

  @keyframes swipeHintArrow {
    0%,
    100% { transform: translateX(0); }
    50% { transform: translateX(6px); }
  }

  /* ===== Rebuild Mobile Landscape (Gallery) ===== */
  /* Nascondo elementi non necessari per questa view */
  .gallery-scroll-btn {
    display: none !important;
  }

  .gallery-swipe-hint {
    display: none !important;
  }

  .gallery-swipe-hint__arrow {
    display: none !important;
  }

  /* Carousel: mostro solo la slide attiva */
  .gallery-carousel__arrow {
    display: none !important;
  }

  .gallery-slide.is-prev,
  .gallery-slide.is-next {
    display: none !important;
  }

  .gallery-carousel-wrap {
    min-width: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 96vw;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-carousel {
    padding: 0 0 0.8rem !important;
  }

  .gallery-cta-card {
    margin: 0.7rem auto 0 !important;
  }

  .gallery-carousel__track {
    min-height: 210px;
    max-width: 96vw;
    margin-left: auto;
    margin-right: auto;
  }

  .gallery-slide.is-active {
    position: relative;
    left: 0;
    margin-left: auto;
    margin-right: auto;
    width: 92vw;
    max-width: 92vw;
  }

  .gallery-slide.is-active .gallery-slide__frame {
    width: 92vw;
    max-width: 92vw;
    aspect-ratio: 3 / 1;
    height: auto;
    min-height: 140px;
    overflow: visible !important;
  }

  .gallery-slide.is-active .gallery-slide__inner {
    overflow: visible !important;
    padding: 0 !important;
  }

  /* CTA card subito sotto le foto (niente sovrapposizione) */
  .gallery-cta-card {
    margin: 0.7rem auto 0 !important;
  }

  /* Collage 5 foto in riga, piccole: ogni foto copre il 30% della precedente */
  .gallery-slide__inner {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    gap: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Non usiamo flex qui: posizioniamo assolutamente i thumbnail così restano tutti centrati */
  .gallery-slide__col-left,
  .gallery-slide__grid--left,
  .gallery-slide__grid--right {
    position: static !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* thumbnail base */
  .gallery-slide__img-wrap {
    position: absolute !important;
    top: 0 !important;
    width: 26.3% !important;
    height: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    border-radius: 26px !important;
    overflow: hidden;
  }

  /* left (in % del frame):
     W = 26.3%
     step = 0.70W = 18.41%
     pos: 0, 18.41, 36.82, 55.23, 73.64 */
  .gallery-slide__grid--left .gallery-slide__img-wrap:nth-child(1) {
    left: 0% !important;
    z-index: 3 !important;
  }
  .gallery-slide__grid--left .gallery-slide__img-wrap:nth-child(2) {
    left: 18.41% !important;
    z-index: 4 !important;
  }

  .gallery-slide__grid--right .gallery-slide__img-wrap:nth-child(1) {
    left: 36.82% !important;
    z-index: 5 !important;
  }
  .gallery-slide__grid--right .gallery-slide__img-wrap:nth-child(2) {
    left: 55.23% !important;
    z-index: 6 !important;
  }
  .gallery-slide__grid--right .gallery-slide__img-wrap:nth-child(3) {
    left: 73.64% !important;
    z-index: 7 !important;
  }
}

/* 3. Tablet portrait */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .gallery-lightbox__scroll-hint {
    padding: 0.48rem 1.05rem;
    font-size: clamp(0.78rem, 1.6vw, 0.88rem);
  }

  .gallery-hero {
    padding: calc(var(--header-height) + 2rem) 1.5rem 3rem;
  }

  .gallery-hero__title {
    font-size: clamp(2rem, 5vw, 3rem);
  }

  .gallery-hero__subtitle {
    font-size: clamp(1rem, 2vw, 1.125rem);
  }

  .gallery-section {
    padding: 3rem 0;
  }

  .container,
  .gallery-section__inner {
    padding: 0 1.5rem;
  }

  .gallery-section__title {
    margin-bottom: 1.75rem;
    font-size: 1.625rem;
  }

  .gallery-carousel-wrap {
    min-width: 0;
    overflow: hidden;
  }

  .gallery-carousel {
    padding: 0 0 2.5rem;
  }

  .gallery-carousel__track {
    min-height: 340px;
    max-width: 100%;
  }

  .gallery-carousel__arrow {
    display: none !important;
  }

  .gallery-slide.is-prev,
  .gallery-slide.is-next {
    display: none;
  }

  .gallery-slide.is-active {
    position: relative;
    left: 0;
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }

  .gallery-slide.is-active .gallery-slide__frame {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 2 / 3;
    height: auto;
    min-height: 300px;
  }

  /* Tablet portrait: alza la 5ª foto (3° elemento nella griglia destra) */
  .gallery-slide.is-active .gallery-slide__grid--right .gallery-slide__img-wrap:nth-child(3) {
    position: relative;
    top: -100px !important;
  }

  /* Tablet portrait: alza anche tit/desc/cta/dots (intera cta card) */
  .gallery-cta-card {
    margin-top: -10.75rem !important;
  }
}

/* 4. Tablet landscape */
@media (min-width: 768px) and (max-width: 1360px) and (orientation: landscape) {
  .gallery-lightbox__scroll-hint {
    padding: 0.48rem 1rem;
    font-size: 0.85rem;
  }

  /* Lightbox: su tablet landscape rimpicciolisci per far entrare anche la barra sotto */
  .gallery-lightbox {
    padding: 1.25rem 1rem;
  }

  .gallery-lightbox__wrap {
    max-width: 92vw;
  }

  .gallery-lightbox__box {
    width: auto;
    height: auto;
    max-width: 86vw;
    max-height: 70vh;
    aspect-ratio: auto;
    background: transparent;
  }

  .gallery-lightbox__img {
    object-fit: contain;
    background: transparent;
    width: auto;
    height: auto;
    max-width: 86vw;
    max-height: 70vh;
  }

  .gallery-lightbox__img-viewport {
    position: static;
    inset: auto;
    overflow: visible;
    border-radius: 22px;
    width: auto;
    height: auto;
    background: transparent;
  }

  .gallery-lightbox__img-slide {
    position: static;
    inset: auto;
  }

  .gallery-lightbox__bar {
    max-width: 86vw;
    margin-top: 0.75rem;
  }

  .gallery-hero {
    padding: calc(var(--header-height) + 1.5rem) 2rem 2.5rem;
  }

  .gallery-hero__title {
    font-size: clamp(2rem, 4vw, 2.75rem);
  }

  .gallery-hero__subtitle {
    font-size: clamp(1rem, 1.8vw, 1.125rem);
  }

  .gallery-section {
    padding: 3rem 0;
  }

  .container,
  .gallery-section__inner {
    padding: 0 1.5rem;
  }

  .gallery-carousel__arrow {
    display: none !important;
  }

  .gallery-carousel__arrow--prev {
    left: -48px;
  }

  .gallery-carousel__arrow--next {
    right: -48px;
  }

  .gallery-carousel__track {
    min-height: 620px;
  }

  .gallery-slide.is-active .gallery-slide__frame {
    width: 540px;
    height: 630px;
  }

  .gallery-slide.is-active {
    margin-left: -270px;
  }

  .gallery-slide.is-prev .gallery-slide__frame,
  .gallery-slide.is-next .gallery-slide__frame {
    width: 270px;
    height: 315px;
  }

  .gallery-slide.is-prev {
    left: calc(50% - 432px);
    margin-top: -157px;
  }

  .gallery-slide.is-next {
    left: calc(50% + 162px);
    margin-top: -157px;
  }
}
