.image-zoom {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    max-width: 100%;
    vertical-align: middle;
    line-height: 0;
}

.image-zoom-cover {
    display: block;
    width: 100%;
}

.image-zoom:not(.image-zoom-map) {
    overflow: hidden;
    border: 1px solid #dfe7ed;
    border-radius: 10px;
    background: #f7fafc;
}

.image-zoom > img,
.image-zoom > a > img,
.content-prose .image-zoom > img,
.content-prose .image-zoom > a > img {
    display: block;
    max-width: 100%;
    margin: 0;
}

.image-zoom:not(.image-zoom-map) > img,
.image-zoom:not(.image-zoom-map) > a > img {
    border-radius: 0;
}

.content-prose > .image-zoom {
    margin: 22px 0;
}

.content-prose > .image-zoom-cover {
    margin: 0 0 28px;
}

.image-zoom-trigger {
    position: absolute;
    left: 6px;
    bottom: 6px;
    z-index: 1;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #254c64;
    font: inherit;
    line-height: 1;
    cursor: zoom-in;
}

.image-zoom-trigger::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid rgb(37 76 100 / 25%);
    border-radius: 50%;
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 1px 4px rgb(20 45 61 / 12%);
}

.image-zoom-trigger > svg {
    position: relative;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.image-zoom-trigger:hover::before,
.image-zoom-trigger:focus-visible::before {
    border-color: #6c8b9f;
    background: #fff;
}

.image-zoom-trigger:focus-visible {
    outline: 3px solid #eab953;
    outline-offset: 3px;
}

body.image-viewer-open {
    overflow: hidden;
}

.image-viewer {
    box-sizing: border-box;
    width: min(1200px, calc(100vw - 24px));
    max-width: none;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 16px;
    overflow: hidden;
    border: 1px solid #ccdce7;
    border-radius: 12px;
    background: #fff;
    color: #203d51;
    box-shadow: 0 12px 60px rgb(0 0 0 / 25%);
}

.image-viewer:not([open]),
.image-viewer [hidden] {
    display: none !important;
}

.image-viewer[open] {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-viewer::backdrop {
    background: rgb(8 25 38 / 80%);
}

.image-viewer-heading {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 18px;
    min-width: 0;
}

.image-viewer-heading h2 {
    flex: 1 1 240px;
    min-width: 0;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.image-viewer-controls {
    display: flex;
    align-items: stretch;
    gap: 8px;
    max-width: 100%;
}

.image-viewer-controls button {
    box-sizing: border-box;
    min-width: 44px;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #bfd3e0;
    border-radius: 6px;
    background: #f4f9fc;
    color: #125f89;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
}

.image-viewer-controls button:disabled {
    opacity: .65;
    cursor: default;
}

.image-viewer-controls button:hover {
    background: #e9f4fb;
}

#image-viewer-close > span {
    margin-right: 5px;
    font-size: 20px;
    line-height: 1;
}

.image-viewer :is(button, a, [tabindex]):focus-visible {
    outline: 3px solid #125f89;
    outline-offset: 3px;
}

.image-viewer-stage {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100px;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: auto;
    border: 1px solid #e1eaf0;
    border-radius: 6px;
    background: #f3f7fa;
}

#image-viewer-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 160px);
    max-height: calc(100dvh - 160px);
    margin: auto;
    object-fit: contain;
}

.image-viewer.is-original-size #image-viewer-image {
    max-width: none;
    max-height: none;
}

.image-viewer-status,
.image-viewer-error {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.image-viewer-error {
    padding: 20px;
}

.image-viewer-error a {
    color: #125f89;
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 600px) {
    .image-viewer {
        padding: 12px;
    }

    .image-viewer-heading h2 {
        flex-basis: 100%;
        font-size: 16px;
    }

    .image-viewer-controls {
        width: 100%;
        justify-content: space-between;
    }

    .image-viewer-controls button {
        padding-inline: 10px;
        font-size: 13px;
    }

    #image-viewer-image {
        max-height: calc(100vh - 210px);
        max-height: calc(100dvh - 210px);
    }
}

@media (max-height: 450px) {
    .image-viewer-heading h2 {
        max-height: 2.8em;
        overflow: auto;
    }

    .image-viewer-stage {
        min-height: 50px;
    }

    #image-viewer-image {
        max-height: calc(100vh - 160px);
        max-height: calc(100dvh - 160px);
    }
}
