﻿/* =============================================================================
   INTRO DE TRUCACHO (2026-11-22) — reemplaza al video viejo (videos/intro_bola_8.mp4)
   Historieta animada con los cuadros de Meta AI (img/intro/), sincronizada con su música. La arma y la pasa js/ui/intro_trucacho.js:
   muchos planos cortos (calle, perro, neón, puerta, interior, manos, vino, el Ciruja), las cartas bravas con fuego y el remate
   con el ancho de espada y el logo de TRUCACHO GD. Ver la lista de planos y tiempos en el script.
   ============================================================================= */
#intro-trucacho { position: absolute; inset: 0; overflow: hidden; background: #000; }
#intro-trucacho .tgi-escena { position: absolute; inset: 0; opacity: 0; overflow: hidden; }
#intro-trucacho .tgi-escena.activa { opacity: 1; }
#intro-trucacho .tgi-foto { position: absolute; inset: -2%; background: center / cover no-repeat; will-change: transform; }
#intro-trucacho .tgi-vineta { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(0, 0, 0, .7) 100%); }

/* PLANOS (js/ui/intro_trucacho.js arma uno por corte): la cámara (zoom/paneo) la anima el script; acá van las entradas */
#intro-trucacho .tgi-planos { position: absolute; inset: 0; z-index: 4; animation: tgiEnMano 3.7s ease-in-out infinite; }
@keyframes tgiEnMano {   /* [2026-11-22] cámara en mano: deriva lenta, casi imperceptible */
    0%, 100% { transform: translate(0, 0) rotate(0deg); } 25% { transform: translate(-.25%, .18%) rotate(-.12deg); }
    50% { transform: translate(.2%, -.15%) rotate(.08deg); } 75% { transform: translate(-.1%, -.22%) rotate(.14deg); }
}
#intro-trucacho .tgi-plano { position: absolute; inset: 0; overflow: hidden; background: #000; }
#intro-trucacho .tgi-plano .tgi-foto { inset: 0; filter: brightness(.86) contrast(1.12) saturate(1.05); }   /* todo un poco más oscuro (autor), con contraste de cine */
#intro-trucacho .tgi-plano .tgi-vineta { background: radial-gradient(ellipse at 50% 50%, transparent 32%, rgba(0, 0, 0, .88) 100%); }
#intro-trucacho .entra-negro  { animation: tgiDesdeNegro .9s both; }
#intro-trucacho .entra-oscuro { animation: tgiDesdeNegro .7s ease-in both; }   /* aparece despacio desde la oscuridad */
#intro-trucacho .entra-zoom   { animation: tgiEntraZoom .28s cubic-bezier(.2, .8, .3, 1) both; }
#intro-trucacho .entra-latigazo-der { animation: tgiLatigazoDer .26s cubic-bezier(.2, .8, .3, 1) both; }
#intro-trucacho .entra-latigazo-izq { animation: tgiLatigazoIzq .26s cubic-bezier(.2, .8, .3, 1) both; }
#intro-trucacho .entra-cae    { animation: tgiCae .3s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes tgiDesdeNegro { from { filter: brightness(0); } to { filter: brightness(1); } }
@keyframes tgiEntraZoom { from { transform: scale(1.5); filter: blur(12px) brightness(1.6); opacity: .2; } to { transform: none; filter: none; opacity: 1; } }
@keyframes tgiLatigazoDer { from { transform: translateX(70%) skewX(-12deg); filter: blur(14px); } to { transform: none; filter: none; } }
@keyframes tgiLatigazoIzq { from { transform: translateX(-70%) skewX(12deg); filter: blur(14px); } to { transform: none; filter: none; } }
@keyframes tgiCae { from { transform: translateY(-40%) scale(1.15); filter: blur(10px); } to { transform: none; filter: none; } }
#intro-trucacho canvas.tgi-lluvia { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#intro-trucacho canvas.tgi-polvo { mix-blend-mode: screen; }

/* capas dentro de la imagen (se mueven con la cámara): el neón de la calle y las lámparas que laten */
#intro-trucacho .tgi-neon.en-calle {
    position: absolute; left: 53%; top: 6%; width: 21%; height: 24%; pointer-events: none; mix-blend-mode: screen;
    background: radial-gradient(ellipse 30% 45% at 50% 50%, rgba(255, 60, 60, .65), transparent 70%), radial-gradient(ellipse 60% 55% at 50% 55%, rgba(60, 255, 110, .4), transparent 70%);
    animation: tgiNeon 1.6s steps(1) infinite;
}
@keyframes tgiNeon { 0%, 18%, 24%, 60%, 100% { opacity: 1; } 20%, 22%, 62% { opacity: .1; } }
#intro-trucacho .tgi-lampara { position: absolute; pointer-events: none; mix-blend-mode: screen; animation: tgiLampara 1.1s ease-in-out infinite alternate;
    background: radial-gradient(ellipse at 50% 60%, rgba(255, 210, 120, .55), transparent 60%); }
#intro-trucacho .tgi-lampara.en-puerta { left: 51%; top: 8%; width: 16%; height: 20%; }
#intro-trucacho .tgi-lampara.en-manos  { left: 44%; top: -3%; width: 24%; height: 20%; }
#intro-trucacho .tgi-lampara.en-ciruja { left: 12%; top: -3%; width: 32%; height: 20%; }
#intro-trucacho .tgi-lampara.en-golpe  { left: 12%; top: -3%; width: 32%; height: 20%; }
@keyframes tgiLampara { from { opacity: .5; } to { opacity: 1; } }
#intro-trucacho .tgi-carta {
    position: absolute; left: 50%; top: 48%; width: 9%; aspect-ratio: 2 / 3; background: center / contain no-repeat; z-index: 3;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); opacity: 0; pointer-events: none;
    animation: tgiCartaVuela 1.1s cubic-bezier(.4, 0, .9, .6) both;
}
@keyframes tgiCartaVuela {
    0%   { transform: translate(-50%, -50%) scale(.25) rotate(0deg); opacity: 0; }
    12%  { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(4) rotate(var(--giro)); opacity: 0; }
}

/* 3 · las cartas bravas: fondo del bar oscuro y desenfocado, fuego abajo; 7 de oro, 7 de espada y ancho de basto caen de golpe en
   abanico con chispas, y al final arden (antes iban los rivales de los niveles: al autor no le gustó) */
#intro-trucacho .tgi-c3 .tgi-foto { filter: blur(10px) brightness(.28) saturate(.8); transform: scale(1.1); }
#intro-trucacho .tgi-escena { z-index: 2; }
#intro-trucacho .tgi-c3.activa, #intro-trucacho .tgi-c5.activa { z-index: 5; }
#intro-trucacho .tgi-fuego {
    position: absolute; left: -10%; right: -10%; bottom: 0; height: 75%; pointer-events: none; mix-blend-mode: screen; opacity: .0;
    background: radial-gradient(ellipse 30% 55% at 30% 100%, rgba(255, 110, 20, 1), transparent 85%),
                radial-gradient(ellipse 28% 60% at 52% 100%, rgba(255, 170, 40, .95), transparent 85%),
                radial-gradient(ellipse 30% 50% at 74% 100%, rgba(255, 90, 20, .95), transparent 85%),
                radial-gradient(ellipse 20% 40% at 15% 100%, rgba(60, 140, 255, .55), transparent 85%);
    filter: blur(6px); animation: tgiFuego .35s ease-in-out infinite alternate;
}
#intro-trucacho .tgi-c3.activa .tgi-fuego { opacity: 1; transition: opacity .6s; }
#intro-trucacho .tgi-c3.arden .tgi-fuego { opacity: 1; filter: blur(6px) brightness(1.35); }
@keyframes tgiFuego { from { transform: scaleY(1) translateX(0); } to { transform: scaleY(1.08) translateX(.6%); } }
#intro-trucacho .tgi-brava {
    position: absolute; left: calc(50% + var(--x)); top: calc(50% + var(--y, 0%)); width: 17%; aspect-ratio: 2 / 3; background: center / contain no-repeat; z-index: 3;
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .85)) drop-shadow(0 0 14px rgba(255, 160, 50, .55));
    animation: tgiBravaCae .45s cubic-bezier(.55, 0, .85, .5) both;
}
@keyframes tgiBravaCae {
    0%   { transform: translate(-50%, -50%) scale(2.6) rotate(calc(var(--giro) * -2)); opacity: 0; filter: blur(8px) brightness(2.2); }
    25%  { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(var(--giro)); opacity: 1; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .85)) drop-shadow(0 0 14px rgba(255, 160, 50, .55)); }
}
#intro-trucacho .tgi-c3.arden .tgi-brava { animation: tgiBravaCae .45s cubic-bezier(.55, 0, .85, .5) both, tgiArde .5s ease-in-out infinite alternate; }
@keyframes tgiArde {
    from { filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .85)) drop-shadow(0 0 14px rgba(255, 160, 50, .55)); }
    to   { filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .85)) drop-shadow(0 0 30px rgba(255, 190, 70, .95)) brightness(1.12); }
}
#intro-trucacho .tgi-chispa {
    position: absolute; width: .7vw; height: .7vw; margin: -.35vw; border-radius: 50%; pointer-events: none; z-index: 8;
    background: radial-gradient(circle, #fff6c8 0%, #ffb340 45%, rgba(255, 120, 30, 0) 75%);
    animation: tgiChispa .9s cubic-bezier(.15, .7, .4, 1) both;
}
#intro-trucacho .tgi-chispa.azul { background: radial-gradient(circle, #eaf6ff 0%, #6ab8ff 45%, rgba(60, 140, 255, 0) 75%); }
@keyframes tgiChispa { 0% { transform: translate(0, 0) scale(1.4); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }

/* 5 · remate: rayos, el ancho de espada cae y se clava, onda, fogonazo, cae el logo */
/* [2026-11-23] fondo semitransparente: detrás se sigue viendo el puño del golpe (el último plano), oscurecido */
#intro-trucacho .tgi-c5 { background: radial-gradient(ellipse at 50% 50%, rgba(42, 20, 6, .45) 0%, rgba(0, 0, 0, .78) 75%); }
#intro-trucacho .tgi-c5 .tgi-rayos {
    position: absolute; left: 50%; top: 50%; width: 160vmax; height: 160vmax; transform: translate(-50%, -50%); opacity: 0;
    background: repeating-conic-gradient(from 0deg, rgba(255, 200, 90, .16) 0deg 6deg, transparent 6deg 18deg, rgba(110, 180, 255, .1) 18deg 22deg, transparent 22deg 36deg);
    -webkit-mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .5) 20%, transparent 45%); mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, .5) 20%, transparent 45%);
}
#intro-trucacho .tgi-c5.golpe .tgi-rayos { animation: tgiRayos 40s linear infinite, tgiAparece .6s forwards; }
@keyframes tgiRayos { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes tgiAparece { to { opacity: 1; } }
#intro-trucacho .tgi-ancho {
    position: absolute; left: 50%; top: 50%; width: 15%; aspect-ratio: 2 / 3; background: center / contain no-repeat; opacity: 0;
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .8));
}
#intro-trucacho .tgi-c5.activa .tgi-ancho { animation: tgiAnchoCae .55s cubic-bezier(.55, 0, .9, .45) both, tgiAnchoSeVa .5s 1.15s ease-in forwards; }
@keyframes tgiAnchoCae {
    0%   { transform: translate(-50%, -260%) scale(2.2) rotate(-35deg); opacity: 0; }
    20%  { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes tgiAnchoSeVa { to { transform: translate(-50%, -50%) scale(.6) rotate(8deg); opacity: 0; filter: blur(3px); } }
#intro-trucacho .tgi-onda {
    position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; border-radius: 50%; opacity: 0; pointer-events: none;
    border: 5px solid rgba(255, 215, 120, .95); box-shadow: 0 0 30px rgba(255, 170, 60, .9), inset 0 0 30px rgba(255, 170, 60, .5);
    transform: translate(-50%, -50%) scale(.4);
}
#intro-trucacho .tgi-onda.dos { border-color: rgba(120, 190, 255, .9); box-shadow: 0 0 30px rgba(60, 150, 255, .8); }
#intro-trucacho .tgi-c5.golpe .tgi-onda { animation: tgiOnda .9s cubic-bezier(.1, .7, .3, 1) both; }
#intro-trucacho .tgi-c5.golpe .tgi-onda.dos { animation-delay: .12s; animation-duration: 1.1s; }
@keyframes tgiOnda { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(4); border-width: 1px; } }
#intro-trucacho .tgi-logo {
    position: absolute; left: 50%; top: 50%; width: min(70%, 118vh); aspect-ratio: 1200 / 793; background: center / contain no-repeat; opacity: 0;
    filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .85));
}
#intro-trucacho .tgi-c5.logo .tgi-logo { animation: tgiLogo .8s cubic-bezier(.2, .9, .3, 1.25) both, tgiLogoFlota 4s .8s ease-in-out infinite; }
@keyframes tgiLogo {
    0%   { transform: translate(-50%, -50%) scale(2.6); opacity: 0; filter: blur(14px) brightness(2.4); }
    55%  { transform: translate(-50%, -50%) scale(.94); opacity: 1; filter: blur(0) brightness(1.6); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .85)); }
}
@keyframes tgiLogoFlota { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -51.5%) scale(1.015); } }

/* fogonazo de corte y sacudida (los pone el script en el momento justo) */
#intro-trucacho .tgi-fogonazo { position: absolute; inset: 0; z-index: 20; pointer-events: none; opacity: 0; background: #fff6e0; }
#intro-trucacho .tgi-fogonazo.ya { animation: tgiFogonazo .45s ease-out; }
@keyframes tgiFogonazo { 0% { opacity: .85; } 100% { opacity: 0; } }
#intro-trucacho.sacude { animation: tgiSacude .4s; }
@keyframes tgiSacude {
    0%, 100% { transform: translate(0, 0); } 15% { transform: translate(-1.2%, .9%); } 30% { transform: translate(1%, -1%); }
    45% { transform: translate(-.7%, .5%); } 65% { transform: translate(.4%, -.3%); }
}
/* bandas de cine arriba y abajo */
#intro-trucacho .tgi-bandas::before, #intro-trucacho .tgi-bandas::after { content: ''; position: absolute; left: 0; right: 0; height: 11%; background: #000; z-index: 15;
    animation: tgiBandas 1.2s cubic-bezier(.4, 0, .2, 1) both; }
@keyframes tgiBandas { from { height: 0; } }
/* grano de película (ruido SVG que salta de lugar 12 veces por segundo) */
#intro-trucacho .tgi-grano { position: absolute; inset: -50%; z-index: 14; pointer-events: none; opacity: .14; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: tgiGrano .5s steps(6) infinite; }
@keyframes tgiGrano { 0% { transform: translate(0, 0); } 20% { transform: translate(-7%, 4%); } 40% { transform: translate(5%, -6%); }
    60% { transform: translate(-3%, -9%); } 80% { transform: translate(8%, 6%); } 100% { transform: translate(-5%, 2%); } }
#intro-trucacho .tgi-bandas::before { top: 0; } #intro-trucacho .tgi-bandas::after { bottom: 0; }

@media (prefers-reduced-motion: reduce) {
    #intro-trucacho *, #intro-trucacho { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
}

/* [2026-11-22] planos con video (Meta AI): el video cubre el cuadro fijo, que queda de respaldo debajo */
#intro-trucacho .tgi-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

/* [2026-11-22] brillo que cruza la cara de las cartas al caer (las bravas y el ancho de espada); la máscara es la misma carta */
#intro-trucacho .tgi-brava::after, #intro-trucacho .tgi-ancho::after {
    content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: 0;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 250, 225, .95) 50%, transparent 62%) 130% 0 / 260% 100% no-repeat;
    -webkit-mask: var(--img) center / contain no-repeat; mask: var(--img) center / contain no-repeat;
}
#intro-trucacho .tgi-brava::after { animation: tgiBrillo .75s .42s ease-out both; }
#intro-trucacho .tgi-c5.golpe .tgi-ancho::after { animation: tgiBrillo .6s .05s ease-out both; }
@keyframes tgiBrillo { 0% { opacity: 1; background-position: 130% 0; } 100% { opacity: 1; background-position: -30% 0; } }

/* [2026-11-23] fundidos: las escenas fijas (cartas bravas, remate) y la capa de planos entran y salen suave en vez de cortar */
#intro-trucacho .tgi-escena, #intro-trucacho .tgi-planos { transition: opacity .45s ease-in-out; }
