/* readings.css · 推荐阅读模块样式（首页动态条 .rs-* + 阅读页 .rd-*）
 * 双主题：变量两套取值与门户主页（portal/index.html）及统计页（stats.css）
 * 完全一致——主题切换复用 assets/portal-{theme,toggle}.js，localStorage 键
 * 'portal-theme' 共享，门户 / 统计页 / 阅读页三页联动。
 * CSP：纯样式文件（style-src 'self' 'unsafe-inline' 合规），无外部资源引用。 */
:root, :root[data-theme="dark"] {
  --bg: #0b1120;
  --bg2: #111a2e;
  --card: #131e35;
  --rule: #24324d;
  --ink: #e6edf7;
  --muted: #8fa0bb;
  --accent: #6ea8fe;
  --accent2: #57d4b0;
  --accent3: #f59e0b;
  --shadow: rgba(0, 0, 0, 0.35);
  /* 分类色（dark）：paper 琥珀 / insight 蓝 / tool 绿 / course 青 / industry 紫 */
  --cat-paper: #f59e0b;
  --cat-insight: #6ea8fe;
  --cat-tool: #57d4b0;
  --cat-course: #22d3ee;
  --cat-industry: #c084fc;
}
:root[data-theme="light"] {
  --bg: #f4f7fb;
  --bg2: #ffffff;
  --card: #ffffff;
  --rule: #dbe4f0;
  --ink: #17233a;
  --muted: #5b6b85;
  --accent: #2563eb;
  --accent2: #0e9f7e;
  --accent3: #d97706;
  --shadow: rgba(23, 35, 58, 0.10);
  /* 分类色（light）：明度压深保证文字对比度 */
  --cat-paper: #b45309;
  --cat-insight: #2563eb;
  --cat-tool: #0e9f7e;
  --cat-course: #0891b2;
  --cat-industry: #7c3aed;
}

/* ---- 分类徽章（首页动态条与阅读页共用）----
   「描边 + 文字」样式而非填充底色：两种主题下均不产生对比度问题 */
.rs-badge {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  padding: 1px 9px; border-radius: 999px;
  border: 1px solid var(--rule); color: var(--muted);
  white-space: nowrap; flex-shrink: 0;
}
.rs-badge[data-cat="paper"]    { color: var(--cat-paper);    border-color: var(--cat-paper); }
.rs-badge[data-cat="insight"]  { color: var(--cat-insight);  border-color: var(--cat-insight); }
.rs-badge[data-cat="tool"]     { color: var(--cat-tool);     border-color: var(--cat-tool); }
.rs-badge[data-cat="course"]   { color: var(--cat-course);   border-color: var(--cat-course); }
.rs-badge[data-cat="industry"] { color: var(--cat-industry); border-color: var(--cat-industry); }

/* ============================================================
 * 一、首页「推荐阅读」条（.rs-strip，由 readings-strip.js 渲染）
 * ============================================================ */
.rs-strip {
  margin: 18px 0 26px;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 18px 10px;
}
.rs-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 6px; border-bottom: 1px dashed var(--rule);
}
.rs-label {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.12em;
  color: var(--accent);
}
.rs-more {
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--muted); transition: color .15s ease;
}
.rs-more:hover { color: var(--accent); }
.rs-list { list-style: none; }
.rs-item { border-bottom: 1px dashed var(--rule); }
.rs-item:last-child { border-bottom: none; }
.rs-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 2px; text-decoration: none; color: inherit;
}
a.rs-row:hover .rs-title { color: var(--accent); }
.rs-date {
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.rs-title {
  font-size: 14px; color: var(--ink); line-height: 1.45;
  transition: color .15s ease;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
 * 二、阅读页 /readings/（.rd-*，由 readings-render.js 渲染）
 * ============================================================ */
body.rd-page {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.65;
  min-height: 100vh;
}
.rd-wrap {
  max-width: 860px; margin: 0 auto;
  padding: 26px 24px 64px;
}

/* ---- 主题切换按钮（与门户主页同款：固定右上角）---- */
#theme-toggle {
  position: fixed; top: 18px; right: 18px; z-index: 99;
  width: 42px; height: 42px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  font-size: 18px; cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}
#theme-toggle:hover { border-color: var(--accent); transform: scale(1.06); }

/* ---- 返回门户 ---- */
.rd-back {
  display: inline-block; font-size: 13.5px; font-weight: 600;
  color: var(--muted); text-decoration: none; margin-bottom: 18px;
  transition: color .15s ease;
}
.rd-back:hover { color: var(--accent); }

/* ---- 页头 ---- */
.rd-header { padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.rd-kicker {
  display: inline-block; font-size: 13px; letter-spacing: 0.12em;
  color: var(--accent); border: 1px solid var(--rule);
  padding: 4px 14px; border-radius: 999px; margin-bottom: 14px;
  background: var(--bg2);
}
.rd-header h1 { font-size: clamp(24px, 3.6vw, 32px); font-weight: 700; }
.rd-sub { color: var(--muted); font-size: 14.5px; margin-top: 10px; max-width: 640px; }
.rd-sub b { color: var(--ink); font-weight: 600; }
.rd-meta {
  margin-top: 12px; font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---- 分类筛选 chips ---- */
.rd-chips {
  display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto;
  padding: 16px 0 14px; scrollbar-width: thin;
}
.rd-chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--muted); background: var(--bg2);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 6px 14px; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
  font-family: inherit;
}
.rd-chip:hover { border-color: var(--accent); color: var(--accent); }
.rd-chip[aria-pressed="true"] {
  border-color: var(--accent); color: var(--accent);
  background: var(--card);
}

/* ---- 置顶区 ---- */
.rd-pinned {
  margin-bottom: 22px; padding: 4px 0 4px 16px;
  border-left: 3px solid var(--accent);
}
.rd-pinned-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--accent); margin-bottom: 10px;
}

/* ---- 月分组 ---- */
.rd-month { margin: 10px 0 18px; }
.rd-month summary {
  cursor: pointer; list-style: none; user-select: none;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 12px;
  padding: 6px 0;
}
.rd-month summary::before,
.rd-month summary::after {
  content: ""; flex: 1; border-top: 1px dashed var(--rule);
}
.rd-month summary::-webkit-details-marker { display: none; }
.rd-month[open] summary { color: var(--ink); }
.rd-month .rd-month-count { font-weight: 400; opacity: 0.75; }

/* ---- 条目卡 ---- */
.rd-item {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 12px; padding: 18px 20px; margin: 12px 0;
  transition: border-color .18s ease;
}
.rd-item:hover { border-color: var(--accent); }
.rd-item-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.rd-date {
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rd-title { font-size: 16.5px; font-weight: 600; line-height: 1.5; }
.rd-title a {
  color: var(--ink); text-decoration: none;
}
.rd-title a:hover { color: var(--accent); }
.rd-title .rd-ext { color: var(--muted); font-weight: 400; font-size: 14px; }
.rd-summary {
  color: var(--muted); font-size: 14px; margin-top: 8px; line-height: 1.7;
}
.rd-tags { margin-top: 10px; font-size: 12px; color: var(--muted); opacity: 0.85; }
.rd-tags span { margin-right: 10px; }

/* ---- 三态：加载 / 错误 / 空 ---- */
.rd-loading, .rd-empty {
  color: var(--muted); font-size: 14px; text-align: center; padding: 42px 0;
}
.rd-error {
  margin-top: 24px; text-align: center;
  background: var(--bg2); border: 1px solid var(--rule); border-radius: 12px;
  padding: 28px 20px; color: var(--muted); font-size: 14px;
}
.rd-error button {
  font: inherit; font-weight: 600; cursor: pointer;
  margin: 12px 8px 0; padding: 8px 20px; border-radius: 10px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  transition: filter .15s ease;
}
.rd-error button:hover { filter: brightness(1.15); }
.rd-error a {
  display: inline-block; margin-top: 12px; color: var(--accent);
  text-decoration: none; font-weight: 600;
}

/* ---- 页脚 ---- */
.rd-footer {
  margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--rule);
  color: var(--muted); font-size: 12.5px; text-align: center;
}
.rd-footer p { margin: 4px 0; }
.rd-footer a { color: var(--accent); text-decoration: none; }
.rd-footer a:hover { text-decoration: underline; }

/* ============================================================
 * 三、文章页 /readings/articles/*.html（.article-*，静态成文页）
 * ============================================================ */
.article-wrap {
  max-width: 760px; margin: 0 auto;
  padding: 26px 24px 64px;
}
.article-kicker {
  display: inline-block; font-size: 12.5px; letter-spacing: 0.12em;
  color: var(--accent); border: 1px solid var(--rule);
  padding: 4px 14px; border-radius: 999px; margin-bottom: 14px;
  background: var(--bg2); text-decoration: none;
}
.article-kicker:hover { border-color: var(--accent); }
.article-header h1 {
  font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; line-height: 1.45;
}
.article-header .article-lede {
  color: var(--muted); font-size: 15px; margin-top: 12px; line-height: 1.7;
}
.article-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 16px 0 0; padding: 14px 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* 导读框（编辑导语 + 课程关联点） */
.article-callout {
  margin: 22px 0; padding: 16px 20px;
  background: var(--bg2); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent); border-radius: 10px;
  font-size: 14px; line-height: 1.75; color: var(--ink);
}
.article-callout .callout-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--accent); display: block; margin-bottom: 8px;
}
.article-callout b { font-weight: 600; }
/* 编辑导读 / 原始资料 callout 内的链接:
   暗主题下浏览器默认 a 颜色偏紫,与 --ink 文字对比度不够;
   改用主色 + 下划线 + hover 换色,亮/暗双主题皆清晰 */
.article-callout a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.article-callout a:hover {
  color: var(--accent2);
  text-decoration-color: var(--accent2);
}

/* 正文区块 */
.article-section { margin-top: 34px; }
.article-section > h2 {
  font-size: 19px; font-weight: 700; line-height: 1.5;
  padding-bottom: 8px; border-bottom: 1px solid var(--rule);
}
.article-section > h3 {
  font-size: 16px; font-weight: 600; margin: 22px 0 10px;
}
.article-section p {
  font-size: 14.5px; line-height: 1.85; color: var(--ink);
  margin: 12px 0;
}
.article-section p b { font-weight: 600; }
.article-section a { color: var(--accent); }

/* 关键数字卡 */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 18px 0;
}
.stat-card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px;
  padding: 14px 16px;
}
.stat-card .num {
  font-size: 24px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.stat-card .desc { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* 金句 */
.article-quote {
  margin: 18px 0; padding: 14px 20px;
  border-left: 3px solid var(--accent2); background: var(--bg2);
  border-radius: 0 10px 10px 0; font-size: 15px; line-height: 1.75;
}
.article-quote .q-src {
  display: block; font-size: 12px; color: var(--muted); margin-top: 6px;
}

/* 表格 */
.article-table {
  width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13px;
}
.article-table th, .article-table td {
  border: 1px solid var(--rule); padding: 8px 10px; text-align: left;
  vertical-align: top; line-height: 1.6;
}
.article-table th { background: var(--bg2); font-weight: 600; white-space: nowrap; }
.article-table td { color: var(--ink); }

/* 证据等级小标签 */
.ev {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--rule); color: var(--muted);
}
.ev-ok   { color: var(--accent2); border-color: var(--accent2); }
.ev-warn { color: var(--accent3); border-color: var(--accent3); }
.ev-bad  { color: #e06666; border-color: #e06666; }
:root[data-theme="light"] .ev-bad { color: #c0392b; border-color: #c0392b; }

/* 配图（figure）：官方来源证据图 */
.article-figure {
  margin: 20px 0; padding: 12px;
  background: var(--bg2); border: 1px solid var(--rule); border-radius: 10px;
}
.article-figure img {
  display: block; width: 100%; height: auto;
  border-radius: 6px; border: 1px solid var(--rule);
}
.article-figure figcaption {
  font-size: 12.5px; color: var(--muted); line-height: 1.7;
  margin-top: 10px; padding: 0 4px;
}
.article-figure figcaption a { color: var(--accent); text-decoration: none; }
.article-figure figcaption a:hover { text-decoration: underline; }
.article-figure .fig-tag {
  font-weight: 700; color: var(--ink); margin-right: 6px;
}

/* 双图并排：两张图左右各半，各带小标题 */
.article-figure.two-col {
  padding: 14px;
}
.article-figure.two-col .fig-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.article-figure.two-col .fig-pair-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.article-figure.two-col .fig-pair-item img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--rule);
}
.article-figure.two-col .fig-pair-caption {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}
@media (max-width: 600px) {
  .article-figure.two-col .fig-pair {
    grid-template-columns: 1fr;
  }
}

/* 来源清单 */
.article-sources {
  margin-top: 30px; padding: 16px 20px;
  background: var(--bg2); border: 1px solid var(--rule); border-radius: 10px;
  font-size: 12.5px; color: var(--muted); line-height: 1.8;
}
.article-sources a { color: var(--accent); text-decoration: none; word-break: break-all; }
.article-sources a:hover { text-decoration: underline; }
.article-sources .src-title { font-weight: 700; color: var(--ink); margin-bottom: 8px; }

/* 文末导航 */
.article-nav {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--rule);
}
.article-nav a {
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  color: var(--muted); transition: color .15s ease;
}
.article-nav a:hover { color: var(--accent); }

/* 响应式（文章页） */
@media (max-width: 640px) {
  .article-wrap { padding: 20px 16px 56px; }
  .article-table { font-size: 12px; }
  .article-table th, .article-table td { padding: 6px 8px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- 响应式 ---- */
@media (max-width: 640px) {
  .rd-wrap { padding: 20px 16px 56px; }
  #theme-toggle { top: 12px; right: 12px; width: 38px; height: 38px; font-size: 16px; }
  .rs-strip { padding: 10px 14px 8px; }
  .rs-row { flex-wrap: wrap; gap: 6px 8px; padding: 8px 0; }
  .rs-title { -webkit-line-clamp: 3; width: 100%; order: 3; }
  .rd-item-meta { margin-bottom: 6px; }
  .rd-item { padding: 15px 16px; }
}

/* ── 文章内自制图表（2026-10-08 agent-skills-reexamined 首用；CSP 合规：内联 SVG + css 变量，双主题自动适配） ── */
.rd-svg { width: 100%; height: auto; display: block; }
.law-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 14px 0 4px; }
.law-card { border: 1px solid var(--rule); border-radius: 10px; background: var(--card); padding: 12px 14px; }
.law-card .law-name { font-weight: 600; font-size: 14px; color: var(--accent); }
.law-card p { margin: 6px 0 0; font-size: 13.5px; color: var(--ink); line-height: 1.65; }
@media (max-width: 640px) { .law-grid { grid-template-columns: 1fr; } }
