.carousel {
  position: relative;
  margin: 3rem auto;
  overflow: hidden;
  width: 50%;
  height: 53dvh;
  min-height: 53dvh;

  display: flex;
  justify-content: center;
  align-items: center;
}


.slide {
  display: none;
  width: 100%;
  height: 100%;
  transition: opacity 1s;
}

.slide.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.carousel-img {
  width: auto;
  height: 100%;
  max-height: 53dvh;
  object-fit: contain;
  object-position: center; 

  cursor: pointer;
}




/* Galleria Modale */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.3s;
}

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

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  max-height: 80%;
}

.modal-content img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

.close:hover {
  color: #ccc;
}

/* Bottoni navigazione */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 15px 20px;
  font-size: 24px;
  cursor: pointer;
  transition: background 0.3s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.prev { left: 20px; }
.next { right: 20px; }

/* Thumbnails */
.thumbnails {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  overflow-x: auto;
}

.thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.thumbnail:hover,
.thumbnail.active {
  opacity: 1;
  border: 2px solid white;
}


@media (max-width: 900px)  and (orientation: portrait){
  .carousel {
    width: 100%;
    margin: 1rem auto;
    height: 24vh;
    min-height: 24vh;
  }
  
  .carousel-img {
    max-height: 24vh;
  }

  .nav-btn{
    background: none;
  }
}

@media (max-width: 900px)  and (orientation: landscape){
  .carousel {
    height: 80dvh;
    min-height: 80dvh;
  }
  
  .carousel-img{
    max-height: 80dvh;
  }
}