/* ─── Photo Lightbox ─────────────────────────────── */

#fb-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.fb-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
}

.fb-lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 10;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    padding: 4px 12px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.fb-lightbox-close:hover {
    opacity: 1;
}

.fb-lightbox-prev,
.fb-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}

.fb-lightbox-prev:hover,
.fb-lightbox-next:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.25);
}

.fb-lightbox-prev {
    left: 16px;
}

.fb-lightbox-next {
    right: 16px;
}

.fb-lightbox-content {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fb-lightbox-media {
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.fb-lightbox-counter {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
}

.fb-lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    max-width: 60vw;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .fb-lightbox-prev,
    .fb-lightbox-next {
        width: 36px;
        height: 36px;
    }

    .fb-lightbox-prev {
        left: 8px;
    }

    .fb-lightbox-next {
        right: 8px;
    }
}

/* The photograph's own words (#309). The caption was one centred line of file name; with a title and a
   description it is a short block, scrolled rather than allowed to cover the photograph. */
.fb-lightbox-caption {
    white-space: normal;
    max-height: 22vh;
    overflow-y: auto;
    text-overflow: clip;
    pointer-events: auto;
}

.fb-lightbox-title {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.fb-lightbox-description,
.fb-lightbox-name {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.fb-lightbox-edit {
    margin-top: 6px;
    padding: 2px 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    background: transparent;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}

.fb-lightbox-edit:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* The photograph's words (#310): small chips under the description, read-only in the viewer. */
.fb-lightbox-words {
    margin-top: 6px;
}

.fb-lightbox-word {
    display: inline-block;
    margin: 0 4px 4px 0;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 12px;
    overflow-wrap: anywhere;
}

/* The page beneath does not scroll while the viewer is open. Said here rather than as a style on
   <body>, because every navigation in this app is an enhanced one and it rewrites <body>'s
   attributes to the server's -- so a style set there was gone as soon as the address changed. */
body:has(#fb-lightbox.fb-lightbox-open) {
    overflow: hidden;
}
