/* ===== Lightbox (shared across portfolio pages) ===== */
#lb-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(24, 22, 20, 0.94);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#lb-overlay.lb-open { opacity: 1; visibility: visible; }

#lb-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

#lb-img {
    max-width: 92vw;
    max-width: calc(100vw - 96px);
    max-height: 78vh;
    max-height: 78dvh;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.3s ease, transform 0.3s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    background: #f5f0e8;
}
#lb-img.lb-loaded { opacity: 1; transform: scale(1); }
#lb-img.lb-dragging { transition: none; }

.lb-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border: 1px solid rgba(245, 240, 232, 0.35);
    border-radius: 50%;
    background: rgba(245, 240, 232, 0.12);
    color: #f5f0e8;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    z-index: 3;
}
.lb-btn:hover { background: rgba(245, 240, 232, 0.25); }
.lb-btn:active { transform: scale(0.92); }
.lb-btn svg { width: 20px; height: 20px; display: block; }

#lb-close {
    top: 18px;
    right: 18px;
}
#lb-prev {
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
}
#lb-next {
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}
#lb-prev:active, #lb-next:active { transform: translateY(-50%) scale(0.92); }

#lb-caption {
    position: absolute;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    max-width: min(92vw, 900px);
    text-align: center;
    color: rgba(245, 240, 232, 0.92);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    line-height: 1.5;
    z-index: 2;
    pointer-events: none;
}
#lb-caption .lb-count {
    display: block;
    margin-top: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(245, 240, 232, 0.55);
}

/* Subtle zoom affordance on thumbnails */
.artwork .img-wrap { cursor: zoom-in; }
.artwork .img-wrap::after {
    content: '';
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(245, 240, 232, 0.85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'%3E%3C/circle%3E%3Cpath d='M21 21l-4.35-4.35'%3E%3C/path%3E%3Cpath d='M11 8v6M8 11h6'%3E%3C/path%3E%3C/svg%3E") center/16px no-repeat;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.artwork:hover .img-wrap::after,
.artwork .img-wrap:focus-visible::after { opacity: 1; transform: scale(1); }

/* ===== Mobile tuning ===== */
@media (max-width: 640px) {
    #lb-img {
        max-width: calc(100vw - 24px);
        max-height: 76dvh;
    }
    #lb-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
    #lb-prev { left: 10px; }
    #lb-next { right: 10px; }
    .lb-btn {
        background: rgba(245, 240, 232, 0.16);
        border-color: rgba(245, 240, 232, 0.3);
    }
    #lb-caption {
        font-size: 0.95rem;
        bottom: calc(12px + env(safe-area-inset-bottom));
    }
}
