html:has(.image-viewer[open]) { overflow: hidden; }

.image-viewer {
    max-width: calc(100% - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--white);
}
.image-viewer::backdrop { background: rgb(0 0 0 / 78%); }
.image-viewer__image {
    max-width: 100%;
    max-height: calc(100dvh - 32px);
    object-fit: contain;
}
.image-viewer__close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
}

.image-viewer__navigation {
    position: absolute;
    inset-inline-start: 50%;
    inset-block-end: 8px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: var(--radius-pill);
    background: var(--white);
}

.image-viewer__navigation button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--color-surface);
    cursor: pointer;
}

.image-viewer__navigation button:hover { background: var(--color-surface-brand); }
.image-viewer__previous img { transform: rotate(180deg); }
.image-viewer__position { min-width: 4ch; text-align: center; white-space: nowrap; }
