/* CF San Pedro — Galería de fotos: mosaico + lightbox.
   Reutiliza en su totalidad las variables/tokens de css/style.css. */

/* ---------- Mosaico ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (min-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
  /* Mosaico: la 1ª foto de cada tanda de 6 ocupa 2x2 para dar variedad
     visual sin depender de las dimensiones reales de cada imagen. */
  .gallery-item:nth-child(6n + 1) { grid-column: span 2; grid-row: span 2; }
}

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--stadium-gray);
  cursor: pointer;
  background: var(--surface-container-low);
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.gallery-item:hover img { transform: scale(1.08); }
.gallery-item::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,17,26,0.35), transparent 45%);
  opacity: 0; transition: opacity 0.25s ease;
}
.gallery-item:hover::after { opacity: 1; }
.gallery-item .zoom-icon {
  position: absolute; bottom: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.85);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.8);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.gallery-item:hover .zoom-icon { opacity: 1; transform: scale(1); }
.gallery-item .zoom-icon svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- Lightbox ---------- */
.gallery-lightbox {
  position: fixed; inset: 0; z-index: 220;
  background: rgba(10,17,26,0.92);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.gallery-lightbox.show { opacity: 1; pointer-events: auto; }

.gallery-lightbox-close {
  position: absolute; top: 20px; right: 20px; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff; font-size: 24px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.gallery-lightbox-close:hover { background: rgba(255,255,255,0.22); }

.gallery-lightbox-counter {
  position: absolute; top: 26px; left: 24px; z-index: 2;
  color: rgba(255,255,255,0.75);
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  letter-spacing: 0.04em;
}

.gallery-lightbox-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.gallery-lightbox-arrow:hover { background: rgba(255,255,255,0.22); }
.gallery-lightbox-arrow.prev { left: 16px; }
.gallery-lightbox-arrow.next { right: 16px; }

.gallery-lightbox-figure {
  max-width: 90vw; max-height: 86vh;
  display: flex; align-items: center; justify-content: center;
}
.gallery-lightbox-figure img {
  max-width: 90vw; max-height: 86vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

body.gallery-lightbox-open { overflow: hidden; }

@media (max-width: 640px) {
  .gallery-lightbox-arrow { width: 40px; height: 40px; font-size: 18px; }
  .gallery-lightbox-arrow.prev { left: 8px; }
  .gallery-lightbox-arrow.next { right: 8px; }
  .gallery-lightbox-close { top: 12px; right: 12px; width: 38px; height: 38px; }
  .gallery-lightbox-counter { top: 18px; left: 14px; font-size: 12px; }
}
