/* =============================================================================
   标题 + table（HKBUAS）
   前台 / 后台 TinyMCE 共用；不依赖 app.css
   复杂表头表格请用 .binfo-table（thead：白底 + 加粗 + 居中）
   ============================================================================= */

.rich-content,
.event-detail__article,
.tox-edit-area__iframe body,
.mce-content-body {
  --hkbuas-table-border: rgba(53, 63, 76, 0.16);
  --hkbuas-table-text: #353f4c;
  --hkbuas-table-title: #1e3e8a;
  --hkbuas-table-zebra: #f0eeef;
  --hkbuas-table-zebra-alt: #e6e5e5;
  --hkbuas-table-font: "DM Sans", "PingFang HK", "Microsoft YaHei", sans-serif;
  --hkbuas-table-body-size: clamp(18px, 1.146vw, 22px);
}

.rich-template-table {
  overflow: visible;
}

.rich-template-table__title,
.rich-template-table > h2 {
  margin: 0 0 clamp(16px, 1.25vw, 24px);
  color: var(--hkbuas-table-title, #1e3e8a);
  font-family: var(--hkbuas-table-font);
  font-size: clamp(20px, 1.25vw, 24px);
  font-weight: 700;
  font-style: normal;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: left;
}

.rich-template-table__wrap,
.rich-template-table,
.binfo-table-wrap {
  overflow-x: auto;
  border-radius: 10px 10px 0 0;
}

.rich-template-table__table,
.rich-template-table table:not(.binfo-table) {
  width: 100%;
  min-width: 480px;
  border: 1px solid var(--hkbuas-table-border, rgba(53, 63, 76, 0.16));
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 10px 10px 0 0;
  background: #fff;
}

.rich-template-table__table :is(th, td),
.rich-template-table table:not(.binfo-table) :is(th, td) {
  padding: clamp(14px, 1.25vw, 24px) clamp(18px, 1.667vw, 32px);
  border: 0;
  border-bottom: 1px solid var(--hkbuas-table-border, rgba(53, 63, 76, 0.16));
  color: var(--hkbuas-table-text, #353f4c);
  font-family: var(--hkbuas-table-font);
  font-size: clamp(16px, 1.146vw, 22px);
  font-weight: 300;
  line-height: clamp(24px, 1.667vw, 32px);
  letter-spacing: 0;
  text-align: left;
  vertical-align: middle;
  -webkit-font-smoothing: antialiased;
}

.rich-template-table__table tbody th[scope="row"],
.rich-template-table table:not(.binfo-table) tbody th[scope="row"] {
  width: 62%;
  border-right: 1px solid var(--hkbuas-table-border, rgba(53, 63, 76, 0.16));
  font-weight: 300;
}

.rich-template-table__table thead th,
.rich-template-table table:not(.binfo-table) thead th {
  font-weight: 700;
  background: #fff;
  text-align: center;
}

.rich-template-table__table tbody tr:nth-child(odd) > *,
.rich-template-table table:not(.binfo-table) tbody tr:nth-child(odd) > * {
  background: var(--hkbuas-table-zebra, #f0eeef);
}

.rich-template-table__table tbody tr:nth-child(even) > *,
.rich-template-table table:not(.binfo-table) tbody tr:nth-child(even) > * {
  background: #fff;
}

.rich-template-table__table tbody tr:last-child > *,
.rich-template-table table:not(.binfo-table) tbody tr:last-child > * {
  border-bottom: 0;
}

/* ---------- binfo-table（制服表等：必须带此 class 才有完整表头/斑马色） ---------- */

.binfo-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--hkbuas-table-border, rgba(53, 63, 76, 0.16));
  border-radius: 10px;
  overflow: hidden;
  font-family: var(--hkbuas-table-font);
}

.binfo-table th,
.binfo-table td {
  padding: clamp(12px, 1.146vw, 22px) clamp(16px, 1.563vw, 30px);
  border: none;
  border-bottom: 1px solid var(--hkbuas-table-border, rgba(53, 63, 76, 0.16));
  border-right: 1px solid var(--hkbuas-table-border, rgba(53, 63, 76, 0.16));
  color: var(--hkbuas-table-text, #353f4c);
  font-family: var(--hkbuas-table-font);
  font-size: var(--hkbuas-table-body-size, clamp(18px, 1.146vw, 22px));
  font-weight: 300;
  line-height: 1.45;
  text-align: left;
  vertical-align: top;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

.binfo-table th:last-child,
.binfo-table td:last-child {
  border-right: none;
}

.binfo-table tbody tr:last-child th,
.binfo-table tbody tr:last-child td {
  border-bottom: none;
}

/* thead：白底 + 加粗 + 居中（高于通用 th 的 font-weight: 300） */
.binfo-table thead th,
.rich-template-table .binfo-table thead th,
.rich-doc .binfo-table thead th,
.mce-content-body .binfo-table thead th {
  font-weight: 700;
  background: #fff;
  text-align: center;
  vertical-align: middle;
  color: var(--hkbuas-table-text, #353f4c);
}

.binfo-table--uniform tbody th[scope="row"] {
  width: clamp(120px, 12.5vw, 220px);
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
}

.binfo-table--uniform tbody tr:nth-child(odd) th[scope="row"],
.binfo-table--uniform tbody tr:nth-child(odd) td {
  background: var(--hkbuas-table-zebra, #f0eeef);
}

.binfo-table--uniform tbody tr:nth-child(even) th[scope="row"],
.binfo-table--uniform tbody tr:nth-child(even) td {
  background: var(--hkbuas-table-zebra-alt, #e6e5e5);
}

.binfo-table--uniform .binfo-list,
.binfo-table .binfo-list {
  margin: 0;
  padding-left: 1.15em;
  color: var(--hkbuas-table-title, #1e3e8a);
  list-style: disc;
}

.binfo-table--uniform .binfo-list li::marker,
.binfo-table .binfo-list li::marker {
  color: var(--hkbuas-table-title, #1e3e8a);
}
.rich-ul{
  margin: 0;
  padding: 0 0 0 1.4em;
  list-style: disc;
}
.rich-ul li{
  margin: 0 0 clamp(8px, 0.833vw, 16px);
  font-family: var(--font-sans);
  font-size: var(--vm-body-size);
  font-weight: 300;
  font-style: normal;
  line-height: var(--vm-body-lh);
  letter-spacing: 0;
  text-align: left;
  color: var(--vm-text-color);
}
.rich-ul li::marker{
  color: var(--vm-title-color);
}
.rich-ul li:last-child{
  margin-bottom: 0;
}

/* =============================================================================
   层级正文 rich-doc（HKBUAS）
   一级 / 二级 / 三级标题 + 内文 + 注释
   公共容器 class：.rich-doc
   后端包一层：<section class="rich-doc">{{ content }}</section>
   ============================================================================= */

.rich-content,
.event-detail__article,
.tox-edit-area__iframe body,
.mce-content-body,
.rich-doc {
  --hkbuas-doc-blue: #1e3e8a;
  --hkbuas-doc-text: #353f4c;
  --hkbuas-doc-note: #02b5dd;
  --hkbuas-doc-font: "DM Sans", "PingFang HK", "Microsoft YaHei", sans-serif;
  --hkbuas-doc-h1-size: clamp(32px, 2.813vw, 54px);
  --hkbuas-doc-h2-size: clamp(20px, 1.458vw, 28px);
  --hkbuas-doc-h3-size: clamp(18px, 1.25vw, 24px);
  --hkbuas-doc-body-size: clamp(18px, 1.146vw, 22px);
  --hkbuas-doc-note-size: clamp(16px, 1.042vw, 20px);
}

.rich-doc {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  color: var(--hkbuas-doc-text, #353f4c);
  font-family: var(--hkbuas-doc-font);
}

/*
  标题只打「干净标签」或 rich-doc__*，避免盖掉页面已有 title class
  （如 .campus-section-title / .binfo-page-title）
*/
.rich-doc > h2:not([class]),
.rich-doc h2.rich-doc__title {
  margin: 0 0 clamp(40px, 3.125vw, 60px);
  color: var(--hkbuas-doc-blue, #1e3e8a);
  font-family: var(--hkbuas-doc-font);
  font-size: var(--hkbuas-doc-h1-size);
  font-weight: 500;
  font-style: normal;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: left;
}

.rich-doc > h3:not([class]),
.rich-doc h3.rich-doc__subtitle {
  margin: 0 0 clamp(16px, 1.458vw, 28px);
  color: var(--hkbuas-doc-blue, #1e3e8a);
  font-family: var(--hkbuas-doc-font);
  font-size: var(--hkbuas-doc-h2-size);
  font-weight: 700;
  font-style: normal;
  line-height: 1.3;
  letter-spacing: 0;
  text-align: left;
}

.rich-doc > h2:not([class]) + h3:not([class]),
.rich-doc > h3:not([class]) + h3:not([class]) {
  margin-top: 0;
}

.rich-doc > h4:not([class]),
.rich-doc h4.rich-doc__heading {
  margin: clamp(16px, 1.25vw, 24px) 0 clamp(8px, 0.625vw, 12px);
  color: var(--hkbuas-doc-text, #353f4c);
  font-family: var(--hkbuas-doc-font);
  font-size: var(--hkbuas-doc-h3-size);
  font-weight: 700;
  font-style: normal;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: left;
}

/* 内文：容器级联，不给 p 贴业务 class */
.rich-doc > p:not([class]),
.rich-doc > p:not([class*="title"]):not([class*="subtitle"]):not([class*="heading"]):not([class*="label"]):not([class*="note"]):not([class*="caption"]):not([class*="kicker"]) {
  margin: 0;
  color: var(--hkbuas-doc-text, #353f4c);
  font-family: var(--hkbuas-doc-font);
  font-size: var(--hkbuas-doc-body-size);
  font-weight: 300;
  font-style: normal;
  line-height: 1.55;
  letter-spacing: 0;
  text-align: left;
}

.rich-doc > p:not([class]) + p:not([class]),
.rich-doc > p:not([class*="note"]) + p:not([class*="note"]),
.rich-doc > h4:not([class]) + p,
.rich-doc > p + h4:not([class]) {
  margin-top: clamp(16px, 1.25vw, 24px);
}

.rich-doc > h3:not([class]) + p {
  margin-top: 0;
}

/* 图集 / 表格前后间距 */
.rich-doc > .content-gallery + p,
.rich-doc > .content-gallery-shell + p,
.rich-doc > p + .campus-table-wrap,
.rich-doc > p + .binfo-table-wrap,
.rich-doc > p + .rich-template-table__wrap,
.rich-doc > p + .rich-template-table {
  margin-top: clamp(16px, 1.25vw, 24px);
}

.rich-doc > p.rich-doc__note,
.rich-doc .rich-doc__note {
  margin: clamp(16px, 1.25vw, 24px) 0 0;
  color: var(--hkbuas-doc-note, #02b5dd);
  font-family: var(--hkbuas-doc-font);
  font-size: var(--hkbuas-doc-note-size);
  font-weight: 300;
  font-style: normal;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
}

.rich-doc > h3:not([class]) + h3:not([class]),
.rich-doc > p + h3:not([class]),
.rich-doc > .rich-doc__note + h3:not([class]) {
  margin-top: clamp(48px, 4.167vw, 80px);
}

@media (max-width: 860px) {
  .rich-template-media,
  .rich-template-grid,
  .rich-template-card-grid {
    grid-template-columns: 1fr;
  }

  .rich-template-block {
    margin: 1.5rem 0;
  }

  .rich-template-placeholder {
    min-height: 180px;
  }

  .rich-template-table__table :is(th, td),
  .rich-template-table table :is(th, td) {
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.45;
  }

  .rich-doc > h2:not([class]),
  .rich-doc h2.rich-doc__title {
    margin-bottom: 28px;
  }

  .rich-doc > p + h3:not([class]),
  .rich-doc > .rich-doc__note + h3:not([class]) {
    margin-top: 40px;
  }
}
