/* ============================================================
   Lightbox — assets/css/lightbox.css
   ============================================================ */

.lightbox {
    --lb-tint: transparent;
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    color: #fff;
    /* Near-black, faintly tinted with the photo's average colour. */
    background:
        radial-gradient(ellipse 70% 60% at 50% 50%, color-mix(in srgb, var(--lb-tint) 16%, transparent), transparent 75%),
        #080808;
    transition: background 0.4s ease;
    animation: lb-fade-in 0.2s ease;
    font-family: var(--font-sans, system-ui, sans-serif);
}

.lightbox.is-open {
    display: block;
}

@keyframes lb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Top bar: counter left, share + close right. */
.lightbox__bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 24px;
    z-index: 2;
}

.lightbox__counter {
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.5);
}

.lightbox__actions {
    display: flex;
    gap: 4px;
}

/* Stage: the photo fills the space between bar and info. */
.lightbox__inner {
    position: absolute;
    inset: 64px 80px 104px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox__img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 2px;
    opacity: 0;
    transform: scale(0.985);
    transition: opacity 0.35s ease, transform 0.35s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

.lightbox__img.is-loaded {
    opacity: 1;
    transform: none;
}

.lightbox button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.lightbox button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.lightbox button:focus-visible {
    color: #ffffff;
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}

.lightbox__prev,
.lightbox__next {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
}

.lightbox .lightbox__prev,
.lightbox .lightbox__next {
    width: 52px;
    height: 52px;
}

.lightbox__prev { left: 16px; }
.lightbox__next { right: 16px; }

.lightbox--single .lightbox__prev,
.lightbox--single .lightbox__next {
    display: none;
}

/* Info below the photo: title, tags, camera settings. */
.lightbox__info {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    width: min(90vw, 720px);
    text-align: center;
    pointer-events: none;
}

.lightbox__info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox__info p:empty {
    display: none;
}

.lightbox__caption {
    font-size: 0.9375rem;
    font-weight: 550;
    letter-spacing: -0.01em;
    color: rgba(255, 255, 255, 0.92);
}

.lightbox__meta {
    margin-top: 2px;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.55);
}

.lightbox__exif {
    margin-top: 6px;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.4);
    white-space: pre;
}

.lightbox__toast {
    position: absolute;
    left: 50%;
    top: 76px;
    transform: translate(-50%, -6px);
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    font-size: 0.8125rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.lightbox__toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 760px) {
    .lightbox__bar { height: 56px; padding: 0 8px 0 16px; }
    .lightbox__inner { inset: 56px 0 112px; }
    .lightbox .lightbox__prev,
    .lightbox .lightbox__next {
        top: auto;
        bottom: 28px;
        transform: none;
        width: 44px;
        height: 44px;
    }
    .lightbox__prev { left: 8px; }
    .lightbox__next { right: 8px; }
    .lightbox__info { width: calc(100vw - 120px); bottom: 26px; }
    .lightbox__exif { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
    .lightbox, .lightbox__img { animation: none; transition: none; }
}
