@import url('https://fonts.googleapis.com/css2?family=REM:wght@300;500;700&family=Roboto:wght@300;400;500&display=swap');

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

body {
    background: #0a0a0a;
    font-family: 'REM', 'Roboto', sans-serif;
    color: #ffffff;
    min-height: 100vh;
    padding: 40px 20px;
}

.contenedor {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.titulo {
    font-family: 'REM', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 50px;
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
}

.titulo::after {
    content: '';
    display: block;
    width: 60%;
    height: 3px;
    background: #d63d46;
    margin: 10px auto 0;
    border-radius: 2px;
}

.grid {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.grid figure {
    content-visibility: auto;
    contain-intrinsic-size: 300px;
    flex-basis: 300px;
    flex-grow: 1;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    overflow: hidden;
    transition: background 0.3s;
    aspect-ratio: 4 / 3;
    content-visibility: auto;
    contain-intrinsic-size: 225px;
}

.grid figure:hover {
    background: rgba(255, 255, 255, 0.08);
}

.grid figure a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.grid figure img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    filter: grayscale(100%);
    transition: all 0.5s ease;
}

.grid figure:hover img {
    filter: grayscale(0%);
    box-shadow: 0 20px 60px rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 60px rgba(255, 255, 255, 0.08);
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 25px;
    right: 35px;
    color: #ffffff;
    font-size: 2.5rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
    background: none;
    border: none;
    font-family: 'REM', sans-serif;
    opacity: 0.6;
}

.lightbox-close:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .lightbox {
        padding: 20px;
    }

    .lightbox img {
        max-width: 100%;
        max-height: 80%;
    }

    .lightbox-close {
        top: 15px;
        right: 20px;
        font-size: 2rem;
    }
}

.btn-volver {
    display: inline-block;
    margin-top: 50px;
    padding: 12px 30px;
    background: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    text-decoration: none;
    font-family: 'REM', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-volver:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
}

@media (max-width: 768px) {
    body {
        padding: 20px 15px;
    }

    .titulo {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }

    .grid {
        gap: 15px;
    }

    .grid figure {
        content-visibility: auto;
        contain-intrinsic-size: 300px;
        flex-basis: 250px;
    }
}

@media (max-width: 480px) {
    .titulo {
        font-size: 1.4rem;
    }

    .grid figure {
        content-visibility: auto;
        contain-intrinsic-size: 300px;
        flex-basis: 100%;
    }
}
