.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

/* center the figure inside the modal */
.modal-figure {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 90%;
    max-width: 1200px;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
    max-height: 90vh;
}

/* image styling - responsive and contained */
.modal-content {
    margin: 0;
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: calc(90vh - 3.5rem);
    object-fit: contain;
    height: auto;
    border-radius: 6px;
}

/* caption below image */
.modal-caption {
    color: #fff;
    font-size: 0.95rem;
    text-align: center;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.45);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    line-height: 1.3;
    word-break: break-word;
}

/* keep close button visible above everything */
.modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.zoomable {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.zoomable:hover {
    transform: scale(1.02);
}