/**
 * GALLERY STYLES
 * Layout specifici per la pagina galleria con tre sezioni diverse
 */

/* =============================================================================
   SECTION LABEL
   ============================================================================= */

.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-valastro-blue);
  color: var(--color-valastro-blue);
  background: rgba(14, 40, 65, 0.05);
}

/* =============================================================================
   GALLERY ITEM BASE
   ============================================================================= */

.gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-gray-100);
  border: 1px solid var(--color-border);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover {
  transform: translateY(-5px);
  border-color: var(--color-valastro-gold);
  box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(to top, rgba(14, 40, 65, 0.95) 0%, rgba(14, 40, 65, 0.8) 50%, transparent 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-overlay h4 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-white);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.gallery-overlay p {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* =============================================================================
   LAYOUT 1: MASONRY GRID (Piatti)
   ============================================================================= */

.gallery-grid-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  grid-auto-flow: dense;
}

.gallery-grid-masonry .gallery-item {
  height: 350px;
}

.gallery-grid-masonry .gallery-item.tall {
  grid-row: span 2;
  height: 720px;
}

.gallery-grid-masonry .gallery-item.wide {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .gallery-grid-masonry {
    grid-template-columns: 1fr;
  }
  
  .gallery-grid-masonry .gallery-item.tall,
  .gallery-grid-masonry .gallery-item.wide {
    grid-row: auto;
    grid-column: auto;
    height: 300px;
  }
}

/* =============================================================================
   LAYOUT 2: SYMMETRIC GRID (Interno)
   ============================================================================= */

.gallery-grid-symmetric {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
}

.gallery-grid-symmetric .gallery-item.large {
  height: 100%;
  min-height: 600px;
}

.gallery-grid-small {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  height: 100%;
}

.gallery-grid-small .gallery-item {
  height: 100%;
  min-height: 285px;
}

@media (max-width: 1024px) {
  .gallery-grid-symmetric {
    grid-template-columns: 1fr;
  }
  
  .gallery-grid-symmetric .gallery-item.large {
    min-height: 400px;
    grid-row: auto;
  }
}

@media (max-width: 768px) {
  .gallery-grid-small {
    grid-template-columns: 1fr;
  }
  
  .gallery-grid-small .gallery-item {
    height: 250px;
  }
}

/* =============================================================================
   LAYOUT 3: HORIZONTAL SCROLL (Esterno)
   ============================================================================= */

.gallery-grid-horizontal {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-valastro-blue) var(--color-gray-200);
}

.gallery-grid-horizontal::-webkit-scrollbar {
  height: 8px;
}

.gallery-grid-horizontal::-webkit-scrollbar-track {
  background: var(--color-gray-200);
}

.gallery-grid-horizontal::-webkit-scrollbar-thumb {
  background: var(--color-valastro-blue);
  border-radius: 4px;
}

.gallery-grid-horizontal::-webkit-scrollbar-thumb:hover {
  background: var(--color-valastro-gold);
}

.gallery-grid-horizontal .gallery-item {
  scroll-snap-align: start;
  height: 500px;
  min-width: 300px;
}

.gallery-grid-horizontal .gallery-item.featured {
  min-width: 600px;
}

@media (max-width: 1024px) {
  .gallery-grid-horizontal {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
  
  .gallery-grid-horizontal .gallery-item.featured {
    min-width: 400px;
  }
}

@media (max-width: 768px) {
  .gallery-grid-horizontal {
    grid-template-columns: 1fr;
    overflow-x: scroll;
  }
  
  .gallery-grid-horizontal .gallery-item {
    height: 350px;
    min-width: 280px;
  }
  
  .gallery-grid-horizontal .gallery-item.featured {
    min-width: 280px;
  }
}

/* =============================================================================
   LIGHTBOX MODAL
   ============================================================================= */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

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

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border: 1px solid var(--color-white-10);
}

.lightbox-caption {
  text-align: center;
  padding: 1.5rem;
  background: var(--color-black-80);
  backdrop-filter: blur(10px);
}

.lightbox-caption h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--color-white);
}

.lightbox-caption p {
  font-size: 1rem;
  color: var(--color-white-70);
}

/* Lightbox Controls */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: var(--color-white-10);
  border: 1px solid var(--color-white-20);
  color: var(--color-white);
  font-size: 2rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--color-white-20);
  border-color: var(--color-white-40);
}

.lightbox-close {
  top: 2rem;
  right: 2rem;
  font-size: 2.5rem;
  line-height: 1;
}

.lightbox-prev {
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 768px) {
  .lightbox-content {
    max-width: 95vw;
  }
  
  .lightbox-content img {
    max-height: 70vh;
  }
  
  .lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 2rem;
  }
  
  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
  
  .lightbox-prev {
    left: 1rem;
  }
  
  .lightbox-next {
    right: 1rem;
  }
}

/* Loading State */
.gallery-item img[loading="lazy"] {
  background: var(--color-gray-100);
}

/* Accessibility */
.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
}