/* ============================================================
   SIEMPRE PRESENTE · Portal conmemorativo
   Diseño premium y sobrio (paleta clara).
   Para cambiar de paleta solo hay que editar las variables :root.
   ============================================================ */

:root {
  /* --- Paleta 1: Marfil & Oro viejo (por defecto) --- */
  --sp-fondo: #faf6ee;
  --sp-fondo-alt: #f3ecdf;
  --sp-fondo-carta: #ffffff;
  --sp-texto: #3a352c;
  --sp-texto-tenue: #6f685a;
  --sp-acento: #8a6a2f;
  --sp-acento-claro: #8a6a2f;
  --sp-linea: rgba(168, 131, 62, 0.25);

  --sp-serif: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --sp-sans: "Lato", "Segoe UI", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body.memorial-body {
  font-family: var(--sp-sans);
  font-weight: 300;
  color: var(--sp-texto);
  background: var(--sp-fondo);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Utilidades de sección ---------- */
.m-seccion {
  padding: 6rem 1.5rem;
}

.m-seccion__inner {
  max-width: 1080px;
  margin: 0 auto;
}

.m-seccion__kicker {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  color: var(--sp-acento);
  margin-bottom: 1rem;
}

.m-seccion__titulo {
  font-family: var(--sp-serif);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  color: var(--sp-texto);
  margin-bottom: 1.25rem;
}

.m-seccion__intro {
  color: var(--sp-texto-tenue);
  max-width: 34rem;
  margin-bottom: 2.5rem;
}

/* ---------- HERO ---------- */
.m-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(168, 131, 62, 0.12), transparent 60%),
    linear-gradient(180deg, #fdfbf5 0%, var(--sp-fondo) 70%);
}

.m-hero__imagen {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.16;
  filter: grayscale(20%);
}

.m-hero__velo {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(250, 246, 238, 0.62) 0%, rgba(250, 246, 238, 0.88) 72%, var(--sp-fondo) 100%);
}

.m-hero__content {
  position: relative;
  z-index: 1;
  animation: sp-aparecer 1.6s ease both;
}

@keyframes sp-aparecer {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.m-hero__kicker {
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: 0.72rem;
  color: var(--sp-acento);
  margin-bottom: 1.6rem;
}

.m-hero__nombre {
  font-family: var(--sp-serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 6.5vw, 4.8rem);
  line-height: 1.05;
  color: var(--sp-texto);
  letter-spacing: 0.01em;
}

.m-hero__divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 1.6rem auto;
}

.m-hero__linea {
  width: 3.5rem;
  height: 1px;
  background: var(--sp-linea);
}

.m-hero__punto {
  color: var(--sp-acento);
  font-size: 0.8rem;
}

.m-hero__fechas {
  font-family: var(--sp-serif);
  font-size: 1.15rem;
  letter-spacing: 0.18em;
  color: var(--sp-acento-claro);
  margin-bottom: 1.4rem;
}

.m-hero__epitafio {
  font-family: var(--sp-serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--sp-texto-tenue);
  max-width: 34rem;
  margin: 0 auto;
}

.m-hero__scroll {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-top: 3rem;
  color: var(--sp-texto-tenue);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.m-hero__scroll:hover {
  color: var(--sp-acento);
}

.m-hero__chevron {
  animation: sp-flotar 2s ease-in-out infinite;
}

@keyframes sp-flotar {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ---------- VOLVER AL INICIO (hero) ---------- */
.m-hero__volver {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 5;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sp-texto-tenue);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--sp-linea);
  border-radius: 2px;
  background: rgba(250, 246, 238, 0.6);
  backdrop-filter: blur(4px);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.m-hero__volver:hover {
  color: var(--sp-acento);
  border-color: var(--sp-acento);
}

.m-hero__demo {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 5;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sp-acento);
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--sp-acento);
  border-radius: 2px;
  background: rgba(250, 246, 238, 0.72);
  backdrop-filter: blur(4px);
}

/* ---------- NAVEGACIÓN ---------- */
.m-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: rgba(250, 246, 238, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--sp-linea);
}

.m-nav__marca {
  font-family: var(--sp-serif);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--sp-acento);
}

.m-nav__links {
  display: flex;
  gap: 1.4rem;
}

.m-nav__links a {
  color: var(--sp-texto-tenue);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.m-nav__links a:hover {
  color: var(--sp-acento);
}

.m-nav__volver {
  color: var(--sp-texto-tenue);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.m-nav__volver:hover {
  color: var(--sp-acento);
}

/* ---------- BIOGRAFÍA ---------- */
.m-bio {
  background: var(--sp-fondo-alt);
}

.m-bio__grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 3rem;
  align-items: start;
}

.m-bio__retrato img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--sp-linea);
}

.m-bio__retrato--vacio {
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  border: 1px solid var(--sp-linea);
  border-radius: 2px;
  background: linear-gradient(160deg, #f6efe1, #ece2cd);
}

.m-bio__retrato--vacio span {
  font-family: var(--sp-serif);
  font-size: 6rem;
  color: rgba(58, 53, 44, 0.12);
}

.m-bio__texto p {
  color: var(--sp-texto);
  margin-bottom: 1.2rem;
  font-size: 1.05rem;
}

.m-bio__cita {
  font-family: var(--sp-serif);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--sp-acento);
  border-left: 1px solid var(--sp-linea);
  padding-left: 1.4rem;
  margin-top: 2rem;
}

/* ---------- GALERÍA ---------- */
.m-galeria__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.m-galeria__item {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--sp-linea);
  border-radius: 2px;
  background: var(--sp-fondo-alt);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  transition: transform 0.45s ease, border-color 0.45s ease;
}

.m-galeria__item:hover {
  transform: translateY(-4px);
  border-color: var(--sp-acento);
}

.m-galeria__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.m-galeria__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.25));
  opacity: 0;
  transition: opacity 0.45s ease;
}

.m-galeria__item:hover::after {
  opacity: 1;
}

/* La primera y la sexta foto ocupan doble columna en escritorio */
.m-galeria__item:nth-child(6n + 1),
.m-galeria__item:nth-child(6n + 6) {
  grid-column: span 2;
}

/* ---------- VÍDEOS ---------- */
.m-videos {
  background: var(--sp-fondo-alt);
}

.m-videos__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.m-video video,
.m-video__embed iframe,
.m-video__embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--sp-linea);
  border-radius: 2px;
  background: #efe7d6;
  display: block;
}

.m-video__embed iframe {
  border: 0;
}

/* ---------- LÍNEA DE VIDA ---------- */
.m-timeline {
  list-style: none;
  margin-top: 2rem;
  position: relative;
  padding-left: 2rem;
}

.m-timeline::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--sp-linea), transparent);
}

.m-timeline__item {
  position: relative;
  padding: 0 0 2.6rem 2rem;
}

.m-timeline__item::before {
  content: "";
  position: absolute;
  left: -2.05rem;
  top: 0.5rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--sp-acento);
  box-shadow: 0 0 0 4px rgba(168, 131, 62, 0.15);
}

.m-timeline__año {
  font-family: var(--sp-serif);
  font-size: 1.4rem;
  color: var(--sp-acento);
  letter-spacing: 0.06em;
}

.m-timeline__titulo {
  font-family: var(--sp-serif);
  font-weight: 500;
  font-size: 1.3rem;
  color: var(--sp-texto);
  margin: 0.2rem 0 0.3rem;
}

.m-timeline__cuerpo p {
  color: var(--sp-texto-tenue);
}

/* ---------- VELAS ---------- */
.m-velas {
  background: var(--sp-fondo-alt);
  text-align: center;
}

.m-velas .m-seccion__intro {
  margin-left: auto;
  margin-right: auto;
}

.m-velas__escenario {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  margin-top: 2.5rem;
}

.m-vela {
  position: relative;
  width: 4rem;
  height: 11rem;
}

.m-vela__cuerpo {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2.4rem;
  height: 9rem;
  border-radius: 6px 6px 4px 4px;
  background: linear-gradient(180deg, #efe6d3, #d9cdb4);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.m-vela__llama {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0.9rem;
  height: 1.5rem;
  margin-left: -0.45rem;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff6d8, #f5c86a 55%, #e09b3a);
  opacity: 0;
  transform-origin: 50% 100%;
}

.m-vela--encendida .m-vela__llama {
  opacity: 1;
  animation: sp-llama 1.6s ease-in-out infinite;
}

@keyframes sp-llama {
  0%, 100% { transform: translateY(0) scale(1) rotate(-2deg); }
  50%      { transform: translateY(-0.25rem) scale(1.08) rotate(2deg); }
}

.m-velas__contador {
  font-family: var(--sp-serif);
  font-size: 1.1rem;
  color: var(--sp-texto-tenue);
  letter-spacing: 0.04em;
}

/* ---------- BOTONES ---------- */
.m-boton {
  font-family: var(--sp-sans);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #fff;
  background: var(--sp-acento);
  border: 1px solid var(--sp-acento);
  padding: 0.9rem 2.2rem;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.3s ease, color 0.3s ease;
}

.m-boton:hover {
  background: transparent;
  color: var(--sp-acento);
}

.m-boton--enviar {
  color: var(--sp-texto);
  background: transparent;
  border-color: var(--sp-linea);
}

.m-boton--enviar:hover {
  border-color: var(--sp-acento);
  color: var(--sp-acento);
}

.m-boton--volver {
  color: var(--sp-texto);
  background: transparent;
  border-color: var(--sp-linea);
  text-decoration: none;
  display: inline-block;
}

.m-boton--volver:hover {
  border-color: var(--sp-acento);
  color: var(--sp-acento);
  background: transparent;
}

/* ---------- CONDOLENCIAS ---------- */
.m-aviso {
  max-width: 34rem;
  margin-bottom: 1.5rem;
  padding: 0.9rem 1.2rem;
  border-radius: 2px;
  font-size: 0.9rem;
}

.m-aviso--ok {
  background: rgba(122, 138, 112, 0.15);
  border: 1px solid rgba(122, 138, 112, 0.4);
  color: #4f5c47;
}

.m-aviso--error {
  background: rgba(176, 111, 58, 0.12);
  border: 1px solid rgba(176, 111, 58, 0.4);
  color: #8a5230;
}

.m-condolencias__form {
  max-width: 34rem;
  margin-bottom: 3rem;
}

.m-campo {
  margin-bottom: 1.4rem;
}

.m-campo label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sp-acento);
  margin-bottom: 0.5rem;
}

.m-campo input,
.m-campo textarea {
  width: 100%;
  background: var(--sp-fondo-carta);
  border: 1px solid var(--sp-linea);
  border-radius: 2px;
  color: var(--sp-texto);
  font-family: var(--sp-sans);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  transition: border-color 0.3s ease;
}

.m-campo input:focus,
.m-campo textarea:focus {
  outline: none;
  border-color: var(--sp-acento);
}

.m-condolencias__lista {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.m-condolencia {
  background: var(--sp-fondo-carta);
  border: 1px solid var(--sp-linea);
  border-radius: 2px;
  padding: 1.4rem 1.6rem;
}

.m-condolencia__texto {
  font-family: var(--sp-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--sp-texto);
}

.m-condolencia__autor {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--sp-acento);
  letter-spacing: 0.06em;
}

/* ---------- FOOTER / QR ---------- */
.m-footer {
  padding: 4rem 1.5rem;
  background: var(--sp-fondo-alt);
  border-top: 1px solid var(--sp-linea);
}

.m-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

.m-footer__qr {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  text-align: left;
}

.m-footer__qr-codigo {
  width: 7rem;
  height: 7rem;
  flex: 0 0 auto;
  border: 1px solid var(--sp-linea);
  border-radius: 2px;
  background: #fff;
  object-fit: contain;
}

.m-footer__qr-codigo--vacio {
  background:
    linear-gradient(90deg, var(--sp-texto) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(0deg, var(--sp-texto) 1px, transparent 1px) 0 0 / 12px 12px,
    var(--sp-fondo-carta);
  opacity: 0.25;
}

.m-footer__qr-texto {
  color: var(--sp-texto-tenue);
  font-size: 0.85rem;
  max-width: 20rem;
}

.m-footer__ubicacion {
  color: var(--sp-texto-tenue);
  font-size: 0.85rem;
}

.m-footer__nota {
  font-family: var(--sp-serif);
  font-style: italic;
  color: var(--sp-texto-tenue);
  font-size: 0.95rem;
}

.m-footer__logo {
  height: 70px;
  width: auto;
  margin-top: 0.6rem;
  opacity: 0.85;
}

.m-footer__placa {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sp-acento);
  text-decoration: none;
  border-bottom: 1px solid var(--sp-linea);
  padding-bottom: 0.2rem;
}

.m-footer__placa:hover {
  border-color: var(--sp-acento);
}

/* ---------- BANNER DE MEJORA (plan Gratis) ---------- */
.m-upsell {
  background: var(--sp-fondo-alt);
  text-align: center;
}

.m-upsell .m-seccion__intro {
  margin-left: auto;
  margin-right: auto;
}

/* ---------- PLANTILLA DE PLACA ---------- */
body.sp-placa {
  background: var(--sp-fondo);
  color: var(--sp-texto);
  font-family: var(--sp-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.sp-placa__hoja {
  text-align: center;
  background: var(--sp-fondo-carta);
  border: 1px solid rgba(168, 131, 62, 0.5);
  border-radius: 2px;
  padding: 3rem 2.5rem;
  max-width: 480px;
}

.sp-placa__qr {
  width: 200px;
  height: 200px;
  display: block;
  margin: 0 auto 1.5rem;
}

.sp-placa__nombre {
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--sp-texto);
}

.sp-placa__fechas {
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  color: var(--sp-acento);
  margin: 0.4rem 0 0.8rem;
}

.sp-placa__epitafio {
  font-style: italic;
  color: var(--sp-texto-tenue);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.sp-placa__pie {
  font-family: var(--sp-sans);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sp-texto-tenue);
}

.sp-placa__imprimir {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  font-family: var(--sp-sans);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--sp-acento);
  color: #fff;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 2px;
  cursor: pointer;
}

@media print {
  .sp-placa__imprimir {
    display: none;
  }

  body.sp-placa {
    background: #fff;
    padding: 0;
  }

  .sp-placa__hoja {
    border: none;
  }
}

/* ---------- LIGHTBOX ---------- */
.sp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}

.sp-lightbox[hidden] {
  display: none;
}

.sp-lightbox__fondo {
  position: absolute;
  inset: 0;
  background: rgba(20, 17, 12, 0.82);
  backdrop-filter: blur(3px);
}

.sp-lightbox__contenido {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 720px);
  text-align: center;
}

.sp-lightbox__imagen {
  max-width: 100%;
  max-height: 80vh;
  border: 1px solid rgba(250, 246, 238, 0.3);
  border-radius: 2px;
  display: block;
  margin: 0 auto;
}

.sp-lightbox__caption {
  margin-top: 1rem;
  font-family: var(--sp-serif);
  font-size: 1.05rem;
  color: #faf6ee;
}

.sp-lightbox__cerrar {
  position: absolute;
  top: -2.6rem;
  right: 0;
  background: none;
  border: none;
  color: #faf6ee;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.sp-lightbox__cerrar:hover {
  opacity: 1;
}

/* ---------- ANIMACIÓN AL HACER SCROLL ---------- */
.sp-revelar {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.sp-revelar.sp-revelar--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .m-seccion {
    padding: 4rem 1.25rem;
  }

  .m-nav__links {
    gap: 1rem;
  }

  .m-nav__links a {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
  }

  .m-bio__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .m-galeria__grid,
  .m-videos__grid {
    grid-template-columns: 1fr;
  }

  .m-galeria__item:nth-child(6n + 1),
  .m-galeria__item:nth-child(6n + 6) {
    grid-column: span 1;
  }

  .m-footer__qr {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .m-footer__qr-texto {
    text-align: center;
  }
}
