.teacher-profile-section {
  padding: 40px 0 60px;
  background: linear-gradient(to bottom, #f8fafc, #f0f7f7);
  min-height: calc(100vh - 220px);
}

.teacher-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.teacher-main {
  flex: 1;
  min-width: 0;
}

.teacher-card {
  background: #fff;
  border: 1px solid #d9ecec;
  border-radius: 4px;
  padding: 26px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.teacher-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.teacher-avatar {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  border: 2px solid rgba(16, 102, 116, 0.25);
}

.teacher-basic {
  flex: 1;
}

.teacher-top-info {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #d9ecec;
}

.teacher-top-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.teacher-top-right {
  width: 44%;
  min-width: 300px;
  padding-left: 24px;
  border-left: 1px solid #d9ecec;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.teacher-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.teacher-name-row h1 {
  margin: 0;
  font-size: 44px;
  color: #106674;
  line-height: 1.08;
}

.teacher-tag {
  font-size: 14px;
  color: #106674;
  border: 1px solid rgba(16, 102, 116, 0.35);
  background: rgba(16, 102, 116, 0.08);
  padding: 3px 12px;
  border-radius: 4px;
}

.teacher-meta-row {
  display: flex;
  gap: 0;
  margin-bottom: 2px;
  color: #334155;
  font-size: 14px;
  flex-wrap: wrap;
}

#teacher-mentor {
  display: inline-flex;
  align-items: center;
}

#teacher-mentor::before {
  content: "";
  width: 1px;
  height: 14px;
  background: rgba(148, 163, 184, 0.45);
  margin: 0 12px;
}

.teacher-contact {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  color: #334155;
  font-size: 14px;
  padding-top: 14px;
}

.teacher-field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.teacher-field-row:last-child {
  margin-bottom: 0;
}

.teacher-field-row[hidden],
.teacher-contact-item[hidden],
.teacher-contact-row[hidden],
#teacher-mentor[hidden],
.teacher-tag[hidden] {
  display: none !important;
}

.teacher-field-label {
  color: #106674;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.teacher-field-value {
  color: #1e293b;
  font-size: 14px;
}

.teacher-contact-row {
  display: flex;
  align-items: center;
  column-gap: 22px;
  row-gap: 10px;
  flex-wrap: wrap;
}

.teacher-contact-label {
  color: #106674;
  font-weight: 600;
  white-space: nowrap;
}

.teacher-contact-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.teacher-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.teacher-contact-row-main .teacher-contact-item {
  flex: 0 1 auto;
}

.teacher-contact-row-main {
  column-gap: 32px;
}

.teacher-contact-row-research .teacher-contact-item {
  max-width: 100%;
}

.teacher-contact-value {
  color: #1e293b;
  line-height: 1.35;
}

a.teacher-contact-value {
  text-decoration: none;
}

a.teacher-contact-value:hover {
  color: #106674;
  text-decoration: underline;
}

.teacher-contact-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.icon-phone {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23106674' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.8 19.8 0 0 1-8.63-3.07 19.51 19.51 0 0 1-6-6A19.8 19.8 0 0 1 2.12 4.18 2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.98.37 1.94.7 2.85a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.23-1.27a2 2 0 0 1 2.11-.45c.91.33 1.87.57 2.85.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E");
}

.icon-email {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23106674' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3Cpolyline points='22,6 12,13 2,6'/%3E%3C/svg%3E");
}

.icon-address {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23106674' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
}

.icon-research {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23106674' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 10 12 5 2 10l10 5 10-5z'/%3E%3Cpath d='M6 12v5c3 2 9 2 12 0v-5'/%3E%3Cpath d='M22 10v6'/%3E%3Ccircle cx='22' cy='17' r='1.2' fill='%23106674' stroke='none'/%3E%3C/svg%3E");
}

.teacher-tabs {
  margin-top: 14px;
  display: flex;
  background: #fff;
  border: 1px solid #d9ecec;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}

.teacher-tabs a {
  text-decoration: none;
  color: #334155;
  padding: 12px 20px;
  font-size: 14px;
  border-right: 1px solid #d9ecec;
  transition: var(--transition);
}

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

.teacher-tabs a:focus-visible {
  outline: 3px solid #f3b33d;
  outline-offset: -3px;
}

.teacher-tabs a.active {
  background: #106674;
  color: #fff;
}

.teacher-tabs a:hover {
  background: #0d4d57;
  color: #fff;
}

.teacher-content {
  margin-top: 0;
  background: #fff;
  border: 1px solid #d9ecec;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 24px 28px;
}

.teacher-panel {
  display: none;
}

.teacher-panel.active {
  display: block;
}

.teacher-content p {
  font-size: 16px;
  line-height: 1.95;
  color: #1e293b;
  text-indent: 2em;
  margin-bottom: 14px;
}

.teacher-content p:last-child {
  margin-bottom: 0;
}

.teacher-content h3 {
  margin: 24px 0 12px;
  color: #106674;
  font-size: 18px;
  line-height: 1.5;
}

.teacher-content h3:first-child {
  margin-top: 0;
}

.teacher-content ul {
  margin: 0 0 18px;
  padding-left: 1.4em;
}

.teacher-content li {
  margin-bottom: 9px;
  color: #1e293b;
  font-size: 15px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.teacher-content li::marker {
  color: #106674;
}

.related-sidebar {
  width: 260px;
  background: #fff;
  border: 1px solid #d9ecec;
  border-radius: 8px;
  padding: 14px;
}

.related-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.related-header h3 {
  margin: 0;
  color: #106674;
  font-size: 20px;
}

.related-header a,
.related-more {
  text-decoration: none;
  font-size: 12px;
  color: #64748b;
}

.related-header a:hover,
.related-more:hover {
  color: #106674;
}

.related-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px 10px !important;
  width: 100% !important;
}

/* WebPlus 新闻窗口实际输出 table/tr/td，display:contents 让教师条目参与两列网格。 */
.related-grid .wp_article_list_table,
.related-grid .wp_article_list_table > tbody,
.related-grid .wp_article_list_table > tbody > tr {
  display: contents !important;
}

.related-grid .wp_article_list_table td {
  display: block !important;
  width: auto !important;
  padding: 0 !important;
}

/* WebPlus 会在“窗口内容”和条目模板之间插入列表包装层。 */
.related-grid > .wp_article_list,
.related-grid > ul {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px 10px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.related-grid > .wp_article_list > *,
.related-grid > ul > * {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  float: none !important;
}

/* 覆盖 WebPlus 新闻组件按后台“列数”写入的行内宽度与浮动。 */
.related-grid > * {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  float: none !important;
}

.related-item {
  display: block !important;
  width: auto !important;
  min-width: 0;
  text-decoration: none;
  text-align: center;
  color: #334155;
}

.related-item-image,
.related-item-image > a {
  display: block;
  width: 100%;
}

.related-item img {
  display: block;
  width: 100% !important;
  height: 82px !important;
  object-fit: cover !important;
  border-radius: 4px;
  border: 1px solid #d9ecec;
}

.related-item span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}

.related-item:hover span {
  color: #106674;
}

.related-item span a {
  color: inherit;
  text-decoration: none;
}

.related-item:focus-visible {
  outline: 3px solid #f3b33d;
  outline-offset: 3px;
}

@media (max-width: 992px) {
  .teacher-profile-section {
    padding: 28px 0 44px;
  }

  .teacher-layout {
    flex-direction: column;
    gap: 18px;
  }

  .teacher-card {
    padding: 22px;
  }

  .teacher-tabs {
    flex-wrap: wrap;
  }

  .teacher-tabs a {
    flex: 1 1 calc(50% - 1px);
    text-align: center;
  }

  .related-sidebar {
    width: 100%;
  }

  .related-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .teacher-profile-section {
    padding: 22px 0 36px;
  }

  .teacher-card {
    padding: 18px;
  }

  .teacher-header {
    flex-direction: column;
    gap: 16px;
  }

  .teacher-basic {
    width: 100%;
  }

  .teacher-top-info {
    flex-direction: column;
    gap: 12px;
  }

  .teacher-top-right {
    width: 100%;
    min-width: 0;
    padding-left: 0;
    border-left: none;
  }

  .teacher-avatar {
    width: 140px;
    height: 180px;
    margin: 0 auto;
  }

  .teacher-name-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .teacher-name-row h1 {
    font-size: 30px;
  }

  .teacher-tag {
    font-size: 13px;
    padding: 3px 10px;
  }

  .teacher-meta-row,
  .teacher-field-label,
  .teacher-field-value,
  .teacher-contact,
  .teacher-contact-label,
  .teacher-contact-value {
    font-size: 15px;
  }

  .teacher-field-row {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
  }

  .teacher-contact-row {
    flex-direction: column;
    column-gap: 12px;
    row-gap: 8px;
  }

  .teacher-contact-item {
    width: 100%;
    align-items: flex-start;
    gap: 8px;
  }

  .teacher-contact-row-main {
    column-gap: 0;
  }

  .teacher-tabs a {
    flex: 1 1 100%;
    padding: 11px 14px;
    font-size: 15px;
    border-right: none;
    border-bottom: 1px solid #d9ecec;
  }

  .teacher-tabs a:last-child {
    border-bottom: none;
  }

  .teacher-content {
    padding: 18px 18px 20px;
  }

  .teacher-content p {
    font-size: 15px;
    line-height: 1.85;
    text-indent: 0;
  }

  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .related-item img {
    height: 110px;
  }
}

@media (max-width: 480px) {
  .teacher-card {
    padding: 14px;
  }

  .teacher-avatar {
    width: 120px;
    height: 156px;
  }

  .teacher-name-row h1 {
    font-size: 26px;
  }

  .teacher-top-info {
    padding-bottom: 12px;
  }

  .teacher-meta-row,
  .teacher-field-label,
  .teacher-field-value,
  .teacher-contact,
  .teacher-contact-label,
  .teacher-contact-value {
    font-size: 14px;
  }

  #teacher-mentor::before {
    margin: 0 8px;
  }

  .teacher-content {
    padding: 16px 14px 18px;
  }

  .teacher-content p {
    font-size: 14px;
    line-height: 1.8;
  }

  .related-sidebar {
    padding: 12px;
  }

  .related-header h3 {
    font-size: 18px;
  }

  .related-item img {
    height: 92px;
  }

  .related-item span {
    font-size: 12px;
  }
}
