/* Import Monocraft font */
@font-face {
    font-family: 'Monocraft';
    src: url('../assets/fonts/monocraft.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

body {
    font-family: 'Monocraft', cursive;
    color: #fff;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Section Backgrounds */
.section-header {
    background-color: #000000;
}

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

.section-gallery {
    background-color: #ffffff;
    padding: 40px 0;
}

/* Header */
header {
    text-align: center;
    padding: 20px 0;
}

/* Header Description */
.header-description {
    max-width: 600px;
    margin: 20px auto 0;
    padding: 0 20px;
    font-size: 0.85rem;
    color: #b8b8b8;
    line-height: 1.6;
    text-align: center;
}

.header-description a {
    color: #5cb85c;
    text-decoration: none;
    -webkit-transition: color 0.2s ease;
    transition: color 0.2s ease;
}

.header-description a:hover {
    color: #6ccf6c;
    text-decoration: underline;
}

@supports (font-size: clamp(1rem, 2vw, 3rem)) {
    .header-description {
        font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    }
}

/* Banner */
.banner {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

/* Fallback para navegadores sin aspect-ratio */
.banner-img {
    width: 100%;
    height: auto;
    display: block;
    /* Fallback: padding-bottom trick para aspect-ratio */
}

/* Contenedor para el fallback de aspect-ratio del banner */
.banner {
    position: relative;
}

.banner::before {
    content: "";
    display: block;
    padding-bottom: calc(1300 / 4096 * 100%); /* ~31.74% */
}

.banner .banner-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Navegadores modernos con soporte de aspect-ratio */
@supports (aspect-ratio: 1) {
    .banner::before {
        display: none;
        padding-bottom: 0;
    }
    
    .banner .banner-img {
        position: static;
        height: auto;
        object-fit: cover;
        aspect-ratio: 4096 / 1300;
    }
}

.main-title {
    /* Fallback para navegadores sin clamp() */
    font-size: 2rem;
    letter-spacing: 4px;
    color: #ffffff;
    text-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.8),
        -2px -2px 0px rgba(255, 255, 255, 0.1);
    image-rendering: pixelated;
}

@supports (font-size: clamp(1rem, 2vw, 3rem)) {
    .main-title {
        font-size: clamp(1.5rem, 4vw, 3rem);
    }
}

/* 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: 100%;
    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-fit, minmax(300px, 1fr));
        gap: 30px;
        margin: 0;
    }
    
    .games-grid > * {
        padding: 0;
        max-width: none;
    }
}

/* Game Card */
.game-card {
    background-color: #2a2a2a;
    border: 4px solid #3a3a3a;
    box-shadow: 
        8px 8px 0px rgba(0, 0, 0, 0.6),
        inset 2px 2px 0px rgba(255, 255, 255, 0.1);
    -webkit-transition: -webkit-transform 0.2s ease, box-shadow 0.2s ease;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    image-rendering: pixelated;
}

.game-card:hover {
    -webkit-transform: translateY(-8px);
    transform: translateY(-8px);
    box-shadow: 
        12px 12px 0px rgba(0, 0, 0, 0.6),
        inset 2px 2px 0px rgba(255, 255, 255, 0.1);
}

/* 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;
}

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

.game-card:hover .game-image img {
    -webkit-transform: scale(1.02);
    transform: scale(1.02);
}

.game-info {
    padding: 25px 20px;
}

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

.game-description {
    /* Fallback para navegadores sin clamp() */
    font-size: 1rem;
    color: #b8b8b8;
    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);
    }
}

/* Buttons - Fallbacks para CSS3 */
.btn-download {
    width: 100%;
    /* Fallback para clamp() */
    padding: 20px 26px;
    font-family: 'Monocraft', cursive;
    font-size: 1rem;
    border: 4px solid;
    cursor: pointer;
    position: relative;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    /* Fallback para gap con margin en hijos */
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    box-shadow: 
        6px 6px 0px rgba(0, 0, 0, 0.4),
        inset 2px 2px 0px rgba(255, 255, 255, 0.3);
}

/* Fallback para gap en flexbox */
.btn-download > * {
    margin-left: 6px;
    margin-right: 6px;
}

.btn-download > *:first-child {
    margin-left: 0;
}

.btn-download > *:last-child {
    margin-right: 0;
}

@supports (font-size: clamp(1rem, 2vw, 3rem)) {
    .btn-download {
        padding: clamp(16px, 3vw, 24px) clamp(20px, 4vw, 32px);
        font-size: clamp(0.9rem, 2vw, 1.2rem);
    }
}

@supports (gap: 12px) {
    .btn-download {
        gap: 12px;
    }
    
    .btn-download > * {
        margin-left: 0;
        margin-right: 0;
    }
}

.btn-download:hover {
    -webkit-transform: translate(2px, 2px);
    transform: translate(2px, 2px);
    box-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.4),
        inset 2px 2px 0px rgba(255, 255, 255, 0.3);
}

.btn-download:active {
    -webkit-transform: translate(4px, 4px);
    transform: translate(4px, 4px);
    box-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.4),
        inset 2px 2px 0px rgba(255, 255, 255, 0.3);
}

.btn-green {
    background-color: #3C8527;
    border-top-color: #52A535;
    border-bottom-color: #2A641C;
    border-left-color: transparent;
    border-right-color: transparent;
    color: #fff;
}

.btn-green:hover {
    background-color: #469a2e;
}

.btn-orange {
    background-color: #f0ad4e;
    border-color: #d89442;
    color: #fff;
}

.btn-orange:hover {
    background-color: #f5bd68;
}

.btn-cyan {
    background-color: #5bc0de;
    border-color: #46a8c5;
    color: #fff;
}

.btn-cyan:hover {
    background-color: #6ccfe8;
}

.arrow {
    font-size: 1.5em;
    line-height: 1;
}

/* Gallery Section */
.gallery-section {
    padding: 20px 0;
}

.gallery-title {
    text-align: center;
    /* Fallback para clamp() */
    font-size: 1.5rem;
    margin-bottom: 40px;
    color: #171615;
    text-shadow: none;
}

@supports (font-size: clamp(1rem, 2vw, 3rem)) {
    .gallery-title {
        font-size: clamp(1.2rem, 3vw, 2rem);
    }
}

.gallery-container {
    position: relative;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-bottom: 30px;
}

/* Fallback para gap en flexbox */
.gallery-container > * {
    margin-left: 10px;
    margin-right: 10px;
}

.gallery-container > *:first-child {
    margin-left: 0;
}

.gallery-container > *:last-child {
    margin-right: 0;
}

@supports (gap: 20px) {
    .gallery-container {
        gap: 20px;
    }
    
    .gallery-container > * {
        margin-left: 0;
        margin-right: 0;
    }
}

.gallery-wrapper {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    overflow: hidden;
    border: 4px solid #3a3a3a;
    background-color: #2a2a2a;
    box-shadow: 
        8px 8px 0px rgba(0, 0, 0, 0.6),
        inset 2px 2px 0px rgba(255, 255, 255, 0.1);
}

.gallery-track {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.gallery-item {
    min-width: 100%;
    position: relative;
}

/* Fallback aspect-ratio para galería */
.gallery-item {
    position: relative;
}

.gallery-item::before {
    content: "";
    display: block;
    padding-bottom: 56.25%; /* 16/9 = 56.25% */
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

@supports (aspect-ratio: 1) {
    .gallery-item::before {
        display: none;
        padding-bottom: 0;
    }
    
    .gallery-item img {
        position: static;
        height: auto;
        aspect-ratio: 16 / 9;
        object-fit: cover;
    }
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    /* Fallback para gradientes sin prefijo */
    background: -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    padding: 40px 20px 20px;
    /* Fallback para clamp() */
    font-size: 0.75rem;
    text-align: center;
    color: #ffffff;
}

@supports (font-size: clamp(1rem, 2vw, 3rem)) {
    .gallery-caption {
        font-size: clamp(0.6rem, 1.5vw, 0.9rem);
    }
}

/* Gallery Buttons */
.gallery-btn {
    width: 60px;
    height: 60px;
    background-color: #3a3a3a;
    border: 4px solid #4a4a4a;
    color: #ffffff;
    font-size: 2.5rem;
    cursor: pointer;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    box-shadow: 
        6px 6px 0px rgba(0, 0, 0, 0.6),
        inset 2px 2px 0px rgba(255, 255, 255, 0.1);
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.gallery-btn:hover {
    background-color: #4a4a4a;
    -webkit-transform: translate(2px, 2px);
    transform: translate(2px, 2px);
    box-shadow: 
        4px 4px 0px rgba(0, 0, 0, 0.6),
        inset 2px 2px 0px rgba(255, 255, 255, 0.1);
}

.gallery-btn:active {
    -webkit-transform: translate(4px, 4px);
    transform: translate(4px, 4px);
    box-shadow: 
        2px 2px 0px rgba(0, 0, 0, 0.6),
        inset 2px 2px 0px rgba(255, 255, 255, 0.1);
}

.gallery-btn span {
    line-height: 1;
    font-family: 'Monocraft', cursive;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    header {
        padding: 15px 0;
    }

    .header-description {
        max-width: 500px;
        margin-top: 15px;
        padding: 0 15px;
        font-size: 0.75rem;
    }

    .section-downloads {
        padding: 30px 0;
    }

    .section-gallery {
        padding: 30px 0;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 400px;
        margin: 0 auto;
    }

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

    .game-image {
        /* Fallback para aspect-ratio */
        padding-bottom: 40%; /* 2.5/1 = 40% */
        border-bottom-width: 3px;
    }
    
    @supports (aspect-ratio: 1) {
        .game-image {
            aspect-ratio: 2.5 / 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;
    }

    .btn-download {
        padding: 12px 16px;
        font-size: 0.85rem;
        border-width: 3px;
    }

    .gallery-section {
        padding: 15px 0;
    }

    .gallery-wrapper {
        border-width: 3px;
    }

    .gallery-item img {
        aspect-ratio: 16 / 9;
    }

    .gallery-btn {
        width: 40px;
        height: 40px;
        font-size: 1.6rem;
        border-width: 3px;
    }

    /* Fallback para gap en media query */
    .gallery-container > * {
        margin-left: 5px;
        margin-right: 5px;
    }
    
    @supports (gap: 10px) {
        .gallery-container {
            gap: 10px;
        }
        
        .gallery-container > * {
            margin-left: 0;
            margin-right: 0;
        }
    }

}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .section-gallery .container {
        padding: 0 5px;
    }

    header {
        padding: 10px 0;
    }

    .header-description {
        max-width: 100%;
        margin-top: 12px;
        padding: 0 10px;
        font-size: 0.65rem;
        line-height: 1.5;
    }

    .section-downloads {
        padding: 15px 0;
    }

    .section-gallery {
        padding: 15px 0;
    }

    .games-grid {
        gap: 15px;
        max-width: 320px;
    }

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

    .game-image {
        /* Fallback para aspect-ratio */
        padding-bottom: 33.33%; /* 3/1 = 33.33% */
        border-bottom-width: 2px;
    }
    
    @supports (aspect-ratio: 1) {
        .game-image {
            aspect-ratio: 3 / 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;
    }

    .btn-download {
        padding: 10px 12px;
        font-size: 0.75rem;
        border-width: 2px;
    }

    .gallery-container {
        position: relative;
    }

    .gallery-btn {
        position: absolute;
        top: 50%;
        -webkit-transform: translateY(-50%);
        transform: translateY(-50%);
        z-index: 2;
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
        border-width: 2px;
        opacity: 0.85;
        background-color: rgba(58, 58, 58, 0.9);
    }

    .gallery-btn-prev {
        left: 4px;
    }

    .gallery-btn-next {
        right: 4px;
    }

    .gallery-btn:hover {
        -webkit-transform: translateY(-50%) translate(2px, 2px);
        transform: translateY(-50%) translate(2px, 2px);
    }

    .gallery-btn:active {
        -webkit-transform: translateY(-50%) translate(4px, 4px);
        transform: translateY(-50%) translate(4px, 4px);
    }

    .gallery-wrapper {
        border-width: 2px;
        -webkit-box-flex: 1;
        -ms-flex: 1;
        flex: 1;
        min-width: 0;
    }

    .gallery-item img {
        aspect-ratio: 16 / 9;
    }

    /* Fallback para gap en 480px */
    .gallery-container > * {
        margin-left: 0;
        margin-right: 0;
    }

    @supports (gap: 0px) {
        .gallery-container {
            gap: 0;
        }
    }

}

/* Animations - Con prefijos para compatibilidad */
@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
        -webkit-transform: translateY(20px);
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        -webkit-transform: translateY(20px);
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

.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;
}
