/* ==========================================================
   Diseño "Princesas" · Infantil (cuento de hadas con motivos genéricos)
   varita mágica → constelación-tiara → castillo iluminado → espejo ovalado
   ========================================================== */

/* Pinyon Script (OFL, ya auto-alojada en assets/fonts) */
@font-face { font-family: "Pinyon Script"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/pinyon-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: "Pinyon Script"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/pinyon-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --rosa: #f7a8c8;
  --rosa-osc: #d9669b;
  --lavanda: #c9b6e8;
  --lavanda-osc: #6d4f9c;
  --oro: #e8c36a;
  --oro-osc: #b88a2e;
  --cielo: #a9d3f5;
  --crema: #fff4e0;
  --tinta: #4a3566;
  --guion: "Pinyon Script", "Great Vibes", cursive;

  --s-fondo: var(--crema);
  --s-tinta: var(--tinta);
  --s-suave: #7a6690;
  --s-acento: var(--rosa-osc);
  --s-acento-tinta: #fff;
  --s-tarjeta: rgba(255, 255, 255, .82);
  --s-borde: rgba(232, 195, 106, .7);
  --s-radio: 24px;
  --s-sombra: 0 16px 30px -18px rgba(109, 79, 156, .55);
  --s-fuente: "Fredoka", system-ui, sans-serif;
  --s-titulo: var(--guion);
  --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(--lavanda-osc);
}

body {
  background:
    radial-gradient(circle at 20% 30%, rgba(232, 195, 106, .35) 0 1.5px, transparent 2.5px) 0 0 / 70px 70px,
    radial-gradient(circle at 70% 60%, rgba(247, 168, 200, .35) 0 2px, transparent 3px) 0 0 / 110px 110px,
    linear-gradient(180deg, #fdeef5 0%, var(--crema) 45%, #f1eafb 100%);
  color: var(--tinta);
  font-family: var(--s-fuente);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ======================= INTRO: el reino al anochecer ======================= */
.reino {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  color: #fff;
  text-align: center;
  background: linear-gradient(180deg, #2c1f4f 0%, #4b3680 38%, #8a64b0 68%, #e59ac0 92%, #f7c4d8 100%);
  -webkit-user-select: none;
  user-select: none;
}
.reino.fundido { opacity: 0; transition: opacity 1.1s ease; pointer-events: none; }
.reino__cielo {          /* estrellitas de fondo */
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, #fff 0 1px, transparent 1.6px) 0 0 / 53px 61px,
    radial-gradient(circle, rgba(255, 244, 224, .8) 0 1.2px, transparent 2px) 17px 29px / 89px 73px,
    radial-gradient(circle, rgba(201, 182, 232, .9) 0 .9px, transparent 1.5px) 31px 7px / 41px 47px;
  -webkit-mask: linear-gradient(#000 40%, transparent 75%);
  mask: linear-gradient(#000 40%, transparent 75%);
  animation: centellear 4s ease-in-out infinite alternate;
}
@keyframes centellear { from { opacity: .6; } to { opacity: 1; } }

/* Constelación que al unirse forma una tiara */
.constelacion {
  position: absolute;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 12svh);
  width: min(86vw, 440px);
  height: auto;
  transform: translateX(-50%);
  overflow: visible;
  pointer-events: none;
}
.constelacion__linea { fill: none; stroke: var(--oro); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .95; }
.reino.unidas .constelacion__linea { stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s ease-in-out; filter: drop-shadow(0 0 3px var(--oro)); }
.astro { fill: #fff; transform-box: fill-box; transform-origin: center; animation: titilarAstro 2.4s ease-in-out infinite; }
.astro:nth-of-type(2n) { animation-delay: -.8s; }
.astro:nth-of-type(3n) { animation-delay: -1.6s; }
@keyframes titilarAstro { 0%, 100% { opacity: .55; scale: .85; } 50% { opacity: 1; scale: 1.15; } }
.reino.unidas .astro { fill: #fff6d6; animation: brillaAstro .6s ease-out both; filter: drop-shadow(0 0 4px #fff); }
@keyframes brillaAstro { 0% { scale: 1; } 50% { scale: 2.2; } 100% { scale: 1.3; } }

/* Castillo original */
.castillo { position: absolute; left: 50%; bottom: 0; height: auto; transform: translateX(-50%); pointer-events: none; }
.castillo--intro { width: min(118vw, 560px); bottom: -2px; filter: brightness(.62) saturate(.75); transition: filter 1.4s ease; }
.reino.encendido .castillo--intro { filter: brightness(1) saturate(1) drop-shadow(0 0 22px rgba(255, 231, 163, .55)); }
.castillo__muro { fill: #f2dcea; }
.castillo__adorno { fill: none; stroke: var(--oro); stroke-width: 2.4; }
.castillo__techo { fill: var(--lavanda); }
.castillo__techo2 { fill: var(--rosa); }
.castillo__banderas { fill: none; stroke: #8a6fb5; stroke-width: 2; }
.castillo__bandera { fill: var(--rosa); stroke: none; }
.castillo__puerta { fill: #8a6fb5; }
.castillo__ventana { fill: #5b4a86; transition: fill .4s ease; }
.castillo__ventana.encendida { fill: #ffe7a3; }
.castillo__halo { fill: url(#halo); opacity: 0; transition: opacity .6s ease; }
.castillo__halo.encendida { opacity: 1; }

.carruaje {
  position: absolute;
  left: max(4%, calc(50% - 250px));
  bottom: 10px;
  width: min(24vw, 110px);
  height: auto;
  filter: brightness(.7) drop-shadow(0 6px 8px rgba(44, 31, 79, .5));
  transition: filter 1.4s ease, transform 1.6s cubic-bezier(.3, .7, .3, 1);
  pointer-events: none;
}
.reino.encendido .carruaje { filter: brightness(1) drop-shadow(0 0 12px rgba(255, 231, 163, .7)); transform: translateX(14px); }

.reino__lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

.reino__erase {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top) + 4svh);
  margin: 0;
  font-family: var(--guion);
  font-size: clamp(2.2rem, 10vw, 3rem);
  color: #fff6dc;
  text-shadow: 0 0 12px rgba(232, 195, 106, .8);
  pointer-events: none;
}

.reino__panel {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  z-index: 2;
  width: min(92vw, 380px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 16px;
  border-radius: 24px;
  background: rgba(44, 31, 79, .55);
  border: 1px solid rgba(232, 195, 106, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity .6s ease, transform .6s ease;
}
.reino.magico .reino__panel { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.reino__dibuja { margin: 0; font-weight: 600; font-size: 1.02rem; line-height: 1.35; text-shadow: 0 2px 6px rgba(44, 31, 79, .6); }
.magia { width: 100%; display: flex; align-items: center; gap: 10px; }
.magia__lbl { font-family: "Cinzel", Georgia, serif; font-size: .72rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--oro); }
.magia__barra { position: relative; flex: 1; height: 14px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .18); box-shadow: inset 0 0 0 1px rgba(232, 195, 106, .6); }
.magia__relleno {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rosa), var(--lavanda), var(--cielo), var(--oro));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease-out;
  box-shadow: 0 0 10px rgba(255, 231, 163, .9);
}
.usar-magia {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6dc, var(--oro));
  color: #5a3f12;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .03em;
  box-shadow: 0 4px 0 var(--oro-osc), 0 10px 18px -8px rgba(0, 0, 0, .5);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.usar-magia svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.usar-magia:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--oro-osc); }
.usar-magia:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.usar-magia:disabled { opacity: .6; cursor: default; }

/* ======================= HERO: espejo ovalado ======================= */
.cuento {
  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) + 64px) 18px calc(env(safe-area-inset-bottom) + 86px);
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(70% 45% at 50% 38%, rgba(255, 255, 255, .85), transparent 70%),
    linear-gradient(180deg, #e9defa 0%, #fbe3ef 45%, #fff4e0 80%, #fde9f1 100%);
}
.cuento__destellos {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, rgba(232, 195, 106, .9) 0 1.4px, transparent 2.2px) 0 0 / 67px 59px,
    radial-gradient(circle, rgba(255, 255, 255, .95) 0 1.2px, transparent 2px) 23px 31px / 43px 71px,
    radial-gradient(circle, rgba(201, 182, 232, .9) 0 1.6px, transparent 2.4px) 11px 17px / 97px 83px;
  animation: centellear 3s ease-in-out infinite alternate;
  pointer-events: none;
}
.castillo--hero { width: min(130vw, 620px); opacity: .32; }
.castillo--hero .castillo__ventana { fill: #ffe7a3; }

.rosa { position: absolute; width: 64px; height: 64px; pointer-events: none; filter: drop-shadow(0 6px 6px rgba(109, 79, 156, .25)); }
.rosa--1 { left: -10px; top: calc(env(safe-area-inset-top) + 18px); width: 78px; height: 78px; rotate: -20deg; }
.rosa--2 { right: -8px; top: calc(env(safe-area-inset-top) + 54px); rotate: 25deg; }
.rosa--3 { left: 4%; bottom: 18%; width: 48px; height: 48px; }
.rosa--4 { right: 3%; bottom: 26%; width: 56px; height: 56px; rotate: -10deg; }

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

.espejo {
  position: relative;
  width: min(68vw, 290px, calc(40svh * 300 / 370));
  aspect-ratio: 300 / 370;
  margin-top: 6%;
  opacity: 0;
  transform: scale(.85) translateY(20px);
  transition: opacity 1s ease .2s, transform 1.2s cubic-bezier(.2, 1.1, .3, 1) .2s;
}
.espejo__oval {
  position: absolute;
  inset: 5.5%;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(160deg, var(--cielo), var(--lavanda));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .7), 0 18px 30px -16px rgba(109, 79, 156, .7);
}
.espejo__foto { display: block; width: 100%; height: 100%; object-fit: cover; }
.espejo__reflejo { position: absolute; inset: 0; background: linear-gradient(125deg, rgba(255, 255, 255, .45) 0 14%, transparent 15% 62%, rgba(255, 255, 255, .18) 63% 70%, transparent 71%); pointer-events: none; }
.espejo__marco { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; filter: drop-shadow(0 3px 3px rgba(122, 89, 30, .35)); }
.marco__oro { fill: none; stroke: var(--oro); stroke-width: 9; }
.marco__perlas { fill: none; stroke: #fffaf0; stroke-width: 6.5; stroke-linecap: round; stroke-dasharray: 0 13; }
.marco__filete { fill: none; stroke: #fff2c9; stroke-width: 2; }
.marco__voluta { fill: none; stroke: var(--oro); stroke-width: 4; stroke-linecap: round; }
.marco__gema { fill: var(--rosa); stroke: var(--oro); stroke-width: 2.5; }

.tiara {
  position: absolute;
  left: 50%;
  top: -17%;
  z-index: 2;
  width: 62%;
  height: auto;
  translate: -50% 0;
  overflow: visible;
  filter: drop-shadow(0 4px 4px rgba(122, 89, 30, .4));
  opacity: 0;
  transform: translateY(-40px) rotate(-8deg);
  transition: opacity .8s ease 1.1s, transform 1s cubic-bezier(.3, 1.6, .5, 1) 1.1s;
}
.tiara__metal { fill: var(--oro); stroke: var(--oro-osc); stroke-width: 2; stroke-linejoin: round; }
.tiara__filigrana { fill: none; stroke: #fff2c9; stroke-width: 2.4; stroke-linecap: round; }
.tiara__banda { fill: #f4d68b; stroke: var(--oro-osc); stroke-width: 1.6; }
.tiara__gema { stroke: #fff; stroke-width: 2; }
.tiara__gema--rosa { fill: var(--rosa-osc); }
.tiara__gema--lila { fill: #9d83cf; }
.tiara__gema--cielo { fill: #6fb3ea; }
.tiara__perla { fill: #fffaf0; }

/* Personaje opcional (PNG del cliente) */
.personaje {
  position: absolute;
  right: -20%;
  bottom: -8%;
  width: 54%;
  height: auto;
  z-index: 3;
  filter: drop-shadow(0 10px 12px rgba(109, 79, 156, .4));
  opacity: 0;
  transform: translateY(30px) scale(.7);
  transition: opacity .7s ease 1.5s, transform 1s cubic-bezier(.3, 1.6, .5, 1) 1.5s;
  pointer-events: none;
}

.cuento__nombre {
  margin: 18px 0 0;
  font-family: var(--guion);
  font-weight: 400;
  font-size: clamp(3.4rem, 17vw, 4.8rem);
  line-height: 1.05;
  color: var(--rosa-osc);
  text-shadow: 0 2px 0 #fff, 0 0 18px rgba(232, 195, 106, .75);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1s ease .6s, transform 1s ease .6s;
}
.cuento__cumple { margin: 4px 0 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; font-size: 1.25rem; color: var(--lavanda-osc); opacity: 0; transition: opacity .8s ease .9s; }
.cuento__edad {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6dc, var(--oro) 60%, var(--oro-osc));
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(122, 89, 30, .6);
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--rosa), 0 8px 14px -6px rgba(109, 79, 156, .6);
}
.cuento__fecha { margin: 10px 0 0; font-family: "Cinzel", Georgia, serif; font-size: .88rem; letter-spacing: .14em; text-transform: uppercase; color: var(--tinta); opacity: 0; transition: opacity .8s ease 1.1s; }
.cuento .desliza-c { color: var(--lavanda-osc); z-index: 3; }

.cuento.listo .espejo { opacity: 1; transform: none; }
.cuento.listo .tiara { opacity: 1; transform: none; }
.cuento.listo .personaje { opacity: 1; transform: none; animation: flotarP 4s ease-in-out 2.6s infinite; }
.cuento.listo .cuento__nombre { opacity: 1; transform: none; }
.cuento.listo .cuento__cumple, .cuento.listo .cuento__fecha { opacity: 1; }
.cuento.listo .tiara__gema { animation: chispa 2.6s ease-in-out 2.2s infinite; }
@keyframes chispa { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
@keyframes flotarP { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }

/* ======================= Secciones ======================= */
.mensaje { padding-top: 84px; overflow: hidden; }
.mensaje__texto { margin: 0; max-width: 22em; font-size: 1.1rem; line-height: 1.65; }
.mensaje__rosa { position: absolute; width: 50px; height: 50px; }
.mensaje__rosa--1 { left: 7%; top: 38px; }
.mensaje__rosa--2 { right: 8%; top: 74px; width: 38px; height: 38px; }

.separador { display: flex; align-items: center; justify-content: center; gap: 12px; }
.separador i { width: 70px; height: 2px; background: linear-gradient(90deg, transparent, var(--oro)); }
.separador i:last-child { background: linear-gradient(90deg, var(--oro), transparent); }
.separador .rosa { position: static; width: 40px; height: 40px; }

.s-titulo { text-shadow: 0 0 14px rgba(232, 195, 106, .55); }
.s-cuenta__caja { border: 1.5px solid var(--oro); background: linear-gradient(170deg, #fff, #fdeef5); }
.s-cuenta__num { font-weight: 700; color: var(--rosa-osc); }
.s-evento { border: 1.5px solid var(--oro); background: linear-gradient(170deg, rgba(255, 255, 255, .95), rgba(241, 234, 251, .9)); }
.s-evento__icono { color: #fff; background: linear-gradient(160deg, var(--rosa), var(--lavanda-osc)); border-color: var(--oro); }
.s-evento__titulo { color: var(--lavanda-osc); }
.s-evento__hora { font-weight: 700; color: var(--rosa-osc); }
.s-vestimenta__tipo { font-family: "Fredoka", system-ui, sans-serif; font-weight: 600; font-size: 1.4rem; color: var(--lavanda-osc); }
.s-paleta li { border-color: var(--oro); background: #fff; }
.s-rsvp__saludo { font-family: "Fredoka", system-ui, sans-serif; font-weight: 600; font-size: 1.2rem; color: var(--rosa-osc); }
.s-btn { letter-spacing: .12em; }
.s-btn--lleno { background: linear-gradient(170deg, #ef8fbb, var(--rosa-osc)); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--oro), 0 14px 22px -12px rgba(109, 79, 156, .7); }
.s-pie__n { font-family: var(--guion); color: var(--rosa-osc); }
.btn-musica { background: var(--rosa-osc); color: #fff; box-shadow: 0 0 0 3px var(--oro); }

.foto-rsvp {
  width: 140px;
  aspect-ratio: 300 / 370;
  margin: 40px auto -30px;
  padding: 6px;
  border-radius: 50%;
  background: linear-gradient(160deg, #fff6dc, var(--oro), #fff6dc);
  box-shadow: 0 0 0 3px #fff, 0 12px 22px -12px rgba(109, 79, 156, .6);
}
.foto-rsvp img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
  .reino__cielo, .astro, .cuento__destellos, .cuento.listo .personaje, .cuento.listo .tiara__gema { animation: none !important; }
  .reino.unidas .astro { animation: none; }
  .espejo, .tiara, .personaje, .cuento__nombre { transition-duration: .3s; transition-delay: 0s; }
}
