/* Fast-Loading Optimizations and Enhanced Styling */

/* Critical CSS for above-the-fold content */
.hero-gradient {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

/* Preload critical fonts */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hiA.woff2') format('woff2');
}

/* Optimized animations */
.pulse-call {
    animation: pulse-call 2s infinite;
}

@keyframes pulse-call {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Service card hover effects */
.service-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Optimized image loading */
img {
    /* Note: `loading` and `decoding` are HTML attributes, not CSS properties */
    /* Move these to HTML <img> tags for best practice */
}

/* Critical images should be loaded immediately */
.hero img,
.above-fold img {
    /* loading and decoding attributes should also be added in HTML */
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html {
        scroll-behavior: auto;
    }
}

/* Performance optimizations */
.container {
    contain: layout style;
}

/* Lazy loading placeholder */
.lazy-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Enhanced button styles */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    color: #fff;
    border: none;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Trust badge styling */
.trust-badge {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.39);
}

/* Optimized typography */
.text-responsive {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.heading-responsive {
    font-size: clamp(1.5rem, 5vw, 3rem);
}

/* Grid optimizations */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Enhanced focus states for accessibility */
.focus-visible:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Optimized shadows */
.shadow-optimized {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-optimized-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Mobile-first responsive design */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .grid-mobile-stack > * {
        grid-column: 1 / -1;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    .grid-tablet-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop optimizations */
@media (min-width: 1025px) {
    .grid-desktop-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    .grid-desktop-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    .print-break {
        page-break-before: always;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: #1f2937;
        color: #f9fafb;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .service-card {
        border: 2px solid currentColor;
    }
}

/* Reduced data mode */
@media (prefers-reduced-data: reduce) {
    .background-image {
        background-image: none !important;
    }
}

/* Critical path CSS */
.critical-css {
    display: block;
}

/* WebP support with fallback */
.webp-support {
    background-image: url('image.webp');
}

.no-webp .webp-support {
    background-image: url('image.jpg');
}

/* Intersection Observer animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading states */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

/* Enhanced form styles */
.form-input {
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
}

.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Optimized button loading states */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Performance monitoring */
.perf-mark {
    display: none;
}
