/* 富文本正文：前台展示与后台 WangEditor 共用 */
.rich-content,
.td-html,
.blog-detail-content,
.w-e-text-container [data-slate-editor].rich-content {
  color: #334155;
  font-size: 16px;
  line-height: 1.8;
}

.rich-content > *:first-child,
.td-html > *:first-child,
.blog-detail-content > *:first-child,
.w-e-text-container [data-slate-editor].rich-content > *:first-child {
  margin-top: 0;
}

.rich-content h2,
.rich-content h3,
.rich-content h4,
.td-html h2,
.td-html h3,
.td-html h4,
.blog-detail-content h2,
.blog-detail-content h3,
.blog-detail-content h4,
.w-e-text-container [data-slate-editor].rich-content h2,
.w-e-text-container [data-slate-editor].rich-content h3,
.w-e-text-container [data-slate-editor].rich-content h4 {
  margin: 28px 0 14px;
  color: #111;
  font-weight: 800;
  line-height: 1.3;
}

.rich-content h2,
.td-html h2,
.blog-detail-content h2,
.w-e-text-container [data-slate-editor].rich-content h2 { font-size: 28px; }

.rich-content h3,
.td-html h3,
.blog-detail-content h3,
.w-e-text-container [data-slate-editor].rich-content h3 { font-size: 20px; }

.rich-content h4,
.td-html h4,
.blog-detail-content h4,
.w-e-text-container [data-slate-editor].rich-content h4 { font-size: 18px; }

.rich-content p,
.td-html p,
.blog-detail-content p,
.w-e-text-container [data-slate-editor].rich-content p {
  margin: 0 0 14px;
}

.rich-content ul,
.rich-content ol,
.td-html ul,
.td-html ol,
.blog-detail-content ul,
.blog-detail-content ol,
.w-e-text-container [data-slate-editor].rich-content ul,
.w-e-text-container [data-slate-editor].rich-content ol {
  margin: 0 0 16px;
  padding-left: 1.2em;
}

.rich-content li,
.td-html li,
.blog-detail-content li,
.w-e-text-container [data-slate-editor].rich-content li {
  margin: 6px 0;
}

.rich-content img,
.rich-content video,
.td-html img,
.td-html video,
.blog-detail-content img,
.blog-detail-content video,
.w-e-text-container [data-slate-editor].rich-content img,
.w-e-text-container [data-slate-editor].rich-content video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: inline-block;
  vertical-align: top;
  margin: 8px 4px;
}

.rich-content p:has(> img ~ img),
.td-html p:has(> img ~ img),
.blog-detail-content p:has(> img ~ img),
.w-e-text-container [data-slate-editor].rich-content p:has(> img ~ img) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: flex-start;
}

.rich-content p:has(> img ~ img) > span,
.td-html p:has(> img ~ img) > span,
.blog-detail-content p:has(> img ~ img) > span,
.w-e-text-container [data-slate-editor].rich-content p:has(> img ~ img) > span {
  display: none;
}

.rich-content p:has(> img ~ img) img,
.rich-content p:has(> img ~ img) video,
.td-html p:has(> img ~ img) img,
.td-html p:has(> img ~ img) video,
.blog-detail-content p:has(> img ~ img) img,
.blog-detail-content p:has(> img ~ img) video,
.w-e-text-container [data-slate-editor].rich-content p:has(> img ~ img) img,
.w-e-text-container [data-slate-editor].rich-content p:has(> img ~ img) video {
  flex: 1 1 calc(50% - 8px);
  max-width: calc(50% - 8px);
  margin: 0;
}

.rich-content p:has(> img ~ img ~ img) img,
.rich-content p:has(> img ~ img ~ img) video,
.td-html p:has(> img ~ img ~ img) img,
.td-html p:has(> img ~ img ~ img) video,
.blog-detail-content p:has(> img ~ img ~ img) img,
.blog-detail-content p:has(> img ~ img ~ img) video,
.w-e-text-container [data-slate-editor].rich-content p:has(> img ~ img ~ img) img,
.w-e-text-container [data-slate-editor].rich-content p:has(> img ~ img ~ img) video {
  flex-basis: calc(33.333% - 8px);
  max-width: calc(33.333% - 8px);
}

.rich-content p:only-child > img:only-child,
.rich-content p:only-child > video:only-child,
.td-html p:only-child > img:only-child,
.td-html p:only-child > video:only-child,
.blog-detail-content p:only-child > img:only-child,
.blog-detail-content p:only-child > video:only-child,
.w-e-text-container [data-slate-editor].rich-content p:only-child > img:only-child,
.w-e-text-container [data-slate-editor].rich-content p:only-child > video:only-child {
  display: block;
  margin: 16px auto;
}

.rich-content iframe,
.td-html iframe,
.blog-detail-content iframe,
.w-e-text-container [data-slate-editor].rich-content iframe {
  max-width: 100%;
  border: 0;
  border-radius: 8px;
}

.rich-content a,
.blog-detail-content a,
.w-e-text-container [data-slate-editor].rich-content a {
  color: #2a6db0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rich-content blockquote,
.blog-detail-content blockquote,
.w-e-text-container [data-slate-editor].rich-content blockquote {
  margin: 1.4em 0;
  padding: 14px 20px;
  border-left: 4px solid #f5b400;
  background: #f8fafc;
  color: #475569;
}
