.gallery-section {
    background: #ffffff;
    padding: 40px 0;
    margin-top: 20px;
}

/* CSS Grid Photo Gallery - Masonry Style */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    grid-auto-rows: 10rem;
    grid-auto-flow: dense;
    gap: 1rem;
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

.photo-gallery figure {
    container: figure / inline-size;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: #f0f0f0;
}

.photo-gallery figure:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
    transform: translateY(-4px);
}

.photo-gallery img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    grid-area: 1 / 1 / -1 / -1;
    transition: scale 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.photo-gallery figure:hover img {
    scale: 1.1;
}

/* Clases dinámicas para diferentes orientaciones */
.photo-gallery figure.portrait {
    grid-row: span 2;
}

.photo-gallery figure.landscape {
    grid-column: span 1;
    grid-row: span 1;
}

.photo-gallery figure.square {
    grid-row: span 1;
}

.photo-gallery figure.tall-portrait {
    grid-row: span 2;
}

.photo-gallery figure.wide-landscape {
    grid-column: span 1;
    grid-row: span 1;
}

.photo-gallery figcaption {
    grid-area: 1 / 1 / -1 / -1;
    align-self: end;
    z-index: 1;
    padding: 2.5em 12% 1.2em 1.2em;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.4;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.75) 40%,
        transparent 100%
    );
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.photo-gallery figure:hover figcaption {
    opacity: 1;
    transform: translateY(0);
}

@container figure (width > 20rem) {
    .photo-gallery figcaption {
        display: block;
    }
}

.photo-gallery figcaption h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-style: italic;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Video indicator badge */
.video-indicator {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 25px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 12px rgba(231, 76, 60, 0.4);
    z-index: 3;
    backdrop-filter: blur(8px);
}

.video-indicator i {
    font-size: 0.95rem;
}

/* Responsive para tablets */
@media (width > 768px) {
    .photo-gallery {
        grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
        grid-auto-rows: 11rem;
        gap: 1.2rem;
        padding: 2rem;
    }
}

/* Responsive para desktop */
@media (width > 1024px) {
    .photo-gallery {
        grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
        grid-auto-rows: 12rem;
        gap: 1.5rem;
        padding: 2.5rem;
    }
}

@media (width > 1400px) {
    .photo-gallery {
        grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
        grid-auto-rows: 13rem;
    }
}

/* Ajuste para móviles */
@media (width <= 768px) {
    .photo-gallery figure.portrait,
    .photo-gallery figure.landscape,
    .photo-gallery figure.square,
    .photo-gallery figure.tall-portrait,
    .photo-gallery figure.wide-landscape {
        grid-row: span 1;
        grid-column: span 1;
    }
}

@media (width <= 480px) {
    .photo-gallery {
        grid-template-columns: 1fr;
        grid-auto-rows: 16rem;
        gap: 1rem;
        padding: 1rem;
    }

    .photo-gallery figure {
        grid-row: span 1 !important;
        grid-column: span 1 !important;
    }
}

