/* ==========================================================================
   news-list.css —— Insights 列表页（/news.html）
   --------------------------------------------------------------------------
   为什么独立成文件：本模板同时承载 /news.html 与「加载更多」的
   ?s=news&c=category&id=4&page=N 响应（每页一次，共 30+ 次）。写在模板内联
   <style> 会让每一次 AJAX 响应都白带一份 CSS；外置后浏览器只缓存一份
   （判据 = 这段 CSS 会被多少个 HTML 响应携带，见 MEMORY「页面级 CSS」条）。

   与 article.css / knowledge.css / productv2.css 同为一节一文件的分区约定。
   只被 pc 版 insights/news-list.html 引用。

   依赖：head-base.css 的 --brand 令牌（本页经 head_base.html 引入）。
   ========================================================================== */

/* 1. 变量与外壳 ---------------------------------------------------------- */

/* 令牌挂 :root，而不是 .nl-main —— .nl-bar 与 .nl-hero 都是 .nl-main 的**兄弟**节点，
   挂在 .nl-main 上它们取不到值；而 var() 取不到值时**不报错**，只会让整条声明在
   计算值阶段失效 → 表现为「工具栏底边线没渲染 / 视图药丸底色透明 / 选中 Tab 的文字颜色
   退回继承值」三处静默丢样式（2026-09-18 用 CDP 逐项实测确认，改造前正是如此）。 */
:root {
  --nl-max: 1440px;
  --nl-gap: 24px;
  --nl-line: #e8ecf2;
  --nl-ink: #0f172a;
  --nl-muted: #64748b;
  --nl-faint: #94a3b8;
  --nl-soft: #f1f5f9;
}

.nl-main {
  max-width: var(--nl-max);
  margin: 0 auto;
  padding: 40px 16px 64px;
}

@media (min-width: 1024px) {
  .nl-main { padding: 56px 24px 88px; }
}

/* 2. Hero（背景图 + 深色遮罩 + 白色大标题） -------------------------------- */

.nl-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;     /* 文字靠左（2026-09-18，原为居中） */
  width: 100%;
  height: clamp(360px, 38vw, 560px);
  /* 顶部让出透明 header 的高度：本页 header 用 about 同款透明版（绝对定位浮在
     Hero 上），文字应在「header 之下的可视区」里垂直居中，否则看起来偏下。
     box-sizing 已被 preflight 设为 border-box → 总高仍是 clamp 的值。 */
  padding-top: 76px;
  overflow: hidden;
  background: #0f172a;   /* 图未加载时的兜底底色，避免白闪 */
}

.nl-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
}

/* 半透明深色遮罩：保证复杂图面上的白字对比度 */
.nl-hero__veil {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.42);
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.05) 35%, rgba(0, 0, 0, 0.45) 100%);
}

/* 窄屏：Hero 更窄更高，object-fit:cover 裁到的亮区（路牌屏）正好落在左对齐文字后面，
   只靠纵向渐变压不住（实测副标题 2~4 行压在亮区上难以辨认）→ 整体加深 + 左侧再压一层。
   只在小屏生效，桌面端视觉完全不变（同一张图在 1440 下裁到的是暗部）。 */
@media (max-width: 767px) {
  .nl-hero__veil {
    background-color: rgba(0, 0, 0, 0.5);
    background-image:
      linear-gradient(to right, rgba(0, 0, 0, 0.34) 0%, rgba(0, 0, 0, 0.14) 62%, rgba(0, 0, 0, 0) 100%),
      linear-gradient(to bottom, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.05) 35%, rgba(0, 0, 0, 0.45) 100%);
  }
}

.nl-hero__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--nl-max);
  margin: 0 auto;
  /* 与 .nl-main 同内距 → 标题左边缘与下方卡片左边缘严格对齐 */
  padding: 0 16px;
  text-align: left;
  color: #fff;
}

/* 原 .nl-hero__eyebrow（「RisingStar」小字）已按需求于 2026-09-18 删除；
   字号 11px / 字距 .3em / 颜色 rgba(255,255,255,.72) 是它当时的配方。 */

.nl-hero__title {
  margin: 0;
  font-size: clamp(40px, 6.2vw, 84px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: #fff;
}

.nl-hero__rule {
  width: 64px;
  height: 2px;
  margin: 20px 0 18px;   /* 靠左对齐（原为 auto 居中） */
  background: #fff;
}

.nl-hero__sub {
  margin: 0;
  max-width: 760px;      /* 文案加长后放宽行宽，稳定控制在两行内 */
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.85);
}

@media (min-width: 1024px) {
  .nl-hero__inner { padding: 0 24px; }
  .nl-hero__sub { font-size: 17px; }
}

/* 3. Tab 栏（居中药丸）+ 视图切换（靠右药丸） ------------------------------ */

/* 吸附（需求「fixed」）：用 position:sticky 而不是 fixed —— 不脱离文档流，
   无需给 body 补 padding-top，滚回顶部时自动回到原位。
   ⚠️ 祖先链上的 overflow-x:hidden（body 上就有这个类）在部分浏览器会打断 sticky，
   所以验收必须实测 rect.top 是否真钉在 0，不能只查声明值。 */
.nl-bar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: #fff;                 /* 吸附时必须不透光，否则卡片会从字缝里透出来 */
  /* 原 border-bottom: 1px solid var(--nl-line) 已按需求删除（2026-09-18）；
     改为吸附时挂一条极淡阴影做分隔，静止态完全无痕 */
  transition: box-shadow 0.2s ease;
}

.nl-bar.is-stuck {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.nl-bar__inner {
  display: grid;
  grid-template-columns: 1fr;        /* 手机端：Tab 一行、视图按钮一行，各自居中 */
  /* ⚠️ align-items: center 不能省（2026-09-18 补）——grid 默认 align-items:normal 等价于
     stretch：桌面端 Tab 药丸与视图药丸同排时，.nl-views 会被拉到与 .nl-tabs 等高（52.5px），
     而它内部按钮是确定高度 30px（stretch 对确定尺寸不生效）→ 按钮只能贴顶，
     下方留 12.5px 死区，圆钮看起来「浮在药丸上缘」。
     居中后视图药丸按自身内容收成 40px（30 + 2×4 padding + 2×1 border），四周均匀 5px 留白。
     手机端两药丸各自独占一行，行高即内容高，此声明无副作用。 */
  align-items: center;
  justify-items: center;
  gap: 12px;
  max-width: var(--nl-max);
  margin: 0 auto;
  padding: 12px 16px;
}

/* 桌面端 1fr auto 1fr —— 中列（Tab）两侧等宽 → Tab 恒落在整栏几何中心，
   视图按钮被推到最右；用网格而不是绝对定位，所以两者永远不会相撞 */
@media (min-width: 768px) {
  .nl-bar__inner {
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    padding: 12px 24px;
  }

  .nl-tabs { grid-column: 2; }
  .nl-views { grid-column: 3; justify-self: end; }
}

/* Tab 药丸容器 */
.nl-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--nl-line);
  border-radius: 9999px;
  background: var(--nl-soft);
  /* 极窄屏兜底横滚；居中由容器自身完成，所以不存在「滚动时左端被裁掉」的问题 */
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.nl-tabs::-webkit-scrollbar { display: none; }

/* Tab 药丸本体 */
.nl-tab {
  flex: 0 0 auto;
  padding: 10px 18px;
  border: 0;
  border-radius: 9999px;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--nl-muted);
  cursor: pointer;
  transition: background-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

.nl-tab:hover {
  color: var(--nl-ink);
  background-color: rgba(255, 255, 255, 0.75);
}

/* 选中态 = 品牌蓝实底 + 白字（原「2px 下划线」方案已废弃） */
.nl-tab.is-active {
  background-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(var(--brand-rgb), 0.3);
}

.nl-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (min-width: 1024px) {
  .nl-tab { padding: 10px 22px; font-size: 15px; }
}

/* 视图切换：与 Tab 同一套药丸几何，只是尺寸更小 */
.nl-views {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--nl-line);
  border-radius: 9999px;
  background: var(--nl-soft);
}

.nl-view {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: none;
  color: #7c8798;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nl-view:hover { color: var(--nl-ink); }

.nl-view.is-active {
  background-color: #fff;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.nl-view:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.nl-view svg { width: 17px; height: 17px; }

/* 4. 面板与网格 ---------------------------------------------------------- */

.nl-panel { display: none; }
.nl-panel.is-active { display: block; }

.nl-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--nl-gap);
}

@media (min-width: 768px) {
  .nl-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .nl-cards { grid-template-columns: repeat(3, 1fr); }
}

/* 5. 卡片（一套标记，网格/列表两种排布） ----------------------------------- */

.nl-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--nl-line);
  border-radius: 14px;
  background: #fff;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.nl-card:hover {
  transform: translateY(-2px);
  border-color: #dfe5ee;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
}

.nl-card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;             /* 统一宽高比，图不变形 */
  overflow: hidden;
  background: var(--nl-soft);
}

.nl-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.nl-card:hover .nl-card__img { transform: scale(1.04); }

/* 无缩略图兜底：浅灰底 + 品牌色小图标（news 老文章约 55% 无图） */
.nl-card__ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  /* 走令牌而不是字面量 rgb —— 原先写死 rgba(19,127,236,.35)，改品牌色时会被漏掉 */
  color: rgba(var(--brand-rgb), 0.35);
}

.nl-card__ph svg { width: 34px; height: 34px; }

.nl-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 20px;
}

.nl-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nl-card__tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.nl-card__date {
  font-size: 12px;
  color: var(--nl-faint);
}

.nl-card__title {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--nl-ink);
}

.nl-card__title a {
  color: inherit;
  text-decoration: none;
}

.nl-card:hover .nl-card__title a { color: var(--brand); }

.nl-card__desc {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
  color: var(--nl-muted);
}

.nl-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--nl-ink);
  transition: color 0.2s ease;
}

.nl-card__more svg {
  width: 15px;
  height: 15px;
  transition: transform 0.25s ease;
}

.nl-card:hover .nl-card__more { color: var(--brand); }
.nl-card:hover .nl-card__more svg { transform: translateX(3px); }

/* 6. 列表视图：同一套卡片标记，改为横向排布 -------------------------------- */

.nl-main[data-view="list"] .nl-cards { gap: 16px; }

@media (min-width: 768px) {
  .nl-main[data-view="list"] .nl-cards { grid-template-columns: 1fr; }
}

.nl-main[data-view="list"] .nl-card { flex-direction: row; align-items: center; }

.nl-main[data-view="list"] .nl-card__media {
  flex: 0 0 300px;
  align-self: center;
  margin: 16px 0 16px 16px;
  border-radius: 10px;
}

.nl-main[data-view="list"] .nl-card__body { padding: 18px 22px; }

@media (max-width: 767px) {
  .nl-main[data-view="list"] .nl-card { flex-direction: column; align-items: stretch; }
  .nl-main[data-view="list"] .nl-card__media {
    flex: none;
    width: auto;
    margin: 0;
    border-radius: 0;
  }
}

/* 7. 加载更多（显式按钮，点击才加载）/ 空态 -------------------------------- */
/* 2026-09-18：交互由「IntersectionObserver 自动加载」改为「按钮点击加载」，
   原 .nl-sentinel / .nl-loading / .nl-loading__dot / @keyframes nl-spin 四条规则
   随之删除（零消费者，不留孤儿样式）；滚动哨兵元素也已从模板移除。 */

.nl-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 0 8px;
}

/* 按钮本体走站内标准 hover-fill（.ball-fill skin-ink-blue，与 News Center / View all news 同款）。
   唯一需要补的是字体：<button> 默认不继承 font-family，其余几何与配色全由 .ball-fill 提供。 */
.nl-more__btn { font-family: inherit; }

/* 加载中 / 已完成：关掉 hover 动效与连点，避免重复请求 */
.nl-more__btn:disabled { pointer-events: none; }

.nl-more.is-done .nl-more__btn { display: none; }

.nl-more__end {
  display: none;
  font-size: 13px;
  color: var(--nl-faint);
}

.nl-more.is-done .nl-more__end { display: block; }

.nl-empty {
  padding: 56px 0;
  text-align: center;
  font-size: 15px;
  color: var(--nl-faint);
}

/* 8. 追加卡片的入场动效（原模板内联 <style> 里的 fadeInUp 迁入此处） -------- */

@keyframes nl-fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nl-card.is-appended { animation: nl-fade-in-up 0.5s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .nl-card,
  .nl-card__img,
  .nl-card__more svg,
  .nl-view,
  .nl-tab { transition: none; }

  .nl-card:hover { transform: none; }
  .nl-card:hover .nl-card__img { transform: none; }
  .nl-card.is-appended { animation: none; }
}
