/* 14 版组件层 · 资讯流：折叠层叠封面 / 来源钮与控制台 / 当天列表 / 详情三视图（UI 规格 §1）
   载入顺序：mobile.css 之后、theme-dark.css 之前——本文件的无条件规则会盖过 mobile.css 对同一选择器的 ≤720 规则，
   改动已有组件时，≤720 的值要在本文件的 @media (max-width: 720px) 里重新写全；深色差异写在本文件 [data-theme="dark"] 段。
   精确值来源：14 版画布（docs/前端参考/2026-10-16-14版整体需求/，10-17 验收）canvas.css / canvas-b.css / canvas-c.css。 */

/* ============ §1.1 头部行「来源 x/y」钮（只登录态渲染） ============ */
.nw-head { min-width: 0; }
.nw-head .h3-title { flex: none; white-space: nowrap; }          /* 标题不被挤折行（10-20 起标题旁不再有副标） */
.nw-src-wrap { margin-left: auto; position: relative; flex: none; }
.nw-src-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
  border-radius: var(--r-pill); border: 1px solid var(--line);
  font-size: var(--fs-12); font-weight: 600; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums;
  transition: background var(--t-micro) var(--ease);
}
.nw-src-btn svg { flex: none; }
.nw-src-btn:hover, .nw-src-btn.is-open { background: var(--soft); }
.nw-src-btn.is-partial { color: var(--ink); border-color: var(--ink); }   /* 有来源被隐藏：提示当前不是全部 */

/* ============ §1.2 折叠行：层叠封面（「N 条」10-19 起并进来源胶囊，见 v18-news.css） ============ */
/* 封面位仍占 200×112；组头封面缩到 176×99 贴左下，身后两层同尺寸卡向右上各错 12 / 6.5 与 24 / 0 */
.nw-stack { position: relative; display: block; flex: none; width: 200px; height: 112px; }
.nw-layer { position: absolute; width: 176px; height: 99px; border-radius: 9px; border: 1px solid var(--line-hover); }
.nw-layer.is-1 { left: 12px; top: 6.5px; background: var(--soft); }
.nw-layer.is-2 { left: 24px; top: 0; background: var(--line-2); }
.nw-stack .nw-thumb { position: absolute; left: 0; bottom: 0; z-index: 1; width: 176px; height: 99px; border-radius: 9px; }

/* §1.7 组头被撤下：原位占位（封面位 --soft 底 + 1px --line 描边，层叠两层保留）、标题位「加载中… / 加载失败 · 重试」 */
.nw-item.is-pend .nw-thumb { background: var(--soft); border-color: var(--line); }
.nw-pend { font-size: var(--fs-12); color: var(--ink-3); line-height: 1.6; }
.nw-pend u { color: var(--ink-2); text-underline-offset: 2px; cursor: pointer; }

/* 空态：「暂无资讯」/「所有来源都已关闭」+「全部打开」 */
.nw-empty { margin: 28px 0 22px; }
.nw-empty .mp-state-btn { margin-top: 0; }
.nw-more:disabled { cursor: default; }
.nw-more:disabled:hover { color: var(--ink-3); border-color: var(--line-hover); }

/* ============ §1.3 弹窗：头部返回钮 / 已下线提示（当天列表 10-19 由博主页替代，见 v18-news.css） ============ */
.nw-pop-head.has-back { padding-left: 16px; }
.nw-back {
  flex: none; display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 10px 0 6px;
  border-radius: var(--r-pill); background: var(--soft); font-size: var(--fs-13); font-weight: 600; color: var(--ink-2);
  white-space: nowrap; font-variant-numeric: tabular-nums; transition: background var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}
.nw-back svg { flex: none; }
.nw-back:hover { color: var(--ink); background: var(--line); }
/* §1.7 正在看的这一条被撤下：固定头最上方提示条，随固定头吸顶；正文、视频、字幕都不动 */
.nw-offline {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--soft); font-size: var(--fs-13); font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.nw-offline svg { width: 14px; height: 14px; flex: none; }
.nw-art-head > .nw-offline { margin-bottom: 12px; }

/* ============ §1.4 不走 AI 来源的详情 ============ */
/* 金十专题配图：标题 → 配图 → 正文或摘要；只存了摘要时正文后注明（契约「摘要降级不称全文」） */
.nw-art-fig { margin: 0; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--soft-2); }
.nw-art-fig img { display: block; width: 100%; height: auto; }
.nw-art-head + .nw-art-fig { margin-top: 16px; }
.nw-art-fig + .nw-art-body, .nw-art-fig + .nw-art-empty { margin-top: 16px; }
.nw-art-note { margin-top: 10px; font-size: var(--fs-12); color: var(--ink-3); }
/* 天天复盘：日报正文（beautifyMarketReport 'morning'）+ 日报浮窗同款免责行；固定头已是日报标题，正文大标题不重复 */
.nw-art-head + .report-body { margin-top: 16px; }
.nw-art .morning-body.mrx h1.mrx-title { display: none; }
.nw-art .morning-body.mrx h1.mrx-title + * { margin-top: 0; }
.nw-art .morning-body:not(.mrx) > h1:first-child { display: none; }          /* 美化回退为原文时同样不重复标题 */
.nw-art .morning-body:not(.mrx) > h1:first-child + * { margin-top: 0; }
.nw-art .report-foot { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }
.nw-art .report-foot .disclaimer { margin: 0; font-size: var(--fs-12); line-height: 1.65; color: var(--ink-3); }
.nw-art .morning-body.mrx:has(.mrx-disc-title) + .report-foot { display: none; }   /* 日报自带免责段时不再叠一条 */

/* ============ §1.5 来源控制台：桌面弹层 / ≤720 底部抽屉 ============ */
.src-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: 360px; max-height: 70vh;
  display: flex; flex-direction: column; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--sh-pop); overflow: hidden; text-align: left; animation: mg-pop var(--t-in) var(--ease) both;
}
.src-h { flex: none; padding: 14px 16px 8px; }
.src-h-t { font-size: var(--fs-14); font-weight: 700; color: var(--ink); }
.src-h-s { margin-top: 2px; font-size: var(--fs-12); color: var(--ink-3); }
.src-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 0 4px; }
.src-row { display: flex; align-items: center; gap: 12px; width: 100%; height: 56px; padding: 0 16px; cursor: pointer; transition: background var(--t-micro) var(--ease); }
.src-row:hover { background: var(--soft-2); }
.src-row:focus-visible { outline-offset: -2px; }
.src-th { flex: none; width: 56px; height: 32px; border-radius: 6px; overflow: hidden; background: var(--soft); }
.src-th img { display: block; width: 100%; height: 100%; object-fit: cover; }
.src-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.src-nm { font-size: var(--fs-14); font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-sub { font-size: var(--fs-12); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.src-row.is-off .src-nm { color: var(--ink-2); }
/* 开关 36×20：开 = --ink 底 + --card 圆点（深色下 --ink 近白，圆点随卡面变深）；关 = --line-hover 底 + 白点 */
.sw { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--ink); transition: background var(--t-micro) var(--ease); }
.sw::after {
  content: ''; position: absolute; top: 2px; left: 18px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); transition: left var(--t-micro) var(--ease);
}
.src-row.is-off .sw { background: var(--line-hover); }
.src-row.is-off .sw::after { left: 2px; background: #FFFFFF; }
.src-f { flex: none; border-top: 1px solid var(--line); padding: 8px 16px 10px; display: flex; align-items: center; }
.src-all { height: 30px; font-size: var(--fs-13); font-weight: 600; color: var(--green-d); }
.src-all:disabled { color: var(--ink-3); cursor: default; }
/* 底部抽屉（≤720）：全宽、最大高 80vh、顶部圆角 20、拖拽条、遮罩 --scrim；层级在顶栏 / 浮钮之上、toast 之下（保存失败的提示要看得见） */
.src-sheet-host { position: fixed; inset: 0; z-index: 70; }
.src-scrim { position: absolute; inset: 0; background: var(--scrim); animation: mg-fade var(--t-in) var(--ease) both; }
.src-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 80vh; display: flex; flex-direction: column;
  border-radius: 20px 20px 0 0; background: var(--card); box-shadow: var(--sh-pop); overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom); animation: nw-sheet-in var(--t-in) var(--ease) both;
}
.src-grab { flex: none; width: 36px; height: 4px; border-radius: 2px; background: var(--line-hover); margin: 8px auto 0; }
.src-sheet .src-h { padding-top: 10px; }
.src-sheet .src-f { padding-bottom: 14px; }
@keyframes nw-sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes nw-sheet-out { from { transform: translateY(0); } to { transform: translateY(100%); } }
/* 退场（util.animateOut 加 .is-closing，播完删节点）：弹层与进场 mg-pop 对称；抽屉下沉 + 遮罩淡出 */
.src-pop.is-closing { animation: mg-pop-out var(--t-out) var(--ease) both; }
.src-sheet-host.is-closing .src-scrim { animation: mg-fade-out var(--t-out) var(--ease) both; }
.src-sheet-host.is-closing .src-sheet { animation: nw-sheet-out var(--t-out) var(--ease) both; }

/* ============ 窄档：封面 120×68 的两档（828–1051 可用宽 < 640、≤720 手机）——折叠行层叠同比缩小 ============ */
@media (min-width: 828px) and (max-width: 1051px) {
  .nw-stack { width: 120px; height: 68px; }
  .nw-layer, .nw-stack .nw-thumb { width: 104px; height: 59px; border-radius: 7px; }
  .nw-layer.is-1 { left: 8px; top: 4.5px; }
  .nw-layer.is-2 { left: 16px; top: 0; }
}
@media (max-width: 720px) {
  /* §1.2 / §8：折叠行封面位 120×68，组头封面 104×59、圆角 7，两层分别错 8 / 4.5 与 16 / 0 */
  .nw-stack { width: 120px; height: 68px; }
  .nw-layer, .nw-stack .nw-thumb { width: 104px; height: 59px; border-radius: 7px; }
  .nw-layer.is-1 { left: 8px; top: 4.5px; }
  .nw-layer.is-2 { left: 16px; top: 0; }
  /* 弹窗全屏：头部内边距收窄 */
  .nw-pop-head { padding: 0 12px 0 16px; }
  .nw-pop-head.has-back { padding-left: 12px; }
  /* 触控目标（13 版 §11：≤720 至少 36）：「来源」钮 28、返回钮 32 外观按画布不变，透明伪元素把可点区上下撑到 36 */
  .nw-src-btn, .nw-back { position: relative; }
  .nw-src-btn::after { content: ''; position: absolute; inset: -9px -2px -1px; }   /* 只往上撑（下方紧贴吸顶日期头，它后绘制会盖住）：inset 从 1px 描边内侧算，9 + 26 + 1 = 36 */
  .nw-back::after { content: ''; position: absolute; inset: -2px; }
}

/* ============ 深色 ============ */
[data-theme="dark"] .nw-pop { box-shadow: -18px 0 44px rgba(0, 0, 0, .5); }
