/* ------------ START Custom Video Gallery Captions ------------ */
#cms-gallery #g2 .slide .video-wrapper {
    position: relative;

    .gallery-cc-widget {
        position: absolute;
        bottom: 12px;
        right: var(--side-padding);
        z-index: 5;
        display: flex;
        flex-direction: row-reverse;
        align-items: center;
        gap: 12px;
        max-width: calc(100% - (var(--side-padding) * 2));

        @media (max-width: 600px) {
            align-items: flex-end;
        }
    }

    .gallery-media-toggles {
        display: flex;
        flex-shrink: 0;
        gap: 8px;
    }

    .gallery-cc-toggle,
    .gallery-audio-toggle {
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        border: 2px solid var(--button-color, #fff);
        background: transparent;
        color: var(--button-color, #fff);
        cursor: pointer;
    }

    .gallery-cc-toggle {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.02em;
        line-height: normal;

        &[aria-pressed="true"] {
            background: var(--button-color, #fff);
            color: var(--button-bg-color, #000);
        }
    }

    .gallery-audio-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;

        svg {
            width: 18px;
            height: 18px;
            display: block;
        }

        &.is-muted .waves {
            display: none;
        }

        &:not(.is-muted) .slash {
            display: none;
        }
    }

    .gallery-cc-captions {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
        margin: 0;
        min-width: 36ch;
        max-width: 50ch;
        min-height: 40px;
        background: rgb(0 0 0 / 70%);
        color: #fff;
        font-size: 16px;
        line-height: 1.4;
        border-radius: 40px;
        filter: drop-shadow(-5px 10px 40px #b3b3b3);
        text-align: center;

        .gallery-cc-caption-line {
            padding: 8px 24px;
            text-box-trim: trim-both;
        }

        &[hidden] {
            display: none;
        }

        @media (max-width: 600px) {
            background: rgb(0 0 0 / 60%);
            min-width: 20ch;
            max-width: calc(100% - 132px - var(--side-padding));
            min-height: 36px;
            font-size: 13px;

            .gallery-cc-caption-line {
                padding: 8px 12px;
            }
        }
    }

    .gallery-cc-caption-line {
        animation: gallery-cc-fade-in 0.35s ease;
    }
}

@keyframes gallery-cc-fade-in {
    from {
        opacity: 0;
        transform: translateY(0.25em);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    #cms-gallery #g2 .slide .video-wrapper .gallery-cc-caption-line {
        animation: none;
    }
}
/* ------------ END Custom Video Gallery Captions ------------ */