/* Smooth Scrolling - Global Optimizations */

/* Ultra smooth scrolling - Fluid motion */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-padding-top: 80px; /* Account for fixed header */
}

/* Force smooth scrolling with momentum */
html, body {
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: smooth;
}

/* Momentum scrolling for smoother feel */
* {
    -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Performance optimizations for smooth scrolling */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain; /* Prevent scroll chaining */
    scroll-behavior: smooth !important;
}

/* Ultra smooth scrolling */
html, body, main, section, div {
    scroll-behavior: smooth;
}

/* Force GPU acceleration for smoother scrolling */
body {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: scroll-position;
    scroll-behavior: smooth !important;
}

/* Ultra smooth scrolling - enhance all scrolling elements */
html, body, main, section {
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Smooth scroll with momentum */
@supports (-webkit-overflow-scrolling: touch) {
    html, body {
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Prevent layout shifts during scroll */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Optimize scroll performance - Force GPU acceleration */
.container,
.container-fluid,
section,
main,
.tp-category-item,
.category-item,
.tp-product-item,
.product-item {
    will-change: scroll-position;
    transform: translateZ(0); /* Force GPU acceleration */
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Smooth anchor link scrolling */
a[href^="#"] {
    scroll-margin-top: 80px;
}

/* Fix for fixed headers */
header,
.navbar,
.tp-header-area {
    position: relative;
    z-index: 1000;
}

/* Prevent scroll jumps */
.swiper-container,
.swiper-wrapper,
.swiper-slide {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Optimize images during scroll */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Smooth transitions */
.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    html {
        scroll-padding-top: 60px;
    }
    
    a[href^="#"] {
        scroll-margin-top: 60px;
    }
}

