/* ============================================================
   VKPROJECT V37 — camada "VK SUBSOLO" (underground)
   Granulado de filme, scanlines, faíscas, glitch, neon vermelho.
   Arquivo separado: não altera o app.css. Para desligar tudo,
   basta remover as duas linhas fx.* do index.html.
   ============================================================ */

:root {
  --fx-neon: #ff2a3d;
  --fx-neon-glow: 0 0 6px #ff2a3daa, 0 0 18px #ff2a3d66, 0 0 42px #c8182b44;
  --fx-glitch-a: #ff2a3d;
  --fx-glitch-b: #19e3ff;
}

/* ---------- Fundo: faíscas + granulado + scanlines ---------- */
.fx-embers { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
body.login-mode .fx-embers { display: none; } /* a intro já tem faíscas no vídeo */

.fx-grain {
  position: fixed; inset: -50%; pointer-events: none; z-index: 9998; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: fx-grain .9s steps(6) infinite;
}
@keyframes fx-grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-6%, 4%); } 40% { transform: translate(5%, -7%); }
  60% { transform: translate(-3%, 8%); } 80% { transform: translate(7%, 2%); } 100% { transform: translate(0, 0); }
}
.fx-scan {
  position: fixed; inset: 0; pointer-events: none; z-index: 9997;
  background: repeating-linear-gradient(0deg, #0000 0 2px, #0000001c 2px 3px);
}

/* Páginas de vídeo/álbum e foto ampliada: nada por cima do conteúdo (qualidade máxima). */
body.fx-clean .fx-scan, body.fx-clean .fx-grain, body.fx-clean .fx-embers,
body:has(.lightbox) .fx-scan, body:has(.lightbox) .fx-grain, body:has(.lightbox) .fx-embers,
body:has(video:fullscreen) .fx-scan, body:has(video:fullscreen) .fx-grain { display: none !important; }

/* ---------- Glitch (RGB split + cortes) — aplicado pelo fx.js ---------- */
.fx-glitch::before, .fx-glitch::after {
  content: attr(data-fx-text); position: absolute; inset: 0; pointer-events: none;
  opacity: 0; background: transparent; white-space: inherit; text-align: inherit;
  -webkit-text-fill-color: currentColor;
}
.fx-glitch::before { color: var(--fx-glitch-a); animation: fx-glitch-a 4.6s infinite steps(1); }
.fx-glitch::after  { color: var(--fx-glitch-b); animation: fx-glitch-b 4.6s infinite steps(1); }
.fx-glitch { animation: fx-shake 4.6s infinite steps(1); }

@keyframes fx-glitch-a {
  0%, 86%, 100% { opacity: 0; transform: none; clip-path: none; }
  87% { opacity: .9; transform: translate(-4px, -1px); clip-path: inset(10% 0 62% 0); }
  89% { opacity: .9; transform: translate(5px, 1px);  clip-path: inset(55% 0 20% 0); }
  91% { opacity: .9; transform: translate(-2px, 0);   clip-path: inset(30% 0 45% 0); }
  93% { opacity: 0; }
}
@keyframes fx-glitch-b {
  0%, 86%, 100% { opacity: 0; transform: none; clip-path: none; }
  87% { opacity: .8; transform: translate(4px, 1px);   clip-path: inset(65% 0 8% 0); }
  89% { opacity: .8; transform: translate(-5px, -1px); clip-path: inset(5% 0 75% 0); }
  91% { opacity: .8; transform: translate(3px, 0);     clip-path: inset(40% 0 35% 0); }
  93% { opacity: 0; }
}
@keyframes fx-shake {
  0%, 86%, 94%, 100% { translate: 0 0; }
  88% { translate: 2px 0; }
  90% { translate: -2px 0; }
  92% { translate: 1px 0; }
}

/* ---------- Intro / login ---------- */
.vk-intro-end.visible h1 { animation: fx-flicker-in 1.1s steps(1) both, fx-shake 4.6s 1.1s infinite steps(1); text-shadow: 0 0 40px #ff2a3d55; }
.vk-intro-eyebrow { text-shadow: var(--fx-neon-glow); }
.vk-intro-end.visible .vk-intro-enter { animation: fx-pulse 2.4s ease-in-out 1.2s infinite; }
.vk-login-panel.visible .vk-login-card { animation: fx-crt-on .5s ease-out both; box-shadow: 0 0 0 1px #ff2a3d33, 0 0 60px #c8182b33; }
.vk-login-submit { animation: fx-pulse 2.6s ease-in-out infinite; }
@keyframes fx-flicker-in {
  0% { opacity: 0; } 10% { opacity: .9; } 14% { opacity: .1; } 22% { opacity: 1; }
  26% { opacity: .3; } 34% { opacity: 1; } 60% { opacity: .75; } 63%, 100% { opacity: 1; }
}

/* ---------- Neon ---------- */
.brand-vk, .hero-logo span, .vk-intro-logo span, .vk-login-logo span {
  text-shadow: 0 0 10px #ff2a3d88, 0 0 26px #ff2a3d44; animation: fx-neon-flicker 7s infinite;
}
@keyframes fx-neon-flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: .45; }
}
@keyframes fx-pulse {
  0%, 100% { box-shadow: 0 0 18px #c8182b55; }
  50% { box-shadow: 0 0 34px #ff2a3daa, 0 0 70px #c8182b55; }
}
.btn.red { animation: fx-pulse 2.8s ease-in-out infinite; }
.hero-kicker, .eyebrow { text-shadow: var(--fx-neon-glow); }

/* barra de "varredura" sob o topo */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, #0000, var(--fx-neon), #0000) no-repeat;
  background-size: 30% 100%; animation: fx-scanline 5s linear infinite; opacity: .75;
}
@keyframes fx-scanline { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* títulos de seção: a barra vermelha pisca como neon */
.section-title::before { animation: fx-neon-flicker 5s infinite; } /* barra vermelha que já existe no app */
.video-carousel-head h2::before {
  content: ""; display: inline-block; width: 4px; height: .9em; margin-right: 10px; vertical-align: -.08em;
  background: var(--fx-neon); box-shadow: 0 0 10px var(--fx-neon); animation: fx-neon-flicker 5s infinite;
}

/* ---------- Troca de página: entrada com glitch rápido ---------- */
/* "backwards": ao terminar não sobra filtro/translate no #app (isso quebraria elementos fixos). */
body:not(.login-mode) #app.fx-route { animation: fx-route-in .45s steps(5) backwards; }
@keyframes fx-route-in {
  0% { opacity: 0; filter: saturate(0) contrast(1.6); translate: -6px 0; }
  40% { opacity: 1; filter: drop-shadow(4px 0 0 #ff2a3d88) drop-shadow(-4px 0 0 #19e3ff66); translate: 4px 0; }
  100% { opacity: 1; filter: none; translate: 0 0; }
}

/* ---------- Cards: surgem ao rolar + neon no hover ---------- */
.fx-wait { opacity: 0; }
.fx-in { animation: fx-rise .6s cubic-bezier(.2, .7, .2, 1) backwards; animation-delay: var(--fx-d, 0s); }
@keyframes fx-rise { from { opacity: 0; translate: 0 22px; scale: .98; filter: blur(4px); } }

.card .thumb { transition: box-shadow .3s ease; }
.card .thumb::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(0deg, #0000 0 2px, #00000055 2px 4px); transition: opacity .25s;
}
.card:hover .thumb, .card:focus-within .thumb {
  box-shadow: 0 0 0 1px var(--fx-neon), 0 0 22px #ff2a3d66, 0 18px 40px -18px #000;
}
.card:hover .thumb::after { opacity: 1; }
.card:hover .thumb img { animation: fx-jolt .35s steps(2) 1; }
@keyframes fx-jolt {
  50% { filter: drop-shadow(3px 0 0 #ff2a3d99) drop-shadow(-3px 0 0 #19e3ff88); translate: -2px 1px; }
}
.card:hover .card-title { text-shadow: 0 0 14px #ff2a3d66; }
.category-card:hover { box-shadow: 0 0 0 1px var(--fx-neon), 0 0 26px #ff2a3d55; }
.play { transition: box-shadow .25s; }
.card:hover .play, .vf-art:hover .play { box-shadow: var(--fx-neon-glow); }

/* ---------- Hero da home: zoom lento ---------- */
.home-hero-media img { animation: fx-slow-zoom 24s ease-in-out infinite alternate; }
@keyframes fx-slow-zoom { to { scale: 1.08; } }

/* ---------- Modal / lightbox abre como TV ligando ---------- */
.lightbox { animation: fx-crt-on .45s ease-out both; }
@keyframes fx-crt-on {
  0% { scale: 1 .004; filter: brightness(3); opacity: .6; }
  45% { scale: 1 .004; filter: brightness(3); }
  70% { scale: 1 1.02; filter: brightness(1.4); opacity: 1; }
  100% { scale: 1; filter: none; }
}

/* ---------- Acessibilidade: sem animação para quem pede ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-grain, .fx-embers { display: none; }
  .fx-glitch::before, .fx-glitch::after { display: none; }
  .fx-glitch, .fx-in, #app.fx-route, .btn.red, .vk-login-submit, .home-hero-media img,
  .brand-vk, .hero-logo span, .vk-intro-logo span, .vk-login-logo span { animation: none !important; }
  .fx-wait { opacity: 1; }
}
