/*
 * Mnemo Image Zoom
 * Автоматическое увеличение изображений без ручного оборачивания в ссылки.
 */

img.mnemo-zoom-enabled,
img.mnemo-zoom-enabled:hover,
a.mnemo-zoom-link,
a.mnemo-zoom-link:hover,
a.mnemo-zoom-link * {
    cursor: zoom-in !important;
}

.mnemo-zoom-enabled:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

body.mnemo-zoom-open {
    overflow: hidden !important;
}

.mnemo-zoom-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 52px 72px 58px;
    background: rgba(0, 0, 0, 0.76);
    color: #fff;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 160ms ease;
}

.mnemo-zoom-overlay.is-open {
    display: flex;
}

.mnemo-zoom-overlay.is-visible {
    opacity: 1;
}

.mnemo-zoom-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
}

.mnemo-zoom-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: scale(0.985);
    transition:
        opacity 160ms ease,
        transform 160ms ease;
}

.mnemo-zoom-image.is-loaded {
    opacity: 1;
    transform: scale(1);
}

.mnemo-zoom-close,
.mnemo-zoom-prev,
.mnemo-zoom-next {
    position: absolute;
    z-index: 2;
    border: 0;
    border-radius: 999px;
    background: rgba(24, 24, 24, 0.72);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.mnemo-zoom-close:hover,
.mnemo-zoom-prev:hover,
.mnemo-zoom-next:hover,
.mnemo-zoom-close:focus-visible,
.mnemo-zoom-prev:focus-visible,
.mnemo-zoom-next:focus-visible {
    background: rgba(70, 70, 70, 0.94);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.mnemo-zoom-close {
    top: 12px;
    right: 14px;
    width: 42px;
    height: 42px;
    font-size: 32px;
    font-weight: 300;
}

.mnemo-zoom-prev,
.mnemo-zoom-next {
    top: 50%;
    width: 46px;
    height: 58px;
    transform: translateY(-50%);
    font-size: 40px;
    font-weight: 300;
}

.mnemo-zoom-prev {
    left: 12px;
}

.mnemo-zoom-next {
    right: 12px;
}

.mnemo-zoom-prev[hidden],
.mnemo-zoom-next[hidden],
.mnemo-zoom-counter[hidden],
.mnemo-zoom-caption[hidden] {
    display: none !important;
}

.mnemo-zoom-caption {
    position: absolute;
    left: 50%;
    bottom: 14px;
    max-width: min(900px, calc(100vw - 40px));
    transform: translateX(-50%);
    padding: 7px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.66);
    color: #fff;
    font-size: 15px;
    line-height: 1.35;
    text-align: center;
}

.mnemo-zoom-counter {
    position: absolute;
    top: 15px;
    left: 16px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 13px;
    line-height: 1;
}

.mnemo-zoom-spinner {
    position: absolute;
    width: 42px;
    height: 42px;
    border: 4px solid rgba(255, 255, 255, 0.28);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mnemo-zoom-spin 0.75s linear infinite;
}

.mnemo-zoom-spinner[hidden] {
    display: none;
}

@keyframes mnemo-zoom-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 700px) {
    .mnemo-zoom-overlay {
        padding: 56px 12px 64px;
    }

    .mnemo-zoom-prev,
    .mnemo-zoom-next {
        top: auto;
        bottom: 12px;
        width: 48px;
        height: 44px;
        transform: none;
    }

    .mnemo-zoom-prev {
        left: 12px;
    }

    .mnemo-zoom-next {
        right: 12px;
    }

    .mnemo-zoom-caption {
        bottom: 15px;
        max-width: calc(100vw - 140px);
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mnemo-zoom-overlay,
    .mnemo-zoom-image {
        transition: none;
    }

    .mnemo-zoom-spinner {
        animation-duration: 1.5s;
    }
}
