/* E8 Team Grid ([e8_team_grid]) */

.team-grid {
    --team-grid-columns: 3;
    --team-grid-gap-x: 40px;
    --team-grid-gap-y: 50px;
    --team-grid-purple: #523594;
    --team-grid-orange: #e78b37;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--team-grid-gap-y) var(--team-grid-gap-x);
    margin: 0;
    padding: 0;
    list-style: none;
}

.team-grid,
.team-grid * {
    box-sizing: border-box;
}

/* Fixed basis so a partial last row stays card-sized and centers */
.team-grid__item {
    flex: 0 0 calc((100% - (var(--team-grid-columns) - 1) * var(--team-grid-gap-x)) / var(--team-grid-columns));
    min-width: 0;
    margin: 0;
    padding: 0;
}

/* Card */
.team-grid .team-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 15px;
    text-decoration: none;
}

.team-grid .team-card:focus-visible {
    outline: 3px solid var(--team-grid-purple);
    outline-offset: 6px;
}

/* Photos: square box, both images fill it so differing aspect ratios never distort */
.team-card__media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 15px;
}

.team-card__media .team-card__img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    object-fit: cover;
    object-position: center 25%;
}

.team-card__media .team-card__img--hover {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Name, title, icon */
.team-card__body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-top: 25px;
    padding: 0 20px;
}

.team-card__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--team-grid-purple);
}

.team-card__name {
    font-family: 'Domus', sans-serif;
    font-size: 25px;
    font-weight: 600;
    line-height: 1.4;
}

.team-card__title {
    font-family: 'Filson Soft', sans-serif;
    font-size: 16px;
    font-weight: normal;
    line-height: 1.4;
}

/* Fixed size regardless of how much text sits beside it */
.team-card__icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    color: var(--team-grid-orange);
    transition: color 0.3s ease-in-out;
}

.team-card__icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Hover only on real pointers, so touch never shows or sticks on the hover photo */
@media (hover: hover) and (pointer: fine) {
    .team-card:hover .team-card__img--hover {
        opacity: 1;
    }

    .team-card:hover .team-card__icon {
        color: var(--team-grid-purple);
    }
}

.team-card:focus-visible .team-card__img--hover {
    opacity: 1;
}

.team-card:focus-visible .team-card__icon {
    color: var(--team-grid-purple);
}

@media (max-width: 1200px) {
    .team-card__body {
        margin-top: 15px;
        padding: 0;
    }

    .team-card__name {
        font-size: 20px;
    }

    .team-card__title {
        font-size: 14px;
    }

    .team-card__icon {
        width: 26px;
        height: 26px;
    }
}

@media (max-width: 1024px) {
    .team-grid {
        --team-grid-columns: 2;
        --team-grid-gap-x: 30px;
        --team-grid-gap-y: 40px;
    }
}

@media (max-width: 767px) {
    .team-grid {
        --team-grid-columns: 1;
    }

    .team-grid__item {
        max-width: 420px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .team-card__media .team-card__img--hover,
    .team-card__icon {
        transition: none;
    }
}
