/* ============================================================
   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: min(1120px, 88%);
  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: minmax(520px, 1.65fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: clamp(185px, 20vw, 245px);
  gap: clamp(0.65rem, 1.2vw, 1rem);
  height: calc(100svh - var(--header-h) - 185px);
  max-height: 590px;
  min-height: 340px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 0 0.1rem 0.25rem;
}

.gallery-grid::-webkit-scrollbar { display: none; }

.gallery-item-featured {
  grid-column: 1;
  grid-row: 1 / -1;
}

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

.gallery-item::before {
  content: attr(data-number);
  position: absolute;
  top: 0.8rem;
  left: 0.85rem;
  z-index: 3;
  color: rgba(255,255,255,0.82);
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  display: block;
  transition: transform var(--transition-slow), filter 0.4s ease;
}

.gallery-item-featured img { object-position: center 17%; }
.gallery-featured-caption {
  position: absolute;
  z-index: 3;
  left: clamp(1rem, 2vw, 1.7rem);
  bottom: clamp(1rem, 2vw, 1.6rem);
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-shadow: 0 2px 16px rgba(0,0,0,0.8);
}

.gallery-featured-caption span {
  margin-bottom: 0.3rem;
  color: rgba(255,255,255,0.72);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.gallery-featured-caption strong {
  color: #fff;
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 2.5vw, 2.25rem);
  font-style: italic;
  font-weight: 600;
}

.gallery-item-featured::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 35% 0 0;
  background: linear-gradient(to bottom, transparent, rgba(5,2,8,0.72));
  pointer-events: none;
}

/* 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);
  z-index: 2;
}

.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; }

/* Pie editorial y navegación de la tira */
.gallery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 46px;
  padding-top: 0.7rem;
}

.gallery-note {
  color: var(--fg-muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-note span {
  color: var(--brand-light);
  font-weight: 600;
  letter-spacing: 0.16em;
  margin-right: 0.65rem;
}

.gallery-scroll-controls { display: flex; gap: 0.45rem; }

.gallery-scroll-controls button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(16,6,20,0.72);
  color: var(--fg);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.gallery-scroll-controls button:hover:not(:disabled) {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.gallery-scroll-controls button:disabled { opacity: 0.3; cursor: default; }
.gallery-scroll-controls svg { width: 16px; height: 16px; }

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

/* El lightbox sustituye temporalmente toda la navegación de la página. */
body.lightbox-open #header,
body.lightbox-open #nav-mobile,
body.lightbox-open #nav-dots,
body.lightbox-open #nav-backdrop {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.lightbox-open::after { display: none; }

.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: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 1rem);
  right: calc(env(safe-area-inset-right, 0px) + 1rem);
  z-index: 4;
  width: 44px;
  height: 44px;
  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);
}
