.team-page {
  padding-top: 48px;
  padding-bottom: 72px;
}

.team-page * {
  box-sizing: border-box;
}

.team-page__title-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.team-card {
  display: flex;
  min-height: 440px;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 36px rgb(35 62 58 / 10%);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.team-card:hover,
.team-card:focus-visible {
  outline: none;
  transform: translateY(-4px);
  box-shadow: 0 16px 42px rgb(35 62 58 / 16%);
}

.team-card__photo,
.doctor-dialog__photo {
  display: grid;
  aspect-ratio: 3 / 4;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(180deg, #faf5ed 0%, #f4f1e5 34%, #a4ad83 100%);
}

.team-card__photo img,
.doctor-dialog__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(var(--team-photo-scale, 1));
  transform-origin: center bottom;
}

.team-card__photo img.team-card__logo,
.doctor-dialog__photo img.doctor-dialog__logo {
  width: min(70%, 200px);
  height: auto;
  object-fit: contain;
}

.team-card__photo span,
.doctor-dialog__placeholder {
  display: grid;
  width: 116px;
  height: 116px;
  place-items: center;
  border-radius: 50%;
  color: #52624f;
  background: rgb(255 255 255 / 75%);
  font-size: 34px;
  font-weight: 700;
}

.team-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px;
}

.team-card__experience,
.team-card__degree {
  display: inline-block;
  margin-bottom: 17px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #52624f;
  background: #eef1e7;
  font-size: 13px;
  font-weight: 700;
}

.team-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 17px;
}

.team-card__badges .team-card__experience,
.team-card__badges .team-card__degree {
  margin-bottom: 0;
}

.team-card h2 {
  margin: 0 0 10px;
  color: #203e3a;
  font-size: 23px;
  line-height: 1.18;
}

.team-card__role {
  margin: 0 0 24px;
  color: #66716f;
  font-size: 16px;
  line-height: 1.45;
}

.doctor-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  width: 33.333vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 24px 0 0 24px;
  color: #33433f;
  box-shadow: 0 25px 80px rgb(20 40 36 / 30%);
  scrollbar-gutter: stable;
}

html:has(.doctor-dialog[open]) {
  overflow: hidden;
}

.doctor-dialog::backdrop {
  background: rgb(25 43 40 / 67%);
  backdrop-filter: blur(3px);
}

.doctor-dialog__close {
  position: sticky;
  z-index: 2;
  top: 14px;
  display: block;
  width: 42px;
  height: 42px;
  margin: 14px 14px -58px auto;
  border: 0;
  border-radius: 50%;
  color: #203e3a;
  background: #fff;
  box-shadow: 0 3px 18px rgb(0 0 0 / 12%);
  font-size: 28px;
  cursor: pointer;
}

.doctor-dialog__head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: center;
  padding: 32px 28px 28px;
  background: #f3f4ec;
}

.doctor-dialog__photo {
  position: relative;
  width: min(230px, 72%, 30dvh);
  justify-self: center;
  border-radius: 18px;
}

.doctor-dialog__photo > img {
  position: absolute;
  inset: 0;
  display: block;
}

.doctor-dialog__photo > img.doctor-dialog__logo {
  position: static;
}

.doctor-dialog__head .doctor-dialog__placeholder {
  width: 170px;
  height: 170px;
  margin: auto;
}

.doctor-dialog__head h2 {
  margin: 7px 0 12px;
  color: #203e3a;
  font-size: clamp(27px, 2.1vw, 36px);
  line-height: 1.08;
}

.doctor-dialog__head p {
  margin: 0;
  color: #66716f;
  font-size: 18px;
}

.doctor-dialog__content {
  padding: 28px 30px 46px;
  font-size: 16px;
  line-height: 1.65;
}

.doctor-dialog__content h3 {
  margin: 18px 0 10px;
  color: #203e3a;
  font-size: 21px;
}

.doctor-dialog__content ul {
  padding-left: 22px;
}

.doctor-certificates__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.doctor-certificates__item {
  padding: 0;
  border: 0;
  display: block;
  overflow: hidden;
  border-radius: 12px;
  background: #eee;
  cursor: pointer;
}

.doctor-certificates__grid img {
  display: block;
  width: 100%;
  height: 240px;
  object-fit: contain;
  transform: rotate(var(--certificate-rotation, 0deg));
}

.doctor-certificates__item[data-certificate-rotation="90"] img,
.doctor-certificates__item[data-certificate-rotation="270"] img {
  width: 75%;
  margin-inline: auto;
}

.doctor-dialog[open] {
  animation: dialog-in 0.24s ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1200px) {
  .team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 950px) {
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doctor-dialog {
    width: 50vw;
  }
}

@media (max-width: 620px) {
  .team-grid {
    grid-template-columns: 1fr;
  }

  .team-card {
    min-height: 430px;
  }

  .doctor-dialog__head {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .doctor-dialog {
    width: min(100vw, 520px);
    border-radius: 0 20px 20px 0;
  }

  .doctor-dialog__photo {
    width: min(230px, 100%, 30dvh);
  }

  .doctor-dialog__head h2 {
    font-size: 28px;
  }

  .doctor-dialog__content {
    padding: 24px;
  }

  .doctor-certificates__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .doctor-certificates__grid img {
    height: 190px;
  }
}
