.modal {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease-in;
}

/* Modal content container */
.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
    animation: slideIn 0.3s ease-out;
}

@media (max-width: 780px) {
  .modal-content {
    top: 20%;
    left: 0;
    transform: none;                                                                                                                                              
    width: 100%;
    height: auto;
    border-radius: 0; /* edge-to-edge in mobile */
    max-width: 100%;
  }
}

.modal-image {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
    max-height: 70vh; 
    object-fit: contain; /* Maintain aspect ratio */
}

/* text under image */
.modal-text {
    padding: 10px;
    margin: 0;
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background-color: rgb(255, 255, 255);
}

/* Close button */
.close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background-color: rgb(0, 0, 0);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 1001;
}

.close:hover {
    background-color: rgba(63, 63, 63, 0.733);
    color: white;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    to { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Hide modal */
.modal.hidden {
    display: none;
}