/* Performance Optimized Animations and Effects */

/* Root scroll behavior optimization */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for fixed navbar */
}

/* Enable hardware acceleration and smooth transitions */
*, *::before, *::after {
    will-change: auto;
    transform-style: preserve-3d;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Body optimization for smooth scrolling */
body {
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
    overscroll-behavior: none; /* Prevent overscroll bounce */
}

/* Optimized navbar transitions */
.navbar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Smooth button hover effects */
.btn {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Fade-in animation for content */
.service-card,
.gallery-item,
.feature,
.stat {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.service-card.animate-in,
.gallery-item.animate-in,
.feature.animate-in,
.stat.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Form validation states */
.form-group.valid input,
.form-group.valid textarea,
.form-group.valid select {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group.invalid input,
.form-group.invalid textarea,
.form-group.invalid select {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Quick service button states */
.quick-service {
    transition: all 0.2s ease;
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

.quick-service:hover,
.quick-service.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    transform: translateY(-1px);
}

/* Gallery filter transitions */
.gallery-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item[style*="display: none"] {
    opacity: 0;
    transform: scale(0.9);
}

/* Back to top button */
.back-to-top {
    transition: opacity 0.3s ease, transform 0.3s ease;
    will-change: transform, opacity;
}

.back-to-top:hover {
    transform: translateY(-2px);
}

/* Optimize image loading */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img:not(.lazy) {
    opacity: 1;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Mobile performance optimizations */
@media (max-width: 768px) {
    .navbar {
        transform: translate3d(0, 0, 0);
    }
    
    .btn:hover {
        transform: none; /* Disable hover effects on mobile */
    }
    
    .service-card,
    .gallery-item {
        will-change: auto; /* Reduce GPU usage on mobile */
    }
}

/* Scrollbar optimization */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.8);
}
