/* ─── Download Cards ─── */

.section-downloads {
    background-color: transparent;
    padding: 40px 0;
}

/* ─── Downloads Group (Main Pack / Add-ons) ─── */
.downloads-group {
    margin-bottom: 40px;
}

.downloads-group:last-child {
    margin-bottom: 0;
}

.downloads-group__title {
    font-family: 'minecraft_seven_v2', cursive;
    font-size: 1.1rem;
    font-weight: normal;
    color: #ffffff;
    text-align: center;
    margin-bottom: 25px;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 12px;
}

/* Pixel-art underline accent */
.downloads-group__title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: #4caf50;
    margin: 10px auto 0;
    /* No border-radius: pixel-art sharp edges */
}

.downloads-group--addons .downloads-group__title::after {
    background-color: #ff9800;
}

@supports (font-size: clamp(1rem, 2vw, 3rem)) {
    .downloads-group__title {
        font-size: clamp(0.9rem, 2vw, 1.3rem);
    }
}

/* ─── Divider between groups ─── */
.downloads-divider {
    width: 80%;
    max-width: 600px;
    height: 4px;
    margin: 10px auto 40px;
    /* Fallback: línea sólida para navegadores sin gradientes */
    background-color: #3a3a3a;
    /* WebKit prefix */
    background: -webkit-repeating-linear-gradient(
        0deg,
        #3a3a3a 0px,
        #3a3a3a 8px,
        transparent 8px,
        transparent 12px
    );
    /* Estándar */
    background: repeating-linear-gradient(
        90deg,
        #3a3a3a 0px,
        #3a3a3a 8px,
        transparent 8px,
        transparent 12px
    );
    opacity: 0.6;
}

/* ─── File metadata (size · format) ─── */
.file-meta {
    display: block;
    font-family: 'minecraft_seven_v2', cursive;
    font-size: 0.7rem;
    color: #888;
    letter-spacing: 0.5px;
    margin-top: 10px;
    text-align: center;
}

@supports (font-size: clamp(1rem, 2vw, 3rem)) {
    .file-meta {
        font-size: clamp(0.6rem, 1.2vw, 0.75rem);
    }
}

/* Games Grid - Fallback con flexbox para CSS3 */
.games-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -15px; /* Compensar padding de los hijos */
}

.games-grid > * {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 300px;
    flex: 1 1 300px;
    max-width: 33.333%; /* Limita a máx 3 por fila */
    padding: 15px; /* Simular gap con padding */
    box-sizing: border-box;
}

/* Navegadores modernos con CSS Grid */
@supports (display: grid) {
    .games-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 30px;
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .games-grid > * {
        padding: 0;
        max-width: none;
    }
}

/* Game Card */
.game-card {
    background-color: #2a2a2a;
    border: 4px solid #3a3a3a;
    -webkit-box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    opacity: 0;
    -webkit-transition: -webkit-transform 0.2s ease, background-color 0.2s ease, -webkit-box-shadow 0.2s ease;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    /* Forzar composición GPU para transiciones suaves en navegadores CSS3 */
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* EdgeHTML/IE: renderizado pixelado para estética Minecraft (Xbox One) */
    -ms-interpolation-mode: nearest-neighbor;
}

/* Mejora progresiva: renderizado pixelado para estética Minecraft */
@supports (image-rendering: pixelated) {
    .game-card {
        image-rendering: pixelated;
    }
}

.game-card:hover {
    -webkit-transform: scale(1.05) translate3d(0, 0, 0);
    -ms-transform: scale(1.05);
    transform: scale(1.05) translate3d(0, 0, 0);
    background-color: #3d3d3d;
    -webkit-box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
}

.game-card:hover .game-image img {
    -webkit-transform: scale(1.05) translate3d(0, 0, 0);
    transform: scale(1.05) translate3d(0, 0, 0);
}

/* Fallback aspect-ratio con padding-bottom trick */
.game-image {
    width: 100%;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid #3a3a3a;
    background-color: #1a1a1a;
    padding-bottom: 50%; /* Fallback: 2/1 = 50% */
}

.game-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    -webkit-transition: -webkit-transform 0.3s ease;
    transition: transform 0.3s ease;
    /* Forzar composición GPU para zoom suave en navegadores CSS3 */
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

@supports (aspect-ratio: 1) {
    .game-image {
        aspect-ratio: 2 / 1;
        padding-bottom: 0;
        position: static;
    }
    
    .game-image img {
        position: static;
        object-fit: contain;
    }
}

.game-info {
    padding: 25px 20px;
    font-family: 'minecraft_seven_v2', cursive;
}

.game-title {
    /* Fallback para navegadores sin clamp() */
    font-family: 'minecraft_seven_v2', cursive;
    font-size: 0.9rem;
    font-weight: normal;
    margin-bottom: 15px;
    color: #ffffff;
    line-height: 1.4;
}

.game-description {
    /* Fallback para navegadores sin clamp() */
    font-size: 1rem;
    color: #c8c8c8;
    letter-spacing: 0.5px;
    margin-bottom: 25px;
}

@supports (font-size: clamp(1rem, 2vw, 3rem)) {
    .game-title {
        font-size: clamp(0.7rem, 1.5vw, 1rem);
    }
    
    .game-description {
        font-size: clamp(0.8rem, 1.8vw, 1.1rem);
    }
}

/* Animations - Con prefijos para compatibilidad */
@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.game-card {
    -webkit-animation: fadeIn 0.6s ease forwards;
    animation: fadeIn 0.6s ease forwards;
}

.game-card:nth-child(1) {
    -webkit-animation-delay: 0.1s;
    animation-delay: 0.1s;
}

.game-card:nth-child(2) {
    -webkit-animation-delay: 0.2s;
    animation-delay: 0.2s;
}

.game-card:nth-child(3) {
    -webkit-animation-delay: 0.3s;
    animation-delay: 0.3s;
}

.game-card:nth-child(4) {
    -webkit-animation-delay: 0.4s;
    animation-delay: 0.4s;
}

.game-card:nth-child(5) {
    -webkit-animation-delay: 0.5s;
    animation-delay: 0.5s;
}

.game-card:nth-child(6) {
    -webkit-animation-delay: 0.6s;
    animation-delay: 0.6s;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .section-downloads {
        padding: 30px 0;
    }

    /* Flexbox fallback: 2 columnas en móvil */
    .games-grid > * {
        -ms-flex: 1 1 45%;
        flex: 1 1 45%;
        max-width: 50%;
    }

    /* Grid: 2 columnas en móvil */
    @supports (display: grid) {
        .games-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
            max-width: 100%;
            margin: 0 auto;
        }

        .games-grid > * {
            max-width: none;
            padding: 0;
        }
    }

    .game-card {
        border-width: 3px;
    }

    .game-image {
        /* Fallback para aspect-ratio */
        padding-bottom: 50%; /* 2/1 = 50% */
        border-bottom-width: 3px;
    }
    
    @supports (aspect-ratio: 1) {
        .game-image {
            aspect-ratio: 2 / 1;
            padding-bottom: 0;
        }
    }

    .game-info {
        padding: 15px 12px;
    }

    .game-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    .game-description {
        font-size: 0.8rem;
        margin-bottom: 15px;
    }

    .downloads-group {
        margin-bottom: 30px;
    }

    .downloads-group__title {
        font-size: 0.95rem;
        margin-bottom: 18px;
    }

    .downloads-divider {
        margin: 5px auto 30px;
        height: 3px;
    }

    .file-meta {
        font-size: 0.6rem;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .section-downloads {
        padding: 15px 0;
    }

    /* Flexbox fallback: mantener 2 columnas en pantallas pequeñas */
    .games-grid > * {
        -ms-flex: 1 1 45%;
        flex: 1 1 45%;
        max-width: 50%;
    }

    @supports (display: grid) {
        .games-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
            max-width: 100%;
        }

        .games-grid > * {
            max-width: none;
            padding: 0;
        }
    }

    .game-card {
        border-width: 2px;
    }

    .game-image {
        /* Fallback para aspect-ratio */
        padding-bottom: 50%; /* 2/1 = 50% */
        border-bottom-width: 2px;
    }
    
    @supports (aspect-ratio: 1) {
        .game-image {
            aspect-ratio: 2 / 1;
            padding-bottom: 0;
        }
    }

    .game-info {
        padding: 12px 10px;
    }

    .game-title {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }

    .game-description {
        font-size: 0.7rem;
        margin-bottom: 12px;
    }

    .downloads-group {
        margin-bottom: 20px;
    }

    .downloads-group__title {
        font-size: 0.8rem;
        margin-bottom: 14px;
        padding-bottom: 8px;
    }

    .downloads-group__title::after {
        width: 40px;
        height: 2px;
        margin-top: 6px;
    }

    .downloads-divider {
        margin: 0 auto 20px;
        height: 2px;
    }

    .file-meta {
        font-size: 0.55rem;
        margin-top: 6px;
    }
}

/* Compactar la primera pantalla en resoluciones tipo 854 x 480.
   La cuadrícula flexbox es el fallback CSS3; Grid solo la mejora. */
@media (max-height: 540px) and (min-width: 769px) and (max-width: 960px) {
    .section-downloads {
        padding: 6px 0;
    }

    .downloads-group__title {
        font-size: 0.75rem;
        margin-bottom: 7px;
        padding-bottom: 4px;
    }

    .downloads-group__title::after {
        width: 36px;
        height: 2px;
        margin-top: 4px;
    }

    .games-grid {
        margin: -4px;
    }

    .games-grid > * {
        -ms-flex: 1 1 33.333%;
        flex: 1 1 33.333%;
        max-width: 33.333%;
        padding: 4px;
    }

    @supports (display: grid) {
        .games-grid {
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            margin: 0 auto;
        }

        .games-grid > * {
            max-width: none;
            padding: 0;
        }
    }

    .game-card {
        border-width: 2px;
    }

    .game-image {
        border-bottom-width: 2px;
    }

    .game-info {
        padding: 7px 8px;
    }

    .game-title {
        font-size: 0.62rem;
        margin-bottom: 4px;
    }

    .game-description {
        font-size: 0.6rem;
        margin-bottom: 6px;
    }

    .file-meta {
        font-size: 0.48rem;
        margin-top: 4px;
    }

}
