.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  grid-auto-rows: 350px;
  gap: 0;
  width: 100%;
  overflow: hidden;
}

.gallery-item {
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background-color: #000; /* Fix problema riga bianca su rollout */
  border: 1px solid #000;
  margin-right: -1px;
  margin-bottom: -1px;
  box-sizing: border-box;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /*transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);*/
  transform: scale(1.01);
  will-change: transform;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  -webkit-font-smoothing: antialiased;
}

.gallery-item:hover img {
  transform: scale(1.08);
}


/* Lightbox Styles */
#lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#lightbox.active {
  display: flex;
  opacity: 1;
}

#lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  cursor: pointer;
  box-shadow: 0 0 40px rgba(0,0,0,0.8);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

#lightbox.active img {
  transform: scale(1);
}

.btn-close-lightbox {
  position: absolute;
  top: 25px;
  right: 25px;
  width: 45px;
  height: 45px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 2101;
}

.btn-close-lightbox:hover {
  color: var(--src-accent);
  background-color: white;
  transform: none;
}

/* Lightbox navigation controls */
.lightbox-control-prev,
.lightbox-control-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 10%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  opacity: 0.5;
  cursor: pointer;
  z-index: 2100;
  transition: opacity 0.3s ease;
}

.lightbox-control-prev {
  left: 0;
}

.lightbox-control-next {
  right: 0;
}

.lightbox-control-prev:hover,
.lightbox-control-next:hover {
  opacity: 0.8;
}
