/* Scroll Performance Optimization */

/* Enable hardware acceleration for smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body {
    /* Optimize rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Optimize elements that are frequently animated */
.header-area,
.site-header,
.nav-menu,
.category-item,
.header-icon,
.shop-now-btn {
    /* Enable hardware acceleration */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}


/* Optimize parallax elements */
.parallax {
    /* Use GPU acceleration */
    transform: translateZ(0);
    will-change: transform;
    /* Reduce repaints */
    contain: layout style paint;
}

/* Optimize modal animations */
.cover-modal {
    /* Use GPU acceleration */
    transform: translateZ(0);
    will-change: transform, opacity;
    /* Reduce repaints */
    contain: layout style paint;
}

/* Optimize cart animations */
.cart-dropdown,
.cart-item,
.add-to-cart-animation {
    /* Use GPU acceleration */
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .parallax > use {
        animation: none !important;
    }
    
}

/* Optimize for mobile devices */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .parallax > use {
        animation-duration: 40s !important;
    }
    
    .category-item:hover {
        transform: none !important;
    }
    
    .header-icon:hover {
        transform: none !important;
    }
    
    .shop-now-btn:hover {
        transform: none !important;
    }
}

/* Optimize scroll performance */
.scroll-container {
    /* Enable smooth scrolling */
    scroll-behavior: smooth;
    /* Optimize scrolling performance */
    -webkit-overflow-scrolling: touch;
    /* Reduce scroll jank */
    contain: layout style paint;
}

/* Optimize images for better scroll performance */
img {
    /* Prevent layout shift */
    height: auto;
    /* Optimize rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Optimize lazy loading elements */
.lazy-load {
    /* Use GPU acceleration */
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Optimize sticky elements */
.sticky {
    /* Use GPU acceleration */
    transform: translateZ(0);
    will-change: transform;
    /* Optimize sticky behavior */
    contain: layout style paint;
}
