.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20;
    background-color: white;
    padding: 8px;
}

.lightbox.active {
    display: block;
}

.lightbox-home {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 22;
}

.lightbox-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 22;
    width: 16px;
    rotate: 45deg;
}

.lightbox-close svg {
    display: block;
    width: 100%;
    height: auto;
}

.lightbox-arrow {
    position: absolute;
    top: 40px;
    bottom: 40px;
    width: 15%;
    z-index: 21;
    opacity: 0;
}

.lightbox-arrow.prev {
    left: 0;
    /* PNG, not SVG: Safari ignores SVG cursors. Second declaration adds the
       retina variant and is dropped by browsers without image-set(). */
    cursor: url('../../icons/chevron-left-cursor.png') 16 16, w-resize;
    cursor: image-set(url('../../icons/chevron-left-cursor.png') 1x, url('../../icons/chevron-left-cursor@2x.png') 2x) 16 16, w-resize;
}

.lightbox-arrow.next {
    right: 0;
    cursor: url('../../icons/chevron-right-cursor.png') 16 16, e-resize;
    cursor: image-set(url('../../icons/chevron-right-cursor.png') 1x, url('../../icons/chevron-right-cursor@2x.png') 2x) 16 16, e-resize;
}

.lightbox-slides {
    height: 100%;
    position: relative;
}

.lightbox-slide {
    display: none;
    height: 100%;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    /* Clears the home link and the close button. */
    padding-top: 1.5rem;
}

.lightbox-slide.active {
    display: flex;
}

/* The figure takes whatever height the tags leave over and centres the image
   inside it, so landscape and portrait both sit on the same middle line. */
.lightbox-slide .figure {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Out of the way, so the image is the flex item being centred. No gap here:
   the <source> is lifted into this flex context too, and a gap after that
   zero-sized item would push the image off centre. */
.lightbox-slide picture {
    display: contents;
}

.lightbox-slide .figure-caption {
    margin-top: 8px;
}

.lightbox-slide img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-slide-tags {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.lightbox-slide-tags-project,
.lightbox-slide-tags-image {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}


