/*!
 * G2Own Performance-Optimized CSS
 * GPU-accelerated animations and optimized rendering
 */

/* GPU acceleration for all animated elements */
.category-card,
.feature-card,
.auth-dropdown,
.navbar,
.hero-section {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimized category cards */
.category-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease-out;
    will-change: transform;
    contain: layout style paint;
}

.category-card:hover {
    transform: translate3d(0, -8px, 0) scale(1.02);
    will-change: transform;
}

.category-card.animating {
    will-change: transform, opacity;
}

/* Optimized feature cards */
.feature-card {
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translate3d(0, 0, 0);
    contain: layout style;
}

.feature-card:hover {
    transform: translate3d(0, -4px, 0) scale(1.03);
}

/* Auth dropdown optimizations */
.auth-dropdown {
    contain: layout style paint;
    transform: translateZ(0);
    transition: opacity 0.2s ease-out,
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-dropdown.show {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
}

.auth-dropdown.hide {
    transform: translate3d(0, -10px, 0) scale(0.95);
    opacity: 0;
}

/* Navbar performance optimizations */
.navbar {
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.3s ease;
    contain: layout style;
}

.navbar.scrolled {
    transform: translate3d(0, 0, 0);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Optimized gradients to reduce paint operations */
.gaming-gradient {
    background: linear-gradient(135deg, #8b0000 0%, #ff4444 100%);
    background-attachment: fixed;
}

.gaming-gradient-alt {
    background: linear-gradient(45deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Hero section optimizations */
.hero-section {
    will-change: transform;
    contain: layout;
}

.hero-content {
    transform: translate3d(0, 0, 0);
    will-change: opacity, transform;
}

/* Button optimizations */
.btn,
.gaming-btn,
.auth-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

.btn:hover,
.gaming-btn:hover {
    transform: translate3d(0, -2px, 0);
}

.btn:active,
.gaming-btn:active {
    transform: translate3d(0, 0, 0);
    transition-duration: 0.1s;
}

/* Animation classes for intersection observer */
.animate-on-scroll {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
    transition: none;
}

.animate-on-scroll.animating {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stats animation */
.stats-item {
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

.stats-item.animating {
    will-change: contents;
}

/* Image optimizations */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.lazy-image {
    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; }
}

/* Scrollbar optimizations */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

/* Font loading optimizations */
@font-face {
    font-family: 'Gaming-Font';
    font-display: swap;
    src: url('fonts/gaming-font.woff2') format('woff2'),
         url('fonts/gaming-font.woff') format('woff');
}

/* Reduce motion for accessibility and performance */
@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;
    }
    
    .category-card,
    .feature-card,
    .btn {
        will-change: auto !important;
        transform: none !important;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .category-card,
    .feature-card {
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .category-card,
    .feature-card {
        transition-duration: 0.2s;
    }
    
    .auth-dropdown {
        contain: layout;
    }
    
    /* Reduce blur effects on mobile for better performance */
    .navbar.scrolled {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background-color: rgba(0, 0, 0, 0.9);
    }
}

/* Print styles to prevent unnecessary processing */
@media print {
    .navbar,
    .auth-dropdown,
    .category-card,
    .feature-card {
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }
}

/* Performance monitoring styles */
.performance-monitor {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    z-index: 10000;
    display: none;
}

.performance-monitor.show {
    display: block;
}

/* Optimized utility classes */
.gpu-accelerated {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.contain-layout {
    contain: layout;
}

.contain-paint {
    contain: paint;
}

.contain-style {
    contain: style;
}

.will-change-transform {
    will-change: transform;
}

.will-change-auto {
    will-change: auto;
}
