.teachers-section {
  overflow: hidden;
}

.teachers-section__head {
  margin-bottom: 38px;
}

.teachers-slider {
  position: relative;
}

.teachers-slider__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 48px) / 3);
  gap: 24px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 8px 4px 24px;
  scrollbar-width: none;
}

.teachers-slider__track::-webkit-scrollbar {
  display: none;
}

.teacher-card {
  scroll-snap-align: start;
  min-height: 440px;
  padding: 22px;
  border: 1px solid #e5ddff;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(34, 18, 91, 0.12);
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.teacher-card:hover {
  transform: translateY(-6px);
  border-color: #cbbdff;
  box-shadow: 0 26px 60px rgba(34, 18, 91, 0.18);
}

.teacher-card:focus-visible {
  outline: 3px solid rgba(107, 61, 244, 0.35);
  outline-offset: 4px;
}

.teacher-card__photo {
  position: relative;
  height: 260px;
  margin-bottom: 22px;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(135deg, #efe8ff, #f8f5ff);
}

.teacher-card__image {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.teacher-card__image[src=""] {
  display: none;
}

.teacher-card__image:not([src]),
.teacher-card__image[src="assets/teacher1.png"],
.teacher-card__image[src="assets/teacher2.png"],
.teacher-card__image[src="assets/teacher3.png"],
.teacher-card__image[src="assets/teacher4.png"],
.teacher-card__image[src="assets/teacher5.png"],
.teacher-card__image[src="assets/teacher6.png"],
.teacher-card__image[src="assets/teacher7.png"] {
  background: transparent;
}

.teacher-card__fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #6b3df4;
  font-size: 64px;
  font-weight: 900;
  opacity: 0.3;
}

.teacher-card h3 {
  margin: 0 0 12px;
  color: #1e1747;
  font-size: 24px;
  line-height: 1.18;
}

.teacher-card p {
  margin: 0;
  color: #6f6791;
  font-size: 16px;
  line-height: 1.6;
}

.teachers-slider__btn {
  position: absolute;
  top: 45%;
  z-index: 5;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #6b3df4;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(34, 18, 91, 0.18);
}

.teachers-slider__btn--prev {
  left: -20px;
}

.teachers-slider__btn--next {
  right: -20px;
}

.teacher-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  color: #fff;
}

.teacher-modal--open {
  display: block;
}

.teacher-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 14, 0.82);
  backdrop-filter: blur(4px);
}

.teacher-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  max-height: 100vh;
  margin: 0 auto;
  padding: 32px 0 42px;
  overflow-y: auto;
}

.teacher-modal__close {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 42px;
  line-height: 0.8;
  cursor: pointer;
}

.teacher-modal__main {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(320px, 1fr);
  gap: 38px;
  align-items: center;
  min-height: 72vh;
}

.teacher-modal__photo-wrap {
  width: 100%;
  max-width: 560px;
  justify-self: end;
  overflow: hidden;
  background: #1d1d1f;
}

.teacher-modal__photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.teacher-modal__info {
  max-width: 560px;
}

.teacher-modal__subject {
  display: block;
  margin-bottom: 10px;
  color: #ff667a;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.teacher-modal__info h3 {
  margin: 0 0 22px;
  color: #fff;
  font-size: clamp(36px, 4.5vw, 64px);
  line-height: 0.92;
  text-transform: uppercase;
}

.teacher-modal__short {
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 20px;
  line-height: 1.55;
}

.teacher-modal__bullets {
  display: grid;
  gap: 18px;
  margin: 0;
  padding-left: 22px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 19px;
  line-height: 1.58;
}

.teacher-modal__bottom {
  margin-top: 34px;
}

.teacher-modal__bottom h4 {
  margin: 0 0 20px;
  color: #fff;
  font-size: 24px;
}

.teacher-modal__thumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 210px;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}

.teacher-modal__thumbs::-webkit-scrollbar {
  display: none;
}

.teacher-modal__thumb {
  display: grid;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  cursor: pointer;
}

.teacher-modal__thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  opacity: 0.65;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.teacher-modal__thumb span {
  font-size: 14px;
  font-weight: 800;
}

.teacher-modal__thumb:hover img,
.teacher-modal__thumb--active img {
  opacity: 1;
  transform: translateY(-2px);
}

@media (max-width: 1024px) {
  .teachers-slider__track {
    grid-auto-columns: calc((100% - 24px) / 2);
  }

  .teacher-modal__main {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 42px;
  }

  .teacher-modal__photo-wrap,
  .teacher-modal__info {
    max-width: 720px;
    justify-self: center;
  }

  .teacher-modal__info {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .teachers-slider__track {
    grid-auto-columns: 86%;
    gap: 16px;
    padding-bottom: 18px;
  }

  .teacher-card {
    min-height: 390px;
    padding: 18px;
  }

  .teacher-card__photo {
    height: 220px;
  }

  .teachers-slider__btn {
    display: none;
  }

  .teacher-modal__dialog {
    width: min(100% - 22px, 560px);
    padding: 74px 0 28px;
  }

  .teacher-modal__main {
    gap: 24px;
    padding-top: 0;
  }

  .teacher-modal__photo {
    aspect-ratio: 1 / 1.1;
  }

  .teacher-modal__short,
  .teacher-modal__bullets {
    font-size: 16px;
  }

  .teacher-modal__thumbs {
    grid-auto-columns: 150px;
  }
}
