/* =========================================================
   CyberSecPlayground - Animated Backgrounds v3.2
   ========================================================= */

#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.35;
    pointer-events: none;
    mix-blend-mode: screen;
}
[data-theme="light"] #matrix-canvas { opacity: 0.1; mix-blend-mode: multiply; }

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(88, 166, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(88, 166, 255, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 30%, black 20%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 30%, black 20%, transparent 80%);
    animation: gridDrift 40s linear infinite;
}
@keyframes gridDrift {
    from { background-position: 0 0; }
    to { background-position: 50px 50px; }
}

.bg-scanlines {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 3px,
        transparent 4px
    );
    opacity: 0.4;
    mix-blend-mode: overlay;
}
[data-theme="light"] .bg-scanlines { display: none; }

.bg-vignette {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 50%,
        rgba(10, 13, 18, 0.6) 100%
    );
}
[data-theme="light"] .bg-vignette { display: none; }

.bg-particles {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent);
    opacity: 0;
    animation: particleRise linear infinite;
}
.particle.gold {
    background: var(--secondary);
    box-shadow: 0 0 6px var(--secondary);
}
@keyframes particleRise {
    0% { opacity: 0; transform: translateY(100vh) scale(0.5); }
    10% { opacity: 0.7; }
    90% { opacity: 0.4; }
    100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

.cursor-spotlight {
    position: fixed;
    width: min(600px, 80vw);
    height: min(600px, 80vw);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(88, 166, 255, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 3;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    opacity: 0;
    mix-blend-mode: screen;
    top: 0;
    left: 0;
}
@media (hover: hover) and (pointer: fine) {
    .cursor-spotlight.active { opacity: 1; }
}
@media (hover: none) {
    .cursor-spotlight { display: none; }
}

/* Hero orbs */
.hero-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite;
}
.orb-1 {
    width: min(400px, 60vw);
    height: min(400px, 60vw);
    background: radial-gradient(circle, rgba(88, 166, 255, 0.5), transparent 70%);
    top: -100px; left: -100px;
}
.orb-2 {
    width: min(350px, 55vw);
    height: min(350px, 55vw);
    background: radial-gradient(circle, rgba(240, 180, 41, 0.4), transparent 70%);
    top: -50px; right: -100px;
    animation-delay: -7s;
}
.orb-3 {
    width: min(300px, 50vw);
    height: min(300px, 50vw);
    background: radial-gradient(circle, rgba(63, 185, 80, 0.3), transparent 70%);
    bottom: -100px; left: 40%;
    animation-delay: -14s;
}
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -40px) scale(1.1); }
    66% { transform: translate(-40px, 40px) scale(0.95); }
}

@media (prefers-reduced-motion: reduce) {
    #matrix-canvas,
    .bg-particles,
    .cursor-spotlight,
    .orb { display: none !important; }
}

@media (max-width: 768px) {
    #matrix-canvas { opacity: 0.2; }
    .bg-scanlines { opacity: 0.25; }
    .orb { filter: blur(40px); opacity: 0.25; }
    .card-trail::after { animation: none; }
}