/* ==========================================================================
   案例页专用样式
   与首页共用 style.css 的变量与基础，本文件只负责长文阅读版式
   ========================================================================== */

.case-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  background: rgba(12, 14, 19, .06);
  pointer-events: none;
}

.case-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
}

/* ---------- 导航 ---------- */

.case-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 248, 252, .88);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.case-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}

.case-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  min-height: 44px;
}

.case-back:hover { color: var(--accent); }

.case-back span {
  color: var(--ink-3);
  transition: transform .25s ease;
}

.case-back:hover span { transform: translateX(-3px); }

.case-nav-tag {
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--ink-3);
}

/* ---------- 容器 ---------- */

.case-wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 头部 ---------- */

.case-head {
  padding: 72px 0 44px;
  border-bottom: 1px solid var(--line);
}

.case-kicker {
  font-size: 12.5px;
  letter-spacing: .1em;
  color: var(--accent);
}

.case-title {
  margin: 18px 0 0;
  font-size: clamp(32px, 5.2vw, 50px);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -.02em;
  color: var(--ink);
}

.case-lede {
  margin: 24px 0 0;
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ink-2);
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 40px 0 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
}

.case-facts dt {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-3);
}

.case-facts dd {
  margin: 8px 0 0;
  font-size: 17px;
  color: var(--ink);
}

.case-facts b {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------- 章节导航 ---------- */

.case-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 30px 0 0;
}

.case-toc a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  color: var(--ink-2);
  transition: border-color .2s ease, color .2s ease, transform .2s ease;
}

.case-toc a:hover {
  border-color: rgba(37, 99, 235, .5);
  color: var(--accent);
  transform: translateY(-1px);
}

.case-toc span {
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.case-toc a:hover span { color: var(--accent); }

/* ---------- 章节 ---------- */

.case-sec {
  padding: 52px 0 8px;
  scroll-margin-top: 76px;
}

.case-num {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.case-sec h2 {
  margin: 12px 0 22px;
  font-size: clamp(23px, 3.4vw, 30px);
  font-weight: 600;
  line-height: 1.36;
  letter-spacing: -.015em;
  color: var(--ink);
}

.case-sec h3 {
  margin: 36px 0 12px;
  font-size: 18.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
}

.case-sec p {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.88;
  color: var(--ink-2);
}

.case-sec p b,
.case-list dd b {
  color: var(--ink);
  font-weight: 600;
}

.case-sec code {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(37, 99, 235, .07);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  color: #1D4ED8;
}

/* ---------- 定义列表 ---------- */

.case-list {
  margin: 26px 0 0;
}

.case-list > div {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.case-list > div:first-child { border-top: 0; padding-top: 4px; }

.case-list dt {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}

.case-list dd {
  margin: 9px 0 0;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-2);
}

.case-list-warn > div {
  padding-left: 16px;
  border-left: 2px solid rgba(217, 119, 6, .5);
  border-top: 0;
  margin-bottom: 22px;
}

.case-list-warn > div:first-child { padding-top: 0; }

/* ---------- 步骤 ---------- */

.case-steps {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.case-steps li {
  position: relative;
  padding: 0 0 24px 46px;
  counter-increment: step;
}

.case-steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 650;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.case-steps li::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}

.case-steps li:last-child { padding-bottom: 4px; }
.case-steps li:last-child::after { display: none; }

.case-steps b {
  display: block;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}

.case-steps span {
  display: block;
  margin-top: 5px;
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--ink-2);
}

/* ---------- 表格 ---------- */

.case-table {
  width: 100%;
  margin: 24px 0 22px;
  border-collapse: collapse;
  font-size: 14px;
}

.case-table caption {
  caption-side: top;
  padding-bottom: 10px;
  font-size: 12.5px;
  text-align: left;
  color: var(--ink-3);
}

.case-table th {
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: .03em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--ink-4, #B2B7C2);
}

.case-table td {
  padding: 11px 12px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.case-table tr:last-child td { border-bottom: 0; }

/* ---------- 代码块 ---------- */

.case-code {
  margin: 26px 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0E1420;
  overflow: hidden;
}

.case-code-title {
  margin: 0 !important;
  padding: 11px 18px;
  font-size: 12px !important;
  line-height: 1.5 !important;
  letter-spacing: .04em;
  color: rgba(198, 212, 234, .62) !important;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.case-code pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow-x: auto;
}

.case-code code {
  display: block;
  padding: 0 !important;
  background: none !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.8px;
  line-height: 1.85;
  color: #C9D6EA;
  white-space: pre;
}

.case-code code .c {
  color: #6E82A0;
}

/* ---------- 图示 ---------- */
/* 图是内联 SVG，不是位图：不额外发请求、能跟着主题配色、缩放不糊。
   窄屏改成横向滚动而不是整图缩放 —— 720 宽的图缩到 354 会把 13px 的字压成 6px。 */

.case-figure {
  margin: 30px 0 30px;
}

/* 窄屏下图要横向滑动才看得全，但滚动条在手机上不可见 —— 给一句提示，
   桌面端不显示。提示放在图上方，读者滑动前就读到。 */
.case-figure::before {
  display: none;
}

.case-figure-frame {
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #FAFBFE;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.case-figure svg {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
}

.case-figure figcaption {
  margin-top: 11px;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink-3);
}

.case-figure figcaption b {
  color: var(--ink-2);
  font-weight: 600;
}

/* ---------- 无序列表 ---------- */

.case-ul {
  margin: 20px 0 22px;
  padding-left: 0;
  list-style: none;
}

.case-ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 11px;
  font-size: 15.5px;
  line-height: 1.82;
  color: var(--ink-2);
}

.case-ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
}

.case-ul-num { counter-reset: cnum; }
.case-ul-num li { padding-left: 28px; }

.case-ul-num li::before {
  counter-increment: cnum;
  content: counter(cnum) ".";
  top: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- 强调块 ---------- */

.case-insight,
.case-caution {
  margin: 26px 0;
  padding: 20px 22px;
  border-radius: 14px;
  font-size: 15px !important;
  line-height: 1.85 !important;
}

.case-insight {
  background: rgba(37, 99, 235, .055);
  border-left: 2px solid var(--accent);
  color: var(--ink) !important;
}

.case-caution {
  background: rgba(217, 119, 6, .06);
  border-left: 2px solid rgba(217, 119, 6, .55);
  color: #6B4A16 !important;
}

/* ---------- 尾部 ---------- */

.case-tail {
  margin-top: 60px;
  padding: 38px 0 72px;
  border-top: 1px solid var(--line);
}

.case-tail p {
  margin: 0 0 22px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-2);
}

/* 案例署名：谁做的、做了多少。甲方看边界，HR 看个人贡献 */
.case-role {
  margin: 30px 0 26px;
  font-size: 13.5px;
  letter-spacing: .02em;
  color: var(--ink-3);
}

.case-role b {
  margin-left: 6px;
  font-weight: 600;
  color: var(--ink);
}

/* 最后更新：跟「我的角色」同一行，一条细竖线隔开，不另起一行。
   .case-role 上方的 30px 留白是章节导航的呼吸，这里只做行内追加 */
.case-role .case-updated {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  letter-spacing: .04em;
  color: var(--ink-3);
}

.case-tail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* 案例索引：让五个案例互相可达。上面的按钮讲的是「技术延续」这一条叙事，
   这里补的是「其余四个在哪」，所以刻意做弱 —— 不跟按钮抢层级，也不跟正文糊在一起。
   用 flex 而不是行内文字 + 「／」：分隔符一旦是文字节点，折行后就会落到行首
   （中文每字都可断行）。改成 gap 造间隔后，每个「行业 · 主题」是不可断的 item */
.case-tail p.case-tail-more {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 16px;
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-3);
}

/* 标签独占一行，四个案例自己排 —— 折行时行首永远是链接，不会是分隔符 */
.case-tail-more .more-label {
  flex-basis: 100%;
  color: var(--ink-3);
}

.case-tail-more a {
  white-space: nowrap;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(20, 40, 80, .28);
  text-underline-offset: 3px;
}

.case-tail-more a:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

/* 案例读完后的转化出口：正文里的行内链接要能看出来是链接 */
/* 转化出口：全页唯一「找我做」的入口。用引用块而非按钮，是为了不跟下方主按钮抢层级。
   三段式（标签 / 具体问题 / 入口）是为了不依赖屏宽——中文逐字断行，长句在真机上会把词组拆开 */
p.case-tail-cta {
  display: grid;
  gap: 3px;
  margin: 2px 0 34px;
  padding: 15px 0 15px 20px;
  border-left: 2px solid var(--ink);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}

.case-tail-cta b { font-weight: 600; }

.case-tail-cta > span {
  font-size: 15px;
  color: var(--ink-2);
}

/* 词组整体换行，避免「表格散架」被拆成「表格 / 散架」 */
.case-tail-cta > span span { white-space: nowrap; }

.case-tail-cta a {
  margin-top: 5px;
  justify-self: start;
  font-size: 15px;
  color: var(--ink);
  border-bottom: 1px solid rgba(20, 40, 80, .3);
  transition: border-color .2s ease;
}

.case-tail-cta a:hover { border-color: currentColor; }

@media (max-width: 720px) {
  p.case-tail-cta { padding-left: 16px; font-size: 15.5px; }
  .case-tail-cta > span,
  .case-tail-cta a { font-size: 14.5px; }
}

.case-tail .btn { height: 44px; padding: 0 22px; font-size: 14px; }

.case-tail .btn-primary {
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 12px 26px -14px rgba(12, 14, 19, .55);
}

.case-tail .btn-primary:hover {
  background: #1D2130;
  box-shadow: 0 16px 30px -14px rgba(12, 14, 19, .6);
}

.btn-line {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
}

.btn-line:hover {
  border-color: var(--ink-3);
  color: var(--ink);
  transform: translateY(-2px);
}

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
  .case-head { padding: 48px 0 34px; }
  .case-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
  .case-sec { padding: 42px 0 6px; }
  .case-sec p { font-size: 15.5px; }
  .case-table { font-size: 13px; }
  .case-table th,
  .case-table td { padding: 9px 8px; }
  .case-nav-tag { display: none; }
  .case-code pre { padding: 14px 14px 16px; }
  .case-code code { font-size: 12px; }
}

@media (max-width: 420px) {
  .case-wrap { padding: 0 18px; }
  .case-facts dd { font-size: 15.5px; }
  .case-tail-links .btn { width: 100%; }
}

/* ---------- 窄屏章节导航：改为单行横向滑动，避免 7 个胶囊挤成两行 ---------- */
@media (max-width: 720px) {
  .case-toc {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .case-toc::-webkit-scrollbar { display: none; }
  .case-toc a { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .case-back span,
  .case-tail .btn { transition: none; }
  .case-back:hover span { transform: none; }
  .case-tail .btn-line:hover { transform: none; }
}

/* ---------- 窄屏表格：改为横向滚动，而不是压缩列宽 ---------- */
/* 中文表头在 60px 宽的列里会被逐字拆行（「推理参 / 数」），比横向滑动更难读。
   480px 是折中值：6 列每列约 80px，四字表头不拆行，数据行仍可换行。 */
@media (max-width: 720px) {
  .case-figure::before {
    content: "左右滑动看完整图 →";
    display: block;
    margin-bottom: 7px;
    font-size: 11.5px;
    letter-spacing: .02em;
    text-align: right;
    color: var(--ink-3);
  }
  .case-table-scroll {
    margin: 24px 0 22px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .case-table-scroll .case-table {
    margin: 0;
    min-width: 480px;
  }

  .case-table-scroll .case-table th {
    white-space: nowrap;
  }
}

/* 手机章节目录提示保留在滚动容器外，滑到底也不会遮住链接。 */
.case-toc-hint { display: none; }
@media (max-width: 720px) {
  .case-toc-hint { display: block; margin: 24px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.4; }
  .case-toc { margin-top: 8px; }
  .case-toc a { min-height: 44px; }
  .case-facts dt { font-size: 13px; }
}

.case-sec [id^="case-"] { scroll-margin-top: 80px; }
