.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #16080AB2;
    backdrop-filter: blur(8px);
    z-index: 9999;
    overflow: auto;
}
.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}
.modal-container {
    background: #fff;
    max-width: 840px;
    width: 90%;
    max-height: calc(100vh - 40px);
    margin: 0 auto;
    border-radius: var(--radius-m);
    box-shadow: 1px 1px 12px 1px #16080A1A; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    padding: var(--space-4xs) var(--space-2xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--calm);
}
.modal-header p {
    margin: 0;
    font-weight: 600;
    color: var(--grey);
}
.modal-close,
.modal-close:hover {
    background: none;
    border: none;
    color: var(--black);
    font-size: 40px;
    cursor: pointer;
    margin-top: -3px;
    width: 0;
    height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover {
    color: var(--desire);
}
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2xs);
    max-height: calc(60vh - 40px);
}
.modal-footer {
    background: #fff;
    padding: var(--space-2xs);
    border-top: 1px solid var(--calm);
    display: flex;
    text-align: center;
    align-items: center;
    flex-shrink: 0;
    flex-direction: column;
    gap: 10px;
}
.modal-footer p {
    font-size: 14px;
    margin: 0;
}
.modal-footer a {
    white-space: nowrap;
    margin: 0;
}

@media (max-width: 768px) {
    .modal-overlay.active {
        align-items: stretch;
        padding: 0;
    }
    .modal-container {
        position: fixed;
        inset: 0;
        display: flex;
        flex-direction: column;
        height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
        width: 100%;
    }
    .modal-header {
        flex: 0 0 auto;
    }
    .modal-body {
        flex: 1 1 auto;
        overflow-y: auto;
        min-height: 0;
    }
    .dl-archive-team__loop .modal-body {
        max-height: calc(100vh - 120px);
    }
    .modal-footer {
        flex: 0 0 auto;
        width: 100%;
        max-width: 840px;
        margin: 0 auto;
        border-radius: 0 0 8px 8px;
        z-index: 10000;
    }
    body.modal-open {
        padding-bottom: 120px; /* Account for fixed footer */
    }
}

@media (max-width: 600px) {
    .dl-archive-team__loop #modalBody {
        grid-template-columns: 1fr;
    }
}

.modal-trigger:hover {
    cursor: pointer;
}
.modal-content-hidden {
    display: none;
}