.team {
    display: flex;
    flex-wrap: wrap;
    gap: 42px 19px;
}

.team .overlay-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 101;
    background-color: #464646;
    opacity: 0.7;
    display: none;
}

.team .member {
    width: calc(25% - 14.25px);
}

.team .member .card {
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.team .member .card .text {
    transition: all 0.3s;
    padding: 23px 31px 6px;
}

.team .member .card:hover .text {
    color: white;
    background-color: #EE7C29;
}

.team .member .card .name {
    font-weight: 500;
    font-size: 18px;
    line-height: 33px;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.team .member .card .position {
    font-size: 14px;
    line-height: 21px;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 63px;
}

.team .member .image {
    position: relative;
}

.team .member .card .image {
    padding-top: 100%;
    width: 100%;
    filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
    transition: all 0.3s;
    height: 0;
}

.team .member .card:hover .image {
    padding-top: 100%;
    width: 100%;
    filter: grayscale(0);
    -webkit-filter: grayscale(0);
}

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

.team .member .popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 102;
    background:
        url(../images/popup-background.svg) top left / 313px no-repeat,
        url(../images/popup-background.svg) bottom 4px right 6px / 413px no-repeat;
    width: calc(100% - 40px);
    max-width: 1277px;
    padding: 62px 64px;
}

.team .member .popup-wrapper {
    background-color: white;
    position: relative;
    display: flex;
    padding: 80px 64px 80px 73px;
    max-height: calc(100vh - 165px);
    overflow: auto;
}

.team .member .close-button {
    border: none;
    outline: none;
    padding: 0;
    color: black;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 19px;
    height: 19px;
    transition: all 0.3s;
    background: none;
}

.team .member .close-button:hover {
    color: #EE7C29;
}

.team .member .close-button svg {
    width: 100%;
    height: 100%;
}

.team .member .popup .image {
    width: 355px;
    height: 472px;
}

.team .member .popup .text {
    width: calc(100% - 355px);
    padding-left: 43px;
    padding-top: 15px;
}

.team .member .popup .name {
    font-size: 25px;
    line-height: 38px;
    margin-bottom: 6px;
}

.team .member .popup .position {
    color: #EE7C29;
    font-weight: 500;
    font-size: 18px;
    line-height: 33px;
    letter-spacing: -0.02em;
    margin-bottom: 39px;
}

.team .member .popup .description {
    font-size: 16px;
    line-height: 29px;
    max-width: 610px;
}

@media (max-width: 1440.98px) {
    .team {
        gap: 37px 17px;
    }

    .team .member {
        width: calc(25% - 12.75px);
    }

    .team .member .card .text {
        padding: 15px 15px 0;
    }

    .team .member .popup {
        padding: 51px 53px;
        max-width: 1046px;
        background:
            url(../images/popup-background.svg) top left / 256px no-repeat,
            url(../images/popup-background.svg) bottom 4px right 6px / 338px no-repeat;
    }

    .team .member .popup-wrapper {
        padding: 65px 52px 65px 60px;
        max-height: calc(100vh - 140px);
    }

    .team .member .popup .image {
        width: 290px;
        height: 386px;
    }

    .team .member .popup .text {
        width: calc(100% - 290px);
        padding-left: 36px;
        padding-top: 12px;
    }

    .team .member .close-button {
        top: 11px;
        right: 11px;
        width: 16px;
        height: 16px;
    }

    .team .member .popup .name {
        margin-bottom: 0;
    }

    .team .member .popup .position {
        margin-bottom: 25px;
    }
}

@media (max-width: 1199.98px) {
    .team .member .popup {
        width: 100%;
        padding: 36px;
    }

    .team .member .popup .position {
        margin-bottom: 10px;
    }

    .team .member .popup .text {
        padding-left: 20px;
    }
}

@media (max-width: 991.98px) {
    .team .member .image {
        width: 165px;
        height: 219px;
    }

    .team .member .popup .text {
        width: calc(100% - 165px);
        padding-top: 0;
    }

    .team .member .popup .position {
        margin-bottom: 0;
    }

    .team .member {
        width: calc((100% - 34px) / 3);
    }
}

@media (max-width: 767.98px) {
    .team {
        gap: 11px 10px;
    }

    .team .member {
        width: calc(50% - 5px);
    }

    .team .member .card .text {
        padding: 8px 10px 17px;
        background-color: #f8f8f8;
    }

    .team .member .card .name {
        margin-bottom: -3px;
    }

    .team .member .card .position {
        font-size: 12px;
        line-height: 18px;
        height: 54px;
    }

    .team .member .popup {
        padding: 0 20px;
        background: none;
    }

    .team .member .popup-wrapper {
        display: block;
        padding: 66px 33px 46px 44px;
        max-height: calc(100vh - 80px);
    }

    .team .member .popup .image {
        width: calc(100vw - 130px);
        height: calc(100vw - 130px);
        overflow: hidden;
        margin-bottom: 12px;
    }

    .team .member .popup .image img {
        width: 130%;
        height: 130%;
    }

    .team .member .close-button {
        width: 20px;
        height: 20px;
        top: 20px;
        right: 18px;
    }

    .team .member .popup .position {
        line-height: 28px;
        margin-bottom: 6px;
    }

    .team .member .popup .text {
        padding-left: 0;
        width: 100%;
    }
}