/* ====================================================
   Galería — mosaico con filtro por álbum/actividad
   ==================================================== */

/* ---------- Hero ---------- */
.gallery-hero {
    position: relative;
    min-height: 460px;
    display: flex;
    align-items: flex-end;
    background: var(--rma-dark);
    color: #fff;
    overflow: hidden;
}

.gallery-hero__mosaic {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    opacity: .5;
}

.gallery-hero__mosaic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-hero__mosaic img:nth-child(even) { transform: translateY(-24px) scale(1.05); }

.gallery-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16, 34, 27, .6) 0%, rgba(16, 34, 27, .35) 45%, rgba(16, 34, 27, .95) 100%);
}

.gallery-hero__content {
    position: relative;
    z-index: 1;
    padding-top: calc(var(--height-header) + 3rem);
    padding-bottom: 3rem;
}

.gallery-hero__eyebrow {
    font-family: Mansalva, cursive;
    color: var(--rma-yellow);
    font-size: 1.75rem;
    margin: 0;
}

.gallery-hero__title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1;
    color: #fff;
    margin: .25rem 0 1rem;
}

.gallery-hero__sub {
    max-width: 560px;
    font-size: 1.15rem;
    color: rgba(255, 255, 255, .85);
}

.gallery-hero__count {
    display: inline-flex;
    gap: .5rem;
    align-items: center;
    margin: .5rem 0 0;
    padding: .35rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(6px);
    font-size: .95rem;
}

/* ---------- Filtros ---------- */
.gallery-filters {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    margin-bottom: 1.5rem;
    scrollbar-width: thin;
}

.gallery-filter {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1.1rem;
    border-radius: 999px;
    border: 1px solid #dfe5e2;
    color: var(--rma-dark);
    font-weight: 500;
    white-space: nowrap;
    transition: all .2s;
}

.gallery-filter:hover { border-color: var(--rma-dark); color: var(--rma-dark); }

.gallery-filter__count {
    font-size: .75rem;
    font-weight: 700;
    min-width: 24px;
    padding: .1rem .45rem;
    border-radius: 999px;
    background: var(--rma-light);
    text-align: center;
}

.gallery-filter.is-active {
    background: var(--rma-dark);
    border-color: var(--rma-dark);
    color: #fff;
}

.gallery-filter.is-active .gallery-filter__count {
    background: var(--rma-yellow);
    color: var(--rma-dark);
}

.gallery-album-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 1rem;
    background: var(--rma-light);
}

.gallery-album-info[hidden] { display: none; }
.gallery-album-info__title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.gallery-album-info__text { color: var(--rma-muted); margin: .25rem 0 0; }

/* ---------- Mosaico ---------- */
.gallery-masonry {
    columns: 4 260px;
    column-gap: 1rem;
}

.gallery-item {
    position: relative;
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    margin: 0 0 1rem;
    break-inside: avoid;
    border-radius: .85rem;
    overflow: hidden;
    cursor: zoom-in;
    background: var(--rma-light);
    animation: gallery-in .35s ease-out both;
}

.gallery-item[hidden] { display: none; }

@keyframes gallery-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

.gallery-item img {
    width: 100%;
    height: auto;
    min-height: 140px; /* reserva espacio mientras el CMS genera el tamaño */
    background: var(--rma-light);
    color: transparent; /* oculta el alt si la imagen tarda */
    display: block;
    transition: transform .6s, filter .3s;
}

.gallery-item__caption {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 2.5rem 1rem .85rem;
    color: #fff;
    font-weight: 600;
    text-align: left;
    background: linear-gradient(180deg, transparent, rgba(16, 34, 27, .85));
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .25s, transform .25s;
}

.gallery-item:hover img,
.gallery-item:focus-visible img { transform: scale(1.05); }

.gallery-item:hover .gallery-item__caption,
.gallery-item:focus-visible .gallery-item__caption {
    opacity: 1;
    transform: none;
}

.gallery-item:focus-visible { outline: 3px solid var(--rma-teal); outline-offset: 2px; }

/* En pantallas táctiles el pie se ve siempre */
@media (hover: none) {
    .gallery-item__caption { opacity: 1; transform: none; padding-top: 1.5rem; font-size: .875rem; }
}

.gallery-empty {
    text-align: center;
    padding: 4rem 1rem;
}

.gallery-empty i { font-size: 3.5rem; color: var(--rma-teal); }
.gallery-empty h2 { font-size: 1.5rem; margin: 1rem 0 .5rem; }
.gallery-empty p { color: var(--rma-muted); }

/* ---------- CTA ---------- */
.gallery-cta {
    background: var(--rma-dark) url(/assets/backgrounds/home_section.png) center / cover;
    background-blend-mode: soft-light;
    padding: 5rem 0;
}

@media (max-width: 575.98px) {
    .gallery-masonry { columns: 2; column-gap: .6rem; }
    .gallery-item { margin-bottom: .6rem; border-radius: .6rem; }
    .gallery-hero__mosaic { grid-template-columns: repeat(3, 1fr); }
}
