/* ============================================================
   Galería de fotos y videos
   Optimizado sin eliminar ninguna regla
============================================================ */

/* ------------------------------
   Lightbox base (fotos y vídeos)
------------------------------ */
.lightbox,
.video-lightbox-container {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: opacity;
}

/* Estado visible con fade-in */
.lightbox.show,
.video-lightbox-container.show {
  display: flex;
  opacity: 1;
}

.lightbox.show img {
  transform: scale(1);
}

/* ------------------------------
   Contenedor de fotos
------------------------------ */
.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-12);
  box-shadow: var(--shadow);
  transition: opacity .3s ease;
  will-change: opacity, transform;
}

.photo-card {
  padding: var(--space-16);
}

.lightbox-img-actual,
.lightbox-img-historica {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-12);
  cursor: pointer;
  display: block;
  transition: opacity .3s ease, transform .3s ease;
  will-change: opacity, transform;
}

.blur-up {
  filter: blur(20px);
  transform: scale(1.05);
  transition: filter .4s ease, transform .4s ease;
}
.blur-up.loaded {
  filter: blur(0);
  transform: scale(1);
}

/* ------------------------------
   Contenedor de vídeo
------------------------------ */
.video-lightbox-content {
  position: relative;
  width: 90%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-12);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.4s ease;
  will-change: transform;
}

.video-lightbox-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-lightbox {
  cursor: pointer;
  border-radius: var(--radius-12);
  display: block;
}

.video-lightbox-container.show .video-lightbox-content {
  transform: scale(1);
}

/* ------------------------------
   Botones de cierre
------------------------------ */
.lightbox-close,
.video-lightbox-close {
  position: fixed;
  top: 10px;
  right: 20px;
  font-size: 2.5rem;
  color: var(--text-white);
  cursor: pointer;
  z-index: 10;
  transition: opacity .25s ease;
}

.lightbox-close:hover,
.video-lightbox-close:hover {
  opacity: 0.75;
}

/* ------------------------------
   Vídeos
------------------------------ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-16);
}

.video-card {
  background: var(--panel);
  border-radius: var(--radius-12);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  will-change: transform, box-shadow;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.video-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.video-info {
  padding: var(--space-12);
  background: var(--bg-light-aqua);
}

.video-info h3 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--font-heading);
  color: var(--text-black);
}

/* ------------------------------
   Audios
------------------------------ */
.audio-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.audio-card {
  background: var(--bg-light-aqua);
  padding: 16px;
  border-radius: var(--radius-12);
  box-shadow: var(--shadow);
}

.audio-card audio {
  width: 100%;
}

.audio-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent-coral);
}

.audio-desc {
  margin-top: 8px;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ------------------------------
   Flechas y animación
------------------------------ */
.lightbox-prev,
.lightbox-next,
.video-lightbox-prev,
.video-lightbox-next {
  position: absolute;
  top: 50%;
  font-size: 2.5rem;
  color: var(--text-white);
  cursor: pointer;
  user-select: none;
  transform: translateY(-50%);
  padding: 8px;
  z-index: 10;
  transition: color .25s ease;
}

.lightbox-prev,
.video-lightbox-prev {
  left: 10px;
}

.lightbox-next,
.video-lightbox-next {
  right: 10px;
}

.lightbox-prev:hover,
.lightbox-next:hover,
.video-lightbox-prev:hover,
.video-lightbox-next:hover {
  color: var(--accent-aqua);
}

/* ------------------------------
   Botón de descarga
------------------------------ */
.card a.btn {
  margin-top: 8px;
  font-size: 0.9rem;
  padding: 8px 12px;
}

/* Ocultar flechas y botón de cierre por inactividad */
.lightbox-arrows-hidden .lightbox-prev,
.lightbox-arrows-hidden .lightbox-next,
.lightbox-arrows-hidden .lightbox-close,
.lightbox-arrows-hidden .video-lightbox-prev,
.lightbox-arrows-hidden .video-lightbox-next,
.lightbox-arrows-hidden .video-lightbox-close {
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}
