/**
 * Lightbox gallery — Stimulus `lightbox` controller.
 *
 * Classes: .lightbox-trigger, .lightbox, .lightbox__close, .lightbox__prev,
 * .lightbox__next, .lightbox__figure, .lightbox__image
 */

.lightbox-trigger {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    border-radius: var(--border-radius-s);
    transition: opacity 0.15s ease;
}

.lightbox-trigger:hover,
.lightbox-trigger:focus-visible {
    opacity: 0.9;
}

.lightbox-trigger:focus-visible {
    outline: 2px solid var(--brand-colour-link-dark);
    outline-offset: 2px;
}

.lightbox {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    padding: var(--space-section);
    border: 0;
    background: rgb(15 20 30 / 92%);
    color: var(--brand-colour-text);
}

.lightbox::backdrop {
    background: transparent;
}

.lightbox__figure {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
}

.lightbox__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
    position: fixed;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: var(--border-radius-s);
    background: var(--brand-colour-surface);
    color: var(--brand-colour-text);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.lightbox__close:hover,
.lightbox__close:focus-visible,
.lightbox__prev:hover,
.lightbox__prev:focus-visible,
.lightbox__next:hover,
.lightbox__next:focus-visible {
    background: var(--brand-colour-surface-hover);
    color:#fff;
}

.lightbox__close:focus-visible,
.lightbox__prev:focus-visible,
.lightbox__next:focus-visible {
    outline: 2px solid var(--brand-colour-link-light);
    outline-offset: 2px;
}

.lightbox__close {
    top: var(--space-block);
    right: var(--space-block);
    background-color:#fff;
    color:var(--brand-colour-primary);
}

.lightbox__prev {
    top: 50%;
    left: var(--space-block);
    transform: translateY(-50%);
}

.lightbox__next {
    top: 50%;
    right: var(--space-block);
    transform: translateY(-50%);
}

.lightbox__close svg,
.lightbox__prev svg,
.lightbox__next svg {
    width: 1.25rem;
    height: 1.25rem;
}
