/* Gallery Modern - Unified styles for gallery system */

:root {
  --gallery-primary: #d4af37;
  --gallery-primary-light: #f0d478;
  --gallery-bg: #0a0a0a;
  --gallery-card-bg: rgba(255, 255, 255, 0.03);
  --gallery-card-hover: rgba(255, 255, 255, 0.06);
  --gallery-border: rgba(184, 134, 11, 0.3);
  --gallery-text: #ffffff;
  --gallery-text-dim: rgba(255, 255, 255, 0.7);
  --gallery-spacing: 2rem;
}

/* ===== COMMON GALLERY PAGE ===== */
.gallery-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--gallery-spacing);
  min-height: 80vh;
}

/* ===== HERO SECTION ===== */
.gallery-hero {
  text-align: center;
  padding: 4rem 2rem;
  margin-bottom: 3rem;
}

.gallery-hero__title {
  font-size: 4rem;
  font-weight: 800;
  color: var(--gallery-text);
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.gallery-hero__description {
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 300;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ===== HEADER (for collections/detail pages) ===== */
.gallery-header {
  margin-bottom: 3rem;
}

.gallery-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gallery-primary);
  text-decoration: none;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.gallery-back-link:hover {
  color: var(--gallery-primary-light);
  gap: 0.75rem;
}

.gallery-header__title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gallery-header__description {
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 300;
  line-height: 1.6;
  max-width: 900px;
}

/* ===== OVERVIEW SECTION CARDS ===== */
.gallery-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.gallery-section-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2.5rem;
  background: var(--_news-panel, #121212);
  border: 1px solid var(--gallery-border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--gallery-text);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.gallery-section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gallery-primary), transparent);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.gallery-section-card:hover::before {
  opacity: 1;
}

.gallery-section-card:hover {
  transform: translateY(-4px);
  background: var(--_news-panel, #141414);
  border-color: color-mix(in srgb, var(--gallery-border) 30%, var(--gallery-primary) 70%);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 0 1px color-mix(in srgb, var(--gallery-primary) 20%, transparent);
}

/* Preview Images for Section Cards */
.gallery-section-card__preview {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  order: -1; /* Place preview at the top */
}

/* Hero + Mini Grid (Modern 2025 Style) */
.gallery-section-card__preview--hero {
  position: relative;
  height: 280px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.preview-hero {
  width: 100%;
  height: 100%;
  position: relative;
}

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

.gallery-section-card:hover .preview-hero img {
  transform: scale(1.08);
}

/* Mini Grid Overlay */
.preview-mini-grid {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.5rem;
  z-index: 2;
}

.preview-mini {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  background: rgba(0, 0, 0, 0.8);
}

.preview-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.gallery-section-card:hover .preview-mini {
  transform: translateY(-4px);
  border-color: var(--gallery-primary);
}

.gallery-section-card:hover .preview-mini img {
  opacity: 1;
}

.gallery-section-card__preview--single {
  height: 280px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-section-card__preview--single img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.35s ease, opacity 0.3s ease;
}

.gallery-section-card:hover .gallery-section-card__preview--single img {
  transform: scale(1.03);
  opacity: 0.95;
}

.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  transition: background 0.3s ease;
}

.gallery-section-card:hover .preview-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.preview-overlay i {
  font-size: 4rem;
  color: white;
  opacity: 0.9;
  transition: all 0.3s ease;
}

.gallery-section-card:hover .preview-overlay i {
  transform: scale(1.15);
  color: var(--gallery-primary);
}

/* Fallback icon (when no preview images) */
.gallery-section-card__icon {
  font-size: 3.5rem;
  color: var(--gallery-primary);
  transition: all 0.4s ease;
}

.gallery-section-card:hover .gallery-section-card__icon {
  color: var(--gallery-primary-light);
  transform: scale(1.1) rotate(5deg);
}

.gallery-section-card__content {
  flex: 1;
}

.gallery-section-card__title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--gallery-text);
}

.gallery-section-card__description {
  font-size: 1rem;
  color: var(--gallery-text-dim);
  line-height: 1.5;
}

.gallery-section-card__count {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--gallery-primary);
  color: #000;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.gallery-section-card:hover .gallery-section-card__count {
  background: var(--gallery-primary-light);
  transform: scale(1.1);
}

.gallery-section-card__arrow {
  align-self: flex-end;
  font-size: 1.5rem;
  color: var(--gallery-primary);
  transition: all 0.3s ease;
}

.gallery-section-card:hover .gallery-section-card__arrow {
  transform: translateX(8px);
  color: var(--gallery-primary-light);
}

/* ===== COLLECTIONS GRID ===== */
.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.collection-card {
  position: relative;
  background: var(--_news-panel, #121212);
  border: 1px solid var(--gallery-border);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.collection-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gallery-primary), transparent);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 2;
}

.collection-card:hover::before {
  opacity: 1;
}

.collection-card--featured {
  border-color: var(--gallery-primary);
}

.collection-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 0 1px color-mix(in srgb, var(--gallery-primary) 20%, transparent);
  border-color: color-mix(in srgb, var(--gallery-border) 30%, var(--gallery-primary) 70%);
}

.collection-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.collection-card__image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #000;
}

.collection-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.collection-card:hover .collection-card__image img {
  transform: scale(1.08);
}

.collection-card__badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--gallery-primary);
  color: #000;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
}

.collection-card__count {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.8);
  color: var(--gallery-text);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
}

.collection-card__content {
  padding: 1.5rem;
}

.collection-card__title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gallery-text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.collection-card__description {
  font-size: 0.95rem;
  color: var(--gallery-text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== GALLERY ITEMS ===== */
.gallery-items {
  margin: 2rem 0;
}

.gallery-items--photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.gallery-item--photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item--photo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.4s ease;
}

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

.gallery-item__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  color: white;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

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

.gallery-item__overlay h4 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.gallery-item__credits {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ===== VIDEO & AUDIO ITEMS ===== */
.gallery-items--videos,
.gallery-items--audio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.gallery-item--video,
.gallery-item--audio {
  background: var(--gallery-card-bg);
  border: 1px solid var(--gallery-border);
  border-radius: 8px;
  overflow: hidden;
}

.video-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Video badge for upcoming/scheduled videos */
.video-embed .video-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font-ui, Montserrat, Arial, sans-serif);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.video-embed .video-badge--upcoming {
  background: linear-gradient(135deg, #d4af37 0%, #c9a135 100%);
  color: #1a1a1a;
  border: 2px solid rgba(255, 255, 255, 0.3);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.4);
  }
  50% {
    box-shadow: 0 2px 20px rgba(212, 175, 55, 0.7);
  }
}

.audio-embed {
  padding: 1rem;
}

.audio-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--gallery-primary);
  color: #000;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.audio-link:hover {
  background: var(--gallery-primary-light);
  transform: translateX(4px);
}

.audio-link i {
  font-size: 2rem;
}

.gallery-item__info {
  padding: 1.5rem;
}

.gallery-item__info h4 {
  font-size: 1.2rem;
  color: var(--gallery-text);
  margin-bottom: 0.5rem;
}

.gallery-item__info p {
  font-size: 0.95rem;
  color: var(--gallery-text-dim);
  line-height: 1.5;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 1.5rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  background: var(--gallery-primary);
  border-color: var(--gallery-primary);
  color: #000;
  transform: scale(1.1);
}

.lightbox__close {
  top: 2rem;
  right: 2rem;
}

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

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

.lightbox__content {
  max-width: 90%;
  max-height: 85%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.lightbox__info {
  text-align: center;
  color: white;
  padding: 1rem;
}

.lightbox__info h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.lightbox__info p {
  font-size: 1rem;
  opacity: 0.8;
}

.lightbox__counter {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  font-weight: 600;
}

/* ===== EMPTY STATE ===== */
.gallery-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gallery-text-dim);
}

.gallery-empty i {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.gallery-empty p {
  font-size: 1.2rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .gallery-hero__title,
  .gallery-header__title {
    font-size: 2.5rem;
  }

  .gallery-hero__description,
  .gallery-header__description {
    font-size: 1.1rem;
  }

  .gallery-sections {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .gallery-section-card {
    padding: 2rem;
  }

  .gallery-section-card__preview--grid,
  .gallery-section-card__preview--single {
    height: 220px;
  }

  .preview-overlay i {
    font-size: 3rem;
  }

  .collections-grid {
    grid-template-columns: 1fr;
  }

  .gallery-items--photos {
    grid-template-columns: 1fr;
  }

  /* Mobile: rimuovi aspect-ratio fisso per mostrare foto nelle proporzioni originali */
  .gallery-item--photo {
    aspect-ratio: unset;
    min-height: 200px;
  }

  .gallery-item--photo img {
    width: 100%;
    height: auto;
    max-height: none;
  }

  .gallery-items--videos,
  .gallery-items--audio {
    grid-template-columns: 1fr;
  }

  .lightbox__prev,
  .lightbox__next {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .lightbox__prev {
    left: 1rem;
  }

  .lightbox__next {
    right: 1rem;
  }

  .lightbox__close {
    top: 1rem;
    right: 1rem;
  }
}

/* Critical iPhone breakpoint */
@media (max-width: 420px) {
  .gallery-hero__title,
  .gallery-header__title {
    font-size: 1.8rem;
  }

  .gallery-hero__description,
  .gallery-header__description {
    font-size: 1rem;
  }
}
