/* Chrome-specific Performance Optimizations */
/* This file addresses Chrome's compositing and scrolling issues */

/* Force GPU acceleration for smooth scrolling */
@supports (-webkit-appearance: none) {
    /* Chrome/Edge specific optimizations */
    html {
        -webkit-font-smoothing: subpixel-antialiased;
        text-rendering: optimizeSpeed;
    }
    
    /* Optimize main sections for Chrome compositor */
    .hero-section,
    .section,
    .footer-section {
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        perspective: 1000px;
        -webkit-perspective: 1000px;
    }
    
    /* Reduce repaints during scroll */
    .scrolling * {
        will-change: auto !important;
    }
    
    /* Optimize 3D canvas during scroll */
    .scrolling .three-d-canvas {
        will-change: auto !important;
        pointer-events: none;
    }
    
    /* Fix Chrome text rendering during transforms */
    h1, h2, h3, h4, h5, h6, p {
        -webkit-font-smoothing: antialiased;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    /* Optimize images and gradients */
    img {
        image-rendering: -webkit-optimize-contrast;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    /* Fix gradient text in Chrome */
    .gradient-text {
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    /* Optimize animations */
    [class*="animate"],
    [class*="fade"],
    .flip-card-inner {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
    
    /* Reduce compositor layers */
    .main-header {
        will-change: auto;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    /* Chrome scroll anchoring fix */
    body {
        overflow-anchor: none;
    }
}

/* Chrome-only using -webkit-min-device-pixel-ratio */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
    /* Disable will-change on elements that don't need it */
    .section-title,
    .section-subtitle,
    .feature-card,
    .step-card {
        will-change: auto !important;
    }
    
    /* Optimize scroll container */
    html, body {
        scroll-behavior: auto !important;
        -webkit-overflow-scrolling: auto;
    }
    
    /* Fix janky animations */
    * {
        -webkit-transform: translateZ(0);
        -webkit-backface-visibility: hidden;
    }
}

/* High refresh rate displays (120Hz+) */
@media (min-resolution: 2dppx) {
    /* Reduce complexity for high DPI */
    .three-d-canvas {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Reduce motion for performance */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}