/* Scroll Performance Optimizations */

/* Disable smooth scroll behavior globally to prevent conflicts */
html,
*,
*::before,
*::after {
  scroll-behavior: auto !important;
}

/* Override Bootstrap smooth scrolling */
@media (prefers-reduced-motion: no-preference) {
  :root {
    scroll-behavior: auto !important;
  }
}

/* Optimize elements that will be animated/transformed */
header.autoshow,
.back-to-top,
.show-on-scroll,
.float-text,
.scrollbar-v,
.fadeScroll {
  will-change: transform, opacity;
  transform: translateZ(0); /* Force hardware acceleration */
}

/* Optimize parallax and scroll-based animations */
[data-scroll-speed],
.de-progress,
.timer,
.section-dark {
  will-change: transform;
  transform: translateZ(0);
}

/* Optimize header transitions - be specific about properties */
header.autoshow {
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* Optimize scroll indicators */
div.scrollbar,
div.scrollbar-v {
  will-change: width, height;
  transform: translateZ(0);
}

/* Optimize fade elements */
.fadeScroll {
  will-change: opacity;
}

/* Reduce paint operations for smooth scrolling */
* {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Optimize transform operations */
.transform-optimized {
  transform: translateZ(0);
  will-change: transform;
}

/* Optimize animations that run on scroll */
.parallax-element {
  will-change: transform;
  transform: translateZ(0);
}

/* Reduce layout thrashing */
.fixed-elements {
  position: fixed;
  will-change: transform;
}

/* Override problematic transitions from main CSS */
* {
  transition: none !important;
}

/* Re-enable specific transitions for elements that need them */
header,
.back-to-top,
.show-on-scroll,
.scrollbar,
.scrollbar-v {
  transition: transform 0.3s ease-out, opacity 0.3s ease-out !important;
}

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

/* Prevent scroll lag on mobile */
@media (max-width: 768px) {
  * {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}
