/* SEO y Performance Optimizations */

/* Lazy Loading Images */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Preload optimización */
.preload-critical {
    font-display: swap;
}

/* Core Web Vitals optimizations */
.img-fluid {
    height: auto;
    max-width: 100%;
    aspect-ratio: auto;
}

/* Breadcrumbs SEO styling */
.breadcrumb-nav {
    background: var(--discord-dark-bg);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.breadcrumb {
    margin: 0;
    padding: 0;
    background: none;
    font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--discord-text-muted);
    padding: 0 0.5rem;
}

.breadcrumb-item a {
    color: var(--discord-link);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--discord-link-hover);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--discord-text-normal);
}

/* Placeholder para imágenes que no cargan */
.placeholder-img {
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.placeholder-img::before {
    content: "📷";
    font-size: 2rem;
}

/* Optimización de rendimiento - crítico above the fold */
.above-fold-content {
    contain: layout;
}

/* Smooth scrolling para anchor links internos */
html {
    scroll-behavior: smooth;
}

/* Skip to content para accesibilidad y SEO */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--discord-blurple);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 100;
}

.skip-to-content:focus {
    top: 6px;
}

/* Optimización de web fonts */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
}

/* Critical CSS - above the fold */
.hero-section {
    contain: layout;
    will-change: transform;
}

/* Lazy loading animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease-out;
}

/* Optimized grid layouts */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    contain: layout;
}

.games-grid .game-card {
    contain: layout style;
}

/* Performance hint for browsers */
.performance-hint {
    transform: translateZ(0); /* Enable hardware acceleration */
    backface-visibility: hidden;
}

/* Responsive images optimization */
.responsive-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 16/9;
}

/* CLS (Cumulative Layout Shift) prevention */
.image-container {
    position: relative;
    overflow: hidden;
}

.image-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

.image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
