/* Aperturas de temporada (aperturas.js → RECIPES): un solo "motor" que arma
   cada una con una receta (cielo, luz, figura central y partículas que caen,
   suben, cruzan, estallan o viajan a la velocidad de la luz). Agregar una
   nueva es agregar una receta, sin CSS nuevo. */

/* body[data-bg] .opening-layer (latido.css) lo deja transparente: esta gana. */
.opening-layer.opening-recipe,
body[data-bg] .opening-layer.opening-recipe {
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 42%, var(--sky1) 0%, var(--sky2) 72%);
}

.opening-recipe .rc-glow {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: radial-gradient(45% 40% at 50% 50%, var(--glow), transparent 70%);
  opacity: 0;
  animation: bloom 1.5s var(--ease-out, ease-out) 0.7s forwards;
}

.opening-recipe .rc-hero {
  position: relative;
  font-size: 92px;
  line-height: 1;
  filter: drop-shadow(0 0 22px var(--glow));
  opacity: 0;
  transform: scale(0.3);
  animation: rcHero 2.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s forwards;
}

@keyframes rcHero {
  0% { opacity: 0; transform: scale(0.3); }
  28% { opacity: 1; transform: scale(1.12); }
  40% { transform: scale(0.96); }
  52% { transform: scale(1.06); }
  64% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 22px var(--glow)); }
  100% { opacity: 0; transform: scale(1.9); filter: drop-shadow(0 0 60px var(--glow)) blur(6px); }
}

.opening-recipe .rc-p {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: calc(26px * var(--s));
  line-height: 1;
  opacity: 0;
  will-change: transform, opacity;
}

/* Caen balanceándose (flores, nieve). */
.rc-fall { top: -10vh !important; animation: rcFall var(--t) cubic-bezier(0.45, 0, 0.55, 1) var(--d) forwards; }
@keyframes rcFall {
  0% { opacity: 0; transform: translate(0, 0) rotate(var(--r)); }
  12% { opacity: 1; }
  50% { transform: translate(calc(var(--sway) * 0.6), 58vh) rotate(calc(var(--r) + 120deg)); }
  100% { opacity: 0.85; transform: translate(var(--sway), 118vh) rotate(calc(var(--r) + 240deg)); }
}

/* Suben flotando (corazones, faroles, notas). */
.rc-rise { top: 104vh !important; animation: rcRise var(--t) cubic-bezier(0.3, 0.1, 0.5, 1) var(--d) forwards; }
@keyframes rcRise {
  0% { opacity: 0; transform: translate(0, 0) scale(0.8); }
  15% { opacity: 1; }
  50% { transform: translate(calc(var(--sway) * -0.5), -58vh) scale(1); }
  100% { opacity: 0; transform: translate(var(--sway), -118vh) scale(1.1); }
}

/* Cruzan la pantalla (murciélagos, fantasmas). --dir: 1 o -1. */
.rc-drift { left: calc(50vw - var(--dir) * 70vw) !important; animation: rcDrift var(--t) ease-in-out var(--d) forwards; }
@keyframes rcDrift {
  0% { opacity: 0; transform: translate(0, 0) scaleX(var(--dir)); }
  15% { opacity: 1; }
  35% { transform: translate(calc(var(--dir) * 45vw), -6vh) scaleX(var(--dir)); }
  65% { transform: translate(calc(var(--dir) * 95vw), 5vh) scaleX(var(--dir)); }
  100% { opacity: 0.6; transform: translate(calc(var(--dir) * 140vw), -4vh) scaleX(var(--dir)); }
}

/* Estallan desde el centro (estrellas, brindis). */
.rc-burst { left: 50% !important; top: 50% !important; animation: rcBurst var(--t) cubic-bezier(0.1, 0.7, 0.3, 1) var(--d) forwards; }
@keyframes rcBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(0deg) scale(0.3); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 12vh)) rotate(var(--r)) scale(1); }
}

/* Viaje a la velocidad de la luz: líneas que salen del centro. */
.rc-streak {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34vmax;
  height: 2px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, transparent, var(--glow) 40%, #fff);
  opacity: 0;
  animation: rcWarp var(--t) cubic-bezier(0.5, 0, 0.9, 0.4) var(--d) forwards;
}
@keyframes rcWarp {
  0% { opacity: 0; transform: rotate(var(--a)) translateX(2vmax) scaleX(0.05); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(60vmax) scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .opening-recipe .rc-p, .opening-recipe .rc-streak { display: none; }
}
