/* 
 * GALLERY SECTION STYLES
 * Stili dedicati alla sezione "Galleria Fotografica" in stile Apple
 * My Place Malpensa - Copyright 2025
 */

:root {
  --gallery-primary-color: #111;
  --gallery-secondary-color: #555;
  --gallery-bg-color: #ffffff;
  --gallery-accent-color: #2196f3; /* Aggiornato per riflettere il tema principale */
  --gallery-card-radius: 16px;
  --gallery-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --gallery-hover-shadow: 0 18px 40px rgba(0, 0, 0, 0.15);
  --gallery-transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  --gallery-caption-bg: rgba(0, 0, 0, 0.7);
  --gallery-caption-color: #fff;
  --gallery-nav-bg: rgba(255, 255, 255, 0.25);
  --gallery-nav-color: #111;
  --gallery-nav-hover-bg: rgba(255, 255, 255, 0.9);
  --gallery-overlay-gradient: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
}

/* Sezione galleria - Contenitore principale */
.gallery-section {
  padding: 5rem 0;
  background-color: #f9f9fb;
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.gallery-section::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle at 70% 30%, rgba(240, 240, 240, 0.7) 0%, transparent 50%);
  z-index: 1;
}

.gallery-section .container {
  position: relative;
  z-index: 2;
}

.gallery-section h2 {
  font-size: 3.125rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--gallery-primary-color);
}

.gallery-section .section-subtitle {
  font-size: 1.25rem;
  font-weight: 400;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--gallery-secondary-color);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Filtri per categorie */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Filtri secondari per tipologia */
.gallery-type-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2.5rem;
  padding: 8px 15px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 12px;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.gallery-type-label {
  font-size: 0.85rem;
  color: var(--gallery-secondary-color);
  margin-right: 5px;
}

.gallery-filter-button {
  background-color: transparent;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 100px;
  color: var(--gallery-secondary-color);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.gallery-type-button {
  padding: 5px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: white;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gallery-secondary-color);
  cursor: pointer;
  transition: var(--gallery-transition);
  white-space: nowrap;
}

.gallery-filter-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--gallery-primary-color);
}

.gallery-filter-button.active {
  background-color: var(--gallery-accent-color);
  color: white;
  border-color: var(--gallery-accent-color);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.25);
}

.gallery-type-button:hover {
  background-color: #f8f8f8;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.gallery-type-button.active {
  background-color: var(--gallery-accent-color);
  color: white;
  border-color: var(--gallery-accent-color);
  box-shadow: 0 3px 8px rgba(33, 150, 243, 0.2);
}

/* Animazioni per gli elementi della galleria */
.gallery-item-hidden {
  opacity: 0;
  transform: translateY(30px);
  pointer-events: none;
}

.gallery-item-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  pointer-events: auto;
}

/* Griglia della galleria */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 250px;
  gap: 1.25rem;
  margin: 2rem 0;
  height: 525px; /* Altezza fissa: 2 righe da 250px + 1 gap da 25px */
  overflow: hidden;
}

.gallery-grid .gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--gallery-card-radius);
  box-shadow: var(--gallery-card-shadow);
  transition: var(--gallery-transition);
  cursor: pointer;
  background-color: var(--gallery-bg-color);
}

.gallery-grid .gallery-item {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: translateY(0);
}

.gallery-grid .gallery-item.gallery-item-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.gallery-grid .gallery-item.gallery-item-visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-grid .gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--gallery-hover-shadow);
}

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

/* Stile per l'immagine in evidenza */
.gallery-grid .gallery-item.featured {
  grid-column: span 1;
  grid-row: span 2;
}

/* Stile per le immagini larghe */
.gallery-grid .gallery-item:nth-child(4) {
  grid-column: span 2;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s ease;
}

.gallery-item .gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--gallery-overlay-gradient);
  padding: 2rem 1.5rem 1.5rem;
  transform: translateY(100%);
  transition: transform 0.35s ease;
}

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

.gallery-item .gallery-overlay h3 {
  color: white;
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.gallery-item .gallery-overlay p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.gallery-item .gallery-category {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background-color: var(--gallery-accent-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.25);
}

.gallery-item .gallery-structure-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background-color: rgba(0, 0, 0, 0.75);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Navigazione galleria */
.gallery-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.gallery-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background-color: white;
  color: var(--gallery-primary-color);
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.gallery-nav-button:hover {
  background-color: var(--gallery-accent-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.3);
}

.gallery-nav-button:active {
  transform: translateY(0);
}

.gallery-nav-button.prev {
  margin-right: 0.5rem;
}

.gallery-nav-button.next {
  margin-left: 0.5rem;
}

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

.gallery-pagination-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ddd;
  margin: 0 0.35rem;
  transition: all 0.25s ease;
}

.gallery-pagination-dot.active {
  background-color: var(--gallery-accent-color);
  transform: scale(1.4);
}

/* Modal per vista ingrandita */
.gallery-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.gallery-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.gallery-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 85vh;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.gallery-modal.show .gallery-modal-content {
  opacity: 1;
  transform: scale(1);
}

.gallery-modal-img {
  display: block;
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.gallery-modal-close {
  position: absolute;
  top: -2.5rem;
  right: -2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.gallery-modal-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.gallery-modal-caption {
  position: absolute;
  bottom: -3rem;
  left: 0;
  width: 100%;
  text-align: center;
  color: white;
  font-size: 1.1rem;
  font-weight: 400;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.gallery-modal-prev,
.gallery-modal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.gallery-modal-prev {
  left: -4.5rem;
}

.gallery-modal-next {
  right: -4.5rem;
}

.gallery-modal-prev:hover,
.gallery-modal-next:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.1);
}

/* Pulsante "Visualizza tutta la galleria" */
.view-gallery-container {
  text-align: center;
  margin-top: 2.5rem;
}

.view-gallery-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: transparent;
  color: var(--gallery-accent-color);
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0.875rem 2rem;
  border: 1px solid var(--gallery-accent-color);
  border-radius: 100px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.view-gallery-button:hover {
  background-color: var(--gallery-accent-color);
  color: white;
}

.view-gallery-button i {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.view-gallery-button:hover i {
  transform: translateX(3px);
}

/* Effetto Skeleton Loading */
.gallery-skeleton {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f0f0f0 0%, #f8f8f8 50%, #f0f0f0 100%);
  background-size: 200% 100%;
  animation: gallerySkeletonShimmer 1.5s infinite;
  border-radius: var(--gallery-card-radius);
  z-index: 2;
}

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

/* Media Queries */
@media (max-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .gallery-grid .gallery-item:nth-child(4) {
    grid-column: span 1;
  }
}

@media (max-width: 991px) {
  .gallery-section {
    padding: 4rem 0;
  }
  
  .gallery-section h2 {
    font-size: 2.5rem;
  }
  
  .gallery-section .section-subtitle {
    font-size: 1.125rem;
    margin-bottom: 2.5rem;
  }
  
  .gallery-modal-prev {
    left: -1.5rem;
  }
  
  .gallery-modal-next {
    right: -1.5rem;
  }
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .gallery-grid .gallery-item:nth-child(1) {
    grid-column: span 2;
    grid-row: span 1;
  }
  
  .gallery-filter-button {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
  }
  
  .gallery-modal-close {
    top: -2rem;
    right: -1rem;
  }
  
  .gallery-modal-caption {
    bottom: -2.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 576px) {
  .gallery-section {
    padding: 3rem 0;
  }
  
  .gallery-section h2 {
    font-size: 2rem;
  }
  
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  
  .gallery-grid .gallery-item:nth-child(1),
  .gallery-grid .gallery-item:nth-child(4) {
    grid-column: span 1;
  }
  
  .gallery-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 1rem;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  
  .gallery-filter-button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  
  .gallery-modal-prev,
  .gallery-modal-next {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }
  
  .gallery-modal-prev {
    left: 0.5rem;
  }
  
  .gallery-modal-next {
    right: 0.5rem;
  }
}
