/* 富文本正文：前台展示（后台编辑器样式见 static/admin/editor-preview.css、dest-intro-editor.css） */
.rich-content,
.td-html,
.blog-detail-content {
  color: #334155;
  font-size: 16px;
  line-height: 1.8;
}

.rich-content > *:first-child,
.td-html > *:first-child,
.blog-detail-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 {
  margin: 28px 0 14px;
  color: #111;
  font-weight: 800;
  line-height: 1.3;
}

.rich-content h2,
.td-html h2,
.blog-detail-content h2 { font-size: 28px; }

.rich-content h3,
.td-html h3,
.blog-detail-content h3 { font-size: 20px; }

.rich-content h4,
.td-html h4,
.blog-detail-content h4 { font-size: 18px; }

.rich-content p,
.td-html p,
.blog-detail-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 {
  margin: 0 0 16px;
  padding-left: 1.2em;
}

.rich-content li,
.td-html li,
.blog-detail-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 {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: inline-block;
  vertical-align: top;
  margin: 8px 4px;
}

.rich-content p.rich-img-row,
.rich-content p:has(> img ~ img),
.dest-content-intro p.rich-img-row,
.dest-content-intro p:has(> img ~ img),
.td-html p:has(> img ~ img),
.blog-detail-content p:has(> img ~ img) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: flex-start;
}

.dest-content-intro p.rich-img-row > span:empty,
.rich-content p.rich-img-row > span:empty,
.td-html p.rich-img-row > span:empty,
.blog-detail-content p.rich-img-row > span:empty {
  display: none;
}

.rich-content p.rich-img-row img,
.rich-content p.rich-img-row video,
.rich-content p:has(> img ~ img) img,
.rich-content p:has(> img ~ img) video,
.dest-content-intro p.rich-img-row img,
.dest-content-intro p:has(> img ~ img) img,
.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 {
  flex: 1 1 calc(50% - 8px);
  max-width: calc(50% - 8px) !important;
  width: auto !important;
  height: auto !important;
  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 {
  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,
.dest-content-intro p:only-child > img:only-child,
.dest-content-intro p:only-child > video:only-child {
  display: block;
  margin: 16px auto;
}

.dest-content-intro p:has(> img:only-child):has(+ p:has(> img:only-child)),
.dest-content-intro p:has(> img:only-child) + p:has(> img:only-child),
.rich-content p:has(> img:only-child):has(+ p:has(> img:only-child)),
.rich-content p:has(> img:only-child) + p:has(> img:only-child) {
  display: inline-block;
  width: calc(50% - 4px);
  vertical-align: top;
  margin: 0 0 12px;
  box-sizing: border-box;
}

.dest-content-intro p:has(> img:only-child):has(+ p:has(> img:only-child)) img,
.dest-content-intro p:has(> img:only-child) + p:has(> img:only-child) img,
.rich-content p:has(> img:only-child):has(+ p:has(> img:only-child)) img,
.rich-content p:has(> img:only-child) + p:has(> img:only-child) img {
  width: 100%;
  max-width: 100%;
  display: block !important;
  margin: 0 !important;
}

.rich-content iframe,
.td-html iframe,
.blog-detail-content iframe {
  max-width: 100%;
  border: 0;
  border-radius: 8px;
}

.rich-content a,
.blog-detail-content a {
  color: #2a6db0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rich-content blockquote,
.blog-detail-content blockquote {
  margin: 1.4em 0;
  padding: 14px 20px;
  border-left: 4px solid #f5b400;
  background: #f8fafc;
  color: #475569;
}
