/* Parallax Background Layers */

.parallax-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-parallax);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    display: none;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%; /* Extra height for parallax scroll */
    will-change: transform;
}

/* Layer D: Vignette (slowest - speed 0.1) - White BG */
.parallax-vignette {
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 50%,
        rgba(252, 221, 9, 0.05) 80%,
        rgba(227, 30, 36, 0.08) 100%
    );
    z-index: 4;
}

/* Layer A: Glow (speed 0.2) - Pan-African Colors (White BG) */
.parallax-glow {
    z-index: 1;
    background:
        radial-gradient(
            ellipse 900px 700px at 15% 25%,
            rgba(227, 30, 36, 0.12) 0%,
            rgba(227, 30, 36, 0.06) 30%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 800px 900px at 85% 65%,
            rgba(0, 132, 61, 0.10) 0%,
            rgba(0, 132, 61, 0.05) 35%,
            transparent 65%
        ),
        radial-gradient(
            ellipse 1100px 600px at 50% 80%,
            rgba(252, 221, 9, 0.15) 0%,
            rgba(252, 221, 9, 0.08) 40%,
            transparent 70%
        ),
        radial-gradient(
            ellipse 700px 700px at 30% 50%,
            rgba(212, 164, 0, 0.08) 0%,
            transparent 55%
        );
    filter: blur(80px);
    animation: glow-pulse 15s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.05);
    }
}

/* Layer B: Grid (speed 0.4) - Gold Lines on White */
.parallax-grid {
    z-index: 2;
    background-image:
        linear-gradient(rgba(212, 164, 0, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 164, 0, 0.15) 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.5;
}

/* Alternative grid with SVG pattern */
.parallax-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 59px,
            rgba(255, 255, 255, 0.03) 59px,
            rgba(255, 255, 255, 0.03) 60px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 59px,
            rgba(255, 255, 255, 0.03) 59px,
            rgba(255, 255, 255, 0.03) 60px
        );
}

/* Layer C: Logo Wash (speed 0.6) - Subtle on White */
.parallax-logo-wash {
    z-index: 3;
    background-image: url('../assets/images/logo-hadinet.png');
    background-repeat: no-repeat;
    background-position: 85% 20%;
    background-size: 900px 900px;
    opacity: 0.08;
    filter: drop-shadow(0 0 40px rgba(212, 164, 0, 0.2));
}

@media (max-width: 1024px) {
    .parallax-logo-wash {
        background-size: 600px 600px;
        background-position: 80% 15%;
    }
}

@media (max-width: 768px) {
    .parallax-logo-wash {
        background-size: 400px 400px;
        background-position: center 10%;
        opacity: 0.05;
    }
}

/* Mobile optimizations - reduce parallax on mobile */
@media (max-width: 768px) {
    .parallax-layer {
        height: 110%; /* Reduce extra height on mobile */
    }

    .parallax-glow {
        filter: blur(40px); /* Less blur on mobile for performance */
    }
}

/* Reduced motion: disable parallax */
@media (prefers-reduced-motion: reduce) {
    .parallax-layer {
        position: absolute !important;
        transform: none !important;
        height: 100%;
    }
}

/* Performance optimization for parallax layers */
.parallax-layer {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Floating particles - Pan-African Colors (Brighter) */
.parallax-grid::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 42, 48, 0.6) 4px, transparent 4px),
        radial-gradient(circle at 60% 60%, rgba(0, 169, 79, 0.6) 5px, transparent 5px),
        radial-gradient(circle at 80% 20%, rgba(252, 221, 9, 0.7) 4px, transparent 4px),
        radial-gradient(circle at 40% 80%, rgba(255, 42, 48, 0.5) 3px, transparent 3px),
        radial-gradient(circle at 70% 40%, rgba(0, 169, 79, 0.5) 4px, transparent 4px),
        radial-gradient(circle at 50% 10%, rgba(252, 221, 9, 0.6) 3px, transparent 3px);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    animation: particles-float 20s ease-in-out infinite;
    opacity: 0.8;
}

@keyframes particles-float {
    0%, 100% {
        transform: translate3d(0, 0, 0);
        opacity: 0.6;
    }
    25% {
        transform: translate3d(15px, -20px, 0);
        opacity: 0.8;
    }
    50% {
        transform: translate3d(-10px, 15px, 0);
        opacity: 0.5;
    }
    75% {
        transform: translate3d(20px, 10px, 0);
        opacity: 0.7;
    }
}
