/* ============================================================
   FOTOS — Galería 3×2 que cabe en 100svh + lightbox
   ============================================================ */

#fotos {
  height: 100svh;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Overlay de textura sutil */
#fotos::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(184,126,192,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 85% 15%, rgba(212,120,154,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.fotos-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  padding-top: var(--header-h);
  /* Limitar la altura total para que quepa el header y el grid */
  max-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* — Grid de galería 3×2 ————————————————————————————————— */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.75rem;
  /* Altura disponible: viewport - header - cabecera de sección */
  height: calc(100svh - var(--header-h) - 130px);
}

/* Primer elemento: ocupa 2 columnas para variedad */
.gallery-item:first-child {
  grid-column: 1 / 3;
}

/* — Item de galería ————————————————————————————————————— */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(16,6,20,0.6);
  /* tabindex gestionado por JS */
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Fotos retrato en contenedores más anchos: mostrar parte superior */
  object-position: center 15%;
  display: block;
  transition: transform var(--transition-slow), filter 0.4s ease;
}

/* El primer item (2 columnas, más ancho) prioriza mostrar rostro */
.gallery-item:first-child img {
  object-position: center 10%;
}

/* Overlay de hover */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(212,120,154,0.45) 0%,
    rgba(184,126,192,0.35) 100%
  );
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition);
}

.gallery-item:hover img         { transform: scale(1.07); filter: brightness(0.7); }
.gallery-item:hover .gallery-overlay { opacity: 1; }

.gallery-overlay-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.8);
  transition: transform var(--transition);
}
.gallery-item:hover .gallery-overlay-icon { transform: scale(1); }
.gallery-overlay-icon svg { width: 20px; height: 20px; color: #fff; }

/* — LIGHTBOX ——————————————————————————————————————————— */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 8, 0.96);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  backdrop-filter: blur(8px);
}
#lightbox.open { display: flex; }

.lightbox-img-wrap {
  position: relative;
  max-width: 88vw;
  max-height: 86vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightbox-img {
  max-width: 88vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.8);
  display: block;
}

/* Botón cerrar */
.lb-close {
  position: absolute;
  top: -3rem;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(212,120,154,0.15);
  border: 1px solid var(--brand);
  color: var(--brand);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.lb-close:hover { background: var(--brand); color: #fff; }

/* Botones prev/next */
.lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(7,3,10,0.75);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  backdrop-filter: blur(6px);
}
.lb-nav:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.lb-prev { left: 1.2rem; }
.lb-next { right: 1.2rem; }
.lb-nav svg { width: 22px; height: 22px; }

/* Contador de imagen */
.lb-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}
