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

html {
  overflow-x: hidden; /* Prevent horizontal scroll on html */
 
}

html, body {
  height: 100%;
  min-height: 100vh;
}

/* Design tokens */
:root{
  --color-bg:#0f2027;
  --color-panel:rgba(20,30,48,0.92);
  --color-text:#ffffff;
  --color-muted:#b2becd;
  --color-accent:#40e0d0;
  --shadow-soft:0 10px 30px rgba(0,0,0,0.25);
  --radius-lg:24px;
  --radius-md:16px;
  --dur-anim:180ms;
  --ease-std:cubic-bezier(0.2,0.8,0.2,1);
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Montserrat', Arial, sans-serif;
  background: linear-gradient(135deg, #0f2027, #2c5364 80%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scroll */
 
  position: relative;
  width: 100%;
  max-width: 100vw; /* Ensure body doesn't exceed viewport width */
  display: flex;
  flex-direction: column;
}

/* Lock scroll when modal is open */
body.lock-scroll {
  position: fixed;
  overflow: hidden;
  width: 100%;
  left: 0;
}

/* 
=== CONTROLLO POSIZIONE MODAL CLOSE & INDICATORS ===

PULSANTE CHIUSURA (X):
MOBILE (<900px):
  --mobile-close-top: valore;     (es: 20px, 2rem)
  --mobile-close-right: valore;   (es: 16px, auto)
  --mobile-close-left: valore;    (es: auto, 16px)

DESKTOP (≥900px):  
  --desktop-close-top: valore;    (es: 16px, 2rem)
  --desktop-close-left: valore;   (es: 16px, auto)
  --desktop-close-right: valore;  (es: auto, 16px)

PUNTINI INDICATORI:
MOBILE (<900px):
  --mobile-indicators-top: valore;       (es: 16px, 2rem)
  --mobile-indicators-left: valore;      (es: 50%, 16px, auto)
  --mobile-indicators-right: valore;     (es: auto, 16px)
  --mobile-indicators-transform: valore; (es: translateX(-50%), none)

DESKTOP (≥900px):
  --desktop-indicators-top: valore;       (es: 16px, 2rem)
  --desktop-indicators-left: valore;      (es: 50%, 16px, auto)
  --desktop-indicators-right: valore;     (es: auto, 16px)
  --desktop-indicators-transform: valore; (es: translateX(-50%), none)

ESEMPI POSIZIONI:
- Sinistra: left: 16px, right: auto, transform: none
- Destra: left: auto, right: 16px, transform: none
- Centro: left: 50%, right: auto, transform: translateX(-50%)
*/



.banner {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw !important;
  z-index: 9999 !important;
  background: rgba(20, 30, 48, 0.95) !important;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  padding: 0 32px;
  max-width: 100%;
}


.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
}

.logo img {
  height: 36px;
  width: 36px;
  object-fit: contain;
}

.menu {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  max-width: 60%;
}

.menu a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  transition: color 0.2s;
  white-space: nowrap;
}

.menu a:hover {
  color: #40e0d0;
  transform: translateY(-2px);
  transition: all 0.3s ease;
}

.menu a.active {
  color: #40e0d0;
  border-bottom: 2px solid #40e0d0;
  padding-bottom: 2px;
}

.menu a {
  position: relative;
  transition: all 0.3s ease;
}

.menu a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #40e0d0;
  transition: width 0.3s ease;
}

.menu a:hover::after {
  width: 100%;
}

/* Spazio invisibile per bilanciare il layout e centrare il menu */
.banner::after {
  content: '';
  width: 120px; /* Stessa larghezza del logo */
  visibility: hidden;
  flex-shrink: 0;
}

main {
  padding-top: 80px !important;
  min-height: auto !important;
  height: auto !important;
  min-height: 200vh; /* Solo per testare che lo scroll funzioni */

}

.hero {
  width: 100%;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  position: relative;
  text-align: center;
  padding: 80px 16px 40px 16px;
  overflow: hidden;
}

/* Glass overlay statico che copre tutto il hero */
.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(64, 224, 208, 0.04) 0%, transparent 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.01) 100%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  z-index: 1;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 20%, rgba(64, 224, 208, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(255, 0, 128, 0.1) 0%, transparent 50%);
  animation: float 6s ease-in-out infinite;
  z-index: 0;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes glassPulse {
  0%, 100% { 
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
  }
  50% { 
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
  }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes liquidFlow {
  0%, 100% { 
    border-radius: 20px;
    transform: scale(1);
  }
  25% { 
    border-radius: 25px 15px 25px 15px;
    transform: scale(1.02);
  }
  50% { 
    border-radius: 15px 25px 15px 25px;
    transform: scale(1.01);
  }
  75% { 
    border-radius: 20px 20px 15px 25px;
    transform: scale(1.02);
  }
}

@keyframes heroGlassPulse {
  0%, 100% { 
    background: 
      radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
      radial-gradient(circle at 80% 70%, rgba(64, 224, 208, 0.05) 0%, transparent 40%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.01) 100%);
    border-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
  }
  25% { 
    background: 
      radial-gradient(circle at 25% 35%, rgba(255, 255, 255, 0.12) 0%, transparent 40%),
      radial-gradient(circle at 75% 65%, rgba(64, 224, 208, 0.08) 0%, transparent 40%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  50% { 
    background: 
      radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.10) 0%, transparent 40%),
      radial-gradient(circle at 70% 60%, rgba(64, 224, 208, 0.06) 0%, transparent 40%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.015) 100%);
    border-color: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
  }
  75% { 
    background: 
      radial-gradient(circle at 35% 45%, rgba(255, 255, 255, 0.14) 0%, transparent 40%),
      radial-gradient(circle at 65% 55%, rgba(64, 224, 208, 0.10) 0%, transparent 40%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.025) 100%);
    border-color: rgba(255, 255, 255, 0.09);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
  }
}

@keyframes heroGlassReflection {
  0%, 100% { 
    transform: translateX(0) translateY(0) rotate(0deg);
  }
  25% { 
    transform: translateX(10px) translateY(-5px) rotate(1deg);
  }
  50% { 
    transform: translateX(-5px) translateY(10px) rotate(-0.5deg);
  }
  75% { 
    transform: translateX(15px) translateY(-8px) rotate(1.5deg);
  }
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 2px 2px 16px #000, 0 0 8px #40e0d0;
  margin-bottom: 32px;
  position: relative;
  z-index: 15;
  animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.center-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 15;
  animation: fadeInUp 1s ease-out 0.3s both;
}

.fa3io-text {
  font-size: 1.4rem;
  color: #fff;
  font-weight: 600;
  letter-spacing: 1px;
  position: relative;
  padding: 20px 40px;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  text-align: center;
  line-height: 1.4;
}

.fa3io-text:hover {
  transform: translateY(-1px);
  text-shadow: 
    0 3px 6px rgba(0, 0, 0, 0.9),
    0 0 25px rgba(0, 0, 0, 0.7),
    0 0 50px rgba(0, 0, 0, 0.5);
}

.fa3io-text{opacity:0;transition:opacity .8s ease;}
.center-logo.loaded .fa3io-text{opacity:1;}

.section {
  width: 100%;
  max-width: min(800px, 100vw); /* Ensure it doesn't exceed viewport width */
  margin: 0 auto 64px auto;
  padding: 48px 16px 0 16px;
  text-align: center;
  box-sizing: border-box; /* Include padding in width calculation */
  position: relative;
  transition: all 0.3s ease;
  scroll-margin-top: 100px; /* Compensa banner fisso per anchor link */
  
  /* FIX: Previene layout shift riservando spazio minimo */
  min-height: 400px; /* Altezza minima per evitare shift */
  contain: layout; /* Ottimizzazione browser per layout */
}

/* Color coding per sezioni */
.section.vfx { --accent-color: #ff0080; }
.section.art3d { --accent-color: #40e0d0; }
.section.interactive { --accent-color: #ff4500; }
.section.creativecoding { --accent-color: #2e8b57; }
.section.ai { --accent-color: #8a2be2; }

.section:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 64px 16px;
  margin-bottom: 80px;
}

.section h2 {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 24px;
  color: #fff;
  text-transform: uppercase;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

/* Migliora respiro titolo nelle sezioni galleria */
.section.art3d > h2 { padding: 0 20px; }

.section h2::before {
  content: "";
  width: 4px;
  height: 40px;
  background: var(--accent-color, #40e0d0);
  border-radius: 2px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.about-text {
  color: #b2becd;
  font-size: 1.15rem;
  margin-bottom: 32px;
  line-height: 1.5;
}

.about-img {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.about-img img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* Modern Contact Styles */
.contacts-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.8rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(64, 224, 208, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-width: 200px;
  flex: 1;
  max-width: 300px;
}

.contact-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(64, 224, 208, 0.1), transparent);
  transition: left 0.6s ease;
}

.contact-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(64, 224, 208, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(64, 224, 208, 0.15);
}

.contact-item:hover::before {
  left: 100%;
}

.contact-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: center;
  align-items: center;
}

.contact-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

.contact-value {
  font-size: 1rem;
  color: #fff;
  text-align: center;
  word-break: break-word;
}

.contact-link {
  color: #40e0d0;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

.contact-link:hover {
  color: #fff;
  text-shadow: 0 0 10px rgba(64, 224, 208, 0.5);
}

.contact-text {
  color: #fff;
  font-weight: 500;
}

.tags {
  margin-bottom: 2em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tag {
  display: inline-block;
  background: #222b3a;
  color: #40e0d0;
  border-radius: 16px;
  padding: 0.4em 1.2em;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(64,224,208,0.08);
  white-space: nowrap;
}

.cta {
  display: inline-block;
  margin-top: 1.5em;
  padding: 0.8em 2.2em;
  background: linear-gradient(90deg, #ff8c00, #ff0080, #40e0d0);
  color: #fff;
  border: none;
  border-radius: 32px;
  font-size: 1.1em;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(255, 140, 0, 0.15);
}

.cta:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 32px rgba(255, 0, 128, 0.18);
}

/* Override per sezioni con carosello largo */
.section.art3d {
  max-width: 100vw; /* Ensure it doesn't exceed viewport width */
  padding-left: 0;
  padding-right: 0;
  box-sizing: border-box; /* Include padding in width calculation */
}

.video-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 32px 0;
  position: relative;
  width: 100%;
  max-width: 100vw; /* Ensure it doesn't exceed viewport width */
}

.carousel-btn {
  background: rgba(32,40,56,0.8);
  border: none;
  color: #fff;
  font-size: 2rem;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  z-index: 2;
  flex-shrink: 0;
}

.carousel-btn:hover {
  background: #40e0d0;
  color: #222b3a;
  transform: scale(1.08);
}

.carousel-track {
  width: 80vw;
  max-width: min(960px, 100vw); /* Ensure it doesn't exceed viewport width */
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  gap: 24px;
}

.carousel-video {
  display: none;
  width: 100%;
  max-width: 300px;
  max-height: 360px;
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.4);
  background: #111;
}

.carousel-video.active {
  display: block;
}

.carousel-video.inactive {
  display: none;
}

/* --- CAROSELLO CON SWIPER --- */
.gallery-carousel {
  width: 100%;
  max-width: 1200px;
  margin: 32px auto;
  position: relative;
  padding: 0 60px;
  overflow: hidden;
}

.gallery-track {
  display: flex;
  align-items: center;
}

.gallery-item {
  flex: 0 0 333px;
  width: 333px !important;
  max-width: 333px;
  height: 350px;
  text-align: center;
  background: var(--color-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transition: transform var(--dur-anim) var(--ease-std), box-shadow var(--dur-anim) var(--ease-std);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation; /* Allow both vertical and horizontal gestures */
  /* Smooth scrolling optimization */
  will-change: transform;
  transform: translateZ(0);
  position: relative;
  
  /* FIX: Previene layout shift riservando spazio fisso */
  contain: layout;
}

.gallery-item:hover,
.gallery-item:focus-within {
  transform: scale(1.02);
  box-shadow: 0 18px 40px rgba(64,224,208,0.25);
}

/* Scala solo il contenuto interno così l'item mantiene larghezza */
.gallery-item:hover .gallery-img,
.gallery-item:hover .gallery-canvas {
  transform: scale(1.05);
}

.gallery-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.6s ease;
}

.gallery-item:hover::before {
  left: 100%;
}

.gallery-item.loading {
  background: linear-gradient(90deg, #2c5364 25%, #40e0d0 50%, #2c5364 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.gallery-img {
  width: 90%;
  height: 210px;
  object-fit: cover;
  border-radius: 16px;
  margin-top: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  cursor: pointer;
  transition: transform var(--dur-anim) var(--ease-std), box-shadow var(--dur-anim) var(--ease-std);
}

.gallery-canvas {
  width: 90%;
  height: 210px;
  border-radius: 16px;
  margin-top: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  cursor: pointer;
  transition: transform var(--dur-anim) var(--ease-std), box-shadow var(--dur-anim) var(--ease-std);
  touch-action: manipulation; /* Simple touch handling */
  
  /* FIX: Previene layout shift riservando lo spazio */
  min-height: 210px;
  min-width: 270px; /* 90% di 300px */
  background: linear-gradient(135deg, #142031, #142031); /* Skeleton background */
  position: relative;
  overflow: hidden;
}



/* Skeleton loading per canvas */
.gallery-canvas::before {
  content: '';
  position: absolute;
  top: 0;   
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(64, 224, 208, 0.1), transparent);
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Rimuovi skeleton quando canvas è caricato */
.gallery-canvas[data-loaded="true"]::before {
  display: none;
}

/* Canvas video special styling - removed blue border */
.gallery-canvas[id*="canvas"] {
  /* Blue border and pulse animation removed */
}

.gallery-canvas[id*="canvas"]:hover {
  /* Blue border hover effect removed */
}

.gallery-title {
  margin-top: 18px;
  font-weight: 700;
  color: #fff;
  font-size: 1.2rem;
  letter-spacing: 1px;
  padding: 0 14px;
  word-wrap: break-word;
}

/* Gestione thumbnail 16:9 nelle card */
.gallery-item .gallery-img.is-16x9 {
  aspect-ratio: 16 / 9 !important;
  width: 100% !important;
  height: auto !important;
  object-fit: cover !important;
}

/* Stili personalizzati per Swiper */
.swiper-button-next,
.swiper-button-prev {
  color: #40e0d0 !important;
  width: 56px !important;
  height: 56px !important;
  margin-top: -28px !important;
  background: rgba(64, 224, 208, 0.9) !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 50% !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(64, 224, 208, 0.4) !important;
}

.swiper-button-next:after,
.swiper-button-prev:after {
  font-size: 20px !important;
  font-weight: 900 !important;
  color: white !important;
}

.gallery-carousel:hover .swiper-button-next,
.gallery-carousel:hover .swiper-button-prev {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
  background: rgba(64, 224, 208, 1) !important;
  transform: scale(1.1) !important;
  box-shadow: 0 12px 48px rgba(64, 224, 208, 0.6) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.swiper-button-next.swiper-button-disabled,
.swiper-button-prev.swiper-button-disabled {
  opacity: 0.3 !important;
  pointer-events: none !important;
}

.modal-video {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-video-content {
  background: #181c24;
  border-radius: 20px;
  padding: 32px 16px 16px 16px;
  box-shadow: 0 8px 32px rgba(31,38,135,0.37);
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}

.modal-close {
  position: absolute;
  top: max(20px, env(safe-area-inset-top, 0px) + 8px);
  right: 20px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  font-size: 2.2rem;
  cursor: pointer;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover,
.modal-close:focus {
  background: rgba(255, 255, 255, 0.2);
  color: #40e0d0;
  transform: scale(1.1);
}

/* Modal Gallery Styles */
.modal-gallery-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  overflow: hidden;
  touch-action: pan-x pan-y; /* Allow both horizontal and vertical panning */
  /* Enhanced scroll performance */
  scroll-behavior: smooth;
  will-change: scroll-position;
  transform: translateZ(0);
  overscroll-behavior-x: none;
  /* Better touch handling */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.modal-gallery-track {
  display: flex;
  width: fit-content;
  height: 100%;
  transition: transform 0.3s ease;
  touch-action: pan-x; /* Allow horizontal panning */
  /* Smooth transform animations */
  will-change: transform;
  transform: translateZ(0);
  /* Prevent subpixel rendering issues */
  backface-visibility: hidden;
  /* Removed padding-right to prevent off-centering */
  /* padding-right: 16px !important; */
  box-sizing: border-box;
  gap: 0; /* Remove gap, use border for separation */
}

.modal-gallery-img {
  flex: 0 0 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  touch-action: pan-x; /* Allow horizontal panning */
  /* Prevent image selection/dragging */
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* Modal Gallery Video Styles */
.modal-gallery-video {
  flex: 0 0 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  touch-action: pan-x; /* Allow horizontal panning */
  border-radius: 8px;
  background: #000;
  /* Prevent video selection/dragging */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Modal Gallery Slide Styles */
.modal-gallery-slide {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  background: #000;
  margin: 0;
}

/* Border between slides in canvas carousel */
.modal-gallery-slide:not(:last-child) {
  border-right: 2px solid rgba(64, 224, 208, 0.3);
}

.modal-gallery-btn {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  border-radius: 50%;
  background: rgba(32,40,56,0.85);
  color: #fff;
  border: none;
  cursor: pointer;
  margin: 0 8px;
  transition: background 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: auto;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.modal-gallery-btn.prev {
  left: 8px;
}

.modal-gallery-btn.next {
  right: 8px;
}

.modal-gallery-btn:hover {
  background: #40e0d0;
  color: #222b3a;
  transform: translateY(-50%) scale(1.08);
}

/* Legacy support for existing modal gallery */
.modal-gallery .carousel-btn {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  border-radius: 50%;
  background: rgba(32,40,56,0.85);
  color: #fff;
  border: none;
  cursor: pointer;
  margin: 0 8px;
  transition: background 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: auto;
}
.modal-gallery .carousel-btn:hover {
  background: #40e0d0;
  color: #222b3a;
  transform: scale(1.08);
}

/* Focus ring personalizzato per accessibilità */
*:focus {
  outline: 2px solid #40e0d0;
  outline-offset: 2px;
}

.menu a:focus {
  outline: 2px solid #40e0d0;
  outline-offset: 4px;
  border-radius: 4px;
}

.carousel-btn:focus {
  outline: 3px solid #40e0d0;
  outline-offset: 2px;
}

.gallery-item:focus {
  outline: 2px solid #40e0d0;
  outline-offset: 4px;
  border-radius: 24px;
}

.gallery-item:focus-visible {
  outline: 2px solid #40e0d0;
  outline-offset: 4px;
  border-radius: 24px;
}

/* Rimuovi focus outline su touch devices per evitare focus permanente */
@media (hover: none) and (pointer: coarse) {
  .gallery-item:focus:not(:focus-visible) {
    outline: none;
  }
}

/* Miglioramenti per animazioni fluide */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Miglioramenti touch per mobile */
@media (max-width: 768px) {
  .gallery-canvas {
    position: relative;
    z-index: 1;
  }
  
  .gallery-item {
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: rgba(64, 224, 208, 0.3);
  }
  
  .gallery-item:active {
    transform: scale(0.98);
  }
  
  /* Permetti scrolling verticale su tutto il sito mobile */
  body, html {
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }
  
  main {
    touch-action: pan-x pan-y;
  }
  
  .section {
    touch-action: pan-x pan-y;
  }
  
  .hero {
    touch-action: pan-x pan-y;
  }
}

/* Ottimizzazioni specifiche per dispositivi mobile fisici */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
  .gallery-carousel {
    /* Permetti scrolling verticale su tutto lo schermo mobile */
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }
  
  .gallery-track {
    /* Ottimizza il rendering su mobile fisico */
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  
  .gallery-item {
    /* Migliora l'area di touch su mobile fisico - permetti scrolling verticale */
    min-height: 44px;
    min-width: 44px;
    touch-action: pan-x pan-y;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Disabilita animazioni non necessarie su mobile fisico per migliorare performance */
  .gallery-item:hover {
    transform: none;
  }
  
  .gallery-item:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  /* Permetti scrolling verticale su tutti gli elementi principali */
  body, html {
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }
  
  main {
    touch-action: pan-x pan-y;
  }
  
  .section {
    touch-action: pan-x pan-y;
  }
}

/* Indicatore di scroll */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(64, 224, 208, 0.3);
  z-index: 9999;
}

.scroll-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #40e0d0, #ff0080);
  transition: width 0.3s ease;
}

/* TABLET RESPONSIVE */
@media (max-width: 900px) {
  /* Forza media verticali in card su tablet/mobile */
  .gallery-img,
  .gallery-canvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
    object-fit: cover !important;
  }
  .gallery-item { height: auto !important; }
  .banner {
    flex-direction: column;
    height: auto;
    padding: 12px 16px;
    gap: 12px;
  }
  
  .logo {
    position: static;
    justify-content: center;
    width: 100%;
  }
  
  .menu {
    width: 100%;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
  }
  
  main {
    margin-top: 120px;
  }
  
  .hero {
    padding: 60px 16px 40px 16px;
    min-height: 50vh;
  }
  
  .hero h1 {
    font-size: 2.4rem;
  }
  
  .section {
    padding: 32px 16px 0 16px;
    margin-bottom: 40px;
  }
  
  .section h2 {
    font-size: 1.8rem;
  }
  
  .carousel-track {
    width: 90vw;
    max-width: 90vw;
    min-height: 200px;
    box-sizing: border-box; /* Include padding in width calculation */
  }
  
  .carousel-video {
    max-width: 250px;
    max-height: 180px;
  }
  
  .gallery-carousel {
    margin: 24px auto;
    padding: 0 20px;
    max-width: 100vw;
    width: 100%;
    height: 350px;
    overflow: hidden;
  }
  
  .gallery-track {
    display: flex;
    align-items: center;
  }
  
  .gallery-item {
    flex: 0 0 280px;
    width: 280px !important;
    height: 320px;
    cursor: pointer;
    touch-action: pan-x pan-y;
    padding: 4px;
  }
  
  .swiper-button-next,
  .swiper-button-prev {
    display: none !important;
  }
  
  .gallery-img {
    height: 180px;
  }
  
  .gallery-canvas {
    height: 180px;
    touch-action: pan-x pan-y; /* Permetti scrolling verticale */
  }
  
  /* Modal Gallery Tablet */
  .modal-gallery-container {
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-gallery-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    transition: none; /* Disable transform animation on tablet */
  }
  
  .modal-gallery-img {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
  
  .modal-gallery-btn {
    display: none !important; /* Hide buttons on tablet */
  }
  
  /* Modal Gallery Tablet */
  .modal-gallery-container {
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-gallery-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    transition: none; /* Disable transform animation on tablet */
  }
  
  .modal-gallery-img {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
  
  .modal-gallery-btn {
    display: none !important; /* Hide buttons on tablet */
  }
  /* Più respiro titolo sezioni su tablet/mobile */
  .section.art3d > h2 { padding: 0 18px; }
}

/* MOBILE RESPONSIVE */
@media (max-width: 600px) {
  .banner {
    padding: 8px 8px;
    gap: 8px;
  }
  /* Vertical canvas e card auto-height */
  .gallery-img,
  .gallery-canvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
    object-fit: cover !important;
  }
  .gallery-item { height: auto !important; }
  .logo {
    font-size: 1.1rem;
    gap: 8px;
  }
  
  .logo img {
    height: 32px;
    width: 32px;
  }
  
  .menu {
    gap: 10px;
    font-size: 0.9rem;
  }
  
  main {
    margin-top: 95px;
  }
  
  .hero {
    padding: 35px 10px 25px 10px;
    min-height: 40vh;
  }
  
  .hero h1 {
    font-size: 1.6rem;
    margin-bottom: 20px;
    letter-spacing: 1px;
  }
  
  .fa3io-text {
    font-size: 1.2rem;
    padding: 16px 32px;
    text-shadow: 
      0 2px 4px rgba(0, 0, 0, 0.8),
      0 0 20px rgba(0, 0, 0, 0.6),
      0 0 40px rgba(0, 0, 0, 0.4);
  }
  
  /* Effetto glass hero per mobile */
  .hero::after {
    background: rgba(255, 255, 255, 0.015);
    backdrop-filter: blur(0.8px);
    -webkit-backdrop-filter: blur(0.8px);
  }
  
  .section {
    padding: 25px 10px 0 10px;
    margin-bottom: 30px;
  }
  
  .section h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
  }
  
  .about-text {
    font-size: 0.95rem;
    margin-bottom: 25px;
  }
  
  /* Contact responsive */
  .contacts-container {
    gap: 0.8rem;
    margin-top: 1.5rem;
    flex-direction: column;
    max-width: 100%;
    padding: 0 1rem;
  }
  
  .contact-item {
    padding: 0.8rem 1rem;
    gap: 0.6rem;
    min-width: unset;
    flex: none;
    max-width: none;
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
  
  .contact-item .contact-info {
    text-align: left;
    align-items: flex-start;
  }
  
  .contact-item .contact-label {
    text-align: left;
  }
  
  .contact-item .contact-value {
    text-align: left;
  }
  
  .contact-label {
    font-size: 0.75rem;
  }
  
  .contact-value {
    font-size: 0.9rem;
  }
  
  .tags {
    gap: 6px;
  }
  
  .tag {
    font-size: 0.8em;
    padding: 0.3em 0.7em;
  }
  
  .cta {
    padding: 0.7em 1.4em;
    font-size: 0.95rem;
  }
  
  .video-carousel {
    gap: 12px;
    margin: 20px 0;
  }
  
  .carousel-btn {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
  
  .carousel-track {
    width: 98vw;
    max-width: 98vw;
    min-height: 180px;
    gap: 12px;
    box-sizing: border-box;
  }
  
  .carousel-video {
    max-width: 280px;
    max-height: 180px;
  }
  
  .gallery-carousel {
    margin: 24px auto;
    padding: 0 10px;
    height: 320px;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
  
  .gallery-track {
    display: flex;
    align-items: center;
  }
  
  /* Aumenta l'area di touch per i canvas su mobile */
  .gallery-canvas {
    margin: 8px;
    padding: 8px;
    min-height: 44px; /* Minimo per touch target */
    min-width: 44px;
  }
  
  .gallery-item {
    flex: 0 0 260px;
    width: 260px !important;
    height: 280px;
    cursor: pointer;
    touch-action: pan-x pan-y;
    padding: 4px;
    text-align: center;
    background: rgba(20,30,48,0.92);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(31,38,135,0.10);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
  }
  
  .swiper-button-next,
  .swiper-button-prev {
    display: none !important;
  }
  
  .gallery-img {
    height: 160px;
    margin-top: 12px;
  }
  
  .gallery-canvas {
    height: 160px;
    margin-top: 12px;
    touch-action: pan-x pan-y;
  }
  
  .gallery-title {
    font-size: 1rem;
    margin-top: 12px;
  }
  
  .carousel-btn.prev { left: 5px; }
  .carousel-btn.next { right: 5px; }
  
  .modal-gallery-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    overflow: hidden;
    touch-action: pan-x pan-y;
  }
  
  .modal-gallery-track {
    display: flex;
    width: fit-content;
    height: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Prevent subpixel rendering issues on mobile */
    backface-visibility: hidden;
    transform: translateZ(0);
  }
  
  .modal-gallery-img {
    flex: 0 0 90vw;
    width: 90vw;
    height: auto;
  }
  
  .modal-gallery-video {
    flex: 0 0 90vw;
    width: 90vw;
    height: auto;
    max-height: 60vh;
  }
  
  .modal-gallery-btn {
    display: none !important;
  }
  
  /* Mobile modal gallery slide borders */
  .modal-gallery-slide:not(:last-child) {
    border-right: 1px solid rgba(64, 224, 208, 0.2) !important;
  }
  /* Più respiro titolo sezioni su mobile */
  .section.art3d > h2 { padding: 0 14px; }

  /* Spazio in fondo alla card e titolo più leggibile */
  .gallery-item { padding-bottom: 12px !important; }
  .gallery-title { padding: 0 16px; margin-bottom: 6px; }
}

/* SMALL MOBILE RESPONSIVE */
@media (max-width: 480px) {
  /* Extra: rinforza ratio verticale su small mobile */
  .gallery-img,
  .gallery-canvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
    object-fit: cover !important;
  }
  .gallery-item { height: auto !important; }
  body {
    font-size: 0.9rem;
  }
  
  .banner {
    padding: 6px 6px;
    gap: 6px;
  }
  
  .logo {
    font-size: 1rem;
    gap: 6px;
  }
  
  .logo img {
    height: 28px;
    width: 28px;
  }
  
  .menu {
    gap: 8px;
    font-size: 0.85rem;
  }
  
  .menu a {
    padding: 4px 6px;
  }
  
  main {
    margin-top: 85px;
  }
  
  .hero {
    padding: 30px 8px 20px 8px;
    min-height: 35vh;
  }
  
  .hero h1 {
    font-size: 1.4rem;
    margin-bottom: 16px;
    letter-spacing: 1px;
  }
  
  .fa3io-text {
    font-size: 1.1rem;
    padding: 14px 28px;
    text-shadow: 
      0 2px 4px rgba(0, 0, 0, 0.8),
      0 0 20px rgba(0, 0, 0, 0.6),
      0 0 40px rgba(0, 0, 0, 0.4);
  }
  
  /* Effetto glass hero per mobile piccolo */
  .hero::after {
    background: rgba(255, 255, 255, 0.01);
    backdrop-filter: blur(0.5px);
    -webkit-backdrop-filter: blur(0.5px);
  }
  
  .section {
    padding: 20px 8px 0 8px;
    margin-bottom: 24px;
  }
  
  .section h2 {
    font-size: 1.3rem;
    margin-bottom: 12px;
  }
  
  .about-text {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }
  
  /* Contact responsive small */
  .contacts-container {
    gap: 0.6rem;
    margin-top: 1rem;
    padding: 0 0.8rem;
  }
  
  .contact-item {
    padding: 0.6rem 0.8rem;
    gap: 0.4rem;
    justify-content: flex-start;
    text-align: left;
  }
  
  .contact-item .contact-info {
    text-align: left;
    align-items: flex-start;
  }
  
  .contact-item .contact-label {
    text-align: left;
  }
  
  .contact-item .contact-value {
    text-align: left;
  }
  
  .contact-label {
    font-size: 0.7rem;
  }
  
  .contact-value {
    font-size: 0.85rem;
  }
  
  .tags {
    gap: 4px;
  }
  
  .tag {
    font-size: 0.8em;
    padding: 0.25em 0.6em;
  }
  
  .cta {
    padding: 0.6em 1.2em;
    font-size: 0.9rem;
  }
  
  .video-carousel {
    gap: 8px;
    margin: 16px 0;
  }
  
  .carousel-btn {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
  
  .carousel-track {
    width: 98vw;
    max-width: 98vw;
    min-height: 150px;
    gap: 8px;
    box-sizing: border-box; /* Include padding in width calculation */
  }
  
  .carousel-video {
    max-width: 240px;
    max-height: 160px;
  }
  
  .gallery-carousel {
    margin: 16px auto;
    padding: 0 10px;
    height: 240px;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
  
  .gallery-track {
    display: flex;
    align-items: center;
  }
  
  /* Aumenta l'area di touch per i canvas su mobile piccolo */
  .gallery-canvas {
    margin: 6px;
    padding: 6px;
    min-height: 44px; /* Minimo per touch target */
    min-width: 44px;
  }
  
  .gallery-item {
    flex: 0 0 240px;
    width: 240px !important;
    height: 240px;
    border-radius: 16px;
    cursor: pointer;
    touch-action: pan-x pan-y;
    padding: 4px;
    text-align: center;
    background: rgba(20,30,48,0.92);
    box-shadow: 0 8px 32px rgba(31,38,135,0.10);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
  }
  
  .swiper-button-next,
  .swiper-button-prev {
    display: none !important;
  }
  
  .gallery-img {
    height: 140px;
    margin-top: 10px;
    border-radius: 12px;
  }
  
  .gallery-canvas {
    height: 140px;
    margin-top: 10px;
    border-radius: 12px;
    touch-action: pan-x pan-y; /* Permetti scrolling verticale */
  }
  
  .gallery-title {
    font-size: 0.9rem;
    margin-top: 10px;
  }
  
  .modal-video-content {
    padding: 16px 8px 8px 8px;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 95vh;
  }
  
  .modal-close {
    font-size: 1.8rem;
    top: max(24px, env(safe-area-inset-top, 0px) + 12px);
    right: 16px;
    width: 40px;
    height: 40px;
  }
  
  /* Modal Gallery Mobile */
  .modal-gallery-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 95vw;
    max-width: 95vw;
    height: 60vh;
    max-height: 60vh;
    margin: 0 auto;
    box-sizing: border-box;
    overflow: hidden;
    touch-action: pan-x pan-y;
  }
  
  .modal-gallery-track {
    display: flex;
    width: fit-content;
    height: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Prevent subpixel rendering issues on mobile */
    backface-visibility: hidden;
    transform: translateZ(0);
  }
  
  .modal-gallery-img {
    flex: 0 0 95vw;
    width: 88vw;
    height: auto;
    object-fit: contain;
  }
  
  .modal-gallery-video {
    flex: 0 0 95vw;
    width: 88vw;
    height: auto;
    max-height: 50vh;
    object-fit: contain;
  }
  
  .modal-gallery-btn {
    display: none !important;
  }
  
  .carousel-btn.prev { left: 2px; }
  .carousel-btn.next { right: 2px; }
  
  /* Modern modal mobile adjustments */
  .modern-modal-header {
    padding: max(24px, env(safe-area-inset-top, 0px) + 12px) 12px 0 12px;
  }
  
  .modern-modal-close {
    width: 40px;
    height: 40px;
    font-size: 1.8rem;
  }
  /* Più respiro titolo sezioni su small mobile */
  .section.art3d > h2 { padding: 0 12px; }
}

/* EXTRA SMALL MOBILE */
@media (max-width: 360px) {
  /* Ultra small: mantieni verticale e auto-height */
  .gallery-img,
  .gallery-canvas { 
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
  }
  .gallery-item { height: auto !important; }
  .hero h1 {
    font-size: 1.2rem;
  }
  
  .fa3io-text {
    font-size: 1rem;
    padding: 12px 24px;
    text-shadow: 
      0 2px 4px rgba(0, 0, 0, 0.8),
      0 0 20px rgba(0, 0, 0, 0.6),
      0 0 40px rgba(0, 0, 0, 0.4);
  }
  
  /* Effetto glass hero per mobile molto piccolo */
  .hero::after {
    background: rgba(255, 255, 255, 0.008);
    backdrop-filter: blur(0.3px);
    -webkit-backdrop-filter: blur(0.3px);
  }
  
  .section h2 {
    font-size: 1.1rem;
  }
  
  .gallery-item {
    flex: 0 0 220px;
    height: 220px;
  }
  
  .gallery-img {
    height: 120px;
  }
  
  .carousel-video {
    max-width: 200px;
    max-height: 140px;
  }
  
  /* Extra small devices - ensure modal close buttons are always visible */
  .modal-close {
    top: max(28px, env(safe-area-inset-top, 0px) + 16px);
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 1.6rem;
  }
  
  .modern-modal-header {
    padding: max(28px, env(safe-area-inset-top, 0px) + 16px) 12px 0 12px;
  }
  
  .modern-modal-close {
    width: 36px;
    height: 36px;
    font-size: 1.6rem;
  }
}

/* Additional support for devices with notch or very small viewports */
@media (max-width: 320px), (max-height: 568px) {
  .modal-close {
    top: max(32px, env(safe-area-inset-top, 0px) + 20px) !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 1.4rem !important;
  }
  
  .modern-modal-header {
    padding: max(32px, env(safe-area-inset-top, 0px) + 20px) 8px 0 8px !important;
  }
  
  .modern-modal-close {
    width: 32px !important;
    height: 32px !important;
    font-size: 1.4rem !important;
  }
}

/* Special handling for landscape on mobile devices */
@media (orientation: landscape) and (max-height: 500px) {
  .modal-close {
    top: max(16px, env(safe-area-inset-top, 0px) + 8px) !important;
  }
  
  .modern-modal-header {
    padding: max(16px, env(safe-area-inset-top, 0px) + 8px) 12px 0 12px !important;
  }
}

/* Modal Gallery Styles */
.modal-gallery-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  overflow: hidden;
}

.modal-gallery-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

.modal-gallery-img {
  flex: 0 0 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.modal-gallery-btn {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  border-radius: 50%;
  background: rgba(32,40,56,0.85);
  color: #fff;
  border: none;
  cursor: pointer;
  margin: 0 8px;
  transition: background 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: auto;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.modal-gallery-btn.prev {
  left: 8px;
}

.modal-gallery-btn.next {
  right: 8px;
}

.modal-gallery-btn:hover {
  background: #40e0d0;
  color: #222b3a;
  transform: translateY(-50%) scale(1.08);
}

/* Legacy support for existing modal gallery */
.modal-gallery .carousel-btn {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  border-radius: 50%;
  background: rgba(32,40,56,0.85);
  color: #fff;
  border: none;
  cursor: pointer;
  margin: 0 8px;
  transition: background 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: auto;
}
.modal-gallery .carousel-btn:hover {
  background: #40e0d0;
  color: #222b3a;
  transform: scale(1.08);
}

.shader-banner{position:absolute;top:0;left:0;width:100%;height:100%;z-index:0;overflow:hidden;pointer-events:none;} 
.shader-banner iframe{position:absolute;top:-30px;left:0;width:100%;height:calc(100% + 60px);border:0;display:block;pointer-events:none;} 
.shader-vignette{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:0;background:radial-gradient(circle at center, rgba(0,0,0,0) 60%, rgba(0,0,0,0.6) 100%);} 
.banner > *:not(.shader-banner){position:relative;z-index:2;}

@media(max-width:600px){
  .banner{flex-direction:column;align-items:center;justify-content:center;height:auto;padding:12px 16px;}
  .logo{margin:0 auto 8px;}
  .gallery-img,
  .gallery-canvas{width:100%!important;height:auto!important;object-fit:cover;}
  /* Force portrait ratio on mobile for canvas cards */
  .gallery-canvas{
    aspect-ratio: 3 / 4; /* vertical card */
    max-height: 72vw; /* keep within viewport for small phones */
    object-fit: cover;
  }
  /* Modern compact spacing for mobile carousel */
  .gallery-carousel{
    padding: 0 8px !important;
    gap: 0 !important;
  }
  .gallery-track{
    gap: 10px !important;
  }
  .gallery-item{
    height: auto !important;
    border-radius: 18px !important;
    box-shadow: 0 6px 22px rgba(0,0,0,.25) !important;
    padding: 6px !important;
  }
}

/* ------------------- Compact Mobile Banner ------------------- */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 4px;
  outline: none;
}

.menu-toggle:focus,
.menu-toggle:active {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* ------------------- Compact Header up to tablets (≤900px) ------------------- */
@media (max-width: 900px) {
  /* Show hamburger, hide menu by default */
  .menu-toggle {
    display: block;
  }

  .banner {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    height: 56px !important;
    padding: 8px 12px !important;
    overflow: visible !important;
  }

  .logo {
    margin: 0 !important;
  }

  .menu-toggle {
    margin-left: auto !important;
    order: 2 !important;
  }

  .banner .menu {
    position: absolute;
    top: 56px;
    right: 0;
    width: auto;
    min-width: 200px;
    flex-direction: column !important;
    align-items: center;
    background: rgba(20, 30, 48, 0.95);
    padding: 8px 16px;
    gap: 12px;
    display: none; /* hidden until toggled */
    z-index: 1001;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .banner .menu.active {
    display: flex !important;
  }

  .banner .menu a {
    font-size: 1rem;
    padding: 8px 0;
  }

  main {
    margin-top: 64px !important;
  }
}

@media (min-width: 901px) {
  .menu-toggle {
    display: none;
  }
  .banner {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    visibility: visible !important;
    opacity: 1 !important;
  }
  .menu {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Regole per schermi intermedi dove il menu potrebbe essere troppo affollato */
@media (min-width: 901px) and (max-width: 1200px) {
  .menu {
    gap: 16px;
    max-width: 55%;
  }
  
  .menu a {
    font-size: 0.9rem;
  }
}

/* Regole per schermi molto grandi */
@media (min-width: 1201px) {
  .menu {
    gap: 28px;
    max-width: 65%;
  }
}

/* Desktop shader canvas */
.desktop-shader {
  position: absolute;
  top: -30px;
  left: 0;
  width: 100%;
  height: calc(100% + 60px);
  display: none;
  pointer-events: none;
}

/* Desktop: show canvas, hide iframe */
@media (min-width: 901px) {
  .desktop-shader {
    display: block !important;
  }
  .shader-banner iframe {
    display: none !important;
  }
  .mobile-shader {
    display: none !important;
  }
}

/* Disable heavy GLSL shader on mobile to improve performance */
@media (max-width: 900px) {
  .shader-banner {
    display: none !important;
  }
}


@media (max-width: 900px) {
  .hero {
    min-height: 60vh;
    background: #0f2027; /* fallback */
    overflow: hidden;
  }

  .center-logo   { animation: fadeInUp 1.2s ease-out .3s both; }
  
  /* Semplifica l'effetto glass su mobile per performance */
  .hero::after {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(0.5px);
    -webkit-backdrop-filter: blur(0.5px);
  }
}

@media (min-width: 901px){
  main{ margin-top:0 !important; }
  .hero{ padding-top:0 !important; margin-top:0 !important; }
}





.model-canvas{display:none !important;}

/* Disattiva gradienti bordo carosello */
.gallery-carousel::before,
.gallery-carousel::after,
.gallery-carousel.edge-hidden::before,
.gallery-carousel.edge-hidden::after{display:none !important;}

/* Arrow scroll hint */
.scroll-hint{position:absolute;top:50%;right:8px;transform:translateY(-50%);font-size:2rem;color:rgba(255,255,255,0.7);pointer-events:none;z-index:3;animation:hintShift 1.2s ease-in-out infinite;}
@keyframes hintShift{0%,100%{transform:translateY(-50%) translateX(0);}50%{transform:translateY(-50%) translateX(6px);}}

/* Pulse animation for unopened cards */
@keyframes cardPulse{0%,100%{transform:scale(1);}50%{transform:scale(1.05);} }
.gallery-item.pulse{animation:cardPulse 1.6s ease-in-out 0s 3 forwards;}
.shader-banner canvas{position:absolute;top:-30px;left:0;width:100%;height:calc(100% + 60px);display:block;pointer-events:none;}

/* Fade-in shader iframe */
.shader-banner iframe{opacity:0;transition:opacity 2.9s ease-in-out;}
.shader-banner iframe.loaded{opacity:1;}

/* Fade-in overlay logo/text */
.center-logo{opacity:0;transition:opacity 2.9s ease-in-out;}
.center-logo.loaded{opacity:1;}

/* Mobile shader canvas */
@media(max-width:900px){
  .mobile-shader{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:2;}
}
@media(min-width:901px){
  .mobile-shader{display:none !important;}
}

/* --- OVERRIDES: eliminate gap between banner and hero --- */
main{margin-top:0 !important;}
.hero{margin-top:0 !important;padding-top:0 !important;}

/* Override mobile carousel height to fit content */
@media (max-width: 600px) {
  .gallery-carousel {
    height: auto !important; /* lascia crescere con contenuto */
    padding: 0 8px !important;
  }
}

/* Performance Mode Styles */
.performance-mode {
  /* Riduci animazioni */
  --animation-duration: 0.3s;
  --transition-duration: 0.2s;
}

.performance-mode * {
  animation-duration: var(--animation-duration) !important;
  transition-duration: var(--transition-duration) !important;
}

.performance-mode .gallery-item {
  animation: none !important;
  transform: none !important;
}

.performance-mode .swiper-slide {
  transition: none !important;
}

.critical-performance-mode {
  /* Disabilita effetti pesanti */
  --animation-duration: 0s;
  --transition-duration: 0s;
}

.critical-performance-mode * {
  animation: none !important;
  transition: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

.critical-performance-mode .shader-banner {
  display: none !important;
}

.critical-performance-mode .desktop-shader,
.critical-performance-mode .mobile-shader {
  display: none !important;
}

.critical-performance-mode .particle-canvas {
  display: none !important;
}

/* Performance Indicator */
.performance-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  z-index: 10000;
  display: none;
}

.performance-indicator.show {
  display: block;
}

.performance-indicator.warning {
  background: rgba(255, 193, 7, 0.9);
  color: #000;
}

.performance-indicator.critical {
  background: rgba(220, 53, 69, 0.9);
  color: #fff;
}

/* Reactivation button styles */
.reactivation-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid var(--accent-color, #40e0d0);
  border-radius: 12px;
  padding: 16px;
  z-index: 10000;
  animation: slideInUp 0.3s ease;
  box-shadow: 0 8px 32px rgba(64, 224, 208, 0.3);
  backdrop-filter: blur(10px);
}

.reactivation-button.fade-out {
  animation: slideOutDown 0.5s ease forwards;
}

.reactivation-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.reactivation-icon {
  font-size: 24px;
  opacity: 0.8;
}

.reactivation-text {
  flex: 1;
  min-width: 0;
}

.reactivation-title {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 2px;
  color: var(--accent-color, #40e0d0);
}

.reactivation-subtitle {
  font-size: 11px;
  opacity: 0.7;
  line-height: 1.2;
}

.reactivation-btn {
  background: var(--accent-color, #40e0d0);
  color: #000;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.reactivation-btn:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(64, 224, 208, 0.4);
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideOutDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero .subtitle { font-size: 1rem; }
  .section { padding: 30px 0; }
  .section h2 { font-size: 1.5rem; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; }
  .gallery-item { height: 200px; }
  .contact-item { flex-direction: column; align-items: flex-start; }
  .contact-item strong { margin-bottom: 5px; }
  
  /* Glass effect per tablet */
  .fa3io-text {
    font-size: 1.3rem;
    padding: 18px 36px;
    text-shadow: 
      0 2px 4px rgba(0, 0, 0, 0.8),
      0 0 20px rgba(0, 0, 0, 0.6),
      0 0 40px rgba(0, 0, 0, 0.4);
  }
  
  /* Effetto glass hero per tablet */
  .hero::after {
    background: 
      radial-gradient(circle at 25% 35%, rgba(255, 255, 255, 0.06) 0%, transparent 40%),
      radial-gradient(circle at 75% 65%, rgba(64, 224, 208, 0.04) 0%, transparent 40%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.015) 0%, rgba(255, 255, 255, 0.008) 100%);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
  }
  
  /* Footer responsive */
  #site-footer {
    position: static !important;
    margin-top: 50px;
  }
  
  #site-footer > div {
    flex-direction: column !important;
    gap: 8px;
  }
  
  #site-footer #credits {
    font-size: 10px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  #site-footer {
    font-size: 10px;
    padding: 6px 10px;
  }
  
  #site-footer #credits {
    font-size: 9px;
  }
}

/* Shader */
.shader-banner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Loader overlay per shader */
.shader-loader{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.35);z-index:5;transition:opacity .6s ease;}
.shader-loader.hide{opacity:0;pointer-events:none;}
.lds-ring{display:inline-block;position:relative;width:80px;height:80px;}
.lds-ring div{box-sizing:border-box;display:block;position:absolute;width:64px;height:64px;margin:8px;border:6px solid #40e0d0;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(0.5,0,0.5,1) infinite;border-color:#40e0d0 transparent transparent transparent;}
.lds-ring div:nth-child(1){animation-delay:-0.45s;}
.lds-ring div:nth-child(2){animation-delay:-0.3s;}
.lds-ring div:nth-child(3){animation-delay:-0.15s;}
@keyframes lds-ring{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}

/* Nasconde completamente gli slide placeholder usati solo per l'allineamento Swiper */
.gallery-item.placeholder-slide {
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 600px) {
  .logo{
    width:auto!important;
    margin-left:16px!important;
    justify-content:flex-start!important;
  }
}

/* Elimina qualsiasi bordo o linea sotto la descrizione del modale */
.modal-video-content,
#modalGallery,
#modalGallery *,
#modalDescription {
  border-bottom: none !important;
  box-shadow: none !important;
}

.modal-video-content::after,
.modal-video-content::before,
#modalGallery::after,
#modalGallery::before,
#modalDescription::after,
#modalDescription::before {
  display: none !important;
  border: none !important;
  background: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Footer sticky solo su desktop */
@media (min-width: 900px) {
  #site-footer {
    position: static;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
  }
  main {
    padding-bottom: 56px; /* altezza footer + margine */
  }
}

/* Footer statico su mobile/tablet */
@media (max-width: 899px) {
  #site-footer {
    position: static;
  }
  main {
    padding-bottom: 0;
  }
}

/* --- MODERN MOBILE MODAL GALLERY --- */
.modern-modal-gallery {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(18,22,34,0.98);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: fadeIn 0.25s;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modern-modal-header {
  /* Variabili per controllo posizione mobile */
  --mobile-close-top: max(20px, env(safe-area-inset-top, 0px) + 8px);
  --mobile-close-right: 16px;
  --mobile-close-left: auto;
  
  position: absolute;
  top: var(--mobile-close-top);
  right: var(--mobile-close-right);
  left: var(--mobile-close-left);
  z-index: 1000;
}
.modern-modal-close {
  background: rgba(0, 0, 0, 0.5);
  border: none;
  transform: translateX(-40%);
  color: #fff;
  font-size: 2.2rem;
  opacity: 0.9;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modern-modal-close:hover,
.modern-modal-close:focus {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
  color: #40e0d0;
  transform: scale(1.1);
  transform: translateX(-40%);

}
.modern-modal-indicators {
  /* Variabili per controllo posizione mobile */
  --mobile-indicators-top: 26px;
  --mobile-indicators-left: 50%;
  --mobile-indicators-right: auto;
  --mobile-indicators-transform: translateX(-50%);
  
  position: absolute;
  top: var(--mobile-indicators-top);
  left: var(--mobile-indicators-left);
  right: var(--mobile-indicators-right);
  transform: var(--mobile-indicators-transform);
  display: flex;
  gap: 6px;
}
.modern-modal-indicators .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff3;
  transition: background 0.2s;
}
.modern-modal-indicators .dot.active {
  background: #40e0d0;
}
.modern-modal-carousel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  min-height: 60vw;
}
.modern-modal-slide {
  min-width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}
.modern-modal-media img,
.modern-modal-media video {
  max-width: 96vw;
  max-height: 55vh;
  border-radius: 18px;
  box-shadow: 0 4px 32px #0008;
  background: #111;
  object-fit: contain;
}
.modern-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 18px 16px;
  gap: 12px;
}
.modern-modal-description {
  color: #fff;
  font-size: 1.1em;
  flex: 1;
  opacity: 0.85;
}
.modern-modal-arrow {
  background: #232b3a;
  color: #40e0d0;
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  margin-right: 8px;
  opacity: 0.85;
  transition: background 0.2s, color 0.2s;
}
.modern-modal-arrow:active,
.modern-modal-arrow:focus { background: #40e0d0; color: #232b3a; }

@media screen and (min-width: 900px) {
  /* Container principale: full‑screen e flex centratore */
  /* FULLSCREEN FLEX CENTERED */
.modern-modal-gallery {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;       /* orizzontalmente centrato */
  justify-content: center;   /* verticalmente centrato */
  background: rgba(18,22,34,0.98);
  overflow: hidden;
  z-index: 9999;
  padding: 0;
}

/* HEADER (X) - Solo pulsante chiusura DESKTOP */
.modern-modal-header {
  /* Variabili per controllo posizione desktop */
  --desktop-close-top: 16px;
  --desktop-close-left: 16px;
  --desktop-close-right: auto;
  
  position: absolute;
  top: var(--desktop-close-top);
  left: var(--desktop-close-left);
  right: var(--desktop-close-right);
  z-index: 1000;
}
/* Solo la X (chiudi) */




  /* Wrapper della slide: auto‑sizing, nessun min‑width */
  .modern-modal-carousel,
  .modern-modal-slide {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: auto !important;
    height: auto !important;
  }

  /* L'immagine/video: max constraints senza overflow e centrata */
  .modern-modal-media img,
  .modern-modal-media video {
    width: auto !important;
    height: auto !important;
    max-width: 80vw !important;
    max-height: 80vh !important;
    object-fit: contain !important;
    margin: 0 auto !important;
  }

  /* Frecce ai lati */
  .modern-modal-arrow.prev {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
  }
  .modern-modal-arrow.next {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
  }
}



html, body {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: auto !important;
}

body {
  display: block !important;
}

/* 
=== PERSONALIZZAZIONE POSIZIONE MODAL CLOSE & INDICATORS ===
Modifica queste variabili per cambiare la posizione del pulsante X e dei puntini
*/

/* CONFIGURAZIONE MOBILE */
@media (max-width: 899px) {
  .modern-modal-header {
    /* Cambia questi valori per spostare la X su mobile */
    --mobile-close-top: max(20px, env(safe-area-inset-top, 0px) + 8px);
    --mobile-close-right: 16px;    /* Distanza da destra */
    --mobile-close-left: auto;     /* auto = non usare sinistra */
    
    /* ESEMPI ALTERNATIVI:
    
    X a sinistra mobile:
    --mobile-close-left: 16px;
    --mobile-close-right: auto;
    
    X centrata mobile:
    --mobile-close-left: 50%;
    --mobile-close-right: auto;
    transform: translateX(-50%);
    */
  }

  .modern-modal-indicators {
    /* Cambia questi valori per spostare i puntini su mobile */
    --mobile-indicators-top: 60px;      /* Distanza dall'alto */
    --mobile-indicators-left: 50%;      /* Posizione orizzontale */
    --mobile-indicators-right: auto;    /* auto = non usare destra */
    --mobile-indicators-transform: translateX(-50%); /* Centratura */
    
    /* ESEMPI ALTERNATIVI:
    
    Puntini a sinistra mobile:
    --mobile-indicators-left: 16px;
    --mobile-indicators-transform: none;
    
    Puntini a destra mobile:
    --mobile-indicators-left: auto;
    --mobile-indicators-right: 16px;
    --mobile-indicators-transform: none;
    */
  }
}

/* CONFIGURAZIONE DESKTOP */
@media (min-width: 900px) {
  .modern-modal-header {
    /* Cambia questi valori per spostare la X su desktop */
    --desktop-close-top:16px;     /* Distanza dall'alto */
    --desktop-close-left:26px;    /* Distanza da sinistra */
    --desktop-close-right: auto;   /* auto = non usare destra */
    
    /* ESEMPI ALTERNATIVI:
    
    X a destra desktop:
    --desktop-close-left: auto;
    --desktop-close-right: 16px;
    
    X centrata desktop:
    --desktop-close-left: 50%;
    --desktop-close-right: auto;
    transform: translateX(-50%);
    */
  }

  .modern-modal-indicators {
    /* Variabili per controllo posizione desktop */
    --desktop-indicators-top: 26px;      /* Distanza dall'alto */
    --desktop-indicators-left: 50%;      /* Posizione orizzontale */
    --desktop-indicators-right: auto;    /* auto = non usare destra */
    --desktop-indicators-transform: translateX(-50%); /* Centratura */
    
    /* Applica le variabili desktop */
    top: var(--desktop-indicators-top);
    left: var(--desktop-indicators-left);
    right: var(--desktop-indicators-right);
    transform: var(--desktop-indicators-transform);
    
    /* ESEMPI ALTERNATIVI:
    
    Puntini a sinistra desktop:
    --desktop-indicators-left: 16px;
    --desktop-indicators-transform: none;
    
    Puntini a destra desktop:
    --desktop-indicators-left: auto;
    --desktop-indicators-right: 16px;
    --desktop-indicators-transform: none;
    
    Puntini più in basso desktop:
    --desktop-indicators-top: 32px;
    */
  }
}

/* Blocca lo scroll sul body */

.modern-modal-description {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.5;
  text-align: center;
  padding: 20px 24px;
  background: rgba(35, 43, 58, 0);
  border-top: 1px solid rgba(64, 224, 208, 0.3);
  margin-top: 0;
  transition: padding 0.3s ease;
}

/* Description text */
.description-text {
  display: block;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Description overlay - tendina che sale dal basso */
.description-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.description-overlay.active {
  opacity: 1;
  visibility: visible;
}

.description-overlay.closing {
  opacity: 0;
  visibility: hidden;
}

/* Panel che slide up */
.description-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  background: linear-gradient(135deg, rgba(35, 43, 58, 0.95), rgba(25, 33, 48, 0.98));
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 2px solid rgba(64, 224, 208, 0.4);
  backdrop-filter: blur(20px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.description-overlay.active .description-panel {
  transform: translateY(0);
}

.description-overlay.closing .description-panel {
  transform: translateY(100%);
}

/* Header del panel */
.description-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(64, 224, 208, 0.2);
}

.description-panel-title {
  color: #40e0d0;
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.5px;
}

.description-panel-close {
  background: none;
  border: none;
  color: #40e0d0;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.description-panel-close:hover {
  background: rgba(64, 224, 208, 0.1);
  transform: scale(1.1);
}

/* Contenuto scrollabile */
.description-panel-content {
  padding: 0 24px 32px;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.7;
  text-align: left;
  max-height: calc(70vh - 80px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(64, 224, 208, 0.3) transparent;
  /* Proprietà per far andare a capo il testo automaticamente */
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: pre-wrap;
  /* Sillabazione automatica per italiano e inglese */
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  hyphenate-character: "-";
}

.description-panel-content::-webkit-scrollbar {
  width: 6px;
}

.description-panel-content::-webkit-scrollbar-track {
  background: transparent;
}

.description-panel-content::-webkit-scrollbar-thumb {
  background: rgba(64, 224, 208, 0.3);
  border-radius: 3px;
}

.description-panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(64, 224, 208, 0.5);
}

/* Expand/collapse button */
.description-expand-btn {
  display: inline-block;
  margin-top: 12px;
  margin-left: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(64, 224, 208, 0.1), rgba(64, 224, 208, 0.2));
  border: 1px solid rgba(64, 224, 208, 0.4);
  border-radius: 20px;
  color: #40e0d0;
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  outline: none;
}

.description-expand-btn:hover {
  background: linear-gradient(135deg, rgba(64, 224, 208, 0.2), rgba(64, 224, 208, 0.3));
  border-color: rgba(64, 224, 208, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(64, 224, 208, 0.2);
}

.description-expand-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(64, 224, 208, 0.3);
}

.description-expand-btn:focus {
  border-color: rgba(64, 224, 208, 0.8);
  box-shadow: 0 0 0 2px rgba(64, 224, 208, 0.2);
}

/* Media container styles */
.modern-modal-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #00000000;
}

/* Responsive styles for mobile */
@media (max-width: 899px) {
  .modern-modal-media img,
  .modern-modal-media video {
    max-height: 45vh !important;
    max-width: 90vw !important;
  }
  
  .modern-modal-description {
    font-size: 1rem;
    padding: 16px 20px;
  }
  
  .description-expand-btn {
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: 36px;
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  .modern-modal-media img,
  .modern-modal-media video {
    max-height: 80vh !important;
    max-width: 95vw !important;
  }
  
  .modern-modal-description {
    font-size: 0.95rem;
    padding: 14px 18px;
  }
  
  .description-expand-btn {
    margin-top: 8px;
    padding: 10px 18px;
    font-size: 0.9rem;
    min-height: 40px;
    border-radius: 25px;
  }
}

/* Responsive styles per la tendina */
@media (max-width: 899px) {
  .description-panel {
    max-height: 80vh;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
  }
  
  .description-panel-header {
    padding: 18px 20px 14px;
  }
  
  .description-panel-title {
    font-size: 1.1rem;
  }
  
  .description-panel-close {
    width: 32px;
    height: 32px;
    font-size: 1.6rem;
  }
  
  .description-panel-content {
    padding: 0 20px 28px;
    font-size: 1rem;
    max-height: calc(80vh - 70px);
    /* Proprietà per far andare a capo il testo automaticamente */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: pre-wrap;
    /* Sillabazione automatica per italiano e inglese */
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphenate-character: "-";
  }
}

@media (max-width: 480px) {
  .description-panel {
    max-height: 85vh;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
  }
  
  .description-panel-header {
    padding: 16px 18px 12px;
  }
  
  .description-panel-title {
    font-size: 1rem;
  }
  
  .description-panel-close {
    width: 30px;
    height: 30px;
    font-size: 1.4rem;
  }
  
  .description-panel-content {
    padding: 0 18px 24px;
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: calc(85vh - 65px);
    /* Proprietà per far andare a capo il testo automaticamente */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: pre-wrap;
    /* Sillabazione automatica per italiano e inglese */
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphenate-character: "-";
  }
  
  .description-panel-content::-webkit-scrollbar {
    width: 4px;
  }
}

.reactivation-button.expanded {
  min-width: 220px;
  min-height: 56px;
  right: 20px;
  bottom: 20px;
  border-radius: 12px;
  background: rgba(0,0,0,0.95);
  box-shadow: 0 8px 32px rgba(64,224,208,0.3);
  transition: all 0.3s cubic-bezier(.4,1.4,.6,1);
  opacity: 1;
  cursor: default;
}
.reactivation-button.minimized {
  width: 48px;
  height: 48px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  right: 16px;
  bottom: 16px;
  background: rgba(0,0,0,0.85);
  box-shadow: 0 4px 16px rgba(64,224,208,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  cursor: pointer;
  z-index: 10000;
  transition: all 0.3s cubic-bezier(.4,1.4,.6,1);
}
.reactivation-mini-icon {
  font-size: 2rem;
  color: var(--accent-color, #40e0d0);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}
.reactivation-button.minimized:hover {
  opacity: 1;
  box-shadow: 0 8px 32px rgba(64,224,208,0.4);
}

/* Rimuovi il contorno degli elementi select quando vengono selezionati */
select:focus,
select:active {
  outline: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Stili per elementi select in generale */
select {
  outline: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 12px;
  background: white;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

select:hover {
  border-color: #40e0d0;
}

/* Rimuovi il contorno blu di default su tutti i browser */
select:focus {
  outline: none;
  border-color: #40e0d0;
  box-shadow: 0 0 0 2px rgba(64, 224, 208, 0.2);
}
