/* ==========================================================
   Diseño "Lunares" · Infantil (caricatura clásica de los años 30, motivos genéricos)
   película en blanco y negro → cuenta regresiva → ¡explota el color!
   ========================================================== */

/* Luckiest Guy (OFL, auto-alojada) */
@font-face { font-family: "Luckiest Guy"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/luckiest-guy-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Luckiest Guy"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/luckiest-guy-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --rojo: #e4002b;
  --rojo-osc: #a8001f;
  --negro: #111111;
  --amarillo: #ffcc00;
  --blanco: #ffffff;
  --crema: #fff8e7;
  --caricatura: "Luckiest Guy", "Fredoka", system-ui, sans-serif;

  --s-fondo: var(--crema);
  --s-tinta: var(--negro);
  --s-suave: #4a4a4a;
  --s-acento: var(--rojo);
  --s-acento-tinta: #fff;
  --s-tarjeta: #ffffff;
  --s-borde: var(--negro);
  --s-radio: 20px;
  --s-sombra: 6px 6px 0 var(--negro);
  --s-fuente: "Fredoka", system-ui, sans-serif;
  --s-titulo: var(--caricatura);
  --s-titulo-tam: clamp(2rem, 9vw, 2.6rem);
  --s-etiqueta: "Fredoka", system-ui, sans-serif;
  --s-num: var(--caricatura);
  --s-titulo-color: var(--rojo);
}

body {
  background:
    radial-gradient(circle, rgba(228, 0, 43, .1) 0 6px, transparent 7px) 0 0 / 46px 46px,
    radial-gradient(circle, rgba(228, 0, 43, .1) 0 6px, transparent 7px) 23px 23px / 46px 46px,
    var(--crema);
  color: var(--negro);
  font-family: var(--s-fuente);
}

/* Texto solo para lectores de pantalla */
.oculto { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ======================= INTRO: película antigua ======================= */
.cine {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 20px) 48px calc(env(safe-area-inset-bottom) + 20px);
  background: radial-gradient(90% 70% at 50% 45%, #5a5a5a, #2b2b2b 60%, #0d0d0d);
  color: #ececec;
}

.cine__tira {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  background:
    repeating-linear-gradient(180deg, #bdbdbd 0 12px, transparent 12px 28px) 50% 0 / 14px 100% no-repeat,
    #050505;
  opacity: .9;
}
.cine__tira--izq { left: 0; }
.cine__tira--der { right: 0; }
.cine.rodando .cine__tira { animation: correrTira .25s linear infinite; }
@keyframes correrTira { to { background-position: 50% 28px, 0 0; } }

.cine__cartel { position: relative; z-index: 1; width: min(100%, 420px); transition: opacity .4s ease, transform .4s ease; }
.cine.rodando .cine__cartel { opacity: 0; transform: scale(.94); pointer-events: none; }
.cartel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 22px 26px;
  border: 4px double #e6e6e6;
  border-radius: 18px;
  background: rgba(0, 0, 0, .25);
  text-align: center;
}
.cartel::before, .cartel::after {           /* esquinas decorativas estilo cartel antiguo */
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid #e6e6e6;
  border-radius: 50%;
}
.cartel::before { top: -14px; left: -14px; }
.cartel::after { bottom: -14px; right: -14px; }
.cartel__estreno { margin: 0; font-family: var(--caricatura); font-size: clamp(2rem, 10vw, 2.8rem); letter-spacing: .06em; line-height: 1; text-shadow: 3px 3px 0 #000; }
.cartel__presenta { margin: 0; font-weight: 600; font-size: 1rem; letter-spacing: .14em; text-transform: uppercase; }
.cartel__linea { width: 60%; height: 3px; background: repeating-linear-gradient(90deg, #e6e6e6 0 10px, transparent 10px 16px); }
.proyector { width: min(58vw, 220px); height: auto; margin: 6px 0 2px; filter: drop-shadow(4px 6px 0 rgba(0, 0, 0, .45)); }
.carrete { transform-box: fill-box; transform-origin: center; }
.manivela { transform-box: view-box; transform-origin: 52px 128px; }
.cine.rodando .carrete { animation: girar .7s linear infinite; }
.cine.rodando .manivela { animation: girar .5s linear infinite; }
@keyframes girar { to { rotate: 360deg; } }

.rodar {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 26px;
  border: 3px solid #000;
  border-radius: 999px;
  background: #ececec;
  color: #111;
  font-family: var(--caricatura);
  font-size: 1.25rem;
  letter-spacing: .04em;
  box-shadow: 5px 5px 0 #000;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  animation: invitar 1.6s ease-in-out infinite;
}
.rodar:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 #000; }
.rodar:focus-visible { outline: 3px dashed #fff; outline-offset: 5px; }
.rodar__icono { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rodar:hover .rodar__icono { animation: girar 1s linear infinite; }
@keyframes invitar { 0%, 100% { scale: 1; } 50% { scale: 1.05; } }

/* Cuenta regresiva de película: disco gris, aros, cruz y un barrido que da la vuelta */
.cuenta-cine { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; }
.cuenta-cine__disco {
  --barrido: 0deg;
  position: relative;
  width: min(76vw, 60svh, 440px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #cfcfcf;
  box-shadow: 0 0 0 6px #111, 0 0 0 100vmax #a9a9a9;
  color: #111;
}
.cuenta-cine__barrido { position: absolute; inset: -20%; background: conic-gradient(rgba(0, 0, 0, .5) 0 var(--barrido), transparent var(--barrido)); }
.cuenta-cine__aro { position: absolute; border-radius: 50%; border: 4px solid #111; }
.cuenta-cine__aro--1 { inset: 7%; }
.cuenta-cine__aro--2 { inset: 15%; border-width: 3px; }
.cuenta-cine__cruz {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(#111, #111) 50% 0 / 3px 100% no-repeat,
    linear-gradient(#111, #111) 0 50% / 100% 3px no-repeat;
}
.cuenta-cine__num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--caricatura);
  font-size: min(36vw, 28svh, 210px);
  line-height: 1;
  padding-top: .12em;
  color: #111;
  text-shadow: 4px 4px 0 #fff;
}
.cuenta-cine__num.salto { animation: saltoNum .3s ease-out; }
@keyframes saltoNum { from { scale: 1.25; opacity: .4; } }

/* Grano, rayones, viñeta y parpadeo */
.cine__grano {
  position: absolute;
  inset: -40%;
  z-index: 2;
  pointer-events: none;
  background: var(--grano) 0 0 / 160px 160px;
  opacity: 1;
  animation: grano .32s steps(4) infinite;
}
.cine__grano::after { content: ""; position: absolute; inset: 0; background: inherit; background-size: 230px 230px; filter: invert(1); opacity: .7; }
@keyframes grano {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-6%, 4%); }
  50% { transform: translate(5%, -3%); }
  75% { transform: translate(-3%, -6%); }
  100% { transform: translate(4%, 5%); }
}
.rayon { position: absolute; top: 0; bottom: 0; z-index: 2; width: 2px; pointer-events: none; background: linear-gradient(transparent, rgba(255, 255, 255, .7) 20%, rgba(255, 255, 255, .35) 70%, transparent); opacity: 0; }
.rayon--1 { animation: rayar 2.3s steps(1) infinite; }
.rayon--2 { width: 1px; animation: rayar 3.1s steps(1) -1.2s infinite; }
.rayon--3 { background: linear-gradient(transparent 30%, rgba(0, 0, 0, .7) 50%, transparent 85%); animation: rayar 1.7s steps(1) -.6s infinite; }
@keyframes rayar {
  0% { left: 18%; opacity: .8; }
  12% { left: 19%; opacity: 0; }
  30% { left: 64%; opacity: .7; }
  42% { left: 63%; opacity: .3; }
  55% { left: 41%; opacity: 0; }
  70% { left: 82%; opacity: .8; }
  85% { left: 30%; opacity: .5; }
  100% { left: 18%; opacity: 0; }
}
.cine__vineta {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .78) 100%);
  animation: parpadeo .16s steps(2) infinite;
}
@keyframes parpadeo { 0% { opacity: .82; } 100% { opacity: 1; } }
.cine::after { content: ""; position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
.cine.flash::after { animation: destello .35s ease-out; }
@keyframes destello { from { opacity: .85; } to { opacity: 0; } }

/* Iris clásico de caricatura: círculo negro que se cierra y se abre (radio en --ir, lo mueve el JS) */
.iris {
  --ir: 150vmax;
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent var(--ir), #0d0d0d calc(var(--ir) + 1px));
}

/* ======================= HERO ======================= */
.escena {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 62px) 18px calc(env(safe-area-inset-bottom) + 92px);
  overflow: hidden;
  text-align: center;
  color: #fff;
  background: var(--rojo);
  transition: filter 1.1s ease;
}
.escena.bn { filter: grayscale(1) contrast(1.2) brightness(1.05); }
.escena::after {              /* grano que se va cuando llega el color */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: var(--grano) 0 0 / 160px 160px, radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, .55));
  opacity: 0;
  transition: opacity 1s ease;
}
.escena.bn::after { opacity: 1; }

.escena__lunares {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, #fff 0 9px, transparent 10px) 0 0 / 64px 64px,
    radial-gradient(circle, #fff 0 9px, transparent 10px) 32px 32px / 64px 64px;
  opacity: .9;
}
.escena.listo .escena__lunares { animation: lunaresPop .9s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes lunaresPop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: none; opacity: .9; } }

.escena__rayos {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 170vmax;
  aspect-ratio: 1;
  translate: -50% -50%;
  background: repeating-conic-gradient(rgba(255, 204, 0, .7) 0 9deg, transparent 9deg 20deg);
  -webkit-mask: radial-gradient(closest-side, #000 18%, transparent 70%);
  mask: radial-gradient(closest-side, #000 18%, transparent 70%);
  opacity: 0;
  transition: opacity 1s ease .3s;
}
.escena.listo .escena__rayos { opacity: 1; animation: girar 50s linear infinite; }

/* Tiras de película arriba y abajo */
.tira {
  height: 38px;
  background:
    repeating-linear-gradient(90deg, var(--crema) 0 14px, transparent 14px 28px) 0 6px / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, var(--crema) 0 14px, transparent 14px 28px) 0 calc(100% - 6px) / 100% 9px no-repeat,
    var(--negro);
}
.tira--arriba, .tira--abajo { position: absolute; left: 0; right: 0; z-index: 2; }
.tira--arriba { top: env(safe-area-inset-top); }
.tira--abajo { bottom: 0; }
.escena.listo .tira { animation: rodarTira 1.2s linear infinite; }
@keyframes rodarTira { to { background-position: 28px 6px, 28px calc(100% - 6px), 0 0; } }
.tira--sep { width: 100%; margin: 0; }

/* Estrellitas */
.estrella { position: absolute; z-index: 2; width: 34px; height: 34px; fill: var(--amarillo); stroke: var(--negro); stroke-width: 2.5; stroke-linejoin: round; }
.estrella--1 { left: 7%; top: 16%; }
.estrella--2 { right: 8%; top: 22%; width: 26px; height: 26px; }
.estrella--3 { left: 10%; bottom: 22%; width: 24px; height: 24px; }
.estrella--4 { right: 6%; bottom: 30%; width: 40px; height: 40px; }
.estrella--5 { left: 46%; top: 9%; width: 20px; height: 20px; }
.escena.listo .estrella { animation: titilar 1.8s ease-in-out infinite; }
.escena.listo .estrella--2 { animation-delay: -.5s; }
.escena.listo .estrella--3 { animation-delay: -1s; }
.escena.listo .estrella--4 { animation-delay: -1.4s; }
@keyframes titilar { 0%, 100% { scale: 1; rotate: 0deg; } 50% { scale: 1.25; rotate: 18deg; } }

.escena__contenido { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; }

/* Título con letras que rebotan (estilo "manguera") */
.rebote {
  margin: 0 0 14px;
  max-width: 12em;
  font-family: var(--caricatura);
  font-size: clamp(2rem, 9.5vw, 3rem);
  line-height: 1.12;
  color: var(--amarillo);
  text-shadow: 3px 3px 0 #111, -2px 2px 0 #111, 2px -2px 0 #111, -2px -2px 0 #111, 0 6px 0 #111;
}
.rebote__palabra { display: inline-block; white-space: nowrap; }
.rebote__l { display: inline-block; transform-origin: 50% 100%; opacity: 0; }
.escena.listo .rebote__l {
  opacity: 1;
  animation:
    caerLetra .75s calc(var(--i) * 55ms) cubic-bezier(.3, .7, .4, 1) both,
    rebotar 1.5s calc(.9s + var(--i) * 70ms) ease-in-out infinite;
}
@keyframes caerLetra {
  0% { transform: translateY(-140px) scale(.6, 1.4); opacity: 0; }
  60% { transform: translateY(8px) scale(1.3, .72); opacity: 1; }
  80% { transform: translateY(-8px) scale(.94, 1.08); }
  100% { transform: none; opacity: 1; }
}
@keyframes rebotar {
  0%, 100% { transform: none; }
  25% { transform: translateY(-12px) scale(.92, 1.1) rotate(-4deg); }
  45% { transform: translateY(0) scale(1.16, .86); }
  60% { transform: translateY(-4px) scale(.98, 1.03) rotate(2deg); }
  75% { transform: none; }
}

/* Marco redondo clásico con lunares */
.redondo { position: relative; width: min(68vw, 310px, 38svh); aspect-ratio: 1; margin: 6px 0 0; }
.redondo__aro {
  position: absolute;
  inset: 0;
  padding: 16px;
  border-radius: 50%;
  border: 5px solid var(--negro);
  background:
    radial-gradient(circle, #fff 0 3.5px, transparent 4.5px) 0 0 / 17px 17px,
    var(--rojo);
  box-shadow: 0 0 0 8px var(--amarillo), 0 0 0 12px var(--negro), 10px 14px 0 12px rgba(0, 0, 0, .35);
}
.redondo__foto { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 30%; border: 4px solid var(--negro); background: var(--amarillo); }
.escena.listo .redondo { animation: popMarco .9s cubic-bezier(.3, 1.7, .5, 1) both; }
@keyframes popMarco { 0% { transform: scale(.3) rotate(-25deg); } 100% { transform: none; } }

/* Personaje opcional (PNG del cliente) */
.personaje {
  position: absolute;
  left: -18%;
  bottom: -10%;
  width: 52%;
  height: auto;
  z-index: 2;
  filter: drop-shadow(5px 6px 0 rgba(0, 0, 0, .35));
  opacity: 0;
  transform: translateX(-60%) rotate(-15deg);
  pointer-events: none;
}
.escena.listo .personaje { animation: entraPersonaje 1s cubic-bezier(.3, 1.6, .5, 1) 1s both, bambolear 2.4s ease-in-out 2.2s infinite; }
@keyframes entraPersonaje { from { opacity: 0; transform: translateX(-60%) rotate(-15deg); } to { opacity: 1; transform: none; } }
@keyframes bambolear { 0%, 100% { rotate: 0deg; } 50% { rotate: -5deg; } }

.escena__nombre {
  margin: 26px 0 0;
  font-family: var(--caricatura);
  font-weight: 400;
  font-size: clamp(3rem, 15vw, 4.4rem);
  line-height: 1;
  color: #fff;
  text-shadow: 3px 3px 0 #111, -3px 3px 0 #111, 3px -3px 0 #111, -3px -3px 0 #111, 0 4px 0 #111, 4px 0 0 #111, 0 -3px 0 #111, -3px 0 0 #111, 0 8px 0 var(--amarillo), 0 11px 0 #111;
}
.escena.listo .escena__nombre { animation: gelatina .9s ease .5s both; }
@keyframes gelatina { 0% { transform: scale(.4, .4); opacity: 0; } 40% { transform: scale(1.18, .82); opacity: 1; } 60% { transform: scale(.9, 1.1); } 80% { transform: scale(1.04, .97); } 100% { transform: none; } }
.escena__cumple { margin: 10px 0 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 1.3rem; text-shadow: 2px 2px 0 #111; }
.escena__edad { position: relative; width: 66px; height: 66px; display: grid; place-items: center; }
.escena__edad svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--amarillo); stroke: #111; stroke-width: 2.5; stroke-linejoin: round; }
.escena__edad b { position: relative; padding-top: 8px; font-family: var(--caricatura); font-weight: 400; font-size: 1.6rem; color: #111; text-shadow: none; }
.escena.listo .escena__edad svg { animation: girar 6s linear infinite; }
.escena__fecha {
  margin: 12px 0 0;
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--negro);
  outline: 2px dashed var(--amarillo);
  outline-offset: -6px;
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.escena .desliza-c { color: #fff; z-index: 4; bottom: calc(env(safe-area-inset-bottom) + 48px); text-shadow: 1px 1px 0 #111; }

/* ======================= Secciones ======================= */
.mensaje { padding-top: 80px; overflow: hidden; }
.mensaje__texto { margin: 0; max-width: 22em; font-size: 1.1rem; line-height: 1.65; }
.mensaje__estrella { position: absolute; }
.mensaje__estrella--1 { left: 9%; top: 34px; }
.mensaje__estrella--2 { right: 10%; top: 70px; width: 24px; height: 24px; }

.s-titulo { text-shadow: 3px 3px 0 var(--negro); letter-spacing: .02em; }
.s-cuenta__caja { border: 3px solid var(--negro); }
.s-cuenta__num { color: var(--rojo); padding-top: .1em; }
.s-cuenta__lbl { color: var(--negro); }
.s-evento { border: 3px solid var(--negro); }
.s-evento__icono { color: var(--negro); background: var(--amarillo); border: 3px solid var(--negro); }
.s-evento__titulo { color: var(--rojo); }
.s-evento__hora { color: var(--negro); }
.s-vestimenta__tipo { font-family: var(--caricatura); font-size: 1.6rem; color: var(--rojo); text-shadow: 2px 2px 0 var(--negro); }
.s-paleta li { border: 2px solid var(--negro); background: #fff; }
.s-rsvp__saludo { font-family: "Fredoka", system-ui, sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--rojo); }
.s-btn { font-weight: 700; letter-spacing: .08em; }
.s-btn--linea, .s-btn--mini { border: 3px solid var(--negro); background: var(--amarillo); color: var(--negro); box-shadow: 4px 4px 0 var(--negro); }
.s-btn--lleno { border: 3px solid var(--negro); box-shadow: 5px 5px 0 var(--negro); }
.s-btn--linea:active, .s-btn--mini:active, .s-btn--lleno:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--negro); }
.s-pie__n { font-family: var(--caricatura); color: var(--rojo); text-shadow: 2px 2px 0 var(--negro); }
.btn-musica { background: var(--rojo); color: #fff; border: 3px solid var(--negro); box-shadow: 3px 3px 0 var(--negro); }

.foto-rsvp {
  width: 150px;
  aspect-ratio: 1;
  margin: 40px auto -30px;
  padding: 9px;
  border-radius: 50%;
  border: 4px solid var(--negro);
  background: radial-gradient(circle, #fff 0 2.5px, transparent 3.5px) 0 0 / 12px 12px, var(--rojo);
  box-shadow: 0 0 0 5px var(--amarillo), 0 0 0 8px var(--negro);
}
.foto-rsvp img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--negro); }

@media (prefers-reduced-motion: reduce) {
  .cine__grano, .rayon, .cine__vineta, .rodar, .cine.rodando .carrete, .cine.rodando .manivela, .cine.rodando .cine__tira,
  .escena.listo .tira, .escena.listo .escena__rayos, .escena.listo .estrella, .escena.listo .escena__edad svg { animation: none !important; }
  .escena.listo .rebote__l { animation: none; opacity: 1; }
  .escena.listo .redondo, .escena.listo .escena__nombre, .escena.listo .escena__lunares { animation: none; }
  .escena.listo .personaje { animation: none; opacity: 1; transform: none; }
}
