/* ============================================================================
   rich-content.css — 富文本（产品特性/规格）排版样式
   ----------------------------------------------------------------------------
   作用域：任何带 .rich-content 类的容器

     前台  <div class="detail-features rich-content">@Html.Raw(FeaturesHtml)</div>
     后台  TinyMCE 编辑器内容区（content_css 引用本文件 + body_class='rich-content'）

   为什么必须单独成文件：
     site.css 开头的全局 reset（*{margin:0;padding:0} + ul{list-style:none}）
     是为了让页面骨架可控，但它同时把富文本里 <ul>/<ol>/<p>/<h*>/<table> 的
     默认排版全部清零 —— 后台编辑器里看到的圆点、缩进、段落间距、标题层级，
     到前台就全没了。这里的规则用更高优先级把它们逐项还原，
     并且前台 / 后台共用同一份文件，保证「编辑器所见 = 前台所得」。

   注意：本文件必须自包含。编辑器 iframe 内不会加载 site.css，前台也不会
   二次加载 —— 两边都只依赖本文件的规则，不要假设外部 reset 存在或不存在。
   ========================================================================== */

/* ---------------------------------------------------------------- 基准排版 */
.rich-content{font-size:15px;line-height:1.75;color:#475569;overflow-wrap:break-word}

/* 首尾元素不留多余外边距（避免与 section 的 padding 叠加成双倍空白） */
.rich-content > *:first-child{margin-top:0}
.rich-content > *:last-child{margin-bottom:0}

.rich-content p{margin:0 0 14px}
.rich-content strong,.rich-content b{font-weight:700;color:#0f172a}
.rich-content em,.rich-content i{font-style:italic}
.rich-content small{font-size:13px;color:#64748b}
.rich-content sup,.rich-content sub{font-size:.75em;line-height:0}

/* -------------------------------------------------------------------- 标题 */
.rich-content h1,.rich-content h2,.rich-content h3,
.rich-content h4,.rich-content h5,.rich-content h6{
  font-family:'Sora','Inter',sans-serif;font-weight:700;color:#0f172a;
  line-height:1.3;margin:30px 0 14px}
.rich-content h1{font-size:26px}
.rich-content h2{font-size:22px}
.rich-content h3{font-size:20px}
.rich-content h4{font-size:17px}
.rich-content h5{font-size:15px}
.rich-content h6{font-size:14px;color:#334155}

/* --------------------------------------------------------- 列表（核心修复） */
/* 必须显式重写，否则被 site.css 的 ul{list-style:none} + *{padding:0} 清空 */
.rich-content ul,.rich-content ol{margin:0 0 16px;padding-left:24px}
.rich-content ul{list-style:disc}
.rich-content ul ul{list-style:circle}
.rich-content ul ul ul{list-style:square}
.rich-content ol{list-style:decimal}
.rich-content ol ol{list-style:lower-alpha}
.rich-content ol ol ol{list-style:lower-roman}

.rich-content li{margin:0 0 8px;padding-left:2px}
.rich-content li > ul,.rich-content li > ol{margin:8px 0 0}
/* 列表项内的段落不再额外撑开间距，避免行距忽大忽小 */
.rich-content li > p{margin:0 0 6px}

/* 项目符号用品牌蓝，和整站的 #0070e0 主色呼应 */
.rich-content li::marker{color:#0070e0;font-weight:600}

/* -------------------------------------------------------- 表格（规格表等） */
/* 后台用 TinyMCE 的 table 插件插入，不带任何 class —— 必须按标签选择器覆盖 */
.rich-content table{
  width:100%;border-collapse:collapse;margin:18px 0;font-size:14px;
  table-layout:auto}
.rich-content th,.rich-content td{
  border:1px solid #e2e8f0;padding:10px 14px;text-align:left;
  vertical-align:top;line-height:1.6}
.rich-content th{background:#f8fafc;font-weight:600;color:#334155}
.rich-content td{color:#475569}
.rich-content tbody tr:nth-child(even) td{background:#fcfdff}
/* 窄屏下允许横向滚动，避免表格把页面顶宽 */
.rich-content .table-scroll,.rich-content > table{max-width:100%}

/* ------------------------------------------------------------ 引用 / 分隔线 */
.rich-content blockquote{
  margin:18px 0;padding:12px 18px;border-left:3px solid #0070e0;
  background:#f1f7ff;border-radius:0 8px 8px 0;color:#334155}
.rich-content blockquote p:last-child{margin-bottom:0}
.rich-content hr{border:0;border-top:1px solid #e2e8f0;margin:26px 0}

/* -------------------------------------------------------------------- 链接 */
.rich-content a{color:#0070e0;text-decoration:underline;text-underline-offset:2px}
.rich-content a:hover{color:#0060c0}

/* ------------------------------------------------------------- 图片 / 代码 */
/* 富文本内图片默认自适应，绝不溢出 */
.rich-content img{max-width:100%;height:auto;border-radius:8px;display:block;margin:16px 0}
/* 编辑器里图片常被包在段落中，避免出现"段落间距 + 图片间距"双份空隙 */
.rich-content p > img:only-child{margin-top:0;margin-bottom:0}

.rich-content code{
  font-family:Consolas,Monaco,'Courier New',monospace;font-size:13px;
  background:#f1f5f9;color:#0f172a;padding:2px 6px;border-radius:4px}
.rich-content pre{
  background:#0f172a;color:#e2e8f0;padding:16px 18px;border-radius:10px;
  overflow-x:auto;font-size:13px;line-height:1.6;margin:18px 0}
.rich-content pre code{background:none;color:inherit;padding:0}

/* ------------------------------------ 一行 N 图网格（后台「2图 / 3图」按钮） */
/* 列宽用 fr，禁止写死 px */
.rich-content .img-grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:16px;margin:16px 0}
.rich-content .img-grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin:16px 0}
.rich-content .img-grid-2 img,.rich-content .img-grid-3 img{
  width:100%;height:auto;border-radius:8px;display:block;margin:0}

/* ---------------------------------------------------------------- 响应式 */
@media(max-width:1100px){
  .rich-content .img-grid-3{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:600px){
  .rich-content{font-size:14.5px}
  .rich-content h1{font-size:22px}
  .rich-content h2{font-size:20px}
  .rich-content h3{font-size:18px}
  .rich-content h4{font-size:16px}
  .rich-content .img-grid-2,.rich-content .img-grid-3{grid-template-columns:1fr}
  .rich-content th,.rich-content td{padding:8px 10px;font-size:13px}
}

/* ------------------------------------------------- 编辑器专属（前台无影响） */
/* TinyMCE 内容区：补内边距，让编辑时有正常呼吸感 */
body.rich-content{padding:18px 20px;background:#fff}
/* 编辑态占位段落（TinyMCE 空行输出 <p><br></p>）也保持行高，便于点选 */
body.rich-content p:empty::after{content:'\00a0'}


/* ============================================================================
   区块化排版（产品详情页三区块改造）
   ----------------------------------------------------------------------------
   入口契约由 RichTextNormalizer 保证（一次性数据规范化脚本产出）：

     <h4>Key Highlights</h4>          ← 区块小标签，同时是「开关」
     <h3>…</h3>                       ← 区块标题
     [<p>引导句</p>]                   ← 可选
     <ul><li>…</li>…</ul>             ← 必须只有一个，条数不限

     <h4>Technical Specifications</h4>
     <h3>…</h3>
     <table>…</table>                 ← 每行恰好 2 个 <td>、无 rowspan、无内联样式

   ★ <h4> 是开关：没有 h4 就完全不触发区块化，内容退化成「普通标题 + 普通列表 /
     普通表格」，<b>不破版</b>。这正是本组规则坚持写成 `h4 + h3 + …` 而不是 `h3 + …`
     的原因 —— 线上未规范化的历史数据（3 个 ul、无 h4）一旦命中，会被渲染成
     「1 张 / 1 张 / 2 张」三行卡片墙，以及 rowspan 错位的规格表。
   ========================================================================== */

/* ------------------------------------------- ① Key Highlights：卖点卡片墙 */

/* 区块小标签 */
.rich-content > h4{
  font-size:12px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;
  color:#00c8ae;margin:34px 0 10px;
}
.rich-content > h4:first-child{margin-top:0}

/* 区块大标题（紧跟 h4） */
.rich-content > h4 + h3{
  font-family:'Sora','Inter',sans-serif;font-size:clamp(23px,2.7vw,31px);font-weight:800;
  color:#0f172a;letter-spacing:-.02em;line-height:1.2;margin:0 0 10px;
}
/* 可选引导句 */
.rich-content > h4 + h3 + p{font-size:14.5px;color:#64748b;margin:0 0 28px;max-width:62ch}

/* 卡片墙本体 */
.rich-content > h4 + h3 + ul,
.rich-content > h4 + h3 + p + ul{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:20px;
  list-style:none;padding:0;margin:0 0 44px;counter-reset:hl;
}
.rich-content > h4 + h3 + ul > li,
.rich-content > h4 + h3 + p + ul > li{
  counter-increment:hl;position:relative;overflow:hidden;
  /* 顶部 hover 渐变条：::before（短杠）与 ::after（序号）两个伪元素槽位都已被占用，
     所以这条用 li 自身的 background-image 实现，靠 background-size 0→100% 扫出。
     border-radius + overflow:hidden 会把渐变条裁进圆角，与示意图一致。 */
  background-color:#fff;
  background-image:linear-gradient(90deg,#0070e0,#00c8ae);
  background-repeat:no-repeat;background-position:top left;background-size:0 3px;
  border:1px solid rgba(0,0,0,.07);border-radius:16px;
  padding:50px 24px 26px;margin:0;
  font-size:13px;color:#64748b;line-height:1.62;
  transition:transform .34s cubic-bezier(.2,.7,.3,1),box-shadow .34s,border-color .34s,
             background-size .34s ease-out;
}
/* 渐变短杠（条目的视觉锚点） */
.rich-content > h4 + h3 + ul > li::before,
.rich-content > h4 + h3 + p + ul > li::before{
  content:'';position:absolute;top:26px;left:24px;width:34px;height:4px;border-radius:2px;
  background:linear-gradient(90deg,#0070e0,#00c8ae);
}
/* 序号水印 01 / 02 / …（走 CSS counter，条数不限） */
.rich-content > h4 + h3 + ul > li::after,
.rich-content > h4 + h3 + p + ul > li::after{
  content:counter(hl,decimal-leading-zero);position:absolute;top:12px;right:16px;
  font-family:'Sora','Inter',sans-serif;font-size:42px;font-weight:800;line-height:1;
  color:rgba(0,112,224,.07);letter-spacing:-.04em;
}
.rich-content > h4 + h3 + ul > li:hover,
.rich-content > h4 + h3 + p + ul > li:hover{
  transform:translateY(-4px);border-color:rgba(0,112,224,.28);
  box-shadow:0 20px 42px -22px rgba(15,23,42,.42);
  background-size:100% 3px;
}
/* 编辑用加粗标记的关键数字 → 品牌蓝 */
.rich-content > h4 + h3 + ul > li strong,
.rich-content > h4 + h3 + p + ul > li strong{color:#0070e0;font-weight:800}

/* --------------------------------------- ② Technical Specifications：规格卡 */

/* 基础修复：h3 之后的规格表一律占满宽度、去掉灰边框。
   未规范化（表里还带内联 style）时也能受益 —— 但不做两列折叠，所以不会破版。 */
.rich-content > h3 + table{
  width:100%!important;max-width:100%!important;background:#fff;
  border:1px solid rgba(0,0,0,.07)!important;border-radius:16px;
  border-collapse:separate!important;border-spacing:0;overflow:hidden;
  margin:0 0 44px;table-layout:auto!important;
}
.rich-content > h3 + table td,
.rich-content > h3 + table th{
  border:0!important;border-width:0!important;background:none!important;
  width:auto!important;height:auto!important;padding:11px 14px!important;
}
.rich-content > h3 + table tbody tr:nth-child(even) td{background:none!important}

/* 两列折叠：仅当表格已规范化（由 h4 开关把关）才启用。
   折叠后 tbody 按 row-major 填充，阅读顺序与源表逐项一致，只是高度减半。 */
.rich-content > h4 + h3 + table{display:block!important;padding:0}
.rich-content > h4 + h3 + table > tbody{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  column-gap:56px;padding:10px 24px 18px;align-items:start;
}
.rich-content > h4 + h3 + table tr{
  display:grid;grid-template-columns:46% 1fr;gap:16px;
  padding:11px 0;border-bottom:1px solid rgba(0,0,0,.048);
}
.rich-content > h4 + h3 + table td{padding:0!important}
.rich-content > h4 + h3 + table td:first-child{
  font-size:12.5px;font-weight:500;color:#64748b;line-height:1.55;
}
.rich-content > h4 + h3 + table td:last-child{
  font-size:12.5px;font-weight:600;color:#1e293b;line-height:1.55;
}
.rich-content > h4 + h3 + table td:last-child strong{color:#0070e0;font-weight:800}

/* 预留能力：编辑把某一行合并成一格（只剩 1 个 <td>）即渲染成整宽分组条。
   规范化后的表格每行恰好 2 个 <td>，所以这条规则常驻也不会被误触发。 */
.rich-content > h4 + h3 + table tr:has(> td:only-child){
  grid-column:1 / -1;grid-template-columns:1fr;
  margin:16px 0 4px;padding:10px 0 8px;
  border-bottom:1px solid rgba(0,112,224,.18);
}
.rich-content > h4 + h3 + table tr:has(> td:only-child) > td{
  font-size:12px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;
  color:#0070e0;
}

/* ------------------------------------------------------------ 区块响应式 */
@media(max-width:1024px){
  .rich-content > h4 + h3 + ul,
  .rich-content > h4 + h3 + p + ul{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:860px){
  .rich-content > h4 + h3 + table > tbody{grid-template-columns:1fr;column-gap:0}
  .rich-content > h4 + h3 + table tr{grid-template-columns:41% 1fr}
}
@media(max-width:640px){
  .rich-content > h4 + h3 + ul,
  .rich-content > h4 + h3 + p + ul{grid-template-columns:1fr;gap:14px}
  .rich-content > h4 + h3 + ul > li,
  .rich-content > h4 + h3 + p + ul > li{padding:44px 20px 22px}
  .rich-content > h4 + h3 + table tr{grid-template-columns:1fr;gap:3px;padding:10px 0}
  .rich-content > h4 + h3 + table td:first-child{
    font-size:11.5px;text-transform:uppercase;letter-spacing:.06em;
  }
}


/* ============================================================================
   编辑器内降级（TinyMCE 的 body_class 同时带 rich-content--editor）
   ----------------------------------------------------------------------------
   卡片墙 / 规格卡在编辑器里是灾难：编辑要在「4 列 grid + 50px 上内距 + 序号水印」
   的卡片里改文字。这里把两者还原成普通的列表与表格 —— 易编辑优先，
   版式以复核过的前台为准（本组规则必须留在文件末尾，靠源码顺序覆盖上面的区块规则）。
   ========================================================================== */
.rich-content--editor > h4 + h3 + ul,
.rich-content--editor > h4 + h3 + p + ul{
  display:block;grid-template-columns:none;list-style:disc;
  padding-left:24px;margin:0 0 16px;counter-reset:none;
}
.rich-content--editor > h4 + h3 + ul > li,
.rich-content--editor > h4 + h3 + p + ul > li{
  counter-increment:none;position:static;overflow:visible;
  background:none;border:0;border-radius:0;padding:0;margin:0 0 8px;
  font-size:15px;color:#475569;line-height:1.75;
  transform:none;box-shadow:none;transition:none;
}
.rich-content--editor > h4 + h3 + ul > li::before,
.rich-content--editor > h4 + h3 + p + ul > li::before,
.rich-content--editor > h4 + h3 + ul > li::after,
.rich-content--editor > h4 + h3 + p + ul > li::after{content:none}

.rich-content--editor > h4 + h3 + table{display:table!important;border:1px solid #e2e8f0!important;border-radius:0}
.rich-content--editor > h4 + h3 + table > tbody{display:table-row-group;padding:0;column-gap:0}
.rich-content--editor > h4 + h3 + table tr{
  display:table-row;grid-template-columns:none;border:0;padding:0;margin:0;
}
.rich-content--editor > h4 + h3 + table td,
.rich-content--editor > h4 + h3 + table th{
  display:table-cell;border:1px solid #e2e8f0!important;
  padding:8px 10px!important;width:auto!important;
  font-size:14px!important;font-weight:400!important;color:#475569!important;
  text-transform:none!important;letter-spacing:normal!important;
}
.rich-content--editor > h4 + h3 + table tr:has(> td:only-child){
  grid-column:auto;margin:0;padding:0;border-bottom:0;
}
