/* SmartCalcs - Performance Optimization CSS */

/* LOADING PERFORMANCE IMPROVEMENTS */
* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* CRITICAL RENDERING PATH OPTIMIZATION */
.above-fold {
    will-change: transform;
}

/* IMAGE PERFORMANCE */
img {
    max-width: 100%;
    height: auto;
    display: block;
    loading: lazy;
    decoding: async;
}

/* ANIMATION PERFORMANCE */
.animate {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* CSS TRANSITIONS PERFORMANCE */
* {
    transition-property: transform, opacity, background-color, border-color, box-shadow;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* MOBILE PERFORMANCE OPTIMIZATIONS */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Optimize mobile scrolling */
    body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }
    
    /* Mobile viewport fixes */
    .container {
        width: 100%;
        overflow-x: hidden;
    }
}

/* CRITICAL CSS RENDERING */
.critical {
    display: block;
    visibility: visible;
}

/* LAZY LOADING HELPERS */
.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy.loaded {
    opacity: 1;
}

/* MOBILE TOUCH OPTIMIZATION */
@media (max-width: 768px) {
    button, .btn, a {
        -webkit-tap-highlight-color: rgba(255, 107, 53, 0.2);
        touch-action: manipulation;
    }
    
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
}

/* GPU ACCELERATION FOR SMOOTH ANIMATIONS */
.gpu-accelerate {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

/* MEMORY EFFICIENT STYLES */
.efficient {
    contain: layout style paint;
}

/* REDUCE REPAINTS AND REFLOWS */
.no-layout-shift {
    contain: layout;
}