/* ==========================================================================
   Сторінка викладача (single-kai_teacher.php)
   Використовує змінні теми: --primary, --secondary, --accent
   ========================================================================== */

.kai-teacher-page {
  padding: 24px 0 40px;
  background: rgba(249, 250, 251, 1);
}

/* ---- Назад на головну ---- */

.kai-teacher-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(107, 114, 128, 1);
  text-decoration: none;
  transition:
    gap 0.2s ease,
    color 0.2s ease;
}

.kai-teacher-back:hover {
  gap: 12px;
  color: var(--primary);
}

/* ---- Шапка профілю ---- */

.kai-teacher-hero {
  padding: 28px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0px 1px 3px 0px rgba(0, 0, 0, 0.1),
    0px 1px 2px 1px rgba(0, 0, 0, 0.1);
}

.kai-teacher-hero__grid {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  grid-template-rows: auto;
  grid-template-areas:
    'photo ident'
    'photo bio'
    'photo facts';
  column-gap: 24px;
  row-gap: 10px;
  align-content: start;
}

.kai-teacher-hero__photo {
  grid-area: photo;
  align-self: start;
  width: 100%;
  aspect-ratio: 178 / 222;
  overflow: hidden;
  border-radius: 16px;
  background: #eef2fb;
}

.kai-teacher-hero__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kai-teacher-hero__ident {
  grid-area: ident;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.kai-teacher-hero__name {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3333;
  color: rgba(26, 29, 41, 1);
}

.kai-teacher-hero__badges {
  margin: 0;
}

.kai-teacher-hero__bio {
  grid-area: bio;
  margin: 0;
  max-width: 795px;
  font-size: 16px;
  line-height: 1.5;
  color: rgba(26, 29, 41, 1);
}

/* ---- Коротко про викладача ---- */

.kai-teacher-facts {
  grid-area: facts;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin-top: 22px;
}

.kai-teacher-fact {
  display: flex;
  gap: 12px;
  padding-left: 32px;
  border-left: 1px solid rgba(238, 242, 255, 1);
}

.kai-teacher-fact:first-child {
  padding-left: 0;
  border-left: 0;
}

.kai-teacher-fact__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(238, 242, 255, 1);
  color: var(--primary);
}

.kai-teacher-fact__icon svg {
  width: 28px;
  height: 28px;
}

.kai-teacher-fact__label {
  margin: 0 0 2px;
  font-size: 16px;
  line-height: 1.5;
  color: rgba(107, 114, 128, 1);
}

.kai-teacher-fact__value {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: rgba(26, 29, 41, 1);
}

/* Цитата «Як я викладаю» у шапці — трохи просторіша за картку на головній */
.kai-teacher-hero__quote {
  margin-top: 32px;
  padding: 20px 24px;
  border-radius: 12px;
  gap: 20px;
}

.kai-teacher__quote-icon {
  width: 40px;
  height: 40px;
  margin-top: -6px;
}

.kai-teacher-hero__quote .kai-teacher__quote-title {
  font-size: 20px;
  margin-bottom: 4px;
}

.kai-teacher-hero__quote .kai-teacher__quote-text {
  font-size: 18px;
}

/* ---- Спільні блоки нижче шапки ---- */

.kai-teacher-block {
  margin-top: 56px;
}

.kai-teacher-block__title {
  margin: 0 0 24px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3333;
  color: rgba(26, 29, 41, 1);
}

/* ---- Експертність ---- */

.kai-teacher-expertise {
  margin: 0;
  padding: 8px 24px;
  list-style: none;
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0px 1px 3px 0px rgba(0, 0, 0, 0.1),
    0px 1px 2px 1px rgba(0, 0, 0, 0.1);
}

.kai-teacher-expertise__item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(238, 242, 255, 1);
}

.kai-teacher-expertise__item:last-child {
  border-bottom: 0;
}

.kai-teacher-expertise__num {
  flex: none;
  font-size: 24px;
  font-weight: 700;
  color: transparent;
  background: linear-gradient(90deg, #4d7cff 0%, #1a1d29 101.15%);
  -webkit-background-clip: text;
  background-clip: text;
}

.kai-teacher-expertise__text {
  font-size: 18px;
  line-height: 1.55;
  color: rgba(26, 29, 41, 1);
  font-weight: 500;
}

/* ---- Розширений профіль ---- */

.kai-teacher-profile {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.kai-teacher-profile__card {
  padding: 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0px 1px 3px 0px rgba(0, 0, 0, 0.1),
    0px 1px 2px 1px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 12px;
}

.kai-teacher-profile__head {
}

.kai-teacher-profile__title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: rgba(26, 29, 41, 1);
  margin-bottom: 12px;
}

.kai-teacher-profile__text {
  margin: 0;
  font-size: 18px;
  line-height: 1.5555;
  color: rgba(26, 29, 41, 1);
}

.kai-teacher-profile__link {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 500;
  color: var(--secondary);
  font-size: 14px;
}

.kai-teacher-profile__link a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}

.kai-teacher-profile__link a:hover {
  text-decoration: underline;
}

.kai-teacher-profile__link svg {
  flex: none;
  width: 16px;
  height: 16px;
}

/* ---- Відгуки ---- */

.kai-teacher-reviews {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.kai-teacher-review {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  padding: 28px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0px 1px 3px 0px rgba(0, 0, 0, 0.1),
    0px 1px 2px 1px rgba(0, 0, 0, 0.1);
}

/* Обгортка потрібна лише мобільній версії (там зірки всередині блоку з текстом).
   На десктопі вона «розчиняється», і зірки з текстом стають елементами сітки картки. */
.kai-teacher-review__body {
  display: contents;
}

.kai-teacher-review__name {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: rgba(26, 29, 41, 1);
}

.kai-teacher-review__stars {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  gap: 4px;
  color: rgba(253, 199, 0, 1);
}

.kai-teacher-review__stars svg {
  width: 20px;
  height: 20px;
}

.kai-teacher-review__text {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 20px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(249, 250, 251, 1);
  font-size: 16px;
  line-height: 1.5;
  border: 1px solid rgba(229, 231, 235, 1);
  color: rgba(26, 29, 41, 1);
}

/* ---- Адаптив ---- */

@media (max-width: 1023px) {
  .kai-teacher-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .kai-teacher-fact {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 767px) {
  .kai-teacher-page {
    padding: 16px 0 32px;
  }

  .kai-teacher-hero {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .kai-teacher-hero__grid {
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-areas:
      'photo ident'
      'bio   bio'
      'facts facts';
    column-gap: 16px;
  }

  .kai-teacher-hero__photo {
    border-radius: 16px;
    aspect-ratio: 92/115;
  }

  .kai-teacher-hero__ident {
    align-self: start;
    flex-direction: column;
    gap: 12px;
  }

  .kai-teacher-hero__name {
    font-size: 18px;
  }

  .kai-teacher-hero__bio {
    font-size: 14px;
  }

  .kai-teacher-fact {
    border-bottom: 1px solid rgba(238, 242, 255, 1);
    padding-bottom: 16px;
  }
  .kai-teacher-fact__icon {
    width: 36px;
    height: 36px;
  }
  .kai-teacher-fact__icon svg {
    width: 20px;
    height: 20px;
  }
  .kai-teacher-fact__label,
  .kai-teacher-fact__value {
    font-size: 14px;
  }
  .kai-teacher-hero__quote {
    padding: 10px 12px;
    gap: 12px;
  }
  .kai-teacher-hero__quote .kai-teacher__quote-icon {
    width: 24px;
    height: 24px;
    margin-top: 4px;
  }
  .kai-teacher-hero__quote .kai-teacher__quote-title {
    font-size: 14px;
  }
  .kai-teacher-hero__quote .kai-teacher__quote-text {
    font-size: 14px;
  }

  .kai-teacher-block {
    margin-top: 44px;
  }

  .kai-teacher-block__title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .kai-teacher-expertise {
    padding: 4px 16px;
  }
  .kai-teacher-expertise__item {
    align-items: start;
    gap: 12px;
  }
  .kai-teacher-expertise__num {
    font-size: 20px;
    line-height: 1.4;
  }

  .kai-teacher-expertise__text {
    font-size: 14px;
    line-height: 1.42;
  }

  .kai-teacher-profile,
  .kai-teacher-reviews {
    grid-template-columns: minmax(0, 1fr);
  }

  .kai-teacher-profile__card,
  .kai-teacher-review {
    padding: 20px 16px;
  }

  .kai-teacher-profile__card .kai-teacher-fact__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  .kai-teacher-profile__card .kai-teacher-fact__icon svg {
    width: 24px;
    height: 24px;
  }
  .kai-teacher-profile__title {
    font-size: 18px;
    margin-bottom: 8px;
  }
  .kai-teacher-profile__text {
    font-size: 14px;
    line-height: 1.42;
  }

  /* На мобільному зірки переїжджають усередину сірого блоку з текстом */
  .kai-teacher-review {
    display: block;
  }

  .kai-teacher-review__name {
    margin-bottom: 16px;
    font-size: 16px;
  }

  .kai-teacher-review__body {
    display: block;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(249, 250, 251, 1);
    border: 1px solid rgba(229, 231, 235, 1);
  }

  .kai-teacher-review__stars {
    margin-bottom: 12px;
  }

  .kai-teacher-review__text {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font-size: 14px;
    line-height: 1.42;
  }
}
