/* Intro de la primera visita: escenario nocturno, personajes animados por fotogramas y salida
   con "bloom" hacia dentro (zoom + destello) mientras la pagina aparece desde un desenfoque. */

/* Mientras intro.js prepara la escena, una capa oscura tapa la pagina. Si algo fallara,
   la capa se retira sola a los 4 s para no dejar la web bloqueada. */
html.intro-pending { overflow: hidden; }
html.intro-pending::before { content: ''; position: fixed; inset: 0; z-index: 9998; background: #07050a; animation: intro-failsafe .4s 4s forwards !important; }
@keyframes intro-failsafe { to { opacity: 0; visibility: hidden; } }

#intro { position: fixed; inset: 0; z-index: 9999; overflow: hidden; background: #07050a; color: #f4efe6; cursor: pointer; }
.intro-stage { position: absolute; inset: 0; transform-origin: 50% 46%; --s: min(.1vh, .15vw); --floor: 21%; }
.intro-sky { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 62%, #1d2b3c 0%, #0f1622 45%, #07050a 85%); }
html.halloween .intro-sky { background: radial-gradient(ellipse at 50% 64%, #5a1f0c 0%, #2b0f17 38%, #120812 70%, #07050a 100%); }
.intro-stars { position: absolute; inset: 0 0 30% 0; background-image: radial-gradient(1.5px 1.5px at 12% 22%, #fff9, transparent), radial-gradient(1.5px 1.5px at 28% 12%, #fff7, transparent), radial-gradient(2px 2px at 44% 30%, #fffa, transparent), radial-gradient(1.5px 1.5px at 63% 16%, #fff8, transparent), radial-gradient(2px 2px at 81% 26%, #fff9, transparent), radial-gradient(1.5px 1.5px at 92% 9%, #fff6, transparent); opacity: .8; }
.intro-moon { position: absolute; left: 50%; top: 7%; width: min(34vh, 46vw); transform: translateX(-50%); image-rendering: pixelated; opacity: 0; display: none; }
html.halloween .intro-moon { display: block; }
.intro-ground { position: absolute; left: 0; right: 0; bottom: 0; height: var(--floor); background: linear-gradient(#1a1410, #07050a); box-shadow: 0 -1px 0 #ffffff14; }
html.halloween .intro-ground { background: linear-gradient(#2a1208, #07050a); box-shadow: 0 -1px 0 #ff8a2a33; }
.intro-glow { position: absolute; left: 50%; bottom: var(--floor); width: min(90vh, 120vw); height: min(30vh, 40vw); transform: translate(-50%, 50%); background: radial-gradient(ellipse, #ffb45a40, transparent 65%); opacity: 0; }
.intro-clip { position: absolute; left: 0; right: 0; top: 0; bottom: var(--floor); overflow: hidden; }

/* Cada actor: caja del tamano de un fotograma, con el pie sobre el suelo. */
.intro-actor { position: absolute; left: calc(var(--x) - var(--fx) * var(--s)); bottom: calc((var(--fy) - var(--h)) * var(--s)); width: calc(var(--w) * var(--s)); height: calc(var(--h) * var(--s)); }
.intro-sprite { width: 100%; height: 100%; background-repeat: no-repeat; background-size: 2400% 100%; background-position: 0 0; image-rendering: pixelated; }
.intro-shadow { position: absolute; left: var(--x); bottom: var(--floor); width: calc(110 * var(--s)); height: calc(18 * var(--s)); transform: translate(-50%, 50%); border-radius: 50%; background: radial-gradient(#000c, transparent 70%); opacity: 0; }

.intro-brand { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; opacity: 0; font-family: 'DM Sans', Arial, sans-serif; }
.intro-brand img { width: clamp(46px, 7vh, 72px); height: auto; border-radius: 10px; box-shadow: 0 10px 30px #0008; }
.intro-brand strong { font-size: clamp(28px, 5.4vh, 54px); font-weight: 700; letter-spacing: -1.5px; line-height: 1; }
.intro-brand strong span { font-weight: 400; color: #c9c2b4; }
.intro-brand small { font-size: clamp(10px, 1.5vh, 13px); letter-spacing: 3px; color: #d3ef96; }
html.halloween .intro-brand small { color: #ffb45a; }
html.halloween .intro-brand { top: auto; bottom: calc(var(--floor) * .3); gap: 6px; }
html.halloween .intro-brand img { display: none; }

.intro-bloom { position: absolute; left: 50%; top: 46%; width: 10vmax; height: 10vmax; transform: translate(-50%, -50%) scale(0); border-radius: 50%; background: radial-gradient(#fff 0%, #ffe2b0 25%, #ffb45a66 55%, transparent 72%); opacity: 0; pointer-events: none; }
.intro-skip { position: absolute; right: 18px; bottom: 16px; padding: 8px 14px; border: 1px solid #ffffff33; border-radius: 6px; background: #0006; color: #f4efe6cc; font: 12px 'DM Sans', Arial, sans-serif; letter-spacing: 1px; cursor: pointer; }
.intro-skip:hover { background: #000a; color: #fff; }

/* ---- Reproduccion ---- */
#intro.playing .intro-sprite { animation: intro-frames 2s steps(24, jump-none) forwards !important; }
@keyframes intro-frames { to { background-position: 100% 0; } }
#intro.playing .intro-actor.walk-left { animation: intro-walk-left .92s cubic-bezier(.25, .7, .35, 1) both !important; }
#intro.playing .intro-actor.walk-right { animation: intro-walk-right .92s cubic-bezier(.25, .7, .35, 1) both !important; }
@keyframes intro-walk-left { from { transform: translateX(calc(-1 * var(--walk))); } }
@keyframes intro-walk-right { from { transform: translateX(var(--walk)); } }
#intro.playing .intro-shadow { animation: intro-fade .5s .1s forwards !important; }
#intro.playing .intro-brand { animation: intro-brand .9s .15s cubic-bezier(.2, .7, .2, 1) forwards !important; }
#intro.playing .intro-moon { animation: intro-moon 1.4s forwards !important; }
#intro.playing .intro-glow { animation: intro-fade 1.6s .3s forwards !important; }
@keyframes intro-fade { to { opacity: 1; } }
@keyframes intro-brand { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes intro-moon { from { opacity: 0; transform: translate(-50%, 18px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Salida: zoom hacia dentro con destello ---- */
#intro.leaving { pointer-events: none; animation: intro-out .95s cubic-bezier(.55, 0, .3, 1) forwards !important; }
#intro.leaving .intro-stage { animation: intro-zoom .95s cubic-bezier(.6, 0, .35, 1) forwards !important; }
#intro.leaving .intro-bloom { animation: intro-bloom .95s cubic-bezier(.3, 0, .2, 1) forwards !important; }
#intro.leaving .intro-skip { opacity: 0; }
@keyframes intro-zoom { to { transform: scale(3.2); filter: brightness(2.4) blur(6px); } }
@keyframes intro-bloom { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0); } 45% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(26); } }
@keyframes intro-out { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }

/* La pagina entra desde un desenfoque brillante y un poco mas grande. */
html.intro-reveal body > header, html.intro-reveal body > main, html.intro-reveal body > footer, html.intro-reveal .seasonal-banner { animation: page-in 1.1s cubic-bezier(.2, .7, .2, 1) both !important; }
@keyframes page-in { from { opacity: 0; transform: scale(1.06); filter: blur(14px) brightness(1.8); } to { opacity: 1; transform: none; filter: none; } }
