.pmb-media-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    place-items: center;
    overflow: hidden;
    overscroll-behavior: contain;
    background: rgba(0, 0, 0, .88);
}

.pmb-media-modal[hidden] {
    display: none;
}

.pmb-media-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    color: #fff;
}

.pmb-media-modal__top {
    position: absolute;
    top: 26rem;
    right: 30rem;
    left: 30rem;
    z-index: 5;
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20rem;
    pointer-events: none;
}

.pmb-media-modal__title {
    max-width: min(900rem, calc(100vw - 140rem));
    margin: 0;
    overflow: hidden;
    font-family: Jost, Arial, sans-serif;
    font-size: 22rem;
    line-height: 1.2;
    font-weight: 600;
    color: #fff;
    text-overflow: ellipsis;
    text-shadow: 0 1rem 5rem rgba(0, 0, 0, .7);
    white-space: nowrap;
}

.pmb-media-modal__close {
    display: grid;
    width: 44rem;
    height: 44rem;
    flex: 0 0 44rem;
    place-items: center;
    padding: 0;
    border: 0;
    appearance: none;
    background: transparent;
    font-family: Arial, sans-serif;
    font-size: 40rem;
    line-height: 1;
    font-weight: 300;
    color: #fff;
    text-shadow: 0 1rem 5rem rgba(0, 0, 0, .75);
    cursor: pointer;
    pointer-events: auto;
    opacity: .9;
    transition: opacity .2s ease, transform .2s ease;
}

.pmb-media-modal__close:hover {
    opacity: 1;
    transform: scale(1.06);
}

.pmb-media-modal__close:focus-visible,
.pmb-media-modal__nav:focus-visible {
    outline: 2rem solid rgba(255, 255, 255, .9);
    outline-offset: 2rem;
}

.pmb-media-modal__stage {
    position: relative;
    display: grid;
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-width: 0;
    place-items: center;
    overflow: hidden;
    overscroll-behavior: contain;
    background: transparent;
}

.pmb-media-modal__content {
    display: flex;
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pmb-media-modal__image,
.pmb-media-modal__video {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100vw - 120rem);
    max-height: 80vh;
    margin: auto;
    flex: 0 1 auto;
    object-fit: contain;
    object-position: 50% 50%;
    background: transparent;
}

.pmb-media-modal__nav {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: grid;
    width: 54rem;
    height: 72rem;
    place-items: center;
    padding: 0;
    border: 0;
    appearance: none;
    background: transparent;
    font-family: Arial, sans-serif;
    font-size: 48rem;
    line-height: 1;
    font-weight: 300;
    color: #fff;
    text-shadow: 0 1rem 7rem rgba(0, 0, 0, .8);
    cursor: pointer;
    transform: translateY(-50%);
    opacity: .9;
    transition: opacity .2s ease;
}

.pmb-media-modal__nav:hover {
    opacity: 1;
}

.pmb-media-modal__prev {
    left: 20rem;
}

.pmb-media-modal__next {
    right: 20rem;
}

.pmb-media-modal__counter {
    position: absolute;
    right: 30rem;
    bottom: 24rem;
    z-index: 4;
    font-family: Jost, Arial, sans-serif;
    font-size: 14rem;
    line-height: 1;
    color: #fff;
    text-shadow: 0 1rem 5rem rgba(0, 0, 0, .75);
}

body.pmb-media-modal-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .pmb-media-modal__top {
        top: 16rem;
        right: 12rem;
        left: 12rem;
    }

    .pmb-media-modal__title {
        max-width: calc(100vw - 72rem);
        font-size: 16rem;
    }

    .pmb-media-modal__close {
        width: 40rem;
        height: 40rem;
        flex-basis: 40rem;
        font-size: 36rem;
    }

    .pmb-media-modal__stage {
        touch-action: none;
    }

    .pmb-media-modal__content {
        width: 100vw;
        max-width: 100vw;
        padding-right: 2.5vw;
        padding-left: 2.5vw;
        touch-action: none;
    }

    .pmb-media-modal__image,
    .pmb-media-modal__video {
        width: auto;
        max-width: 100%;
        max-height: 80dvh;
        margin-right: auto;
        margin-left: auto;
        user-select: none;
        -webkit-user-drag: none;
    }

    .pmb-media-modal__nav {
        width: 30rem;
        height: 48rem;
        font-size: 32rem;
    }

    .pmb-media-modal__prev {
        left: 2rem;
    }

    .pmb-media-modal__next {
        right: 2rem;
    }

    .pmb-media-modal__counter {
        right: 12rem;
        bottom: calc(14rem + env(safe-area-inset-bottom));
        font-size: 12rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pmb-media-modal__close,
    .pmb-media-modal__nav {
        transition-duration: 0s !important;
    }
}
