/* Lightbox/Modal styles for figure popups */

/* The overlay background */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

/* The enlarged image container */
.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The enlarged image */
.lightbox-image {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background-color: #fff;
}

/* SVG-specific styling - ensure proper dimensions */
.lightbox-image.lightbox-svg {
    width: auto;
    height: auto;
    min-width: 67vw;
    min-height: 40vh;
    max-width: 95vw;
    max-height: 95vh;
    padding: 20px;
    background-color: #fff;
}

/* Dark mode: use dark background for SVGs */
[data-theme="dark"] .lightbox-image.lightbox-svg,
:root[data-theme="dark"] .lightbox-image.lightbox-svg,
body[data-theme="dark"] .lightbox-image.lightbox-svg {
    background-color: #131416;
}

/* Also handle prefers-color-scheme for auto mode */
@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) .lightbox-image.lightbox-svg {
        background-color: #131416;
    }
}

/* Close button */
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 30px;
    font-size: 40px;
    font-weight: bold;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10000;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    line-height: 1;
    font-family: sans-serif;
    padding: 0;
    margin: 0;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Make figures and images clickable */
.content figure,
.content .figure,
.content img:not(.lightbox-image),
article figure,
article .figure,
article img:not(.lightbox-image) {
    cursor: zoom-in;
}

/* Hover effect on images to indicate they're clickable */
.content figure img:not(.lightbox-image),
.content .figure img:not(.lightbox-image),
.content p > img:not(.lightbox-image),
.content .image-wrapper img:not(.lightbox-image),
article figure img:not(.lightbox-image),
article .figure img:not(.lightbox-image),
article p > img:not(.lightbox-image) {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.content figure img:not(.lightbox-image):hover,
.content .figure img:not(.lightbox-image):hover,
.content p > img:not(.lightbox-image):hover,
.content .image-wrapper img:not(.lightbox-image):hover,
article figure img:not(.lightbox-image):hover,
article .figure img:not(.lightbox-image):hover,
article p > img:not(.lightbox-image):hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Prevent body scroll when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}
