/* Galería Principal */
.gallery-header {
    text-align: center;
    max-width: 800px;
    margin: auto;
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

.gallery-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 900;
    color: #9e0909;
}

.gallery-header p {
    margin-top: 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #555;
    max-width: 700px;
    margin: auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 1rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.3s;
}

/* 🔥 SOLO CAMBIO: control de estado activo */
.gallery-item.selected {
    border-color: grey;
}

/* 🔥 POR DEFECTO: todas en gris */
.gallery-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: grayscale(1);
}

/* 🔥 SOLO la seleccionada en color */
.gallery-item.selected img {
    filter: grayscale(0);
}

/* hover sigue funcionando igual */
.gallery-item:hover img {
    filter: grayscale(0);
    transform: scale(1.05);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.9rem;
    padding: 5px 0;
    text-align: center;
}

/* ===========================
   SUB-GALERÍA FIX (4x3 DESKTOP)
=========================== */

.sub-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding-bottom: 8px;
}

.sub-gallery-grid > div {
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 4px;
}

.sub-gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.sub-gallery-grid img:hover {
    transform: scale(1.05);
}

/* MOBILE */
@media (max-width: 768px) {
    .sub-gallery-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .sub-gallery-grid > div {
        flex: 0 0 auto;
        width: 160px;
        height: 120px;
        scroll-snap-align: start;
    }
}

/* Scrollbar */
.sub-gallery-grid::-webkit-scrollbar {
    height: 4px;
}

.sub-gallery-grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* AFTER SUBGALLERY (NO TOCADO) */
.after-subgallery {
    font-weight: 900;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #9e0909;
    text-align: center;
    padding: 20px 0;
    border-top: 2px solid #9e0909;
    background-color: #f8f8f8;
}

.after-subgallery h2 {
    margin: 0;
    font-size: 2.5rem;
    color: #9e0909;
    font-weight: bold;
}

/* VIDEOS (SIN TOCAR) */
.videos-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.video-item {
    width: calc(50% - 10px) !important;
    margin-bottom: 20px;
}

.video-responsive {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* BOTÓN */
.toggle-btn {
    display: block;
    width: 120px;
    margin: 0 auto;
    padding: 10px;
    background-color: #9e0909;
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    font-size: 20px;
}

.toggle-btn:hover {
    background-color: #7a0707;
}

.hidden {
    display: none !important;
}


/* RESPONSIVE GALLERY */
@media (max-width: 991px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 700px) {
    .video-item {
        width: 100% !important;
    }

    .row {
        flex-direction: column;
        align-items: center;
    }
}