.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.overlay-content {
    background: var(--color-bg-secondary);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    animation: popIn 0.3s ease forwards;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
}

/* For image-only popouts */
.overlay-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

.hidden-info {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay-content .hidden-info {
    display: block;
    opacity: 1;
    margin-top: 1rem;
}

.overlay-content .card {
    animation: fadeUp 0.3s ease forwards;
    transform: translateY(20px);
    opacity: 0;
}

@keyframes fadeUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.overlay-content .hide-in-popout {
    display: none;
}

/* Default: all images in popout scale normally */
.overlay-content img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
}

/* Smaller images */
.overlay-content img.small-popout {
    max-width: 550px;
    /* adjust as needed */
    max-height: 70vh;
}

.overlay-content img {
    transition: transform 0.3s ease, max-width 0.3s ease, max-height 0.3s ease;
}

/* Center audio in overlay */
.overlay-content audio {
    display: block;
    /* treat as block element */
    margin: 1rem auto 0;
    /* auto left/right centers it, 1rem top space */
    width: 100%;
    /* optional: fill container width */
    max-width: 400px;
    /* limit maximum width */
}