/* Performance fixes for smoother scrolling */

/* Optimize scroll progress bar */
#progress-bar {
    will-change: width;
    transform: translateZ(0); /* Enable hardware acceleration */
    -webkit-transform: translateZ(0);
}

/* Optimize navbar animations */
.navbar {
    will-change: background-color, border-color;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Optimize hero section */
.hero::before {
    will-change: opacity;
    /* Reduced animation duration to improve performance */
    animation-duration: 20s !important;
    /* Simplified animation */
    animation-iteration-count: infinite;
}

/* Optimize elements with hover effects */
.navbar-link, 
.cta-button, 
.theme-toggle,
.benefit-card,
.faq-item,
.testimonial-card {
    /* Use transform and opacity for better performance */
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Optimize animations that run during scroll */
.fade-in-section {
    /* Use transform instead of other properties */
    will-change: transform, opacity;
}

/* Optimize for sticky elements */
.navbar {
    /* Ensure proper compositing */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Optimize animated elements */
@keyframes subtle-pan {
    0% { transform: scale(1.1) translate(1%,-1%); } /* Reduced movement */
    50% { transform: scale(1.1) translate(-1%,1%); }
    100% { transform: scale(1.1) translate(1%,-1%); }
}

/* Optimize complex animated elements */
.portfolio-item,
.pricing-card,
.benefit-card {
    /* Reduce animation complexity on scroll */
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

/* Optimize elements that change on scroll */
section {
    /* Prevent layout thrashing */
    contain: layout style paint;
}

/* Reduce CSS filter usage which can be expensive */
.faq-item,
.testimonial-card {
    /* Only use lightweight effects */
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

/* Optimize for scroll-bound animations */
.how-it-works .step,
.kpi-section .kpi-card,
.locations-section .location-item {
    /* Reduce animation complexity */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

/* Optimize parallax and animated backgrounds */
body::before {
    /* Reduce expensive background transitions */
    transition: opacity 0.4s ease;
    will-change: opacity;
}

/* Use hardware acceleration for elements with transforms */
section:nth-of-type(even) {
    will-change: transform;
}

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

/* Optimize container queries */
.container {
    /* Reduce reflow */
    contain: layout style;
}