/* Pure Natural Scroll System */
/* Completely natural scrolling with visual enhancements only */

/* Disable any scroll behavior interference */
html {
    scroll-behavior: auto;
}

body {
    overflow-x: hidden;
    /* Optimize for smooth scrolling performance */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
}

/* Section Setup */
.scroll-section {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1000px;
    will-change: transform;
}

/* Parallax Background Base */
.parallax-background {
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    z-index: 0;
    will-change: transform;
    pointer-events: none;
}

/* Background Floating Elements */
.bg-floater {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
    pointer-events: none;
    opacity: 0.6;
}

/* Section Content Containers - Fixed Layering */
.scroll-section .container {
    position: relative;
    z-index: 100;
    transform-style: preserve-3d;
    will-change: transform;
}

/* Ensure all content is properly layered above backgrounds */
.scroll-section .container > * {
    position: relative;
    z-index: 10;
}

/* Flying Box Animations - Fixed Layering */
.mode-item,
.feature-card,
.gallery-item,
.detail-item,
.stat-card,
.steam-stats .stat-item {
    position: relative;
    z-index: 20;
    transform-style: preserve-3d;
    will-change: transform, opacity;
    transition: all 0.3s ease;
    transform: translateZ(0); /* Force GPU layer */
}

/* Enhanced Box Hover Effects */
/* Separate hover effects for different elements */
.feature-card:hover,
.gallery-item:hover,
.detail-item:hover,
.stat-card:hover {
    transform: translateY(-15px) rotateY(8deg) rotateX(8deg) scale(1.05) !important;
    box-shadow:
        0 25px 50px rgba(0, 212, 255, 0.4),
        0 0 30px rgba(108, 43, 217, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.5);
}

/* Special hover effect for mode items to preserve intended slide behavior */
.mode-item:hover {
    transform: translateY(-5px) scale(1.02) !important; /* Remove horizontal translation */
    box-shadow:
        0 0 0 1px rgba(0, 212, 255, 0.8), /* Border effect */
        0 15px 30px rgba(0, 212, 255, 0.3),
        0 0 20px rgba(108, 43, 217, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Enhanced Box Animations */
.mode-item,
.feature-card,
.gallery-item,
.detail-item,
.stat-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Scroll-triggered animations */
@keyframes boxSlideIn {
    0% {
        transform: translateX(-100px) translateY(50px) rotate(-10deg) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateX(10px) translateY(-10px) rotate(2deg) scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
}

@keyframes boxSlideInRight {
    0% {
        transform: translateX(100px) translateY(50px) rotate(10deg) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateX(-10px) translateY(-10px) rotate(-2deg) scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
}

.box-animate-left {
    animation: boxSlideIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.box-animate-right {
    animation: boxSlideInRight 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Section Background Images */
.section-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.section-bg-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(8px) brightness(0.3) saturate(1.2);
    transform: scale(1.1); /* Prevent blur edge artifacts */
    transition: all 0.3s ease;
}

/* Section-Specific Parallax Backgrounds */

/* Hero Section */
.hero .parallax-background {
    background:
        radial-gradient(circle at 20% 80%, rgba(108, 43, 217, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 212, 255, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 107, 157, 0.2) 0%, transparent 70%);
}

/* Features Section */
.features .parallax-background {
    background:
        linear-gradient(135deg, rgba(255, 107, 157, 0.3) 0%, rgba(108, 43, 217, 0.4) 100%),
        radial-gradient(ellipse at 30% 70%, rgba(0, 212, 255, 0.3) 0%, transparent 60%);
    z-index: 2; /* Above background image */
}

.features .section-bg-image {
    z-index: 1; /* Behind parallax */
}

/* Gameplay Section */
.gameplay .parallax-background {
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(0, 212, 255, 0.3) 0%, transparent 70%),
        linear-gradient(180deg, transparent 0%, rgba(26, 26, 29, 0.9) 100%),
        conic-gradient(from 180deg at 70% 30%, rgba(108, 43, 217, 0.2), transparent);
}

/* Gallery Section */
.gallery .parallax-background {
    background:
        conic-gradient(from 45deg at 30% 70%, rgba(108, 43, 217, 0.5), rgba(0, 212, 255, 0.4), rgba(255, 107, 157, 0.3)),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    z-index: 2; /* Above background image */
}

.gallery .section-bg-image {
    z-index: 1; /* Behind parallax */
}

.gallery-background {
    position: relative;
}

/* Steam Section */
.steam .parallax-background {
    background: 
        radial-gradient(circle at 70% 30%, rgba(255, 107, 157, 0.4) 0%, transparent 60%),
        linear-gradient(45deg, rgba(108, 43, 217, 0.2) 0%, transparent 100%),
        radial-gradient(ellipse at 20% 80%, rgba(0, 212, 255, 0.2) 0%, transparent 50%);
}

/* Advanced Floating Animations */
@keyframes advancedFloat {
    0% {
        transform: translateY(100vh) translateX(-50px) rotate(0deg) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translateY(80vh) translateX(-30px) rotate(36deg) scale(0.7);
    }
    50% {
        transform: translateY(50vh) translateX(30px) rotate(180deg) scale(1);
        opacity: 0.8;
    }
    90% {
        opacity: 1;
        transform: translateY(20vh) translateX(50px) rotate(324deg) scale(0.7);
    }
    100% {
        transform: translateY(-20vh) translateX(70px) rotate(360deg) scale(0.3);
        opacity: 0;
    }
}

@keyframes parallaxPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.9;
    }
}

@keyframes parallaxDrift {
    0% {
        transform: translateX(0px) translateY(0px);
    }
    25% {
        transform: translateX(50px) translateY(-30px);
    }
    50% {
        transform: translateX(0px) translateY(-60px);
    }
    75% {
        transform: translateX(-50px) translateY(-30px);
    }
    100% {
        transform: translateX(0px) translateY(0px);
    }
}

/* Enhanced Background Floaters */
.bg-floater:nth-child(1) {
    animation: advancedFloat 25s linear infinite, parallaxPulse 8s ease-in-out infinite;
    animation-delay: 0s, 2s;
}

.bg-floater:nth-child(2) {
    animation: advancedFloat 30s linear infinite, parallaxDrift 12s ease-in-out infinite;
    animation-delay: 5s, 0s;
}

.bg-floater:nth-child(3) {
    animation: advancedFloat 20s linear infinite, parallaxPulse 6s ease-in-out infinite;
    animation-delay: 10s, 4s;
}

.bg-floater:nth-child(4) {
    animation: advancedFloat 35s linear infinite, parallaxDrift 15s ease-in-out infinite;
    animation-delay: 15s, 8s;
}

.bg-floater:nth-child(5) {
    animation: advancedFloat 28s linear infinite, parallaxPulse 10s ease-in-out infinite;
    animation-delay: 20s, 6s;
}

/* Section Transition Effects */
.section-transitioning {
    pointer-events: none;
}

.section-entering {
    animation: sectionEnter 1.5s ease-out forwards;
}

.section-leaving {
    animation: sectionLeave 1s ease-in forwards;
}

@keyframes sectionEnter {
    0% {
        transform: rotateY(15deg) rotateX(-5deg) translateZ(100px);
        opacity: 0.3;
    }
    100% {
        transform: rotateY(0deg) rotateX(0deg) translateZ(0px);
        opacity: 1;
    }
}

@keyframes sectionLeave {
    0% {
        transform: rotateY(0deg) rotateX(0deg) translateZ(0px);
        opacity: 1;
    }
    100% {
        transform: rotateY(-15deg) rotateX(5deg) translateZ(-100px);
        opacity: 0.7;
    }
}

/* Box Flying Animations */
.box-fly-in-left {
    animation: flyInLeft 0.8s ease-out forwards;
}

.box-fly-in-right {
    animation: flyInRight 0.8s ease-out forwards;
}

.box-fly-out-up {
    animation: flyOutUp 0.6s ease-in forwards;
}

@keyframes flyInLeft {
    0% {
        transform: translateX(-200px) translateY(100px) rotate(-15deg);
        opacity: 0;
    }
    100% {
        transform: translateX(0px) translateY(0px) rotate(0deg);
        opacity: 1;
    }
}

@keyframes flyInRight {
    0% {
        transform: translateX(200px) translateY(100px) rotate(15deg);
        opacity: 0;
    }
    100% {
        transform: translateX(0px) translateY(0px) rotate(0deg);
        opacity: 1;
    }
}

@keyframes flyOutUp {
    0% {
        transform: translateX(0px) translateY(0px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-100px) translateY(-200px) rotate(-15deg);
        opacity: 0;
    }
}

/* Section-Based Scroll Indicator */
.section-scroll-indicator {
    user-select: none;
    pointer-events: none;
}

.section-scroll-indicator .scroll-mode-text {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.section-scroll-indicator .scroll-mode-icon {
    font-size: 1.2rem;
}

.section-progress {
    position: relative;
    overflow: hidden;
}

.section-progress-fill {
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

.section-info {
    text-align: center;
}

/* Scroll Progress Indicator */
.scroll-progress-advanced {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.scroll-progress-bar-advanced {
    height: 100%;
    background: linear-gradient(90deg, #6c2bd9, #00d4ff, #ff6b9d);
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    will-change: transform;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .scroll-section {
        perspective: 500px;
    }
    
    .parallax-background {
        top: -10%;
        left: -10%;
        width: 120%;
        height: 120%;
    }
    
    .feature-card:hover,
    .gallery-item:hover,
    .detail-item:hover,
    .stat-card:hover {
        transform: translateY(-5px) rotateY(2deg) rotateX(2deg) !important;
    }

    .mode-item:hover {
        transform: translateY(-3px) !important; /* Remove horizontal translation */
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .scroll-section,
    .parallax-background,
    .bg-floater,
    .mode-item,
    .feature-card,
    .gallery-item,
    .detail-item,
    .stat-card {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
    
    html {
        scroll-behavior: smooth;
    }
}
