/* Galería multimedia reutilizable · V5 */
.media-gallery {
    width: 100%;
    padding: 0;
}

.gallery-slider {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgb(var(--ma-cream-rgb) / 18%);
    border-radius: var(--radius-lg);
    background: rgb(var(--ma-dark-blue-rgb) / 72%);
    box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 22%);
}

.gallery-player {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.gallery-viewport {
    position: relative;
    width: 100%;
    min-height: 13.75rem;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #020914;
    touch-action: pan-y;
}

.gallery-slide {
    position: absolute;
    z-index: 1;
    inset: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 380ms ease, visibility 0s linear 380ms;
}

.gallery-slide.is-active {
    z-index: 2;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 380ms ease, visibility 0s linear 0s;
}

.gallery-media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    user-select: none;
    -webkit-user-drag: none;
}

.gallery-audio,
.gallery-control,
.gallery-caption {
    position: relative;
    z-index: 4;
}

.gallery-control,
.gallery-audio {
    min-width: 2.75rem;
    min-height: 2.75rem;
    border: 1px solid rgb(var(--ma-cream-rgb) / 26%);
    background: rgb(var(--ma-dark-blue-rgb) / 76%);
    color: var(--ma-cream);
    cursor: pointer;
    backdrop-filter: blur(0.65rem);
    transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.gallery-control {
    display: inline-grid;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: var(--radius-sm);
    place-items: center;
}

.gallery-control svg,
.gallery-audio svg {
    width: 1.3rem;
    height: 1.3rem;
    fill: none;
}

.gallery-control:hover,
.gallery-audio:hover {
    border-color: rgb(var(--ma-cream-rgb) / 55%);
    background: rgb(var(--ma-dark-blue-rgb) / 94%);
}

.gallery-control:active,
.gallery-audio:active {
    transform: scale(.97);
}

.gallery-control:focus-visible,
.gallery-audio:focus-visible,
.gallery-dot:focus-visible {
    outline: 3px solid var(--ma-yellow-100);
    outline-offset: 3px;
}

.gallery-audio {
    position: absolute;
    right: var(--space-3);
    bottom: var(--space-3);
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem .75rem .45rem .45rem;
    border-radius: 999px;
}

.gallery-audio__ico {
    display: grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    border-radius: 50%;
    place-items: center;
    background: rgb(var(--ma-cream-rgb) / 10%);
}

.gallery-audio__txt {
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.1;
}

.gallery-fs-overlay {
    position: absolute;
    bottom: var(--space-3);
    left: var(--space-3);
}

.gallery-caption {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    padding: .9rem 1rem 1.5rem;
    background: linear-gradient(180deg, rgb(0 0 0 / 72%), transparent);
    color: var(--ma-cream);
    font-size: .9rem;
    font-weight: 600;
    pointer-events: none;
}

.gallery-menu {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-3);
    align-items: center;
    min-height: 4.25rem;
    padding: .7rem;
    border-top: 1px solid rgb(var(--ma-cream-rgb) / 12%);
    background: rgb(var(--ma-dark-blue-rgb) / 92%);
}

.gallery-menu__right {
    display: flex;
    gap: .6rem;
    align-items: center;
}

.gallery-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.gallery-dot {
    position: relative;
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    place-items: center;
    background: transparent;
    cursor: pointer;
}

.gallery-dot::before {
    width: .5rem;
    height: .5rem;
    border-radius: 999px;
    background: rgb(var(--ma-cream-rgb) / 45%);
    content: "";
    transition: width 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.gallery-dot:hover::before {
    background: rgb(var(--ma-cream-rgb) / 78%);
    transform: scale(1.12);
}

.gallery-dot.is-active::before {
    width: 1.35rem;
    background: var(--ma-cream);
}

.gallery-slider:fullscreen {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    background: #000;
}

.gallery-slider:fullscreen .gallery-player {
    border-radius: 0;
}

.gallery-slider:fullscreen .gallery-viewport {
    height: calc(100vh - 4.25rem);
    min-height: 0;
    aspect-ratio: auto;
}

.gallery-slider:fullscreen .gallery-media {
    object-fit: contain;
    background: #000;
}

.gallery-slider:fullscreen .gallery-menu {
    background: #000;
}

@supports (height: 100dvh) {
    .gallery-slider:fullscreen .gallery-viewport {
        height: calc(100dvh - 4.25rem);
    }
}

@media (max-width: 47.99rem) {
    .gallery-slider {
        border-radius: var(--radius-md);
    }

    .gallery-player {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .gallery-menu {
        gap: .35rem;
        padding: .5rem;
    }

    .gallery-menu__right {
        gap: .35rem;
    }

    .gallery-dots {
        max-width: 52vw;
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
    }

    .gallery-dots::-webkit-scrollbar {
        display: none;
    }

    .gallery-dot {
        width: 1.9rem;
        height: 2.25rem;
    }

    .gallery-audio__txt {
        display: none;
    }

    .gallery-audio {
        width: 2.75rem;
        padding: .35rem;
        justify-content: center;
    }

    .gallery-audio__ico {
        width: 1.9rem;
        height: 1.9rem;
    }

    .gallery-caption {
        padding: .7rem .8rem 1.25rem;
        font-size: .78rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-slide,
    .gallery-dot::before,
    .gallery-control,
    .gallery-audio {
        transition: none;
    }
}
