.teachers {
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.teachers__top {
  display: flex;
  gap: 32px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.teachers__top .section__head {
  margin-bottom: 0;
}

.teachers__top .lead {
  max-width: 700px;
  margin-bottom: 0;
}

.teachers__controls {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  padding-bottom: 2px;
}

.teachers__arrow {
  display: grid;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  color: var(--color-indigo);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.teachers__arrow:hover:not(:disabled) {
  color: var(--color-white);
  background: var(--color-indigo);
  border-color: var(--color-indigo);
  transform: translateY(-1px);
}

.teachers__arrow:disabled {
  cursor: default;
  opacity: 0.38;
  box-shadow: none;
}

.teachers__arrow svg {
  width: 20px;
  height: 20px;
}

.teachers__viewport {
  max-width: 100%;
  padding: 4px 4px 18px;
  margin: -4px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  touch-action: pan-x pan-y;
}

.teachers__viewport::-webkit-scrollbar {
  display: none;
}

.teachers__track {
  display: grid;
  grid-auto-columns: calc((100% - 48px) / 4);
  grid-auto-flow: column;
  gap: 16px;
}

.teacher-card {
  display: flex;
  min-width: 0;
  min-height: 100%;
  padding: 14px;
  flex-direction: column;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.teacher-card__media,
.teacher-modal__media {
  position: relative;
  display: grid;
  overflow: hidden;
  place-items: center;
  color: var(--color-indigo);
  background: var(--color-soft-indigo);
  border-radius: var(--radius-md);
}

.teacher-card__media {
  height: 220px;
  margin-bottom: 17px;
}

.teacher-media--photo::before {
  position: absolute;
  inset: -18px;
  content: "";
  background-image: var(--teacher-photo);
  background-position: center;
  background-size: cover;
  filter: blur(16px);
  opacity: 0.24;
  transform: scale(1.08);
}

.teacher-media--photo::after {
  position: absolute;
  inset: 0;
  content: "";
  background: rgba(255, 255, 255, 0.18);
}

.teacher-card__photo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: calc(100% + var(--teacher-image-shift, 0px));
  object-fit: contain;
  object-position: center;
  transform: translateY(calc(0px - var(--teacher-image-shift, 0px)));
}

.teacher-card__initials,
.teacher-modal__initials {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.teacher-card__initials {
  font-size: 42px;
}

.teacher-card__body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.teacher-card__name {
  margin-bottom: 7px;
  color: var(--color-navy);
  font-size: 20px;
  line-height: 1.2;
}

.teacher-card__role {
  display: -webkit-box;
  min-height: 44px;
  margin-bottom: 14px;
  overflow: hidden;
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.teacher-card__subject-label {
  display: block;
  margin-bottom: 4px;
  color: var(--color-indigo);
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.teacher-card__subject {
  display: -webkit-box;
  min-height: 66px;
  margin-bottom: 18px;
  overflow: hidden;
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.teacher-card__more {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  padding: 4px 0;
  margin-top: auto;
  color: var(--color-orange-dark);
  background: transparent;
  border: 0;
  font-weight: 800;
}

.teacher-card__more:hover {
  color: var(--color-orange);
}

.teacher-card__more svg {
  width: 17px;
  height: 17px;
  transition: transform 0.18s ease;
}

.teacher-card__more:hover svg {
  transform: translateX(3px);
}

.teachers__pagination {
  display: flex;
  min-height: 12px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 8px;
}

.teachers__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  background: #cbd5e1;
  border: 0;
  border-radius: 999px;
  transition: width 0.18s ease, background-color 0.18s ease;
}

.teachers__dot.is-active {
  width: 24px;
  background: var(--color-indigo);
}

.teachers__arrow:focus-visible,
.teachers__viewport:focus-visible,
.teachers__dot:focus-visible,
.teacher-card__more:focus-visible,
.teacher-modal__close:focus-visible {
  outline: 3px solid var(--color-soft-orange);
  outline-offset: 3px;
}

.teachers__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.teachers-noscript {
  display: grid;
  grid-auto-columns: calc((100% - 48px) / 4);
  grid-auto-flow: column;
  gap: 16px;
  padding: 0 0 18px;
  overflow-x: auto;
  list-style: none;
  scroll-snap-type: x mandatory;
}

.teachers-noscript li {
  padding: 20px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  scroll-snap-align: start;
}

.teachers-noscript strong,
.teachers-noscript span {
  display: block;
}

.teachers-noscript strong {
  margin-bottom: 8px;
  color: var(--color-navy);
  font-family: var(--font-heading);
}

.teachers-noscript span {
  color: var(--color-muted);
  font-size: 14px;
}

body.teacher-modal-open {
  overflow: hidden;
}

.teacher-modal[hidden] {
  display: none;
}

.teacher-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  padding: 24px;
  place-items: center;
}

.teacher-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(7px);
}

.teacher-modal__dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  background: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.teacher-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--color-navy);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

.teacher-modal__close svg {
  width: 19px;
  height: 19px;
}

.teacher-modal__grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.22fr);
  gap: 0;
}

.teacher-modal__visual {
  min-height: 520px;
  /* padding: 28px; */
  background: linear-gradient(160deg, var(--color-soft-indigo), #f8fafc);
}

.teacher-modal__media {
  width: 100%;
  height: 100%;
  min-height: 464px;
}

.teacher-modal__photo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.teacher-modal__initials {
  font-size: 72px;
}

.teacher-modal__content {
  padding: 52px 42px 40px;
}

.teacher-modal__content .eyebrow {
  margin-bottom: 10px;
}

.teacher-modal__content h2 {
  padding-right: 32px;
  margin-bottom: 9px;
  font-size: clamp(27px, 4vw, 36px);
}

.teacher-modal__role {
  margin-bottom: 22px;
  color: var(--color-muted);
  font-weight: 600;
}

.teacher-modal__subject {
  padding: 15px 17px;
  margin-bottom: 24px;
  color: var(--color-text);
  background: var(--color-soft-orange);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  line-height: 1.55;
}

.teacher-modal__subject strong {
  display: block;
  margin-bottom: 3px;
  color: var(--color-orange-dark);
  font-family: var(--font-heading);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.teacher-modal__content h3 {
  margin-bottom: 13px;
  font-size: 20px;
}

.teacher-modal__achievements {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.teacher-modal__achievements li {
  position: relative;
  padding-left: 25px;
  color: var(--color-muted);
  line-height: 1.55;
}

.teacher-modal__achievements li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 4px;
  width: 8px;
  height: 8px;
  background: var(--color-orange);
  border-radius: 999px;
  box-shadow: 0 0 0 4px var(--color-soft-orange);
}

@media (max-width: 1279px) {
  .teachers__track,
  .teachers-noscript {
    grid-auto-columns: calc((100% - 16px) / 2);
  }
}

@media (max-width: 767px) {
  .teachers {
    padding-top: 58px;
    padding-bottom: 58px;
  }

  .teachers__top {
    gap: 18px;
    align-items: flex-end;
    margin-bottom: 23px;
  }

  .teachers__top .lead {
    font-size: 16px;
  }

  .teachers__controls {
    gap: 7px;
  }

  .teachers__arrow {
    width: 40px;
    height: 40px;
  }

  .teachers__track,
  .teachers-noscript {
    grid-auto-columns: calc(100% - 42px);
    gap: 12px;
  }

  .teacher-card__media {
    height: 280px;
  }

  .teacher-card__photo {
    height: calc(100% + var(--teacher-mobile-image-shift, var(--teacher-image-shift, 0px)));
    transform: translateY(calc(0px - var(--teacher-mobile-image-shift, var(--teacher-image-shift, 0px))));
  }

  .teacher-modal {
    padding: 0;
    place-items: end center;
  }

  .teacher-modal__dialog {
    width: 100%;
    max-height: 100dvh;
    border-radius: 18px 18px 0 0;
  }

  .teacher-modal__grid {
    display: block;
  }

  .teacher-modal__visual {
    min-height: 260px;
    padding: 18px;
  }

  .teacher-modal__media {
    height: 310px;
    min-height: 0;
  }

  .teacher-modal__photo {
    height: calc(100% + var(--teacher-mobile-modal-image-shift, 0px));
    transform: translateY(calc(0px - var(--teacher-mobile-modal-image-shift, 0px)));
  }

  .teacher-modal__content {
    padding: 27px 20px 36px;
  }

  .teacher-modal__content h2 {
    padding-right: 38px;
  }
}

@media (max-width: 520px) {
  .teachers__top {
    display: block;
  }

  .teachers__controls {
    justify-content: flex-end;
    margin-top: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .teachers__viewport {
    scroll-behavior: auto;
  }

  .teachers__arrow,
  .teachers__dot,
  .teacher-card__more svg {
    transition: none;
  }
}
