/*
F3L1X 3D Parallax Effects
Uses CSS 3D transforms and perspective for layered depth
*/

/* ===========================================
   PARALLAX CONTAINER
   =========================================== */
.parallax-scene {
    position: relative;
    overflow: hidden;
    perspective: 1000px;
    perspective-origin: 50% 50%;
}

/* ===========================================
   PARALLAX LAYERS
   Each layer has different transform speeds
   =========================================== */
.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    will-change: transform;
    transform-style: preserve-3d;
}

/* Allow interaction with content layer */
.parallax-layer.layer-content {
    pointer-events: auto;
    position: relative;
}

/* Background layer - moves slowest, furthest back */
.layer-bg {
    transform: translateZ(-300px) scale(1.3);
    z-index: 1;
}

/* Mid-background layer */
.layer-mid-bg {
    transform: translateZ(-200px) scale(1.2);
    z-index: 2;
}

/* Mid layer */
.layer-mid {
    transform: translateZ(-100px) scale(1.1);
    z-index: 3;
}

/* Content layer - no transform, main interaction */
.layer-content {
    transform: translateZ(0);
    z-index: 4;
}

/* Foreground layer - moves fastest, closest */
.layer-fg {
    transform: translateZ(50px) scale(0.95);
    z-index: 5;
}

/* ===========================================
   HERO PARALLAX SECTION
   =========================================== */
.hero-parallax {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--f3l1x-gradient-hero);
}

/* Animated grid background */
.parallax-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Floating orbs for depth */
.parallax-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: orbFloat 8s ease-in-out infinite;
}

.orb-blue {
    background: radial-gradient(circle, var(--f3l1x-blue-primary) 0%, transparent 70%);
}

.orb-purple {
    background: radial-gradient(circle, var(--f3l1x-purple) 0%, transparent 70%);
}

.orb-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: -50px;
    animation-delay: -2s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    top: 40%;
    left: 30%;
    animation-delay: -4s;
}

@keyframes orbFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(20px, -20px) scale(1.05);
    }
    50% {
        transform: translate(0, -30px) scale(1);
    }
    75% {
        transform: translate(-20px, -10px) scale(0.95);
    }
}

/* ===========================================
   FLOATING ELEMENTS (3D Tilt Effect)
   =========================================== */
.float-element {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
}

.float-element:hover {
    transform: translateZ(20px);
}

/* Cards with 3D hover tilt */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.tilt-card:hover {
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 30px var(--f3l1x-blue-glow);
}

/* Inner content lifts on hover */
.tilt-card .card-inner {
    transform: translateZ(30px);
    transition: transform 0.3s ease;
}

/* ===========================================
   SCROLL-BASED PARALLAX
   =========================================== */
[data-parallax] {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* Speed variants for scroll parallax */
[data-speed="slow"] {
    --parallax-speed: 0.2;
}

[data-speed="medium"] {
    --parallax-speed: 0.5;
}

[data-speed="fast"] {
    --parallax-speed: 0.8;
}

/* ===========================================
   FLOATING PARTICLES
   =========================================== */
.particles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--f3l1x-blue-light);
    border-radius: 50%;
    opacity: 0.3;
    animation: particleFloat 15s linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 12s; }
.particle:nth-child(2) { left: 20%; animation-delay: -2s; animation-duration: 14s; }
.particle:nth-child(3) { left: 30%; animation-delay: -4s; animation-duration: 16s; }
.particle:nth-child(4) { left: 40%; animation-delay: -6s; animation-duration: 13s; }
.particle:nth-child(5) { left: 50%; animation-delay: -8s; animation-duration: 15s; }
.particle:nth-child(6) { left: 60%; animation-delay: -10s; animation-duration: 17s; }
.particle:nth-child(7) { left: 70%; animation-delay: -12s; animation-duration: 14s; }
.particle:nth-child(8) { left: 80%; animation-delay: -14s; animation-duration: 16s; }
.particle:nth-child(9) { left: 90%; animation-delay: -16s; animation-duration: 13s; }
.particle:nth-child(10) { left: 95%; animation-delay: -18s; animation-duration: 15s; }

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ===========================================
   IMAGE DEPTH EFFECT
   =========================================== */
.depth-image {
    position: relative;
    transform-style: preserve-3d;
}

.depth-image::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    background: inherit;
    background-size: cover;
    filter: blur(20px);
    opacity: 0.3;
    transform: translateZ(-50px) scale(1.1);
    z-index: -1;
}

/* ===========================================
   SECTION DIVIDERS WITH DEPTH
   =========================================== */
.depth-divider {
    position: relative;
    height: 150px;
    overflow: hidden;
}

.depth-divider-wave {
    position: absolute;
    width: 200%;
    height: 100%;
    left: -50%;
}

.wave-back {
    fill: var(--f3l1x-bg-section);
    opacity: 0.3;
    animation: waveMove 8s linear infinite;
}

.wave-front {
    fill: var(--f3l1x-bg-dark);
    animation: waveMove 6s linear infinite reverse;
}

@keyframes waveMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(25%); }
}

/* ===========================================
   STATS CARDS 3D EFFECT
   =========================================== */
.stat-card-3d {
    position: relative;
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.stat-card-3d::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%
    );
    border-radius: inherit;
    pointer-events: none;
}

.stat-card-3d:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) translateZ(10px);
}

/* Floating badge effect */
.stat-value {
    transform: translateZ(40px);
    display: inline-block;
}

/* ===========================================
   RESPONSIVE ADJUSTMENTS
   =========================================== */
@media (max-width: 992px) {
    .parallax-orb {
        opacity: 0.2;
    }

    .orb-1 {
        width: 250px;
        height: 250px;
    }

    .orb-2 {
        width: 200px;
        height: 200px;
    }

    .orb-3 {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Reduce parallax intensity on mobile for performance */
    .layer-bg { transform: translateZ(-100px) scale(1.1); }
    .layer-mid-bg { transform: translateZ(-75px) scale(1.075); }
    .layer-mid { transform: translateZ(-50px) scale(1.05); }
    .layer-fg { transform: translateZ(25px) scale(0.975); }

    .parallax-grid {
        background-size: 30px 30px;
    }

    .particles-container {
        display: none;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .parallax-orb,
    .particle,
    .wave-back,
    .wave-front {
        animation: none;
    }

    .parallax-grid {
        animation: none;
        opacity: 0.3;
    }

    .tilt-card,
    .float-element,
    .stat-card-3d {
        transition: none;
    }
}
