/* ==========================================================================
   Sracing 车型档案 —— 技术规格 / OBD 档案 / 同品牌 / 延伸阅读 / FAQ
   对应 mu-plugins/sracing-car-dossier.php 的 .sr-dossier 输出。
   只在 singular(car) 加载（见插件 wp_enqueue_scripts）。

   视觉口径沿用 v20261023：字重只有 330 / 450 两档，中文零字距，
   全页唯一左缘由主题容器（is-layout-constrained）负责，这里只做内容排布。
   ========================================================================== */

/* 块主题的 contentSize 约 485px，对参数表 + FAQ 这种数据型长页太窄。
   把两个布局宽度令牌放开，由 main 自己控制在 1080 以内。
   P12 之后 solution 单页复用同一套，加进选择器即可。 */
body.single-car,
body.single-solution,
body.sr-about-page {
  --wp--style--global--content-size: 100%;
  --wp--style--global--wide-size: 100%;
}

body.single-car main.wp-block-group,
body.single-solution main.wp-block-group,
body.sr-about-page main.wp-block-group {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 64px);
}

.sr-dossier {
  --sd-ink: #f4f4f2;
  --sd-ink-2: rgba(244, 244, 242, .68);
  --sd-ink-3: rgba(244, 244, 242, .44);
  --sd-line: rgba(244, 244, 242, .13);
  --sd-line-soft: rgba(244, 244, 242, .06);
  --sd-fill: rgba(244, 244, 242, .035);
  --sd-accent: #ff5a1f;
  --sd-red: #ff3b23;

  margin-top: 3.5rem;
  color: var(--sd-ink);
  font-weight: 330;
  letter-spacing: 0;
}

.sr-dossier * {
  letter-spacing: 0;
}

/* ---------- 章节标题 ---------- */

.sr-dossier__h2 {
  margin: 3rem 0 1.1rem;
  font-size: 1.375rem;      /* 22px */
  line-height: 1.35;
  font-weight: 450;
  color: var(--sd-ink);
}

.sr-dossier__h2:first-child {
  margin-top: 0;
}

/* 标题左侧 24×2 线段，跟站内其它板块的标记语言一致 */
.sr-dossier__h2::before {
  content: "";
  display: block;
  width: 24px;
  height: 2px;
  margin-bottom: .8rem;
  background: var(--sd-red);
}

/* ---------- 正文段落 ---------- */

.sr-dossier p {
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.85;
  font-weight: 330;
  color: var(--sd-ink-2);
}

.sr-dossier p strong {
  font-weight: 450;
  color: var(--sd-ink);
}

.sr-dossier p em {
  font-style: normal;
  color: var(--sd-ink-3);
  font-size: .9375rem;
}

/* ---------- 文档内链接 ---------- */

/* 表格与正文里的链接默认跟随正文色 + 细下划线，hover 才上品牌红。
   档案是长文档语境，满屏饱和红链接会把数据表读成告警表。 */
.sr-dossier a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--sd-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .18s ease, text-decoration-color .18s ease;
}

.sr-dossier a:hover,
.sr-dossier a:focus-visible {
  color: var(--sd-red);
  text-decoration-color: var(--sd-red);
}

/* ---------- 结论段（方案档案 answer-first） ---------- */

.sr-dossier__lead {
  margin: 0 0 1.1rem !important;
  padding-left: 1.1rem;
  border-left: 2px solid var(--sd-red);
  font-size: 1.125rem !important;
  line-height: 1.75 !important;
}

.sr-dossier__lead strong {
  font-weight: 450;
  color: var(--sd-ink);
}

/* ---------- 有序流程 ---------- */

.sr-dossier__steps {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: sdstep;
}

.sr-dossier__steps li {
  position: relative;
  padding: .75rem 0 .75rem 2.4rem;
  border-bottom: 1px solid var(--sd-line-soft);
  font-size: .9375rem;
  line-height: 1.75;
  font-weight: 330;
  color: var(--sd-ink-2);
  counter-increment: sdstep;
}

.sr-dossier__steps li::before {
  content: counter(sdstep, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: .8rem;
  width: 1.6rem;
  font-size: .75rem;
  line-height: 1.5;
  font-weight: 450;
  color: var(--sd-ink-3);
  font-variant-numeric: tabular-nums;
}

/* ---------- 边界清单 ---------- */

.sr-dossier__limits {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.sr-dossier__limits li {
  position: relative;
  padding: .65rem 0 .65rem 1.5rem;
  border-bottom: 1px solid var(--sd-line-soft);
  font-size: .9375rem;
  line-height: 1.75;
  font-weight: 330;
  color: var(--sd-ink-2);
}

.sr-dossier__limits li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.42rem;
  width: 8px;
  height: 1px;
  background: var(--sd-ink-3);
}

/* ---------- 表格 ---------- */

.sr-dossier__tbl {
  width: 100%;
  margin: 0 0 1.25rem;
  border-collapse: collapse;
  border-top: 1px solid var(--sd-line);
  table-layout: fixed;
}

.sr-dossier__tbl thead th {
  padding: .7rem .75rem .7rem 0;
  border-bottom: 1px solid var(--sd-line);
  font-size: .75rem;
  line-height: 1.5;
  font-weight: 450;
  text-align: left;
  color: var(--sd-ink-3);
  vertical-align: bottom;
}

/* 三列表：分组 / 项目 / 数值 */
.sr-dossier__tbl.is-3col thead th:first-child { width: 20%; }
.sr-dossier__tbl.is-3col thead th:nth-child(2) { width: 26%; }

/* 三列表（方案档案用）：阶段 / 做什么 / 得到什么。中列需要更宽 */
.sr-dossier__tbl.is-flow thead th:first-child { width: 13%; }
.sr-dossier__tbl.is-flow thead th:nth-child(2) { width: 58%; }
.sr-dossier__tbl.is-flow thead th:nth-child(3) { width: 29%; }

/* 链路表的中列是叙述，不该被压暗 */
.sr-dossier__tbl.is-flow td:nth-child(2) {
  color: var(--sd-ink-2);
}

/* 两列表：项目 / 结论。第一列要给「需私有定义才能读」这类长标签留够宽度 */
.sr-dossier__tbl.is-2col thead th:first-child { width: 30%; }
.sr-dossier__tbl.is-2col thead th:nth-child(2) { width: 70%; }

.sr-dossier__tbl tbody th {
  padding: .85rem .75rem .85rem 0;
  font-size: .8125rem;
  line-height: 1.7;
  font-weight: 450;
  text-align: left;
  vertical-align: top;
  color: var(--sd-ink-3);
  border-bottom: 1px solid var(--sd-line-soft);
  border-right: 1px solid var(--sd-line-soft);
}

.sr-dossier__tbl td {
  padding: .85rem .75rem .85rem 0;
  font-size: .9375rem;
  line-height: 1.7;
  font-weight: 330;
  color: var(--sd-ink-2);
  border-bottom: 1px solid var(--sd-line-soft);
  vertical-align: top;
  word-break: break-word;
}

/* 数值列：等宽数字，扫读时小数点对齐 */
.sr-dossier__tbl td:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--sd-ink);
}

.sr-dossier__tbl tbody th + td {
  padding-left: .75rem;
}

/* 分组列的第二列（项目名）稍暗，把视线让给数值 */
.sr-dossier__tbl td:nth-child(2):not(:last-child) {
  color: var(--sd-ink-3);
}

/* ---------- 列表（同品牌 / 延伸阅读） ---------- */

.sr-dossier__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0 1.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.sr-dossier__list li {
  border-bottom: 1px solid var(--sd-line-soft);
}

.sr-dossier__list a {
  display: block;
  padding: .7rem 0;
  font-size: .9375rem;
  line-height: 1.6;
  font-weight: 330;
  color: var(--sd-ink-2);
  text-decoration: none;
  transition: color .18s ease, padding-left .18s ease;
}

.sr-dossier__list a:hover,
.sr-dossier__list a:focus-visible {
  color: var(--sd-red);
  padding-left: .35rem;
}

/* ---------- FAQ ---------- */

.sr-dossier__faq h3 {
  margin: 1.75rem 0 .55rem;
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 450;
  color: var(--sd-ink);
}

.sr-dossier__faq h3:first-child {
  margin-top: 0;
}

/* 问题前的小问号块，纯装饰 */
.sr-dossier__faq h3::before {
  content: "Q";
  display: inline-block;
  width: 1.15rem;
  margin-right: .55rem;
  font-size: .6875rem;
  line-height: 1.15rem;
  font-weight: 450;
  text-align: center;
  color: var(--sd-ink-3);
  border: 1px solid var(--sd-line);
  border-radius: 3px;
  vertical-align: .1em;
}

.sr-dossier__faq p {
  margin: 0 0 1.1rem;
  padding-left: 1.7rem;
  color: var(--sd-ink-2);
}

/* ---------- 页脚说明 ---------- */

.sr-dossier__meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sd-line-soft);
  font-size: .8125rem;
  line-height: 1.8;
  color: var(--sd-ink-3);
}

/* ---------- 响应式 ---------- */

@media (max-width: 700px) {
  .sr-dossier {
    margin-top: 2.5rem;
  }

  .sr-dossier__h2 {
    font-size: 1.1875rem;
    margin-top: 2.25rem;
  }

  /* 窄屏把表格还原成「项目 / 数值」两列，
     分组列（th[scope=rowgroup]）在移动端只会挤占宽度 */
  .sr-dossier__tbl thead th:first-child,
  .sr-dossier__tbl tbody th[scope="rowgroup"] {
    display: none;
  }

  .sr-dossier__tbl thead th:nth-child(2) { width: 46%; }
  .sr-dossier__tbl thead th:nth-child(3) { width: 54%; }

  /* 两列表（项目 / 结论）在窄屏按 38:62 分。
     表头首列被隐藏后，剩下的那一个 th 描述的是**第一列**（fixed 布局按首行
     可见单元格依次分配），所以这里给 38% 而不是 62%——给反了会把项目列
     撑到 65%、值列压到 121px，长值折四行。 */
  .sr-dossier__tbl.is-2col thead th:last-child { width: 38%; }
  .sr-dossier__tbl tbody th + td { padding-left: 0; }

  .sr-dossier__tbl th,
  .sr-dossier__tbl td {
    padding-top: .7rem;
    padding-bottom: .7rem;
    font-size: .875rem;
  }

  .sr-dossier__list {
    grid-template-columns: 1fr;
  }

  .sr-dossier__faq p {
    padding-left: 0;
  }

  /* 链路表在窄屏改成一格一段：阶段标签在上，说明与产出在下。
     三列硬挤会把「做什么」压成每行两三个字。 */
  .sr-dossier__tbl.is-flow,
  .sr-dossier__tbl.is-flow tbody,
  .sr-dossier__tbl.is-flow tr {
    display: block;
  }

  .sr-dossier__tbl.is-flow thead {
    display: none;
  }

  .sr-dossier__tbl.is-flow tbody tr {
    padding: .8rem 0;
    border-bottom: 1px solid var(--sd-line-soft);
  }

  .sr-dossier__tbl.is-flow tbody th,
  .sr-dossier__tbl.is-flow tbody td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    font-size: .875rem;
  }

  .sr-dossier__tbl.is-flow tbody th {
    margin-bottom: .25rem;
    font-size: .75rem;
    color: var(--sd-ink-3);
  }

  .sr-dossier__tbl.is-flow tbody td:last-child {
    margin-top: .3rem;
    color: var(--sd-ink-3);
  }

  .sr-dossier__lead {
    font-size: 1.0625rem !important;
  }
}
