/* Always Dale FX library: reusable page effects, switched on per event from /themes/<event>.json.
   Names mirror Squarespace where there is an equivalent (see FX.md). Everything respects "reduce motion". */

/* ---------- Text / logo ---------- */
/* neon-flicker + flicker-occasional: exact copy of the Game Over logo effect on alwaysdale.com (custom CSS) */
@keyframes fx-neon-flicker { 0% { opacity: 0 } 5% { opacity: .8 } 10% { opacity: .3 } 15% { opacity: 1 } 20% { opacity: .5 } 25% { opacity: .9 } 30% { opacity: .2 } 35% { opacity: 1 } 100% { opacity: 1 } }
@keyframes fx-flicker-occasional { 0%, 80% { opacity: 1 } 81% { opacity: .7 } 82% { opacity: 1 } 85% { opacity: .5 } 86% { opacity: 1 } 88% { opacity: .9 } 89% { opacity: 1 } 100% { opacity: 1 } }
.fx-neon-flicker { animation: fx-neon-flicker 3s forwards; }
.fx-neon-flicker.fx-flicker-occasional { animation: fx-neon-flicker 3s forwards, fx-flicker-occasional 5s 3s infinite forwards; }
.fx-flicker-occasional:not(.fx-neon-flicker) { animation: fx-flicker-occasional 5s infinite; }

/* neon-glow: soft pulsing glow in the event accent colour (works on images with transparency) */
@keyframes fx-glow { 0%, 100% { filter: drop-shadow(0 0 10px var(--fx-accent, #39ff14)) } 50% { filter: drop-shadow(0 0 26px var(--fx-accent, #39ff14)) } }
.fx-neon-glow { animation: fx-glow 3.2s ease-in-out infinite; }

/* glitch: brief RGB-split jolt every few seconds (arcade / cyber / techno themes) */
@keyframes fx-glitch {
  0%, 92%, 100% { transform: none; filter: none; }
  93% { transform: translate(-3px, 1px) skewX(-4deg); filter: drop-shadow(3px 0 0 rgba(255,0,80,.8)) drop-shadow(-3px 0 0 rgba(0,240,255,.8)); }
  95% { transform: translate(3px, -1px); filter: drop-shadow(-4px 0 0 rgba(255,0,80,.8)) drop-shadow(4px 0 0 rgba(0,240,255,.8)); }
  97% { transform: translate(-1px, 0) skewX(3deg); filter: none; }
}
.fx-glitch { animation: fx-glitch 6s infinite steps(1, end); }

/* ---------- Reveal on scroll (Squarespace site animations: Fade / Slide / Scale / Clip / Flex) ---------- */
.fx-reveal-fade, .fx-reveal-slide, .fx-reveal-scale, .fx-reveal-clip { transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1), clip-path .9s cubic-bezier(.2,.7,.2,1); }
.fx-reveal-fade:not(.fx-in) { opacity: 0; transform: translateY(10px); }
.fx-reveal-slide:not(.fx-in) { opacity: 0; transform: translateY(40px); }
.fx-reveal-scale:not(.fx-in) { opacity: 0; transform: scale(.92); }
.fx-reveal-clip:not(.fx-in) { clip-path: inset(0 0 100% 0); }
.fx-reveal-clip.fx-in { clip-path: inset(0 0 0 0); }

/* ---------- Background / image effects (Squarespace image effects: Parallax / Zoom / Pan / Film Grain / Refracted Lines) ---------- */
/* sized to the largest viewport (lvh) so it doesn't rescale when a phone's address bar collapses */
.fx-bg { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: -2; background: #000 center top / cover no-repeat; will-change: transform; }
.fx-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55) 40%, rgba(0,0,0,.75)); }
@keyframes fx-zoom { from { transform: scale(1); } to { transform: scale(1.12); } }
.fx-bg.fx-zoom { animation: fx-zoom 24s ease-in-out infinite alternate; }
@keyframes fx-pan { from { background-position: 30% top; } to { background-position: 70% top; } }
.fx-bg.fx-pan { animation: fx-pan 30s ease-in-out infinite alternate; }

/* film grain: animated noise overlay over the whole page */
.fx-grain-layer { position: fixed; inset: -50%; z-index: 30; pointer-events: none; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%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: fx-grain .6s steps(4) infinite; }
@keyframes fx-grain { 0% { transform: translate(0, 0) } 25% { transform: translate(-6%, 4%) } 50% { transform: translate(5%, -3%) } 75% { transform: translate(-3%, -6%) } 100% { transform: translate(4%, 5%) } }

/* refracted lines: frosted vertical glass strips over the background */
.fx-refracted-lines-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 2px, transparent 2px 38px); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); }

/* scanlines: CRT / arcade monitor lines with a slow roll */
/* sits between the background and the page content, so text and buttons stay crisp */
.fx-scanlines-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px); }
.fx-scanlines-layer::after { content: ""; position: absolute; left: 0; right: 0; height: 18vh; top: -18vh;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.035), transparent); animation: fx-roll 7s linear infinite; }
@keyframes fx-roll { to { transform: translateY(136vh); } }

/* falling-blocks / particles canvases (drawn by fx.js) */
.fx-canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* tilt: images lean toward the pointer / phone tilt (Squarespace "Tilt") */
.fx-tilt { transition: transform .25s ease-out; transform-style: preserve-3d; }

@media (prefers-reduced-motion: reduce) {
  .fx-neon-flicker, .fx-flicker-occasional, .fx-neon-glow, .fx-glitch, .fx-bg.fx-zoom, .fx-bg.fx-pan, .fx-grain-layer, .fx-scanlines-layer::after { animation: none !important; }
  .fx-reveal-fade, .fx-reveal-slide, .fx-reveal-scale, .fx-reveal-clip { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .fx-canvas { display: none; }
}
