.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: left;
}

.gallery-item {
  width: 380px;
  height: 214px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.05);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.lightbox-img {
  width: 75vw;
  height: auto;
  max-height: 90vh;
  box-shadow: 0 0 15px rgba(0,0,0,0.7);
}

.close-lightbox {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: #fff;
  cursor: pointer;
}

.lightbox-caption {
  margin-top: 10px;
  font-size: 16px;
  color: #eee;
  text-align: center;
}

/* Overlay miniatura */
.gallery-item-wrapper {
  position: relative;
  display: inline-block;
}

.gallery-caption-hover {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 13px;
  padding: 4px 6px;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-align: center;
  z-index: 3;
}

.gallery-item-wrapper:hover .gallery-caption-hover {
  opacity: 1;
}


.lightbox-video {
  width: 75vw;
  height: auto;
  max-height: 90vh;
  background: #000;
  box-shadow: 0 0 15px rgba(0,0,0,0.7);
}

/* ✅ AGGIUNTA: gestione elementi con video */
.gallery-item-wrapper.has-video {
  transform: scale(1);
  transition: transform 0.3s ease;
}

.gallery-item-wrapper.has-video .gallery-item {
  transition: opacity 0.3s ease;
}

/* Video di anteprima nascosto di default */
.gallery-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: none;
}

/* ✅ Al passaggio mouse su elementi con video */
.gallery-item-wrapper.has-video:hover .gallery-item {
  opacity: 0;
}

/* ✅ Stato normale video preview */
.gallery-item-wrapper.has-video .gallery-preview {
  transform: scale(1);
  transform-origin: center center;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ✅ Zoom sul video in hover */
.gallery-item-wrapper.has-video:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* ✅ Elementi normali (senza video) mantengono effetto originale */
.gallery-item-wrapper:not(.has-video):hover .gallery-item {
  filter: brightness(1.1);
  transform: scale(1.05);
}
/* ✅ Per video: immagine scompare subito senza fade */
.gallery-item-wrapper.has-video .gallery-item {
  transition: none !important;
}

/* ✅ Pulsante play con cerchio + freccia */
.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.4); /* cerchio semitrasparente */
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  transition: opacity 0.3s ease;
  opacity: 0.8;
  pointer-events: none;
}

/* ✅ Triangolo bianco dentro il cerchio */
.play-overlay::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 20px solid white; /* freccia bianca */
  transform: translate(-40%, -50%); /* centrata leggermente a sinistra */
}

/* ✅ Sparisce in hover */
.gallery-item-wrapper.has-video:hover .play-overlay {
  opacity: 0;
}



