/* Scrolling Effects and Animations */

/* Parallax Background Animations */
.hero::before {
    animation: particleFloat 20s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg) scale(1); }
    33% { transform: translateY(-10px) rotate(2deg) scale(1.1); }
    66% { transform: translateY(5px) rotate(-1deg) scale(0.9); }
}

/* Floating Orb Animations */
.floating-orb {
    animation: orbFloat 8s ease-in-out infinite;
}

@keyframes orbFloat {
    0%, 100% { 
        transform: translateY(0px) rotateZ(0deg) scale(1);
        filter: blur(40px);
    }
    50% { 
        transform: translateY(-30px) rotateZ(180deg) scale(1.2);
        filter: blur(20px);
    }
}

/* Scroll-triggered Element States */

/* Stats Section */
.stat-item {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-item.animate {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Section Titles */
.section-title {
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-title.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Section Subtitles */
.section-subtitle {
    opacity: 0;
    transform: translateY(20px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

.section-subtitle.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Filter Buttons */
.filter-btn {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-btn.animate {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Project Cards */
.project-card {
    opacity: 0;
    transform: translateY(50px) rotateX(10deg);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card.animate {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
}

/* Testimonial Cards */
.testimonial-card {
    opacity: 0;
    transform: translateX(-50px) rotateY(10deg);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.testimonial-card.animate {
    opacity: 1;
    transform: translateX(0) rotateY(0deg);
}

/* Footer Content */
.footer-content {
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-content.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Advanced Scroll Effects */

/* Staggered Animations */
.stat-item:nth-child(1) { transition-delay: 0.1s; }
.stat-item:nth-child(2) { transition-delay: 0.2s; }
.stat-item:nth-child(3) { transition-delay: 0.3s; }
.stat-item:nth-child(4) { transition-delay: 0.4s; }

.project-card:nth-child(1) { transition-delay: 0.1s; }
.project-card:nth-child(2) { transition-delay: 0.2s; }
.project-card:nth-child(3) { transition-delay: 0.3s; }
.project-card:nth-child(4) { transition-delay: 0.4s; }
.project-card:nth-child(5) { transition-delay: 0.5s; }
.project-card:nth-child(6) { transition-delay: 0.6s; }

.testimonial-card:nth-child(1) { transition-delay: 0.1s; }
.testimonial-card:nth-child(2) { transition-delay: 0.3s; }
.testimonial-card:nth-child(3) { transition-delay: 0.5s; }

/* Parallax Elements */
.parallax-element {
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a3e;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #00d4ff, #ff006e);
    border-radius: 10px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #ff006e, #00d4ff);
    transform: scale(1.1);
}

::-webkit-scrollbar-thumb:active {
    background: linear-gradient(45deg, #00d4ff, #ff79c6);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #00d4ff #1a1a3e;
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #00d4ff, #ff006e);
    z-index: 9999;
    transition: width 0.1s ease;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

/* Scroll-based Transforms */
.scroll-transform {
    transition: transform 0.2s ease-out;
}

/* Enhanced Floating Effects */
.floating-element {
    animation: floatingMotion 6s ease-in-out infinite;
}

@keyframes floatingMotion {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* Section Fade-in Effects */
.fade-in-section {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll-triggered Scale Effects */
.scale-on-scroll {
    transform: scale(0.95);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-on-scroll.in-view {
    transform: scale(1);
}

/* Rotation Effects */
.rotate-on-scroll {
    transition: transform 0.3s ease-out;
}

/* Blur Effects */
.blur-on-scroll {
    transition: filter 0.3s ease-out;
}

/* Perspective Effects */
.perspective-scroll {
    perspective: 1000px;
}

.perspective-item {
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Optimizations */
@media (prefers-reduced-motion: reduce) {
    .stat-item,
    .section-title,
    .section-subtitle,
    .filter-btn,
    .project-card,
    .testimonial-card,
    .footer-content {
        transition: none;
        animation: none;
    }
    
    .parallax-element {
        transform: none !important;
    }
}

@media (max-width: 768px) {
    /* Reduce complex animations on mobile */
    .project-card {
        transform: translateY(30px);
    }
    
    .project-card.animate {
        transform: translateY(0);
    }
    
    .testimonial-card {
        transform: translateY(30px);
    }
    
    .testimonial-card.animate {
        transform: translateY(0);
    }
}