.teamBlock {
  padding: 64px 0;
}
.teamBlock__container {
  max-width: 1280px;
  width: 90%;
  margin: 0 auto;
}
.teamBlock__header {
  margin: 0 0 80px 0;
  color: #000;
  text-align: center;
  font-family: "Roboto", sans-serif;
  font-size: 48px;
  font-style: normal;
  font-weight: 700;
  line-height: 120%;
}

.teamBlock__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.teamCard {
  background: #e8f2fa;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.teamCard:hover {
  background: rgba(109, 132, 151, 0.4);
}
.teamCard__media img {
  width: 100%;
  height: 490px;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.teamCard__content {
  padding: 24px 32px;
}
.teamCard__name {
  color: #000;
  font-family: "Roboto", sans-serif;
  font-size: 24px;
  font-style: normal;
  font-weight: 600;
  line-height: 150%;
}
.teamCard__position {
  color: #000;
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  margin-top: 4px;
}
.teamCard__contacts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.teamCard__contact {
  color: #1b2335;
  text-decoration: none;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Roboto", sans-serif;
}
.teamCard__open {
  position: absolute;
  right: 24px;
  bottom: 24px;
  background: #1b2335;
  color: #fff;
  border: 0;
  border-radius: 18px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

/* Modal */
.teamModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
  overflow: auto; /* allow overlay to scroll if content exceeds viewport */
}
.teamModal.is-open {
  display: flex;
}
.teamModal__dialog {
  background: #e8f2fa;
  width: min(90%, 1280px);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-columns: 30% 70%;
  max-height: 92vh; /* keep within viewport height */
}
.teamModal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 18px;
  border: 0;
  background: #1b2335;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}
.teamModal__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.teamModal__content {
  padding-top: 24px;
}
.teamModal__name {
  color: #1b2335;
  font-family: "Roboto", sans-serif;
  font-size: 40px;
  font-style: normal;
  font-weight: 700;
  line-height: 150%;
  margin: 0;
  padding: 0 55px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.teamModal__position {
  color: #1b2335;
  font-family: "Roboto", sans-serif;
  font-size: 22px;
  font-style: normal;
  font-weight: 500;
  line-height: 150%;
  margin-top: 6px;
  padding: 0 55px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.teamModal__desc {
  margin-top: 12px;
  color: rgba(36, 36, 36, 0.9);
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  padding: 0 55px;
  padding-bottom: 40px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.teamModal__cta {
  margin-top: 16px;
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
  background-color: #1b2335;
  color: #fff;
  padding: 40px 55px;
}
.teamModal__link {
  text-decoration: none;
  font-family: "Roboto", sans-serif;
  font-size: 21px;
  font-style: normal;
  line-height: 150%;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.teamModal__link svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

/* Bigger LinkedIn icon only */
.teamModal__link--linkedin svg {
  width: 42px;
  height: 42px;
}

@media (max-width: 1024px) {
  .teamBlock__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .teamBlock__grid {
    grid-template-columns: 1fr;
  }
  .teamModal__dialog {
    grid-template-columns: 1fr;
    width: 96%;
    max-height: 92vh;
  }
  .teamModal__media {
    max-height: 40vh; /* reserve height for image */
    overflow: hidden;
  }
  .teamModal__media img {
    height: 100%;
  }
  .teamModal__content {
    max-height: calc(92vh - 40vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px;
  }
  .teamModal__name {
    font-size: 28px;
    padding: 0 16px;
  }
  .teamModal__position {
    font-size: 18px;
    padding: 0 16px;
  }
  .teamModal__desc {
    padding: 0 16px 24px;
  }
  .teamModal__cta {
    gap: 16px;
    padding: 16px;
    padding-bottom: 40px;
  }
  .teamModal__link {
    font-size: 18px;
  }
}

@media (max-width: 900px) {
  .teamCard__media img {
    height: 360px;
  }
}
