/* Click-to-enlarge for order product card images only. */
.bn-lightbox-trigger {
    cursor: zoom-in;
}
.bn-lightbox-trigger:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* The page behind the overlay must not scroll. */
html.bn-lightbox-open,
html.bn-lightbox-open body {
    overflow: hidden;
}

.bn-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000; /* above the sticky header and the cookie banner */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: rgba(0, 0, 0, 0.85);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.bn-image-lightbox.is-open {
    opacity: 1;
}
.bn-image-lightbox[hidden] {
    display: none;
}

.bn-image-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
}

.bn-image-lightbox__image {
    display: block;
    /* Leave room for the caption below and the padding around. */
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #fff;
    transform: scale(0.97);
    transition: transform 0.2s ease;
}
.bn-image-lightbox.is-open .bn-image-lightbox__image {
    transform: scale(1);
}

.bn-image-lightbox__caption {
    max-width: 48rem;
    color: #fff;
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: center;
}
.bn-image-lightbox__caption[hidden] {
    display: none;
}

.bn-image-lightbox__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 44px: a comfortable touch target. */
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.bn-image-lightbox__close:hover,
.bn-image-lightbox__close:focus-visible {
    background: rgba(255, 255, 255, 0.15);
}
.bn-image-lightbox__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (min-width: 768px) {
    .bn-image-lightbox {
        padding: 3rem;
    }
    .bn-image-lightbox__close {
        top: 1rem;
        right: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bn-image-lightbox,
    .bn-image-lightbox__image {
        transition: none;
    }
    .bn-image-lightbox__image {
        transform: none;
    }
}
