/* =====================================================
   GALLERY — tira de miniaturas + lightbox
   Coherente con index-modern-4.css (dark/red)
   ===================================================== */

/* ── Sección contenedora ───────────────────────────── */
.gallery-section {
  width: 100%;
  min-height: 100svh;
  padding: clamp(26px, 5vw, 56px) 0;
  background: linear-gradient(180deg, #090b10, #0d1018);
  border-top: 1px solid #281117;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

.gallery-inner {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 56px);
  box-sizing: border-box;
}

.gallery-head {
  margin-bottom: 28px;
}

.gallery-head h2 {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  text-transform: uppercase;
  color: #f0222f;
  margin: 0 0 6px;
  line-height: 1.02;
}

.gallery-head p {
  color: #b6becf;
  margin: 0;
  font-size: 1rem;
}

/* ── Tira horizontal de miniaturas ─────────────────── */
.gallery-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 12px;
  cursor: grab;
}

.gallery-strip:active {
  cursor: grabbing;
}

.gallery-strip::-webkit-scrollbar {
  height: 4px;
}

.gallery-strip::-webkit-scrollbar-track {
  background: #1a2030;
}

.gallery-strip::-webkit-scrollbar-thumb {
  background: #f0222f;
  border-radius: 999px;
}

.gallery-thumb {
  flex: 0 0 clamp(160px, 22vw, 240px);
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  background: #111622;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease, filter 0.45s ease;
}

.gallery-thumb:hover {
  border-color: #f0222f;
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4);
}

.gallery-thumb:hover img {
  transform: scale(1.07);
}

.gallery-thumb-index {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(9, 11, 16, 0.82);
  border: 1px solid #2e3a4e;
  color: #d2d8e7;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.gallery-thumb:hover .gallery-thumb-index {
  opacity: 1;
}

/* ── Grid mosaico ───────────────────────────────────── */
.gallery-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 220px;
  gap: 10px;
}

/* Celdas normales */
.gallery-grid .gallery-thumb {
  flex: none;
  width: 100%;
  height: 100%;
  aspect-ratio: unset;
  border-radius: 10px;
}

.gallery-grid .gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Patrón de tamaños — se repite cada 14 ítems */
/* wide: 2 cols */
.gallery-grid .gallery-thumb:nth-child(14n+1),
.gallery-grid .gallery-thumb:nth-child(14n+5),
.gallery-grid .gallery-thumb:nth-child(14n+9)  { grid-column: span 2; }

/* tall: 2 rows */
.gallery-grid .gallery-thumb:nth-child(14n+3),
.gallery-grid .gallery-thumb:nth-child(14n+7),
.gallery-grid .gallery-thumb:nth-child(14n+11) { grid-row: span 2; }

/* big: 2x2 */
.gallery-grid .gallery-thumb:nth-child(14n+13) { grid-column: span 2; grid-row: span 2; }

/* ── Lightbox overlay ───────────────────────────────── */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(6, 8, 13, 0.97);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lb-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Barra superior */
.lb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #1e2736;
  gap: 12px;
  flex-shrink: 0;
}

.lb-counter {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1rem;
  color: #b6becf;
  letter-spacing: 0.4px;
}

.lb-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #3b4560;
  background: transparent;
  color: #e0e6f8;
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.lb-close:hover {
  background: rgba(240, 34, 47, 0.18);
  border-color: #f0222f;
}

/* Zona central (imagen + flechas) */
.lb-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.lb-img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 64px;
  box-sizing: border-box;
}

.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.6);
  transition: opacity 0.25s ease, transform 0.25s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.lb-img.fade {
  opacity: 0;
  transform: scale(0.97);
}

/* Flechas */
.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid #3b4560;
  background: rgba(12, 15, 24, 0.82);
  color: #e0e6f8;
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.lb-arrow-prev { left: 12px; }
.lb-arrow-next { right: 12px; }

.lb-arrow:hover {
  background: rgba(240, 34, 47, 0.22);
  border-color: #f0222f;
  transform: translateY(-50%) scale(1.06);
}

.lb-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Tira de miniaturas inferior */
.lb-filmstrip {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 14px;
  border-top: 1px solid #1e2736;
  scroll-behavior: smooth;
}

.lb-filmstrip::-webkit-scrollbar {
  height: 3px;
}

.lb-filmstrip::-webkit-scrollbar-thumb {
  background: #f0222f;
  border-radius: 999px;
}

.lb-film-thumb {
  flex: 0 0 64px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
  opacity: 0.55;
}

.lb-film-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lb-film-thumb.active {
  border-color: #f0222f;
  opacity: 1;
}

.lb-film-thumb:hover {
  opacity: 0.85;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .lb-img-wrap {
    padding: 8px 52px;
  }

  .lb-arrow {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .lb-arrow-prev { left: 6px; }
  .lb-arrow-next { right: 6px; }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 160px;
  }

  /* Ajustar spans al grid de 3 columnas */
  .gallery-grid .gallery-thumb:nth-child(14n+1),
  .gallery-grid .gallery-thumb:nth-child(14n+5),
  .gallery-grid .gallery-thumb:nth-child(14n+9)  { grid-column: span 2; }

  .gallery-grid .gallery-thumb:nth-child(14n+13) { grid-column: span 2; grid-row: span 2; }
}

@media (max-width: 540px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 140px;
  }

  /* En 2 columnas solo admitimos tall, no wide ni big */
  .gallery-grid .gallery-thumb:nth-child(14n+1),
  .gallery-grid .gallery-thumb:nth-child(14n+5),
  .gallery-grid .gallery-thumb:nth-child(14n+9),
  .gallery-grid .gallery-thumb:nth-child(14n+13) { grid-column: span 1; grid-row: span 1; }

  .gallery-grid .gallery-thumb:nth-child(14n+3),
  .gallery-grid .gallery-thumb:nth-child(14n+7),
  .gallery-grid .gallery-thumb:nth-child(14n+11) { grid-row: span 2; }
}

@media (max-width: 480px) {
  .lb-film-thumb {
    flex: 0 0 50px;
    height: 38px;
  }

  .lb-img-wrap {
    padding: 6px 44px;
  }
}
