/* =====================================================================
   正文内容兜底净化样式（ylltk 版）——新闻 / 产品 / 案例 / 单页 .content
   ---------------------------------------------------------------------
   挂载：inc/content-functions.php → enqueue 依赖 ylltk-style（最后层）
   作用范围：body.single 与 body.page 的 .content 容器——即四类详情模板
   （content-news / content-products / content-case / cached/page.php:12）的
   正文容器。首页/列表/侧栏不涉及（.content 类名仅详情模板使用）。

   与既有体系的关系（ylltk 已有保存期白名单 content-sanitizer.php 在跑）：
   - 新入库内容已被 sanitizer 清洗（div/span/style 剥除、h1-h4 降级 h5），
     本文件主要治理两类对象：
     a) sanitizer 之前入库的历史文章（线上实测 assyauto 82 号文 12 处行内样式）；
     b) sanitizer 管不到的东西：行内字号残留、假空段显示、字体族、浮动图贴字等。
   - 既有规则不重复：.content 已有 16px 基准/行高 1.6/断行（style.css:514-521）、
     表格边框包 + display:block 横滚（style.css:524-527）、img/iframe/video
     max-width（style.css:523/530-533）、pre/code 防溢出（style.css:528-529）。
   - 本主题是 Bootstrap 5 环境：BS5 自带 ul 圆点/默认排版，列表真空比 ahlsx/
     ylzncn 轻，但粘贴行内 list-style:none 仍需对抗。

   标题阶梯的 ylltk 特殊决策：sanitizer 把 h1-h4 全部降级为 h5（保存期），
   所以前台正文标题的现实是"h5 或无标题"（线上三站实测：motoassy 全部 h5、
   assyauto/xgdlsj 多数无标题）。h5 必须按"正文一级标题"对待（16px/700），
   否则被降级的标题全部显示为 13px 小字；h1-h4 规则仍保留——历史文章在
   sanitizer 之前入库的带 h2/h3（ahlsx 系实测同源内容有），归一防溢出。

   设计原则（与 ahlsx 9-11 轮 / ylzncn 第一轮同一套已验证方案）：
   1. 行内 style 优先级高，关键归一化属性一律 !important；
   2. 只强制破坏排版/层级的属性；颜色/对齐等作者意图不动；
   3. 表格豁免：行业决定表格必须原样保留（Word/Excel 紧凑表格 12px 字号、
      合并单元格、粘贴底色），:not(:is(table...) *) 精确排除表格后代；
   4. 纯 CSS 做不到的（假空段/零宽字符）由 inc/content-functions.php 过滤层接管。

   线上取证（2026-11-29）：assyauto 空调文 10 假空段、motoassy 多篇 3 个、
   xgdlsj 每篇 1-3 个，形态 <p>&nbsp;</p>；行内样式残留见 assyauto 82 号文。
   ===================================================================== */

/* -------------------------------------------------------------------
   1. 防溢出：任何后代不超版心（行内写死 width 被 max-width 在使用值层面压回）
   ------------------------------------------------------------------- */
body:is(.single, .page) .content * {
	max-width: 100%;
	box-sizing: border-box;
}
body:is(.single, .page) .content img,
body:is(.single, .page) .content video,
body:is(.single, .page) .content canvas,
body:is(.single, .page) .content svg,
body:is(.single, .page) .content table {
	max-width: 100% !important;
}
body:is(.single, .page) .content img,
body:is(.single, .page) .content video {
	height: auto !important;
}
body:is(.single, .page) .content img {
	vertical-align: middle;
	border: 0;
}

/* -------------------------------------------------------------------
   2. 字体族归一：粘贴自带 Calibri/宋体/Arial 行内字体，统一继承站点字体
      （BS5 站点字体栈）；pre/code 保持等宽（style.css:528 有防溢出无字体规则）
   ------------------------------------------------------------------- */
body:is(.single, .page) .content * {
	font-family: inherit !important;
}
body:is(.single, .page) .content pre,
body:is(.single, .page) .content code,
body:is(.single, .page) .content kbd,
body:is(.single, .page) .content samp {
	font-family: Consolas, Monaco, "Courier New", monospace !important;
}

/* -------------------------------------------------------------------
   3. 标题层级：h5 顶配（sanitizer 降级落点），h1-h4 为历史文章兜底
   ------------------------------------------------------------------- */
body:is(.single, .page) .content h1,
body:is(.single, .page) .content h2,
body:is(.single, .page) .content h3,
body:is(.single, .page) .content h4,
body:is(.single, .page) .content h5,
body:is(.single, .page) .content h6 {
	font-weight: 700 !important;
	line-height: 1.4 !important;
	margin: 1.4em 0 0.6em !important;
}
body:is(.single, .page) .content h1 { font-size: 20px !important; }
body:is(.single, .page) .content h2 { font-size: 18px !important; }
body:is(.single, .page) .content h3 { font-size: 17px !important; }
body:is(.single, .page) .content h4 { font-size: 16px !important; }
body:is(.single, .page) .content h5 { font-size: 16px !important; }
body:is(.single, .page) .content h6 { font-size: 13px !important; }

/* -------------------------------------------------------------------
   4. 段落与文本块：微信/135 粘贴常 margin:0 挤成一片
      （.content 已有行高 1.6 与正文 16px，这里只对抗行内覆盖）
   ------------------------------------------------------------------- */
body:is(.single, .page) .content p {
	margin: 0 0 1em !important;
	line-height: inherit !important;
	font-size: inherit !important;
}
body:is(.single, .page) .content section,
body:is(.single, .page) .content li {
	font-size: inherit !important;
}
body:is(.single, .page) .content p:empty {
	display: none !important;
}

/* -------------------------------------------------------------------
   5. 行内元素与包裹层字号归一（历史文章行内样式残留的主战场），
      颜色/背景刻意不动（作者意图）。表格豁免：单元格行内字号原样生效。
   ------------------------------------------------------------------- */
body:is(.single, .page) .content :is(div, section, span, a, strong, b, em, i, u, font):not(:is(table, thead, tbody, tfoot, tr, td, th) *) {
	font-size: inherit !important;
	line-height: inherit !important;
}

/* -------------------------------------------------------------------
   6. 列表：BS5 自带圆点，但行内 list-style:none / margin:0 / padding:0
      的 135 编辑器粘贴仍需对抗（线上实测 ul 内 li 正常、行内清空常见）
   ------------------------------------------------------------------- */
body:is(.single, .page) .content ul,
body:is(.single, .page) .content ol {
	margin: 1em 0 !important;
	padding-left: 2em !important;
	list-style-position: outside !important;
}
body:is(.single, .page) .content ul { list-style-type: disc !important; }
body:is(.single, .page) .content ol { list-style-type: decimal !important; }
body:is(.single, .page) .content li > ul,
body:is(.single, .page) .content li > ol {
	margin: 0.3em 0 !important;
}

/* -------------------------------------------------------------------
   7. 引用 / 代码 / 术语列表 / figure / 图注 / 分隔线（主题无既有规则，补齐）
   ------------------------------------------------------------------- */
body:is(.single, .page) .content blockquote {
	margin: 1.2em 0 !important;
	padding: 10px 16px !important;
	background-color: #f7f9fb;
	border-left: 4px solid #0d6efd;
	border-radius: 3px;
}
body:is(.single, .page) .content blockquote > :last-child {
	margin-bottom: 0 !important;
}
body:is(.single, .page) .content pre {
	margin: 1.2em 0 !important;
	padding: 12px 15px !important;
	background-color: #f6f8fa;
	border: 1px solid #e5e5e5;
	border-radius: 4px;
	overflow-x: auto;
	font-size: 13px !important;
	line-height: 1.6 !important;
	white-space: pre !important;
}
body:is(.single, .page) .content code {
	padding: 2px 6px;
	background-color: #f5f5f5;
	border-radius: 3px;
	font-size: 90%;
}
body:is(.single, .page) .content pre code {
	padding: 0 !important;
	background: none !important;
	font-size: inherit !important;
}
body:is(.single, .page) .content dl { margin: 1em 0 !important; }
body:is(.single, .page) .content dd { margin: 0 0 0.5em 2em !important; }
body:is(.single, .page) .content dt { font-weight: 700; }
body:is(.single, .page) .content figure { margin: 1em 0 !important; }
body:is(.single, .page) .content figcaption {
	margin-top: 0.5em;
	text-align: center;
	color: #999;
	font-size: 13px !important;
}
body:is(.single, .page) .content hr {
	height: 0 !important;
	border: 0 !important;
	border-top: 1px solid #ddd !important;
	margin: 1.5em 0 !important;
}

/* -------------------------------------------------------------------
   8. 表格兜底补充（边框/表头底色/display:block 横滚已在 style.css 524-527，
      此处只补行内宽度兜底与表头加粗；行业红线：单元格粘贴样式原样保留）
   ------------------------------------------------------------------- */
body:is(.single, .page) .content table {
	width: 100% !important;
	margin: 15px 0 !important;
}
body:is(.single, .page) .content th { font-weight: 700 !important; }

/* -------------------------------------------------------------------
   9. WP 编辑器对齐类与经典图注（BS5 主题此前无对应样式，按 WP 标准补齐）
   ------------------------------------------------------------------- */
body:is(.single, .page) .content .aligncenter {
	display: block !important;
	float: none !important;
	margin-left: auto !important;
	margin-right: auto !important;
}
body:is(.single, .page) .content .alignleft {
	float: left !important;
	margin: 5px 20px 8px 0 !important;
}
body:is(.single, .page) .content .alignright {
	float: right !important;
	margin: 5px 0 8px 20px !important;
}
body:is(.single, .page) .content dl.wp-caption {
	box-sizing: content-box;
	padding: 5px 5px 0;
	text-align: center;
}
body:is(.single, .page) .content dd.wp-caption-text {
	margin: 5px 0 0 !important;
	text-align: center;
	font-size: 13px;
	color: #999;
}

/* -------------------------------------------------------------------
   10. 粘贴垃圾修正
   ------------------------------------------------------------------- */
body:is(.single, .page) .content [style*="position:fixed"],
body:is(.single, .page) .content [style*="position: fixed"],
body:is(.single, .page) .content [style*="position:absolute"],
body:is(.single, .page) .content [style*="position: absolute"] {
	position: static !important;
}
body:is(.single, .page) .content img[style*="float:left"],
body:is(.single, .page) .content img[style*="float: left"] {
	float: left !important;
	margin: 5px 20px 8px 0 !important;
}
body:is(.single, .page) .content img[style*="float:right"],
body:is(.single, .page) .content img[style*="float: right"] {
	float: right !important;
	margin: 5px 0 8px 20px !important;
}
