/**
 * ALGA ARENA — Cinematic Image Motion System
 * id="cinematic-image-motion"
 * AAA game-launcher feel: layered depth, living scenes, holographic energy
 * ALL animations GPU-accelerated (transform/opacity only). No width/height animated.
 */

/* ============================================================
   HERO — LIVING SCENE LAYERS
   ============================================================ */

/* Slow breathing camera drift on the background image */
@keyframes heroCameraDrift {
    0%   { transform: scale(1.06) translate(0px,    0px); }
    25%  { transform: scale(1.07) translate(-4px,  -2px); }
    50%  { transform: scale(1.06) translate(-6px,   2px); }
    75%  { transform: scale(1.07) translate(-2px,  -3px); }
    100% { transform: scale(1.06) translate(0px,    0px); }
}

.hero-bg-img {
    /* Override previous static scale — use the drift animation as the base */
    animation: heroCameraDrift 22s ease-in-out infinite;
    /* keep will-change from base CSS */
}

/* Pause drift while JS is driving parallax (class added by JS on mousemove) */
.hero-banner-container.parallax-active .hero-bg-img {
    animation-play-state: paused;
}


/* ── Atmospheric Fog Layer ─────────────────────────────────── */
.hero-fog {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

.hero-fog::before,
.hero-fog::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 100%;
    top: 0;
    background: radial-gradient(
        ellipse 55% 40% at 70% 75%,
        rgba(0, 212, 255, 0.045) 0%,
        rgba(124, 92, 252, 0.025) 40%,
        transparent 70%
    );
    animation: fogDrift 28s ease-in-out infinite alternate;
    transform-origin: center center;
}

.hero-fog::after {
    background: radial-gradient(
        ellipse 40% 35% at 80% 30%,
        rgba(124, 92, 252, 0.035) 0%,
        transparent 65%
    );
    animation: fogDrift 36s ease-in-out infinite alternate-reverse;
    animation-delay: -14s;
}

@keyframes fogDrift {
    0%   { transform: translateX(0%)   scaleY(1);    opacity: 0.7; }
    50%  { transform: translateX(-6%)  scaleY(1.05); opacity: 1;   }
    100% { transform: translateX(-12%) scaleY(0.95); opacity: 0.6; }
}


/* ── Crowd Light Shimmer (distant coloured bokeh) ─────────── */
.hero-crowd-lights {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

/* Individual light blobs — CSS-generated, no extra DOM elements */
.crowd-light {
    position: absolute;
    border-radius: 50%;
    filter: blur(18px);
    opacity: 0;
    animation: crowdFlicker var(--cf-dur, 4s) ease-in-out infinite;
    animation-delay: var(--cf-delay, 0s);
}

@keyframes crowdFlicker {
    0%,100% { opacity: 0;    transform: scale(1);    }
    30%     { opacity: var(--cf-peak, 0.18); }
    50%     { opacity: var(--cf-peak, 0.22); transform: scale(1.15); }
    70%     { opacity: var(--cf-peak, 0.14); }
}


/* ── Screen Glow Pulse (giant LED displays in background) ─── */
.hero-screen-glow {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 30% 25% at 78% 22%, rgba(0, 212, 255, 0.07) 0%, transparent 100%),
        radial-gradient(ellipse 22% 18% at 90% 55%, rgba(124, 92, 252, 0.06) 0%, transparent 100%);
    animation: screenGlow 6s ease-in-out infinite alternate;
}

@keyframes screenGlow {
    0%   { opacity: 0.6; }
    50%  { opacity: 1.0; }
    100% { opacity: 0.7; }
}


/* ── Moving Light Sweep (realistic light source inside arena) */
.hero-light-sweep {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
}

.hero-light-sweep::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -60%;
    width: 40%;
    height: 160%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255, 255, 255, 0.025) 45%,
        rgba(0, 212, 255, 0.04)   50%,
        rgba(255, 255, 255, 0.025) 55%,
        transparent 100%
    );
    transform: skewX(-15deg);
    animation: lightBeamSweep 14s ease-in-out infinite;
}

.hero-light-sweep::after {
    content: '';
    position: absolute;
    top: -20%;
    left: -60%;
    width: 25%;
    height: 160%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(124, 92, 252, 0.03) 48%,
        rgba(124, 92, 252, 0.05) 50%,
        rgba(124, 92, 252, 0.03) 52%,
        transparent 100%
    );
    transform: skewX(-15deg);
    animation: lightBeamSweep 14s ease-in-out infinite;
    animation-delay: -7s;
}

@keyframes lightBeamSweep {
    0%   { left: -60%; }
    100% { left: 140%; }
}


/* ── Lens Flare Drift ───────────────────────────────────────── */
.hero-lens-flare {
    position: absolute;
    z-index: 7;
    pointer-events: none;
    /* positioned by JS based on brightest scene area */
    top: 18%;
    left: 58%;
    width: 320px;
    height: 320px;
    transform: translate(-50%, -50%);
}

.lens-flare-core {
    position: absolute;
    top: 50%; left: 50%;
    width: 6px; height: 6px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow:
        0 0 8px 4px rgba(255,255,255,0.9),
        0 0 24px 10px rgba(0,212,255,0.5),
        0 0 60px 24px rgba(0,212,255,0.2);
    animation: flarePulse 4s ease-in-out infinite alternate;
}

.lens-flare-streak {
    position: absolute;
    top: 50%;
    left: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,212,255,0.4), transparent);
    transform-origin: left center;
    animation: flareStreak 4s ease-in-out infinite alternate;
}

.lens-flare-streak:nth-child(2) { width: 120px; transform: translate(-50%,-50%) rotate(0deg);   }
.lens-flare-streak:nth-child(3) { width: 80px;  transform: translate(-50%,-50%) rotate(45deg);  }
.lens-flare-streak:nth-child(4) { width: 60px;  transform: translate(-50%,-50%) rotate(90deg);  }
.lens-flare-streak:nth-child(5) { width: 100px; transform: translate(-50%,-50%) rotate(135deg); }

.lens-flare-halo {
    position: absolute;
    top: 50%; left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(0,212,255,0.15);
    transform: translate(-50%,-50%);
    animation: haloExpand 4s ease-in-out infinite alternate;
}

.lens-flare-halo:nth-child(6) { width: 80px;  height: 80px;  animation-delay: 0s;    }
.lens-flare-halo:nth-child(7) { width: 140px; height: 140px; animation-delay: 0.4s;  }
.lens-flare-halo:nth-child(8) { width: 220px; height: 220px; animation-delay: 0.8s; border-color: rgba(124,92,252,0.08); }

@keyframes flarePulse {
    0%   { opacity: 0.6; transform: translate(-50%,-50%) scale(0.8); }
    100% { opacity: 1.0; transform: translate(-50%,-50%) scale(1.2); }
}

@keyframes flareStreak {
    0%   { opacity: 0.3; }
    100% { opacity: 0.7; }
}

@keyframes haloExpand {
    0%   { opacity: 0.5; transform: translate(-50%,-50%) scale(0.92); }
    100% { opacity: 1.0; transform: translate(-50%,-50%) scale(1.08); }
}


/* ── Energy / Trophy Pulse (centre-right of scene) ─────────── */
.hero-energy-pulse {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    top: 30%;
    left: 55%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
}

.energy-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 255, 0.25);
    animation: energyExpand 3.5s ease-out infinite;
}

.energy-ring:nth-child(2) { animation-delay: 1.16s; }
.energy-ring:nth-child(3) { animation-delay: 2.33s; }

@keyframes energyExpand {
    0%   { transform: scale(0.3); opacity: 0.8; border-color: rgba(0,212,255,0.5); }
    80%  { opacity: 0.1; }
    100% { transform: scale(1.4); opacity: 0; }
}


/* ── Holographic Scan Line ─────────────────────────────────── */
.hero-scan-line {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.35;
}

.hero-scan-line::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0,212,255,0.5) 30%,
        rgba(255,255,255,0.7) 50%,
        rgba(0,212,255,0.5) 70%,
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(0,212,255,0.6);
    animation: scanLineMove 8s linear infinite;
}

@keyframes scanLineMove {
    0%   { top: -2px; opacity: 0; }
    5%   { opacity: 1; }
    90%  { opacity: 0.6; }
    100% { top: 100%; opacity: 0; }
}


/* ── Floating Particle System (extended) ───────────────────── */
.hero-particle-field {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
}

.field-particle {
    position: absolute;
    border-radius: 50%;
    animation: fieldFloat var(--fp-dur, 10s) ease-in-out infinite;
    animation-delay: var(--fp-delay, 0s);
    opacity: 0;
}

@keyframes fieldFloat {
    0%   { transform: translateY(100%) translateX(0);   opacity: 0; }
    10%  { opacity: var(--fp-peak, 0.5); }
    90%  { opacity: var(--fp-peak, 0.3); }
    100% { transform: translateY(-20%)  translateX(var(--fp-drift, 20px)); opacity: 0; }
}


/* ============================================================
   CARDS — CINEMATIC DEPTH REVEAL & LIVING IMAGE SYSTEM
   ============================================================ */

/* Card enters from depth on load — JS drives this via GSAP */
.quick-card {
    /* Base perspective for the 3D feel */
    perspective: 800px;
    /* Extra shadow for depth when idle */
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.7),
        0 0 0 0px rgba(0, 212, 255, 0);
    transition:
        transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
        box-shadow 0.5s ease,
        border-color 0.5s ease;
}

/* Image starts at 1.08 and JS animates to 1.0 on load */
.quick-card__bg {
    transform: scale(1.08);
    transform-origin: center center;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* After JS reveals — image sits at natural scale */
.quick-card.revealed .quick-card__bg {
    transform: scale(1.0);
}

/* Hover image parallax (JS updates --px / --py via mousemove) */
@media (hover: hover) {
    .quick-card:hover .quick-card__bg {
        transform: scale(1.05) translate(var(--px, 0px), var(--py, 0px));
    }

    /* Edge glow on hover — stronger than base */
    .quick-card:hover {
        transform: translateY(-6px);
        box-shadow:
            0 20px 56px rgba(0, 0, 0, 0.88),
            0 0 0 1px rgba(0, 212, 255, 0.3),
            0 0 24px rgba(0, 212, 255, 0.08);
        border-color: rgba(0, 212, 255, 0.3);
    }
}


/* ── Card Light Sweep (realistic scene illumination) ───────── */
.quick-card__sweep {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
}

.quick-card__sweep::before {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255, 255, 255, 0.0) 35%,
        rgba(255, 255, 255, 0.045) 50%,
        rgba(0, 212, 255, 0.03) 55%,
        transparent 100%
    );
    transform: skewX(-15deg);
    opacity: 0;
    transition: opacity 0.4s;
}

@media (hover: hover) {
    .quick-card:hover .quick-card__sweep::before {
        opacity: 1;
        animation: cardSweepOnce 0.7s ease-out forwards;
    }
}

@keyframes cardSweepOnce {
    from { left: -80%; }
    to   { left: 160%;  }
}


/* ── Card holographic grid overlay (very subtle) ───────────── */
.quick-card__holo {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    border-radius: inherit;
    background-image:
        linear-gradient(rgba(0,212,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,212,255,0.018) 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: 0;
    transition: opacity 0.5s ease;
    mix-blend-mode: screen;
}

@media (hover: hover) {
    .quick-card:hover .quick-card__holo {
        opacity: 1;
    }
}


/* ── Card scan line on hover ───────────────────────────────── */
.quick-card__scan {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    border-radius: inherit;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

.quick-card__scan::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(0,212,255,0.45) 30%,
        rgba(255,255,255,0.6) 50%,
        rgba(0,212,255,0.45) 70%,
        transparent
    );
    box-shadow: 0 0 6px rgba(0,212,255,0.5);
    animation: cardScanMove 2.5s linear infinite;
    animation-play-state: paused;
}

@media (hover: hover) {
    .quick-card:hover .quick-card__scan {
        opacity: 1;
    }
    .quick-card:hover .quick-card__scan::after {
        animation-play-state: running;
    }
}

@keyframes cardScanMove {
    from { top: -1px; }
    to   { top: 100%; }
}


/* ── Card live-status dot ──────────────────────────────────── */
.quick-card__live {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(6, 8, 14, 0.72);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0,212,255,0.2);
    border-radius: 20px;
    padding: 3px 8px 3px 6px;
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(0,212,255,0.9);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #00d4ff;
    box-shadow: 0 0 6px #00d4ff;
    animation: livePulse 1.8s ease-in-out infinite;
}

@keyframes livePulse {
    0%,100% { opacity: 1; transform: scale(1);   box-shadow: 0 0 4px #00d4ff; }
    50%     { opacity: 0.5; transform: scale(0.7); box-shadow: 0 0 10px #00d4ff; }
}


/* ── Card energy border (ambient idle glow) ────────────────── */
.quick-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 13px;
    background: linear-gradient(
        135deg,
        rgba(0,212,255,0.0) 0%,
        rgba(0,212,255,0.12) 50%,
        rgba(124,92,252,0.12) 75%,
        rgba(0,212,255,0.0) 100%
    );
    background-size: 300% 300%;
    animation: borderEnergyFlow 8s ease-in-out infinite;
    z-index: -1;
    opacity: 0.6;
    pointer-events: none;
}

@keyframes borderEnergyFlow {
    0%   { background-position: 0%   50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0%   50%; }
}


/* ============================================================
   SCROLL REVEAL — DEPTH ENTRANCE
   ============================================================ */

/* Initial hidden state — JS (GSAP) will override these */
.quick-card[data-cinematic-hidden] {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
    filter: blur(4px);
}


/* ============================================================
   PANEL BLUR REVEAL (activity feed, tournaments, rankings)
   ============================================================ */
.card-arena[data-cinematic-hidden] {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(6px);
}


/* ============================================================
   MOUSE PARALLAX — CSS CUSTOM PROPERTY TARGETS
   ============================================================ */

/* Hero layers driven by JS → CSS custom props */
.hero-bg-img  { --px: 0px; --py: 0px; }
.hero-fog     { will-change: transform; }
.hero-particles { will-change: transform; }


/* ============================================================
   PERFORMANCE — REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .hero-bg-img,
    .hero-fog::before,
    .hero-fog::after,
    .hero-screen-glow,
    .hero-light-sweep::before,
    .hero-light-sweep::after,
    .hero-scan-line::before,
    .energy-ring,
    .crowd-light,
    .field-particle,
    .lens-flare-core,
    .lens-flare-streak,
    .lens-flare-halo,
    .live-dot,
    .quick-card::before,
    .quick-card__scan::after {
        animation: none !important;
    }

    .hero-bg-img {
        transform: scale(1.03) !important;
    }

    .quick-card:hover {
        transform: translateY(-4px) !important;
    }

    .quick-card:hover .quick-card__bg {
        transform: scale(1.02) !important;
    }
}


/* ============================================================
   MOBILE — REDUCED COMPLEXITY
   ============================================================ */
@media (max-width: 767px) {
    /* Disable expensive fog on small screens */
    .hero-fog::before,
    .hero-fog::after { display: none; }

    /* Keep lens flare smaller */
    .hero-lens-flare { transform: translate(-50%, -50%) scale(0.6); }

    /* Simpler card border */
    .quick-card::before { display: none; }

    /* No grid overlay on mobile */
    .quick-card__holo  { display: none; }

    /* Pause hero drift on mobile — static is fine */
    .hero-bg-img { animation-play-state: paused; }
}
