/* ==========================================================
   Diseño "Hielo" · Infantil (reino helado con motivos genéricos)
   escarcha fractal → hielo roto → nevada, aurora y marco de cristal
   ========================================================== */

:root {
  --hielo: #a7d8f5;
  --profundo: #1d4e89;
  --noche: #0c2448;
  --lila: #b8a1d9;
  --plata: #c7ced8;
  --blanco: #ffffff;
  --tinta: #1b3a63;

  --s-fondo: #eef7fd;
  --s-tinta: var(--tinta);
  --s-suave: #4d6a8c;
  --s-acento: var(--profundo);
  --s-acento-tinta: #fff;
  --s-tarjeta: rgba(255, 255, 255, .78);
  --s-borde: rgba(167, 216, 245, .9);
  --s-radio: 22px;
  --s-sombra: 0 16px 30px -18px rgba(29, 78, 137, .55);
  --s-fuente: "Fredoka", system-ui, sans-serif;
  --s-titulo: "Great Vibes", "Cormorant Garamond", serif;
  --s-titulo-tam: clamp(2.5rem, 11vw, 3.2rem);
  --s-etiqueta: "Cinzel", Georgia, serif;
  --s-num: "Fredoka", system-ui, sans-serif;
  --s-titulo-color: var(--profundo);
}

body {
  background:
    radial-gradient(circle at 15% 20%, rgba(167, 216, 245, .35) 0 2px, transparent 3px) 0 0 / 90px 90px,
    radial-gradient(circle at 60% 70%, rgba(184, 161, 217, .3) 0 1.5px, transparent 2.5px) 0 0 / 130px 130px,
    linear-gradient(180deg, #e3f2fc 0%, #f1ecfa 55%, #eaf5fd 100%);
  color: var(--tinta);
  font-family: var(--s-fuente);
}

/* Sprite de símbolos: fuera de la vista pero disponible para <use> */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.copo { display: block; color: var(--blanco); }

/* ---------- INTRO (capa fija; el canvas pinta el fondo y la escarcha) ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(120% 80% at 50% 35%, #2a64a8, var(--profundo) 45%, var(--noche));
}
.intro.pintado { background: transparent; }
.intro.fundido { opacity: 0; transition: opacity .9s ease; }
.intro__lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.intro__toque {
  all: unset;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  cursor: pointer;
  text-align: center;
  color: var(--blanco);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.intro__toque:focus-visible { outline: 3px dashed rgba(255, 255, 255, .8); outline-offset: -14px; border-radius: 26px; }
.intro__pre {
  font-family: "Cinzel", Georgia, serif;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  opacity: .85;
  transition: opacity .5s ease;
}
.intro__copo {
  width: clamp(96px, 30vw, 140px);
  height: auto;
  color: var(--blanco);
  filter: drop-shadow(0 0 12px rgba(167, 216, 245, .9));
  animation: latir 2.6s ease-in-out infinite, girarLento 24s linear infinite;
  transition: opacity .5s ease, transform .5s ease;
}
@keyframes latir { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }
@keyframes girarLento { to { rotate: 360deg; } }
.intro__texto {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 26px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .12);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: .02em;
  text-shadow: 0 2px 6px rgba(12, 36, 72, .5);
  animation: flotar 2.2s ease-in-out infinite;
  transition: opacity .5s ease;
}
@keyframes flotar { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
/* mientras crece el hielo se ocultan los textos; al congelarse aparece "¡Toca otra vez!" */
.intro.creciendo .intro__pre, .intro.creciendo .intro__copo, .intro.creciendo .intro__texto { opacity: 0; }
.intro.congelado .intro__pre, .intro.congelado .intro__copo { opacity: 0; }
.intro.congelado .intro__texto { opacity: 1; color: var(--profundo); background: rgba(255, 255, 255, .82); border-color: #fff; text-shadow: none; box-shadow: 0 10px 24px -10px rgba(12, 36, 72, .6); }
.intro.rompiendo .intro__toque { opacity: 0; pointer-events: none; }

/* ---------- HERO ---------- */
.hero {
  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) + 34px) 18px calc(env(safe-area-inset-bottom) + 84px);
  overflow: hidden;
  color: var(--blanco);
  text-align: center;
  background: linear-gradient(180deg, var(--noche) 0%, var(--profundo) 52%, #4f86c2 82%, #a7d8f5 100%);
}

/* Aurora boreal: bandas difuminadas que ondulan */
.aurora { position: absolute; inset: -10% -30% auto; height: 70%; pointer-events: none; mix-blend-mode: screen; }
.aurora__banda {
  position: absolute;
  left: 0;
  right: 0;
  height: 42%;
  border-radius: 50%;
  filter: blur(28px);
  opacity: .55;
  transform-origin: 50% 50%;
}
.aurora__banda--1 { top: 10%; background: linear-gradient(90deg, transparent, #7fe0d4 30%, var(--hielo) 55%, transparent); animation: ondular 14s ease-in-out infinite; }
.aurora__banda--2 { top: 26%; background: linear-gradient(90deg, transparent, var(--lila) 35%, #d6c6f0 60%, transparent); animation: ondular 18s ease-in-out -6s infinite reverse; opacity: .5; }
.aurora__banda--3 { top: 40%; background: linear-gradient(90deg, transparent 10%, #9fe8f5 45%, transparent 85%); animation: ondular 22s ease-in-out -11s infinite; opacity: .35; }
@keyframes ondular {
  0%, 100% { transform: translateX(-8%) skewY(-6deg) scaleY(.8); }
  50% { transform: translateX(8%) skewY(5deg) scaleY(1.15); }
}

.nieve { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

.palacio {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(140%, 760px);
  height: auto;
  transform: translateX(-50%);
  opacity: .55;
  pointer-events: none;
  z-index: 0;
}
.palacio__luces { animation: titilar 3.4s ease-in-out infinite; }
@keyframes titilar { 0%, 100% { opacity: .9; } 50% { opacity: .55; } }

.hero__contenido { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.hero__pre {
  margin: 0 0 18px;
  font-family: "Cinzel", Georgia, serif;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .26em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .8s ease .2s, transform .8s ease .2s;
}

/* Marco de cristal (gema alargada de 6 lados) */
.cristal {
  position: relative;
  width: min(74vw, 330px, calc(44svh * 9 / 11));
  aspect-ratio: 9 / 11;
  opacity: 0;
  transform: scale(.82);
  transition: opacity 1s ease .1s, transform 1.2s cubic-bezier(.2, 1.2, .3, 1) .1s;
}
.cristal__marco {
  position: absolute;
  inset: 0;
  padding: 9px;
  clip-path: polygon(50% 0, 100% 17%, 100% 83%, 50% 100%, 0 83%, 0 17%);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(167, 216, 245, .9) 30%, rgba(199, 206, 216, .95) 55%, rgba(184, 161, 217, .9) 80%, #fff);
}
/* el resplandor va en el padre: un filter en el hijo recortado por clip-path se perdería */
.cristal { filter: drop-shadow(0 0 16px rgba(167, 216, 245, .75)); }
.cristal__marco::after {     /* facetas de luz sobre la foto */
  content: "";
  position: absolute;
  inset: 9px;
  clip-path: polygon(50% 0, 100% 17%, 100% 83%, 50% 100%, 0 83%, 0 17%);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .35) 0 18%, transparent 18.5% 60%, rgba(255, 255, 255, .14) 60.5% 72%, transparent 72.5%),
    linear-gradient(0deg, rgba(29, 78, 137, .25), transparent 35%);
  pointer-events: none;
}
.cristal__foto {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: polygon(50% 0, 100% 17%, 100% 83%, 50% 100%, 0 83%, 0 17%);
  background: var(--hielo);
}
.cristal__copo { position: absolute; filter: drop-shadow(0 0 8px rgba(167, 216, 245, .95)); }
.cristal__copo--arriba { width: 74px; left: 50%; top: -34px; margin-left: -37px; animation: girarLento 30s linear infinite; }
.cristal__copo--izq { width: 44px; left: -20px; top: 44%; animation: girarLento 26s linear infinite reverse; }
.cristal__copo--der { width: 52px; right: -24px; bottom: 12%; animation: girarLento 34s linear infinite; }

/* Personaje opcional (PNG del cliente) */
.personaje {
  position: absolute;
  right: -14%;
  bottom: -6%;
  width: 52%;
  height: auto;
  z-index: 3;
  filter: drop-shadow(0 10px 14px rgba(12, 36, 72, .45));
  opacity: 0;
  transform: translate(30%, 20%) scale(.6) rotate(8deg);
  transition: opacity .6s ease 1.2s, transform 1s cubic-bezier(.3, 1.6, .5, 1) 1.2s;
  pointer-events: none;
}

.hero__nombre {
  margin: 22px 0 0;
  font-family: "Great Vibes", "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: clamp(3.4rem, 17vw, 4.8rem);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 14px rgba(167, 216, 245, .95), 0 0 34px rgba(184, 161, 217, .7), 0 4px 10px rgba(12, 36, 72, .5);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1s ease .5s, transform 1s ease .5s;
}
.hero__cumple {
  margin: 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.25rem;
  text-shadow: 0 2px 6px rgba(12, 36, 72, .5);
  opacity: 0;
  transition: opacity .8s ease .8s;
}
.hero__edad {
  width: 58px;
  height: 64px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, #fff, var(--hielo) 50%, var(--lila));
  color: var(--profundo);
  font-size: 2rem;
  font-weight: 700;
  text-shadow: none;
}
.hero__fecha {
  margin: 8px 0 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: .9rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-shadow: 0 2px 6px rgba(12, 36, 72, .5);
  opacity: 0;
  transition: opacity .8s ease 1s;
}
.hero .desliza-c { color: #fff; z-index: 3; }

/* Hero visible tras romper el hielo */
.hero.listo .hero__pre, .hero.listo .hero__nombre { opacity: 1; transform: none; }
.hero.listo .cristal { opacity: 1; transform: none; }
.hero.listo .hero__cumple, .hero.listo .hero__fecha { opacity: 1; }
.hero.listo .personaje { opacity: 1; transform: none; animation: mecerse 4s ease-in-out 2.4s infinite; }
@keyframes mecerse { 0%, 100% { rotate: 0deg; translate: 0 0; } 50% { rotate: -3deg; translate: 0 -6px; } }

/* ---------- Secciones ---------- */
.mensaje { padding-top: 84px; overflow: hidden; }
.mensaje__texto { margin: 0; max-width: 22em; font-size: 1.1rem; line-height: 1.65; }
.mensaje__copo { position: absolute; color: var(--hielo); }
.mensaje__copo--1 { width: 56px; left: 8%; top: 36px; }
.mensaje__copo--2 { width: 40px; right: 10%; top: 70px; color: var(--lila); }

.separador { display: flex; justify-content: center; gap: 22px; color: var(--hielo); }
.separador .copo { width: 28px; color: var(--hielo); }
.separador .copo:nth-child(2) { width: 38px; color: var(--lila); }

.s-titulo { text-shadow: 0 0 12px rgba(167, 216, 245, .9); }
.s-cuenta__caja { background: linear-gradient(160deg, rgba(255, 255, 255, .95), rgba(167, 216, 245, .45)); border-color: #fff; }
.s-cuenta__num { font-weight: 700; color: var(--profundo); }
.s-evento { background: linear-gradient(170deg, rgba(255, 255, 255, .92), rgba(234, 225, 248, .8)); border: 1.5px solid #fff; }
.s-evento__icono { color: #fff; background: linear-gradient(160deg, var(--hielo), var(--profundo)); border-color: transparent; }
.s-evento__titulo { color: var(--profundo); }
.s-evento__hora { font-weight: 700; color: var(--profundo); }
.s-vestimenta__tipo { font-weight: 600; font-family: "Fredoka", system-ui, sans-serif; font-size: 1.4rem; color: var(--profundo); }
.s-paleta li { border-color: var(--hielo); background: #fff; }
.s-rsvp__saludo { font-family: "Fredoka", system-ui, sans-serif; font-weight: 600; font-size: 1.2rem; color: var(--profundo); }
.s-btn { letter-spacing: .12em; }
.s-btn--lleno { background: linear-gradient(160deg, #3d77bd, var(--profundo)); box-shadow: 0 0 0 3px rgba(167, 216, 245, .6), 0 14px 24px -12px rgba(29, 78, 137, .8); }
.s-pie__n { font-family: "Great Vibes", serif; color: var(--profundo); }
.btn-musica { background: var(--profundo); color: #fff; box-shadow: 0 0 0 3px var(--hielo); }

.foto-rsvp {
  width: 150px;
  aspect-ratio: 9 / 11;
  margin: 40px auto -30px;
  padding: 5px;
  clip-path: polygon(50% 0, 100% 17%, 100% 83%, 50% 100%, 0 83%, 0 17%);
  background: linear-gradient(135deg, #fff, var(--hielo), var(--lila));
}
.foto-rsvp img { display: block; width: 100%; height: 100%; object-fit: cover; clip-path: polygon(50% 0, 100% 17%, 100% 83%, 50% 100%, 0 83%, 0 17%); }

@media (prefers-reduced-motion: reduce) {
  .intro__copo, .intro__texto, .aurora__banda, .palacio__luces, .cristal__copo, .hero.listo .personaje { animation: none !important; }
  .cristal, .hero__nombre, .personaje { transition-duration: .3s; transition-delay: 0s; }
}
