:root {
  --blanco: #ffffff;
  --gris-fondo: #f8fafc;
  --gris-lineas: #e2e8f0;
  --azul: #0f2b5c;
  --azul-claro: #1d4ed8;
  --rojo: #dc2626;
  --texto: #334155;
  --texto-suave: #64748b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--gris-fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

/* --- NAVEGACIÓN --- */
.nav-recuerdos {
  background-color: var(--blanco);
  border-bottom: 1px solid var(--gris-lineas);
  padding: 0.85rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.btn-volver {
  text-decoration: none;
  color: var(--azul);
  font-weight: 700;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.btn-volver:hover {
  color: var(--rojo);
}

.badge-familia {
  background-color: #fee2e2;
  color: var(--rojo);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- ENCABEZADO --- */
.recuerdos-header {
  text-align: center;
  padding: 3rem 1.5rem 1.5rem;
  max-width: 700px;
  margin: 0 auto;
}

.recuerdos-header h1 {
  color: var(--azul);
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.6rem;
}

.recuerdos-header p {
  color: var(--texto-suave);
  font-size: 1rem;
}

/* --- REJILLA DINÁMICA --- */
.galeria-container {
  max-width: 1200px;
  margin: 1.5rem auto 4rem;
  padding: 0 5%;
}

/* El grid calcula cuántas columnas caben con un mínimo de 260px por foto */
.galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.foto-item {
  position: relative;
  background-color: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(15, 43, 92, 0.05);
  cursor: pointer;
  aspect-ratio: 4 / 3; /* Todas mantienen la misma proporción limpia */
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.foto-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(15, 43, 92, 0.15);
}

.foto-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.foto-item:hover img {
  transform: scale(1.05);
}

/* Pie de foto discreto */
.foto-item figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 0.8rem 0.6rem;
  background: linear-gradient(to top, rgba(15, 43, 92, 0.85), transparent);
  color: var(--blanco);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.foto-item:hover figcaption {
  opacity: 1;
  transform: translateY(0);
}

/* --- VISOR LIGHTBOX --- */
.visor-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 43, 92, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
}

.visor-modal.activo {
  opacity: 1;
  pointer-events: auto;
}

.visor-modal img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  object-fit: contain;
}

.visor-modal p {
  color: var(--blanco);
  margin-top: 1rem;
  font-weight: 600;
  font-size: 1rem;
}

.visor-cerrar {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  color: var(--blanco);
  font-size: 2.2rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.visor-cerrar:hover {
  color: var(--rojo);
}