/* 北辰 V4 图表配色与通用图表样式（assets/charts/*.js 使用）
 * 规则：每个图表组件在本文件末尾追加自己的一节，以 "/* ===== <组件名> ===== *\/" 注释开头；
 *       分类色必须先跑 dataviz/scripts/validate_palette.js 通过后再写入，并在注释里记下校验结果。
 * 站点目前只有浅色主题（styles.css 无深色模式），这里也只定义浅色；将来加深色时在各节补 dark 值。
 * 文字一律用 ink 令牌，不用系列色。
 */

/* ===== 通用（emotion 组件创建，所有图表共用） ===== */
:root {
  --bc-chart-surface: var(--surface, #fff);
  --bc-chart-ink: var(--ink, #141c27);        /* 主文字 */
  --bc-chart-ink-2: var(--muted, #5f6b7b);    /* 次要文字、坐标轴刻度 */
  --bc-chart-ink-3: #7b8594;                  /* 弱化注释（仅 ≥11px 辅助说明） */
  --bc-chart-grid: #e9edf2;                   /* 网格线：比表面深一档，1px 实线 */
  --bc-chart-axis: #cfd6de;                   /* 基线 */
  --bc-chart-other: #a7b0bb;                  /* “其他”合并项 */
  --bc-chart-low: #c3cad3;                    /* 样本不足（n<5）置灰 / 斜线 */
  --bc-chart-marker: #8792a1;                 /* 时间轴节点竖线 */
}

.bc-chart { display: block; width: 100%; height: auto; overflow: visible; font-family:var(--font); }
.bc-chart text { fill: var(--bc-chart-ink-2); font-size:var(--fs-meta); font-weight:var(--fw-regular); }
.bc-chart .bc-t-ink { fill: var(--bc-chart-ink); }
.bc-chart .bc-t-strong { fill: var(--bc-chart-ink); font-weight:var(--fw-bold); }
/* 图表文字语义类（字号只取规范变量；SVG 经 viewBox 缩放，勿在此写死 px） */
.bc-chart .bc-t-axis { fill: var(--bc-chart-ink-2); font-size:var(--fs-meta); }
.bc-chart .bc-t-label { fill: var(--bc-chart-ink); font-size:var(--fs-meta); }
.bc-chart .bc-t-value { fill: var(--bc-chart-ink-2); font-size:var(--fs-meta); font-variant-numeric: tabular-nums; }
.bc-chart .bc-t-title { fill: var(--bc-chart-ink); font-size:var(--fs-h3); font-weight:var(--fw-bold); }
/* 词云字号分档：只用规范档位，频次越高档位越大 */
.bc-wordcloud .bc-w-meta { font-size:var(--fs-meta); }
.bc-wordcloud .bc-w-body { font-size:var(--fs-body); }
.bc-wordcloud .bc-w-h3 { font-size:var(--fs-h3); }
.bc-wordcloud .bc-w-h2 { font-size:var(--fs-h2); }
.bc-wordcloud .bc-w-h1 { font-size:var(--fs-h1); }
.bc-wordcloud .bc-w-num { font-size:var(--fs-num); }
.bc-chart .bc-t-muted { fill: var(--bc-chart-ink-3); }
.bc-chart .bc-t-on-dark { fill: #fff; }
.bc-chart .bc-t-halo { paint-order: stroke; stroke: var(--bc-chart-surface); stroke-width: 3px; stroke-linejoin: round; }
.bc-chart .bc-grid { stroke: var(--bc-chart-grid); stroke-width: 1; fill: none; shape-rendering: crispEdges; }
.bc-chart .bc-axis { stroke: var(--bc-chart-axis); stroke-width: 1; fill: none; shape-rendering: crispEdges; }
.bc-chart .bc-marker { stroke: var(--bc-chart-marker); stroke-width: 1; }
.bc-chart .bc-hit { fill: transparent; cursor: pointer; }
.bc-chart .bc-hit:hover, .bc-chart .bc-hit:focus { fill: rgba(20, 28, 39, .05); outline: none; }
.bc-chart [data-tip]:not(.bc-hit):hover, .bc-chart [data-tip]:not(.bc-hit):focus { filter: brightness(1.08) saturate(1.1); outline: none; }
.bc-chart-note { margin: 6px 0 0; color: var(--bc-chart-ink-2); font-size:var(--fs-meta); line-height: 1.6; }
.bc-chart-empty { padding: 24px 0; text-align: center; color: var(--bc-chart-ink-2); font-size:var(--fs-body); }
.bc-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 6px; padding: 0; list-style: none; color: var(--bc-chart-ink-2); font-size:var(--fs-meta); }
.bc-chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.bc-chart-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.bc-chart-table { width: 100%; border-collapse: collapse; font-size:var(--fs-body); font-variant-numeric: tabular-nums; }
.bc-chart-table caption { text-align: left; color: var(--bc-chart-ink-2); padding: 0 0 6px; font-size:var(--fs-meta); }
.bc-chart-table th, .bc-chart-table td { padding: 5px 8px; border-bottom: 1px solid var(--bc-chart-grid); text-align: right; white-space: nowrap; }
.bc-chart-table th:first-child, .bc-chart-table td:first-child { text-align: left; }
.bc-chart-table thead th { color: var(--bc-chart-ink-2); font-size:var(--fs-meta); font-weight:var(--fw-medium); }
.bc-chart-table tr.bc-low td { color: var(--bc-chart-ink-3); }

/* ===== emotion（情绪轮 / 情绪条形 / 情绪构成面积） =====
 * 普拉奇克传统色相，按轮盘顺序（喜悦→信任→恐惧→惊讶→悲伤→厌恶→愤怒→期待，首尾相接）：
 * validate_palette.js --mode light --surface #ffffff，序列末尾补回喜悦以校验首尾相邻：
 *   Lightness PASS · Chroma PASS · CVD PASS（最差相邻 喜悦↔期待 ΔE 9.1 deutan）· Normal-vision PASS（16.2）
 *   Contrast WARN：喜悦 2.12、惊讶 2.93 低于 3:1 —— 缓解：每瓣/每条都有文字标签 + 数据表。
 * 强度三档用同色相的不透明度区分（强 1 / 中 .66 / 弱 .38），内圈为强。
 */
:root {
  --bc-emo-joy: #d0b000;          /* 喜悦 黄 */
  --bc-emo-trust: #4b9c30;        /* 信任 浅绿 */
  --bc-emo-fear: #04663a;         /* 恐惧 深绿 */
  --bc-emo-surprise: #07a7b2;     /* 惊讶 青 */
  --bc-emo-sadness: #2d569c;      /* 悲伤 蓝 */
  --bc-emo-disgust: #9e6fcc;      /* 厌恶 紫 */
  --bc-emo-anger: #b8333a;        /* 愤怒 红 */
  --bc-emo-anticipation: #e56e1e; /* 期待 橙 */
}

/* ===== words（词云 / 短句云 / 高频词条形） =====
 * 词云用单色相 navy 顺序色阶（频次越高越深），非分类色：
 *   validate_palette.js "#4a78a8,#2c5a8c,#173b66,#0b1c30" --mode light --ordinal --surface #ffffff
 *   → Lightness monotone PASS · Adjacent ΔL PASS · Light-end contrast PASS（4.62:1）· Single hue PASS（4°）
 * 高频词条形为单系列 slot 色 #2a6ab5：Lightness/Chroma/Contrast 均 PASS。
 * 短句药丸底色为同色相浅阶（仅作底，文字一律 ink）。低样本置灰：文字 --bc-chart-ink-3，条形 --bc-chart-low。
 */
:root {
  --words-seq-1: #4a78a8;
  --words-seq-2: #2c5a8c;
  --words-seq-3: #173b66;
  --words-seq-4: #0b1c30;
  --words-bar: #2a6ab5;
  --words-chip-1: #f4f8fc;
  --words-chip-2: #eaf2fa;
  --words-chip-3: #d6e4f3;
  --words-chip-4: #bfd4ea;
  --words-chip-line: #dde3ea;
}
.bc-wordcloud .bc-word:hover text, .bc-wordcloud .bc-word:focus text { text-decoration: underline; }
.bc-wordcloud .bc-word:focus, .bc-topbars .bc-bar:focus { outline: none; }
.bc-topbars .bc-bar:hover path, .bc-topbars .bc-bar:focus path { filter: brightness(1.15); }
.bc-phrasecloud .bc-phrase:hover, .bc-phrasecloud .bc-phrase:focus-visible { border-color: var(--words-seq-1); }
.bc-word.is-active text { text-decoration: underline; }
.bc-phrase.is-active, .bc-phrase[aria-pressed="true"] { border-color: var(--words-seq-3); box-shadow: inset 0 0 0 1px var(--words-seq-3); }

/* ===== evolution（短句热力 / 议题份额面积 / 折线小多图） =====
 * 命题类别色按 id 顺序 C1..C6 固定（取参考色板前 6 槽，顺序即 CVD 安全机制，勿重排）：
 * validate_palette.js "#2a78d6,#eb6834,#1baf7a,#eda100,#e87ba4,#008300" --mode light --surface #ffffff
 *   Lightness PASS · Chroma PASS · CVD PASS（最差相邻 #eda100↔#1baf7a ΔE 9.1 protan）· Normal-vision PASS（19.6）
 *   Contrast WARN：#1baf7a 2.82 / #eda100 2.17 / #e87ba4 2.69 —— 缓解：色块内直接标 C 编号 + 图例 + 数据表；堆叠间 2px 表面色间隙。
 * 热力顺序色阶（蓝，4 档，0 次为中性底色）：
 * validate_palette.js "#86b6ef,#3987e5,#1c5cab,#0d366b" --mode light --surface #ffffff --ordinal → ALL PASS（浅端 2.11:1）
 */
:root {
  --evo-claim-1: #2a78d6; --evo-claim-2: #eb6834; --evo-claim-3: #1baf7a;
  --evo-claim-4: #eda100; --evo-claim-5: #e87ba4; --evo-claim-6: #008300;
  --evo-seq-0: #f1f4f8; --evo-seq-1: #86b6ef; --evo-seq-2: #3987e5; --evo-seq-3: #1c5cab; --evo-seq-4: #0d366b;
  --evo-line: #2a78d6;       /* 小多图折线（单系列/面板，不需类别色） */
  --evo-low-band: #eef1f4;   /* n<5 时段底色带 */
}
.bc-evo .evo-svg text { font-size:var(--fs-meta); }
.bc-evo .evo-dlabel { font-weight:var(--fw-bold); font-size:var(--fs-meta); pointer-events: none; }
.bc-evo .evo-hit { cursor: pointer; }
.bc-evo .evo-hit:hover { fill: rgba(20, 28, 39, .06); }
.bc-evo .evo-legend { gap: 4px 14px; }
.bc-evo .evo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bc-evo .evo-sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin: 0; vertical-align: middle; position: relative; flex: none; }
.bc-evo .evo-sw-low { background: var(--evo-low-band); box-shadow: inset 0 0 0 1px var(--bc-chart-low, #c3cad3); }
.bc-evo .evo-sw-lowdot { width: 6px; height: 6px; border-radius: 50%; background: var(--bc-chart-low, #c3cad3); }
.bc-evo .evo-sw-first { background: var(--evo-seq-2); }
.bc-evo .evo-sw-first .evo-first { left: 50%; top: 50%; }
.bc-evo .evo-legend-claims span { max-width: 100%; }
.evo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.evo-empty { color: var(--bc-chart-ink-2, #5f6b7b); font-size:var(--fs-meta); margin: 8px 0; }
/* 热力：HTML 表格，行标签 sticky 在左，窄屏横向滚动 */
.evo-heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.evo-heat { border-collapse: separate; border-spacing: 2px; font-size:var(--fs-meta); min-width: max-content; }
.evo-heat th { font-weight:var(--fw-regular); color: var(--bc-chart-ink-2, #5f6b7b); white-space: nowrap; }
.evo-heat thead th { font-size:var(--fs-meta); padding: 0 0 2px; text-align: center; vertical-align: bottom; font-variant-numeric: tabular-nums; }
.evo-heat .evo-heat-day.is-low { color: var(--bc-chart-ink-3, #7b8594); opacity: .7; }
.evo-heat .evo-heat-mon { display: block; font-size:var(--fs-meta); }
.evo-heat .evo-heat-label { position: sticky; left: 0; z-index: 1; background: var(--bc-chart-surface, #fff); color: var(--bc-chart-ink, #141c27); text-align: right; padding: 0 8px 0 0; max-width: 15em; overflow: hidden; text-overflow: ellipsis; box-shadow: 6px 0 6px -6px rgba(20, 28, 39, .18); }
.evo-heat thead .evo-heat-corner { color: var(--bc-chart-ink-2, #5f6b7b); font-size:var(--fs-meta); }
.evo-heat .evo-heat-total { color: var(--bc-chart-ink, #141c27); padding: 0 0 0 6px; text-align: left; font-variant-numeric: tabular-nums; }
.evo-heat td.evo-c { width: 22px; min-width: 22px; height: 22px; padding: 0; border-radius: 3px; position: relative; cursor: pointer; }
.evo-heat td.evo-c:hover { outline: 2px solid var(--bc-chart-ink, #141c27); outline-offset: -1px; }
.bc-evo .evo-s0 { background: var(--evo-seq-0); }
.bc-evo .evo-s1 { background: var(--evo-seq-1); }
.bc-evo .evo-s2 { background: var(--evo-seq-2); }
.bc-evo .evo-s3 { background: var(--evo-seq-3); }
.bc-evo .evo-s4 { background: var(--evo-seq-4); }
.evo-heat td.evo-c.is-low.evo-s0 { background: var(--evo-low-band); background-image: repeating-linear-gradient(45deg, transparent 0 4px, rgba(20, 28, 39, .06) 4px 5px); }
.bc-evo .evo-first { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--bc-chart-ink, #141c27); box-shadow: 0 0 0 2px var(--bc-chart-surface, #fff); }
/* 份额面积：窄屏保持可读宽度，横向滚动 */
.evo-area-svg { min-width: 520px; }
/* 小多图 */
.evo-sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 14px; }
.evo-sm-panel { margin: 0; min-width: 0; }
.evo-sm-panel figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size:var(--fs-meta); color: var(--bc-chart-ink, #141c27); }
.evo-sm-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evo-sm-last { font-weight:var(--fw-bold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.evo-sm-last small { font-weight:var(--fw-regular); color: var(--bc-chart-ink-2, #5f6b7b); margin-left: 4px; font-size:var(--fs-meta); }
.evo-sm-svg text { font-size:var(--fs-meta) !important; }
.evo-heat td.evo-c.is-low:not(.evo-s0) { opacity: .55; }

/* ===== effect（回应效果哑铃图 / 净情绪指数线） =====
   validate_palette.js "#0ca30c,#1f5fb8,#d03b3b" --mode light --surface #ffffff → ALL PASS（相邻序）。
   good↔critical 直接对比 CVD ΔE 4.1：按状态色规则必配 ▲/▼ 图标＋文字，颜色从不单独表意。文字一律用 ink 色。 */
:root {
  --fx-line:#1f5fb8;      /* 净情绪线（单序列） */
  --fx-before:#8792a1;    /* 执行前：中性灰空心点 */
  --fx-up:#0ca30c;        /* status good：改善 / 回升 */
  --fx-down:#d03b3b;      /* status critical：恶化 */
  --fx-flat:#5f6b7b;      /* 持平 */
  --fx-na:var(--bc-chart-low);        /* 数据不足 */
  --fx-grid:var(--bc-chart-grid); --fx-axis:var(--bc-chart-axis); --fx-low-bg:#f1f3f6;
  --fx-ink:var(--bc-chart-ink); --fx-ink-2:var(--bc-chart-ink-2); --fx-ink-3:var(--bc-chart-ink-3); --fx-surface:var(--bc-chart-surface);
}
.fx-wrap .chart text{fill:var(--fx-ink-3)}
.chart .fx-grid{stroke:var(--fx-grid);stroke-width:1}
.chart .fx-zero{stroke:var(--fx-axis);stroke-width:1}
.chart .fx-axis{font-size:var(--fs-meta);fill:var(--fx-ink-3)}
.chart .fx-hit{fill:transparent}
.chart .fx-sep{stroke:var(--fx-grid);stroke-width:1}
.chart .fx-label{font-size:var(--fs-meta);fill:var(--fx-ink);font-weight:var(--fw-bold)}
.chart .fx-sub{font-size:var(--fs-meta);fill:var(--fx-ink-3)}
.chart .fx-verdict{font-size:var(--fs-meta);fill:var(--fx-ink-2);font-weight:var(--fw-bold)}
.chart .fx-conn{stroke:var(--fx-na);stroke-width:2;stroke-linecap:round}
.chart .fx-dot-before{fill:var(--fx-surface,#fff);stroke:var(--fx-before);stroke-width:2}
.chart .fx-dot-after{stroke:var(--fx-surface,#fff);stroke-width:2}
.chart .fx-up .fx-dot-after{fill:var(--fx-up)} .chart .fx-up .fx-conn{stroke:var(--fx-up);opacity:.45}
.chart .fx-down .fx-dot-after{fill:var(--fx-down)} .chart .fx-down .fx-conn{stroke:var(--fx-down);opacity:.45}
.chart .fx-flat .fx-dot-after{fill:var(--fx-flat)}
.chart .fx-na .fx-dot-after{fill:var(--fx-na)}
.chart .fx-na .fx-label,.chart .fx-na .fx-verdict{fill:var(--fx-ink-3);font-weight:var(--fw-regular)}
.chart .fx-up .fx-icon{fill:var(--fx-up)} .chart .fx-down .fx-icon{fill:var(--fx-down)} .chart .fx-flat .fx-icon{fill:var(--fx-flat)} .chart .fx-na .fx-icon{fill:var(--fx-na)}
.chart .fx-row:hover .fx-hit,.chart .fx-row:focus .fx-hit{fill:rgba(20,28,39,.035)}
.chart .fx-line{fill:none;stroke:var(--fx-line);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.chart .fx-pt{fill:var(--fx-line);stroke:var(--fx-surface,#fff);stroke-width:2}
.chart .fx-pt-low{fill:var(--fx-na);stroke:var(--fx-surface,#fff);stroke-width:2}
.chart .fx-low{fill:var(--fx-low-bg)}
.chart .fx-low-label{font-size:var(--fs-meta);fill:var(--fx-ink-3)}
.chart .fx-tick{stroke:var(--fx-ink-2);stroke-width:2;stroke-linecap:round}
.chart .fx-action{cursor:default}
.chart .fx-action:hover .fx-tick,.chart .fx-action:focus .fx-tick{stroke:var(--fx-ink)}
.chart .fx-bucket:hover{fill:rgba(20,28,39,.04)}
.chart .fx-tp{cursor:pointer}
.chart .fx-tp-lead{stroke:var(--fx-axis);stroke-width:1}
.chart .fx-tp-dot{stroke:var(--fx-surface,#fff);stroke-width:2}
.chart .fx-tp.fx-up .fx-tp-dot{fill:var(--fx-up)} .chart .fx-tp.fx-down .fx-tp-dot{fill:var(--fx-down)}
.chart .fx-tp-label{font-size:var(--fs-meta);fill:var(--fx-ink);font-weight:var(--fw-bold)}
.fx-legend i{display:inline-block;width:14px;height:3px;border-radius:2px;margin-right:5px;vertical-align:middle}
.fx-legend b{font-weight:var(--fw-bold);margin-right:3px}
.fx-legend b.fx-up{color:var(--fx-up)} .fx-legend b.fx-down{color:var(--fx-down)} .fx-legend b.fx-flat{color:var(--fx-flat)} .fx-legend b.fx-na{color:var(--fx-na)}
.fx-key-before{width:10px!important;height:10px!important;border-radius:50%!important;border:2px solid var(--fx-before);background:transparent}
.fx-key-after{width:10px!important;height:10px!important;border-radius:50%!important;background:var(--fx-ink-2)}
.fx-key-line{background:var(--fx-line)}
.fx-key-tp{width:10px!important;height:10px!important;border-radius:50%!important;background:linear-gradient(90deg,var(--fx-up) 50%,var(--fx-down) 50%)}
.fx-key-tick{width:2px!important;height:10px!important;background:var(--fx-ink-2)}
.fx-key-low{width:14px!important;height:10px!important;background:var(--fx-low-bg);border:1px solid var(--fx-grid)}
.fx-note{font-size:var(--fs-meta);color:var(--fx-ink-3);margin:6px 0 0}
.fx-empty{font-size:var(--fs-body);color:var(--fx-ink-3)}
@media (max-width: 520px) { .evo-heat .evo-heat-label { max-width: 8.5em; } }
.evo-area-svg { max-width: 900px; }

/* words：短句药丸与计数（原为内联样式） */
.bc-phrasecloud .bc-phrase[data-tier="meta"] { font-size:var(--fs-meta); }
.bc-phrasecloud .bc-phrase[data-tier="body"] { font-size:var(--fs-body); }
.bc-phrasecloud .bc-phrase[data-tier="h3"] { font-size:var(--fs-h3); }
.bc-phrasecloud .bc-phrase[data-tier="h2"] { font-size:var(--fs-h2); }
.bc-phrase .bc-phrase-count, .bc-phrase .bc-phrase-tag { font-size:var(--fs-meta); white-space: nowrap; }
