/* 专家详情弹层：前台 / 后台预览共用，保证 1:1 */
.expert-modal {
  border: 0;
  padding: 0;
  margin: 0;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  background: transparent;
  color: inherit;
}

.expert-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
}

.expert-modal::backdrop {
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(2px);
}

html.expert-modal-open,
html.expert-modal-open body {
  overflow: hidden;
}

.expert-modal-panel {
  --expert-bg-w: 1697;
  --expert-bg-h: 1155;
  --expert-sheet-top: 24.8%;
  --expert-sheet-bottom: 9.2%;
  --expert-sheet-x: 7.6%;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: min(
    1220px,
    calc(100vw - 40px),
    calc((100vh - 40px) * var(--expert-bg-w) / var(--expert-bg-h))
  );
  aspect-ratio: var(--expert-bg-w) / var(--expert-bg-h);
  max-height: calc(100vh - 40px);
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  background-color: #eaf3fb;
  background-image: none;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% 100%;
  border-radius: 6px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.28);
  animation: expert-modal-in 0.22s ease;
}

.expert-modal-panel.has-bg {
  background-image: var(--expert-bg);
}

.expert-modal-panel:not(.has-bg) {
  background: linear-gradient(180deg, #7eb7e8 0%, #dceaf7 22%, #f4f7fa 50%, #e8f1f9 90%, #5a9fd4 100%);
}

@keyframes expert-modal-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.expert-modal-close {
  position: absolute;
  top: 2.2%;
  right: 1.6%;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(12, 74, 140, 0.88);
  color: #fff;
  font-size: 22px;
  line-height: 34px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.expert-modal-close:hover {
  background: #0a3d75;
}

.expert-modal-sheet {
  position: absolute;
  z-index: 1;
  left: var(--expert-sheet-x);
  right: var(--expert-sheet-x);
  top: var(--expert-sheet-top);
  bottom: var(--expert-sheet-bottom);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
  padding: 0.8% 1.2% 0.4%;
}

.expert-modal-article {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: auto;
  font-family: "Songti SC", "Noto Serif SC", "SimSun", "STSong", serif;
  font-size: 18px;
  line-height: 1.88;
  font-weight: 400;
  color: #222;
  text-align: justify;
  -webkit-overflow-scrolling: touch;
}

/* 人像略下移，贴近原稿版心 */
.expert-modal-photo {
  float: left;
  width: 23.5%;
  max-width: 228px;
  min-width: 128px;
  margin: 1.35em 1.35em 0.45em 0;
}

.expert-modal-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border: 0;
  box-shadow: none;
  background: #eef2f6;
}

.expert-modal-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed #c5d4e4;
  color: #888;
  font-size: 13px;
  font-family: "Microsoft YaHei", sans-serif;
}

.expert-modal-title {
  margin: 0 0 0.35em;
  font-size: 1.08em;
  font-weight: 700;
  color: #1a2330;
  line-height: 1.55;
  font-family: inherit;
}

.expert-modal-title.is-in-summary {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.expert-modal-role {
  margin: 0 0 0.55em;
  font-size: 0.92em;
  font-weight: 600;
  color: #0c4a8c;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.expert-modal-summary {
  overflow: visible;
  /* 避免继承页面 .article-body 的 16px，与后台预览字号不一致 */
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.expert-modal-summary p {
  margin: 0 0 0.55em;
  /* 默认无缩进；需要缩进时由编辑器写入段落内联 text-indent */
  text-indent: 0;
}

/* 时间履历行：略紧于正文，但仍铺满版面、层次清晰 */
.expert-modal-summary p.expert-cv {
  margin: 0 0 0.32em;
  line-height: 1.62;
  text-indent: 0;
}

.expert-modal-summary p.expert-cv + p.expert-cv {
  margin-top: 0;
}

.expert-modal-summary p.expert-lead {
  margin-bottom: 0.62em;
}

.expert-modal-summary p.expert-lead + p.expert-cv {
  margin-top: 0.15em;
}

/* 仅含换行的占位空段也要占一行高度（图文相对位置） */
.expert-modal-summary p:has(> br:only-child),
.expert-modal-summary p:empty {
  min-height: 1em;
  text-indent: 0;
}

.expert-modal-summary p:last-child {
  margin-bottom: 0;
}

.expert-modal-summary strong,
.expert-modal-summary b {
  font-weight: 700;
}

.expert-modal-actions {
  position: absolute;
  z-index: 2;
  left: auto;
  right: 3%;
  bottom: 5%;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  pointer-events: none;
}

.expert-modal-profile,
.expert-modal-done {
  pointer-events: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}

.expert-modal-profile {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(12, 74, 140, 0.95);
  border-radius: 3px;
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.expert-modal-profile:hover {
  background: #0a3d75;
  color: #fff;
}

.expert-modal-done {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #0c4a8c;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #9db8d4;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.expert-modal-done:hover {
  border-color: #0c4a8c;
  background: #fff;
}

@media (max-width: 760px) {
  .expert-modal[open] {
    align-items: flex-end;
    padding: 0;
  }
  .expert-modal-panel,
  .expert-modal-panel.has-bg,
  .expert-modal-panel:not(.has-bg) {
    width: 100%;
    max-width: none;
    aspect-ratio: auto;
    max-height: min(92vh, 860px);
    height: auto;
    margin: 0;
    padding: 0;
    border-radius: 16px 16px 0 0;
    background: #fff !important;
    background-image: none !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
  }
  .expert-modal-sheet {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    flex: 1 1 auto;
    max-height: none;
    padding: 18px 14px 8px;
    overflow: auto;
  }
  .expert-modal-article {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    line-height: 1.75;
    height: auto;
    overflow: visible;
  }
  .expert-modal-photo {
    float: none;
    display: block;
    width: 112px;
    max-width: 36%;
    min-width: 96px;
    margin: 0 auto 12px;
  }
  .expert-modal-photo img,
  .expert-modal-photo-empty {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
  }
  .expert-modal-title:not(.is-in-summary) {
    margin: 0 36px 6px;
    text-align: center;
    font-size: 20px;
    font-family: inherit;
  }
  .expert-modal-role {
    text-align: center;
  }
  .expert-modal-actions {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    flex: 0 0 auto;
    justify-content: stretch;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 14px 14px;
    margin: 0;
    border-top: 1px solid #eef2f5;
    background: #fff;
    pointer-events: auto;
  }
  .expert-modal-profile,
  .expert-modal-done {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 8px 10px;
    font-size: 13px;
    box-shadow: none;
  }
  .expert-modal-close {
    top: 8px;
    right: 8px;
    background: rgba(12, 74, 140, 0.9);
  }
}
