.team-grid {
    --team-gap: clamp(12px, 2vw, 24px);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--team-gap);
}

.team-grid .team-card {
    --team-card-padding: clamp(9px, 1.2vw, 16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 calc((100% - 3 * var(--team-gap)) / 4);
    min-width: 0;
    padding: var(--team-card-padding);
}

.team-card > p { margin-bottom: 8px; }

.team-profile-button {
    display: grid;
    place-items: center;
    align-self: flex-end;
    width: 48px;
    height: 44px;
    margin-block: auto calc(-1 * var(--team-card-padding));
    margin-inline-end: calc(-1 * var(--team-card-padding));
    padding: 0;
    border: 0;
    border-radius: 14px 0 calc(var(--radius) - 1px) 0;
    background: var(--gold);
    color: var(--blue-dark);
    font: 800 1.6rem/1 Manrope, system-ui, sans-serif;
    cursor: pointer;
}

.team-profile-button:hover {
    background: var(--blue-dark);
    color: white;
}

.team-profile {
    width: min(560px, calc(100% - 30px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: white;
    color: var(--blue-dark);
    box-shadow: 0 12px 55px rgb(18 34 70 / 28%);
    text-align: left;
}

.team-profile::backdrop { background: rgb(19 32 64 / 65%); }

.team-profile-content {
    position: relative;
    padding: 20px clamp(18px, 5vw, 32px) clamp(20px, 5vw, 32px);
}

.team-profile-close {
    position: absolute;
    inset-block-start: 12px;
    inset-inline-end: 12px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: var(--gold);
    color: var(--blue-dark);
    font: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.team-profile-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    padding-inline-end: 36px;
}

.team-card .team-profile-heading :is(img, .avatar) {
    flex: 0 0 70px;
    width: 70px;
    height: 70px;
    margin: 0;
}

.team-profile-heading h2 { color: var(--blue-dark); font-size: clamp(1.35rem, 5vw, 2rem); }
.team-card .team-profile-role { margin: 5px 0 0; }
.team-card .team-profile-bio {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 1rem;
    white-space: pre-line;
}

@media (max-width: 700px) {
    .team-grid .team-card { flex-basis: calc((100% - var(--team-gap)) / 2); }
}
