/*
    static/css/lightbox.css

    This CSS provides styling for the centered image figure and the lightbox effect.
*/

/* --- Image Centering --- */
/*
    The <figure> element is a block, so we can center it using margin auto.
    We also set a max-width to prevent small images from stretching the figure too wide.
*/
.figure-center {
    margin-left: auto;
    margin-right: auto;
    text-align: center; /* Ensures the content inside is centered */
    padding: 1rem 0;
}

.figure-center img {
    max-width: 100%; /* Ensures images are responsive and don't overflow their container */
    height: auto;
    border-radius: 0.5rem; /* A subtle rounded corner for aesthetics */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* A soft shadow */
    transition: transform 0.3s ease;
}

.figure-center a:hover img {
    transform: scale(1.02); /* Slight zoom effect on hover */
}


/* --- Lightbox --- */
/*
    The main lightbox container. It's fixed to cover the entire viewport.
    It's hidden by default and uses a fade-in/fade-out transition.
*/
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Semi-transparent black background */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer; /* Indicates the overlay can be clicked to close */

    /* Visibility and transition */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* The class added by JavaScript to show the lightbox */
.lightbox-overlay.show {
    visibility: visible;
    opacity: 1;
}

/* The container for the large image inside the lightbox */
.lightbox-image-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default; /* Reset cursor for the image area */
}

.lightbox-image-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 0.25rem;
}

/* The close button for the lightbox */
.lightbox-close {
    position: absolute;
    top: -1.5rem;
    right: -1.5rem;
    font-size: 2rem;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
}

/* Responsive adjustment for smaller screens */
@media (max-width: 768px) {
    .lightbox-overlay {
        padding: 1rem;
    }
    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        background-color: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }
}

/*
  KaTeX Fix: Forcefully hide the visual HTML layer to prevent double-rendering
  when the browser's native MathML rendering is preferred.
*/
.katex-html {
  display: none !important;
}

