/* Lightbox Overlay */
#lightbox {
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(var(--spacing-md), env(safe-area-inset-top)) max(var(--spacing-md), env(safe-area-inset-right)) max(var(--spacing-md), env(safe-area-inset-bottom)) max(var(--spacing-md), env(safe-area-inset-left));
}

#lightbox[hidden] {
    display: none;
}

body.lightbox-open {
    overflow: hidden;
}

/* Lightbox Image */
#lightbox img {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    border-radius: 4px;
    animation: zoomIn 0.3s ease;
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border: none;
    background: transparent;
    color: #f1f1f1;
    font-size: 40px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Animation */
@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}