/* ============================================================
   V5 / P2 核心子页共用扩展样式 v5-core.css
   ------------------------------------------------------------
   依赖顺序：capability.css → site-ui.css → topic.css → v5-core.css
   原则：不改动 /topic/ 母版的布局/类名/配图；v5-* 扩展样式集中在本文件。
        P4 起 topic.css 按用户明确要求，仅调整「标题下划线自适应文字宽度」
        与「首屏副标题上间距」，其余 Figma 视觉令牌保持原样。
        本文件只提供三类「附加类」：
          ① 复用能力链锚点链接（P4 / P7 中文标签）
          ② AI 应用页三个场景入口 + 导流（P10 三列浅蓝卡片）
          ③ 页底深色 CTA / P8 智能 Grid / P6 大图占位
             （P9 行业表格、P10 旧密度类均已废弃；Tab 样式见 v5-industry.css）
        母版四大特征全部沿用：
          Banner 860px、模块标题蓝色下划线（宽度自适应文字）、
          .tpc-subcard:hover translateY(-4px)、:nth-child(odd/even) 蓝白交替。
   ============================================================ */

/* 1. [P10 已废弃] 原「多模块密度」扩展类
   .tpc-modules.v5-dense（100px→80px / 88px→56px）与 .tpc-cards.v5-cards
   （写死 auto-fit 四列）是 P2 过渡方案，会让页面退化成纯文字色块。
   全站五页现已统一回到 topic.css 母版留白 + P8 智能 Grid，故整段移除。 */

/* 1b. P6 模块大图占位（仅产品及服务能力页使用）
   尺寸 / 宽高比 / 圆角 / 响应式一律继承 topic.css 的 .tpc-media-img
   （1600×424、border-radius 10px；992px→300px；640px→210px），
   此处只覆盖背景为深蓝科技渐变 + 细网格，不改变任何母版布局令牌。 */
.tpc-media-img.v5-media-ph {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 380px at 20% 12%, rgba(31,111,255,.48), transparent 66%),
    radial-gradient(900px 360px at 84% 88%, rgba(0,198,255,.22), transparent 62%),
    linear-gradient(135deg, #0B1730 0%, #102C63 46%, #0A3B8C 100%);
}
.tpc-media-img.v5-media-ph::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* 2. 复用能力链：母版 .tpc-tags li 内的可点击锚点 */
.tpc-tags li a.v5-anchor { color: inherit; text-decoration: none; }
.tpc-tags li a.v5-anchor:hover { color: inherit; text-decoration: underline; }

/* 3. P10 AI 应用页：三个场景入口卡片 + 导流（浅蓝微渐变 + hover 上浮） */
.v5-scene-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
  margin-top: 32px;
}
.v5-scene-item {
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
  min-height: 176px; padding: 32px 36px;
  border-radius: 14px; border: 1px solid #D6E5FF;
  background: linear-gradient(135deg, #EAF1FF 0%, #F5F9FF 58%, #FFFFFF 100%);
  color: #0B1528;
  font-size: 26px; font-weight: 700; letter-spacing: .5px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(22, 61, 216,.07);
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.v5-scene-item::after {
  content: "\2192";
  position: absolute; right: 32px; bottom: 24px;
  font-size: 24px; font-weight: 600; color: #163DD8;
  transition: transform .28s ease;
}
.v5-scene-item:hover {
  transform: translateY(-8px);
  border-color: #93C5FD;
  box-shadow: 0 22px 44px rgba(22, 61, 216,.18);
}
.v5-scene-item:hover::after { transform: translateX(6px); }
.v5-scene-item:focus-visible { outline: 3px solid #93C5FD; outline-offset: 3px; }
.v5-guide {
  display: inline-block; margin-top: 36px;
  font-size: 18px; font-weight: 600; color: var(--tpc-brand);
  text-decoration: none; border-bottom: 1px solid var(--tpc-brand);
  padding-bottom: 4px;
}
.v5-guide:hover { color: var(--tpc-brand-deep); border-color: var(--tpc-brand-deep); }

/* P10：中文标签点击同页锚点时，给固定 Header 留出空间 */
body[data-nav="/ai/"] .tpc-module[id] { scroll-margin-top: 100px; }

/* 4. [P9 已废弃] 原「16 行列表/表格」样式
   行业应用页已改为「3 分类 Tab + 16 行业母版模块」，表格选择器全部移除；
   Tab 样式见 v5-industry.css，智能 Grid 见本文件第 7 节。 */

/* 5. 页底统一深色 CTA 区（A1）
   沿用母版令牌：底色 #0B1528、主题蓝 #0B52D1、装饰短线 168×5、hover 上浮 -4px。
   注：该区位于 </main> 之外，.tpc-page 上的 CSS 变量不生效，故此处用硬编码色值。 */
.v5-endcta { background: #0B1528; padding: 88px 24px; }
.v5-endcta-in {
  position: relative;
  max-width: 1600px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 24px;
}
.v5-endcta-in::before {
  content: ""; position: absolute; left: 50%; top: -34px;
  transform: translateX(-50%);
  width: 168px; height: 5px; border-radius: 2px;
  background: #0B52D1;
}
.v5-endcta-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 260px; min-height: 64px; padding: 16px 36px;
  border-radius: 8px; border: 1px solid rgba(255,255,255,.55);
  background: transparent; color: #fff;
  font-size: 20px; font-weight: 700; letter-spacing: .5px;
  text-decoration: none;
  transition: transform .25s ease, box-shadow .25s ease,
              border-color .25s ease, background .25s ease;
}
.v5-endcta-btn.is-primary {
  background: #163DD8; border-color: #163DD8;
  box-shadow: 0 6px 20px rgba(22, 61, 216,.28);
}
.v5-endcta-btn:hover {
  transform: translateY(-4px);
  border-color: #93C5FD;
  box-shadow: 0 18px 36px rgba(0,0,0,.28);
}
.v5-endcta-btn.is-primary:hover { background: #0B52D1; border-color: #0B52D1; }

/* 6. 响应式 */
@media (max-width: 992px) {
  .v5-scene-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  /* P9 行业表格 / P10 旧密度类响应式规则均已废弃 */
  .v5-endcta { padding: 64px 20px; }
  .v5-endcta-in { flex-direction: column; gap: 16px; }
  .v5-endcta-btn { width: 100%; min-width: 0; font-size: 18px; }
}
@media (max-width: 640px) {
  .v5-scene-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .v5-scene-item { min-height: 140px; padding: 24px; font-size: 22px; }
  body[data-nav="/ai/"] .tpc-module[id] { scroll-margin-top: 72px; }
}
/* ============================================================
   7. P8 智能卡片矩阵（仅 /cap-product/ / /base/ 的 .v5-grid）
   ------------------------------------------------------------
   列数由「模块内卡片数量」决定，不再写死两列：
     1 → 1 列（限宽 796px，避免全宽空卡）  2 → 2 列  3 → 3 列  4 → 4 列
     5 → repeat(3) 自动换行 = 第一行 3 个 + 第二行 2 个（左对齐）
     8 → repeat(4) = 严格 2 行 × 4 列
   数量信号双保险：:has() 数量查询（纯 CSS 感知） + data-count（生成器自动写），
   两条规则值一致、互不冲突；卡片增减时无需手改 HTML 布局。
   颜色改由 :nth-child(odd/even) 决定，HTML 不再写死颜色类。
   大图占位统一 300px，容器改 height:auto 消除原 468px 固定高留下的空白。
   ============================================================ */

/* 同一行卡片自动撑满等高（Grid 默认 stretch，此处显式声明便于验收） */
.tpc-cards.v5-grid { align-items: stretch; }

/* 桌面：精确数量 → 精确列数；数量规则只在 >992px 生效，避免与窄屏降级打架 */
@media (min-width: 993px) {
  /* 未列举数量的兜底：以后新增卡片数也不会塌陷 */
  .tpc-cards.v5-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

  .tpc-cards.v5-grid:has(> :nth-child(1):last-child),
  .tpc-cards.v5-grid[data-count="1"] { grid-template-columns: minmax(0, 796px); }

  .tpc-cards.v5-grid:has(> :nth-child(2):last-child),
  .tpc-cards.v5-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .tpc-cards.v5-grid:has(> :nth-child(3):last-child),
  .tpc-cards.v5-grid[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .tpc-cards.v5-grid:has(> :nth-child(4):last-child),
  .tpc-cards.v5-grid[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  /* 5 张：3 列自动换行 → 3 + 2，第二行左对齐 */
  .tpc-cards.v5-grid:has(> :nth-child(5):last-child),
  .tpc-cards.v5-grid[data-count="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* 8 张：4 列 → 严格 2×4 */
  .tpc-cards.v5-grid:has(> :nth-child(8):last-child),
  .tpc-cards.v5-grid[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 统一白底：奇偶数均为纯白底 + 深字 + 浅蓝标签（取消蓝白交替），底部蓝线由 topic.css 的 ::after 在 hover 时出现 */
.tpc-cards.v5-grid > .tpc-subcard:nth-child(even) {
  background: #fff;
  border-color: var(--tpc-line);
  box-shadow: 0 4px 16px rgba(15,26,48,.05);
}
.tpc-cards.v5-grid > .tpc-subcard:nth-child(even) h3 { color: var(--tpc-ink); }
.tpc-cards.v5-grid > .tpc-subcard:nth-child(even) p  { color: var(--tpc-body); }
.tpc-cards.v5-grid > .tpc-subcard:nth-child(even) .tpc-tags li {
  color: var(--tpc-brand); background: var(--tpc-soft);
  border-color: rgba(22, 61, 216,.10);
}
.tpc-cards.v5-grid > .tpc-subcard:nth-child(even) .tpc-tags li:hover {
  background: var(--tpc-soft-hi); color: #163DD8;
  border-color: rgba(22, 61, 216,.28);
}
.tpc-cards.v5-grid > .tpc-subcard:nth-child(odd) {
  background: #fff;
  border-color: var(--tpc-line);
  box-shadow: 0 4px 16px rgba(15,26,48,.05);
}
.tpc-cards.v5-grid > .tpc-subcard:nth-child(odd) h3 { color: var(--tpc-ink); }
.tpc-cards.v5-grid > .tpc-subcard:nth-child(odd) p  { color: var(--tpc-body); }
.tpc-cards.v5-grid > .tpc-subcard:nth-child(odd) .tpc-tags li {
  color: var(--tpc-brand); background: var(--tpc-soft);
  border-color: rgba(22, 61, 216,.10);
}
.tpc-cards.v5-grid > .tpc-subcard:nth-child(odd) .tpc-tags li:hover {
  background: var(--tpc-soft-hi); color: #163DD8;
  border-color: rgba(22, 61, 216,.28);
}
.tpc-cards.v5-grid > .tpc-subcard:nth-child(odd):hover {
  box-shadow: 0 18px 36px rgba(15,26,48,.16); border-color: rgba(22,61,216,.45);
}

/* 一级能力大图占位：统一 300px；容器自适应高度，不再留 168px 空白 */
.tpc-media.v5-media-box { height: auto; padding-top: 28px; }
.tpc-media-img.v5-media-ph { height: 300px; }

/* 窄屏降级：平板 2 列、手机 1 列，大图按比例收敛 */
@media (max-width: 992px) {
  .tpc-cards.v5-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .tpc-media-img.v5-media-ph { height: 240px; }
}
@media (max-width: 640px) {
  .tpc-cards.v5-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .tpc-media-img.v5-media-ph { height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .v5-scene-item, .v5-scene-item::after, .v5-endcta-btn { transition: none; }
  .v5-scene-item:hover, .v5-scene-item:hover::after, .v5-endcta-btn:hover { transform: none; }
}
