.image-popup-trigger {
    all: unset;
    display: inline-block;
    cursor: pointer;
    vertical-align: middle;
    border-radius: 6px;
}

.image-popup-trigger:focus-visible {
    outline: 2px solid #630b0b;
    outline-offset: 4px;
}

.image-popup-trigger:hover {
    transform: scale(1.05);
}

.image-popup-trigger .u-photo-inline {
    cursor: pointer;
}

.image-popup-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(20 20 20 / 0.68);
    z-index: 999;
}

.image-popup-backdrop.is-open {
    display: flex;
}

.image-popup-panel {
    position: relative;
    width: min(480px, 92vw);
    max-height: 85vh;
    overflow: auto;
    padding: 1rem 1rem 0.75rem;
    border: 1px solid #630b0b;
    border-radius: 14px;
    background: #fffdf6;
    box-shadow: 0 18px 48px rgb(0 0 0 / 0.28);
}

.image-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: none;
    background: transparent;
    color: #630b0b;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.image-popup-body {
    padding-top: 1.5rem;
    color: #2b1b1b;
}

.image-popup-media {
    margin: 0 0 1rem;
    position: relative;
}

.image-popup-media:empty {
    display: none;
    margin: 0;
}

.image-popup-media.is-loading {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(99 11 11 / 0.25);
    border-radius: 8px;
}

.image-popup-media.is-loading::after {
    content: "";
    width: 32px;
    height: 32px;
    border: 3px solid rgb(99 11 11 / 0.2);
    border-top-color: #630b0b;
    border-radius: 50%;
    animation: image-popup-spin 0.8s linear infinite;
}

@keyframes image-popup-spin {
    to {
        transform: rotate(360deg);
    }
}

.image-popup-image,
.image-popup-video,
.image-popup-embed {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.image-popup-media.is-loading .image-popup-image,
.image-popup-media.is-loading .image-popup-video,
.image-popup-media.is-loading .image-popup-embed {
    /* Rendered off-screen rather than display:none, so the browser still
       loads it and fires the load/loadeddata event that clears is-loading —
       display:none can pause that in some browsers (notably iframes). */
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.image-popup-image,
.image-popup-video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border: 1px solid #630b0b;
    border-radius: 8px;
}

.image-popup-image {
    image-rendering: pixelated; /* keeps small gifs (88x31 buttons) crisp when scaled up */
}

.image-popup-embed {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid #630b0b;
    border-radius: 8px;
}

.image-popup-body p {
    margin: 0 0 1rem;
    line-height: 1.6;
}

.image-popup-link {
    display: inline-block;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    background: #630b0b;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.image-popup-link:hover {
    opacity: 0.95;
}

@media (max-width: 480px) {
    .image-popup-panel {
        padding: 0.9rem 0.9rem 0.75rem;
    }
}