/* Performance Optimizations CSS */

/* Loading States */
.loading-placeholder {
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Font Loading Optimization */
@font-face {
    font-family: 'Inter-fallback';
    font-display: swap;
    src: local('Inter'), local(-apple-system), local(system-ui);
}

@font-face {
    font-family: 'Orbitron-fallback'; 
    font-display: swap;
    src: local('Orbitron'), local('Courier New'), local(monospace);
}

.font-loading body {
    font-family: system-ui, -apple-system, sans-serif;
}

/* Font loading states */
.fonts-loaded {
    font-family: var(--font-primary);
}

.fonts-failed {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Critical CSS - Above the fold content */
.critical-content {
    visibility: visible;
    opacity: 1;
}

.deferred-content {
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease;
}

.deferred-content.loaded {
    visibility: visible;
    opacity: 1;
}

/* Reduce motion for performance */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .particles {
        display: none !important;
    }
    
    .floating-controller {
        animation: none !important;
    }
}

/* GPU Acceleration for animations */
.gpu-accelerated {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
    transform: translateZ(0);
}

/* Optimize images */
img {
    height: auto;
    max-width: 100%;
}

img[data-src] {
    filter: blur(5px);
    transition: filter 0.3s;
}

img.loaded {
    filter: blur(0px);
}

/* Critical path CSS inlining helper */
.above-fold {
    critical: true;
}

.below-fold {
    critical: false;
    contain: layout style paint;
}

/* Optimized scrolling */
.smooth-scroll {
    scroll-behavior: smooth;
}

@supports (scroll-behavior: smooth) {
    html {
        scroll-behavior: smooth;
    }
}