.team-member-grid {
    display: grid;
    gap: var(--wp--preset--spacing--60);
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
}

.team-member {
    display: flex;
    text-align: left;
}

.team-member-grid .team-member {
    flex-direction: column;
    margin-bottom: var(--wp--preset--spacing--50);
}

.team-member-grid .team-member__image-wrapper {
    margin-bottom: 1.5rem;
    overflow: hidden;
    width: 100%;
}

.team-member-grid .team-member__image {
    aspect-ratio: 1;
    display: block;
    height: auto;
    object-fit: cover;
    transition: transform 0.3s ease-in-out;
    width: 100%;
}

@media (min-width: 993px) {
    .team-member-grid .team-member:hover .team-member__image {
        transform: scale(1.05);
    }
}

.team-member-grid .team-member__content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-member-grid .team-member__name {
    font-size: var(--wp--preset--font-size--large);
    font-weight: 500;
    line-height: 1;
    margin: 0;
}

.team-member-grid .team-member__position {
    color: currentcolor;
    font-size: var(--wp--preset--font-size--big);
    font-weight: 400;
    line-height: 1;
    margin: 0;
}

.team-member-grid .team-member .wp-block-buttons {
    justify-content: flex-start;
    margin-top: 0.25rem;
}

@media (max-width: 992px) {
    .team-member-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .team-member-grid {
        gap: 3rem;
        grid-template-columns: 1fr;
    }
}

.team-member-modal {
    --modal-info-padding: 5rem;

    animation: team-overlay-reveal 0.3s ease-in 1 forwards;
    border: none;
    border-radius: 0;
    height: 90vh;
    margin: auto;
    max-height: 800px;
    max-width: 1200px;
    overflow: clip;
    padding: 0;
    width: 90vw;
}

.team-member-modal .team-member {
    height: 100%;
    overflow: clip;
}

.team-member-modal__content {
    align-items: center;
    background: var(--wp--preset--color--secondary);
    box-sizing: border-box;
    color: var(--wp--preset--color--base);
    display: flex;
    height: 100%;
    padding: 0;
}

.team-member-modal__image-wrapper {
    align-items: center;
    display: flex;
    flex: 0 0 50%;
    height: 100%;
    max-width: 50%;
    overflow: clip;
    position: relative;
}

.team-member-modal__image {
    display: block;
    height: 100%;
    left: 0;
    object-fit: cover;
    position: absolute;
    top: 0;
    width: 100%;
}

.team-member-modal__info {
    align-self: center;
    box-sizing: border-box;
    flex: 0 0 50%;
    max-height: 100%;
    overflow-y: auto;
    padding: var(--modal-info-padding);
}

.team-member-modal::backdrop {
    animation: team-backdrop-filter 0.3s ease-out 1 forwards;
    background: rgba(255, 255, 255, 0.05);
}

@supports not selector(.team-member-modal::backdrop) {
    .team-member-modal::after {
        animation: team-backdrop-filter 0.3s ease-out 1 forwards;
        background: rgba(255, 255, 255, 0.05);
        bottom: 0;
        content: '';
        display: block;
        left: 0;
        position: fixed;
        right: 0;
        top: 0;
        z-index: -1;
    }
}

.team-member-modal__close {
    align-items: center;
    backdrop-filter: blur(7.5px);
    background: rgba(255, 255, 255, 0.31);
    border: none;
    border-radius: 50vw;
    cursor: pointer;
    display: flex;
    height: 2.625rem;
    justify-content: center;
    padding: 0.5rem;
    position: absolute;
    right: 1rem;
    top: 1rem;
    transition: background-color 0.2s ease;
    width: 2.625rem;
    z-index: 1;
}

.team-member-modal__close:hover {
    background: var(--wp--preset--color--primary);
}

.team-member-modal__close:hover svg line {
    stroke: white;
}

.team-member-modal__name {
    font-size: var(--wp--preset--font-size--x-large);
    margin: 0;
}

.team-member-modal__position {
    color: var(--wp--preset--color--primary);
    font-size: var(--wp--preset--font-size--medium);
    margin: 0;
}

.team-member-modal__bio {
    margin-top: 1rem;
}

.team-member-modal__bio p {
    font-weight: 400;
}

.team-member-modal__contact {
    display: flex;
    flex-direction: column;
    font-size: var(--wp--preset--font-size--regular);
    gap: 0.5rem;
    margin-top: 1rem;
}

.team-member-modal__contact a {
    color: inherit;
    text-decoration: none;
}

.team-member-modal__contact a:hover {
    color: var(--wp--preset--color--primary);
}

.team-member-modal__contact h6 {
    font-size: var(--wp--preset--font-size--big);
    font-weight: 500;
    margin: 0;
}

.team-member-modal__label {
    color: var(--wp--preset--color--primary);
}

@media (max-width: 768px) {
    .team-member-modal {
        --modal-info-padding: 2rem;

        height: 100vh;
        margin: 0;
        max-height: none;
        width: 100vw;
    }

    .team-member-modal__content {
        flex-direction: column;
        height: 100%;
        overflow-y: auto;
    }

    .team-member-modal__image-wrapper {
        flex: 0 0 40vh;
        height: 40vh;
        max-width: 100%;
        position: relative;
        width: 100%;
    }

    .team-member-modal__image {
        height: 100%;
        left: 0;
        object-fit: cover;
        position: absolute;
        top: 0;
        width: 100%;
    }

    .team-member-modal__info {
        flex: 1;
        max-height: unset;
        max-width: 100%;
        overflow: unset;
        padding: var(--modal-info-padding);
    }
}

/* Prevent scroll on body when modal is open */
body:has(.team-member-modal[aria-hidden=false]) {
    overflow: clip;
}

.team-member__bio {
    margin-top: 1rem;
}

/* Add support for Gutenberg blocks inside bio */
.team-member__bio > * {
    margin-bottom: 1rem;
}

.team-member__bio > *:last-child {
    margin-bottom: 0;
}

/* Handle block alignment */
.team-member__bio .alignfull,
.team-member__bio .alignwide {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Handle block spacing */
.team-member__bio [class*=wp-block] {
    margin-bottom: 1rem;
    margin-top: 1rem;
}

/* Handle lists */
.team-member__bio ul,
.team-member__bio ol {
    padding-left: 1.5rem;
}

.team-member-modal__close svg {
    height: 0.625rem;
    width: 1.125rem;
}

.team-member__image-link {
    display: block;
    width: 100%;
}

@keyframes team-overlay-reveal {
    0% {
        opacity: 0;
        transform: translateY(0.5rem);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes team-backdrop-filter {
    0% {
        backdrop-filter: blur(0);
    }

    100% {
        backdrop-filter: blur(15.4px);
    }
}
