/* ============================================
   阙外 Premium 设计令牌 v3.0
   统一三主题 · GEP v8 进化同步
   命名: --qw-* (网站UI) + --qw-* (管线研报)
   和谐度: 0.978 (温润:0.948 | 克制:1.000 | 节律:1.000 | 层次:0.963 | 余韵:0.975)
   ============================================ */

/* ===== 浅色主题 (默认) ===== */
:root,
[data-theme="light"] {
  /* 品牌色 — 精调降饱和，避免"暴发户感" */
  --qw-brand: #1e3a5f;
  --qw-brand-light: #2d5a8a;
  --qw-brand-subtle: #ebf0f7;
  --qw-gold: #b8943a;
  --qw-gold-light: #d4b96a;
  --qw-gold-subtle: #faf6ed;

  /* GEP v8 进化色板 (管线同步, Gen 3) */
  --qw-navy: #0a1124;
  --qw-navy-surface: #102131;
  --qw-gold-evolved: #b69226;
  --qw-gold-muted: #a59566;
  --qw-gold-evolved-subtle: rgba(184,148,46,0.08);
  --qw-ink: #1a1a18;
  --qw-ink-secondary: #4c5652;
  --qw-ink-muted: #888888;
  --qw-ink-whisper: #b0b0b0;
  --qw-paper: #fefefe;
  --qw-paper-warm: #f4f4f1;
  --qw-rule: #e9e5e5;
  --qw-rule-light: #e7e6e6;
  --qw-red: #C0392B;
  --qw-green: #1E8449;
  --qw-blue-accent: #1a56db;

  /* 背景层级 */
  --qw-bg: #f9fafb;
  --qw-surface: #ffffff;
  --qw-surface-raised: #ffffff;
  --qw-surface-subtle: #f3f4f6;

  /* 文字层级 */
  --qw-text: #1e293b;
  --qw-text-secondary: #475569;
  --qw-text-muted: #94a3b8;
  --qw-text-inverse: #f8fafc;

  /* 边框 */
  --qw-border: #e2e8f0;
  --qw-border-light: #f1f5f9;
  --qw-border-focus: #b8943a;

  /* 功能色 */
  --qw-success: #2d6a4f;
  --qw-success-bg: #d8f3dc;
  --qw-warning: #b45309;
  --qw-warning-bg: #fef3c7;
  --qw-danger: #b91c1c;
  --qw-danger-bg: #fee2e2;
  --qw-info: #1e5a7b;
  --qw-info-bg: #dbeafe;

  /* 阴影 */
  --qw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --qw-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --qw-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --qw-shadow-lg: 0 12px 40px rgba(30, 58, 95, 0.10);
  --qw-shadow-xl: 0 20px 60px rgba(30, 58, 95, 0.14);

  /* 四层穿透色 */
  --qw-layer-1: #c53030;
  --qw-layer-2: #c05621;
  --qw-layer-3: #b7791f;
  --qw-layer-4: #2f855a;

  /* 图表 */
  --qw-chart-bg: #ffffff;
  --qw-chart-grid: #e2e8f0;

  /* 特殊区域 */
  --qw-insight-bg: #fefce8;
  --qw-insight-border: #b8943a;
  --qw-code-bg: #f1f5f9;

  /* Callout 语义色 (Notion-inspired, 阙外调性适配) */
  --qw-callout-blue-bg: rgba(30,90,123,0.05);
  --qw-callout-blue-border: rgba(30,90,123,0.2);
  --qw-callout-blue-text: #1e5a7b;
  --qw-callout-green-bg: rgba(45,106,79,0.05);
  --qw-callout-green-border: rgba(45,106,79,0.2);
  --qw-callout-green-text: #2d6a4f;
  --qw-callout-yellow-bg: rgba(180,83,9,0.06);
  --qw-callout-yellow-border: rgba(180,83,9,0.2);
  --qw-callout-yellow-text: #92400e;
  --qw-callout-red-bg: rgba(185,28,28,0.05);
  --qw-callout-red-border: rgba(185,28,28,0.2);
  --qw-callout-red-text: #991b1b;
  --qw-callout-purple-bg: rgba(109,60,150,0.05);
  --qw-callout-purple-border: rgba(109,60,150,0.2);
  --qw-callout-purple-text: #6b21a8;
  --qw-callout-gray-bg: rgba(100,100,100,0.05);
  --qw-callout-gray-border: rgba(100,100,100,0.15);
  --qw-callout-gray-text: #4b5563;
}

/* ===== 深色主题 ===== */
[data-theme="dark"] {
  --qw-brand: #7eb8da;
  --qw-brand-light: #a3d0e8;
  --qw-brand-subtle: #1a2d3d;
  --qw-gold: #c9a96e;
  --qw-gold-light: #dbc08a;
  --qw-gold-subtle: #2a2418;

  --qw-bg: #0f172a;
  --qw-surface: #1e293b;
  --qw-surface-raised: #273548;
  --qw-surface-subtle: #162032;

  --qw-text: #e2e8f0;
  --qw-text-secondary: #b0bec5;
  --qw-text-muted: #64748b;
  --qw-text-inverse: #0f172a;

  --qw-border: #334155;
  --qw-border-light: #1e293b;
  --qw-border-focus: #c9a96e;

  --qw-success: #4ade80;
  --qw-success-bg: #14532d;
  --qw-warning: #fbbf24;
  --qw-warning-bg: #451a03;
  --qw-danger: #f87171;
  --qw-danger-bg: #450a0a;
  --qw-info: #7dd3fc;
  --qw-info-bg: #0c2d48;

  --qw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --qw-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --qw-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --qw-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --qw-shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);

  --qw-layer-1: #f87171;
  --qw-layer-2: #fb923c;
  --qw-layer-3: #fbbf24;
  --qw-layer-4: #4ade80;

  --qw-chart-bg: #1e293b;
  --qw-chart-grid: #334155;

  --qw-insight-bg: #2a2418;
  --qw-insight-border: #c9a96e;
  --qw-code-bg: #1e293b;

  /* Callout 语义色 (深色) */
  --qw-callout-blue-bg: rgba(125,211,252,0.08);
  --qw-callout-blue-border: rgba(125,211,252,0.2);
  --qw-callout-blue-text: #7dd3fc;
  --qw-callout-green-bg: rgba(74,222,128,0.08);
  --qw-callout-green-border: rgba(74,222,128,0.2);
  --qw-callout-green-text: #4ade80;
  --qw-callout-yellow-bg: rgba(251,191,36,0.08);
  --qw-callout-yellow-border: rgba(251,191,36,0.2);
  --qw-callout-yellow-text: #fbbf24;
  --qw-callout-red-bg: rgba(248,113,113,0.08);
  --qw-callout-red-border: rgba(248,113,113,0.2);
  --qw-callout-red-text: #f87171;
  --qw-callout-purple-bg: rgba(192,132,252,0.08);
  --qw-callout-purple-border: rgba(192,132,252,0.2);
  --qw-callout-purple-text: #c084fc;
  --qw-callout-gray-bg: rgba(148,163,184,0.08);
  --qw-callout-gray-border: rgba(148,163,184,0.15);
  --qw-callout-gray-text: #94a3b8;
}

/* ===== 暖色/护眼主题 ===== */
[data-theme="warm"] {
  --qw-brand: #5c4033;
  --qw-brand-light: #7b5b47;
  --qw-brand-subtle: #f5ede5;
  --qw-gold: #9b7b3a;
  --qw-gold-light: #b8964a;
  --qw-gold-subtle: #faf3e6;

  --qw-bg: #fdfaf5;
  --qw-surface: #fffbeb;
  --qw-surface-raised: #ffffff;
  --qw-surface-subtle: #f7f1e8;

  --qw-text: #3d2b1f;
  --qw-text-secondary: #5c4033;
  --qw-text-muted: #8b7355;
  --qw-text-inverse: #fdfaf5;

  --qw-border: #d4c5b9;
  --qw-border-light: #e8dcd0;
  --qw-border-focus: #9b7b3a;

  --qw-success: #3d6b3d;
  --qw-success-bg: #d8f0d8;
  --qw-warning: #8b6914;
  --qw-warning-bg: #fef5d4;
  --qw-danger: #a03030;
  --qw-danger-bg: #fce4e4;
  --qw-info: #3d5c6b;
  --qw-info-bg: #dceef5;

  --qw-shadow-sm: 0 1px 2px rgba(92, 64, 51, 0.04);
  --qw-shadow: 0 2px 12px rgba(92, 64, 51, 0.06);
  --qw-shadow-md: 0 4px 20px rgba(92, 64, 51, 0.08);
  --qw-shadow-lg: 0 12px 40px rgba(92, 64, 51, 0.10);
  --qw-shadow-xl: 0 20px 60px rgba(92, 64, 51, 0.14);

  --qw-layer-1: #c53030;
  --qw-layer-2: #c05621;
  --qw-layer-3: #b7791f;
  --qw-layer-4: #2f855a;

  --qw-chart-bg: #fffbeb;
  --qw-chart-grid: #d4c5b9;

  --qw-insight-bg: #fef5e7;
  --qw-insight-border: #9b7b3a;
  --qw-code-bg: #f7f1e8;

  /* Callout 语义色 (暖色) */
  --qw-callout-blue-bg: rgba(61,92,107,0.05);
  --qw-callout-blue-border: rgba(61,92,107,0.2);
  --qw-callout-blue-text: #3d5c6b;
  --qw-callout-green-bg: rgba(61,107,61,0.05);
  --qw-callout-green-border: rgba(61,107,61,0.2);
  --qw-callout-green-text: #3d6b3d;
  --qw-callout-yellow-bg: rgba(139,105,20,0.08);
  --qw-callout-yellow-border: rgba(139,105,20,0.25);
  --qw-callout-yellow-text: #7a5d1b;
  --qw-callout-red-bg: rgba(160,48,48,0.05);
  --qw-callout-red-border: rgba(160,48,48,0.2);
  --qw-callout-red-text: #a03030;
  --qw-callout-purple-bg: rgba(90,55,120,0.05);
  --qw-callout-purple-border: rgba(90,55,120,0.2);
  --qw-callout-purple-text: #5a3778;
  --qw-callout-gray-bg: rgba(139,115,85,0.06);
  --qw-callout-gray-border: rgba(139,115,85,0.2);
  --qw-callout-gray-text: #6b5e4a;
}

/* ===== 排版令牌 ===== */
:root {
  /* 字体栈 */
  --qw-serif: 'Noto Serif SC', 'Source Han Serif SC', 'STSong', 'Songti SC', Georgia, serif;
  --qw-sans: 'PingFang SC', 'Microsoft YaHei', 'Inter', -apple-system, system-ui, sans-serif;
  --qw-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;

  /* 字号比例尺 (6级) */
  --qw-text-xs: 0.75rem;     /* 12px — 辅助信息 */
  --qw-text-sm: 0.875rem;    /* 14px — 标签/说明 */
  --qw-text-base: 1.0625rem;  /* 17px — 正文 (从15px提升) */
  --qw-text-lg: 1.25rem;     /* 20px — 引言/摘要 */
  --qw-text-xl: 1.75rem;     /* 28px — 小标题 */
  --qw-text-2xl: 2.5rem;     /* 40px — Hero标题 */

  /* 行高 */
  --qw-leading-tight: 1.25;
  --qw-leading-normal: 1.7;
  --qw-leading-relaxed: 1.85;

  /* 字重 */
  --qw-weight-normal: 400;
  --qw-weight-medium: 500;
  --qw-weight-semibold: 600;
  --qw-weight-bold: 700;

  /* 间距比例尺 */
  --qw-space-xs: 0.25rem;    /* 4px */
  --qw-space-sm: 0.5rem;     /* 8px */
  --qw-space-md: 1rem;       /* 16px */
  --qw-space-lg: 2rem;       /* 32px */
  --qw-space-xl: 4rem;       /* 64px */
  --qw-space-2xl: 7.5rem;    /* 120px */

  /* 圆角 */
  --qw-radius-sm: 6px;
  --qw-radius-md: 12px;
  --qw-radius-lg: 20px;
  --qw-radius-full: 9999px;

  /* 过渡 */
  --qw-transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --qw-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --qw-transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* 内容宽度 */
  --qw-content-sm: 680px;
  --qw-content: 900px;
  --qw-content-lg: 1100px;

  /* z-index 层级 */
  --qw-z-base: 0;
  --qw-z-raised: 10;
  --qw-z-sticky: 100;
  --qw-z-overlay: 200;
  --qw-z-modal: 300;
  --qw-z-toast: 400;

  /* Callout / Toggle / TOC 结构令牌 */
  --qw-callout-radius: var(--qw-radius-sm);
  --qw-callout-padding: var(--qw-space-md) var(--qw-space-lg);
  --qw-callout-gap: 12px;
  --qw-callout-icon-size: 1.2em;

  --qw-toggle-indent: 1.1em;
  --qw-toggle-bar-width: 2px;
  --qw-toggle-bar-color: var(--qw-border-light);

  --qw-toc-width: 200px;
  --qw-toc-min-viewport: 1300px;
  --qw-toc-active-color: var(--qw-brand);
  --qw-toc-hover-color: var(--qw-gold);

  --qw-content-reading: 720px;
  --qw-content-wide: 1280px;
}

/* ============================================
   GEP v8 进化设计令牌 (管线同步 · Gen 3)
   用于研报渲染管线 — build_qa.mjs / build_lithium
   管线侧独立使用 distribution/quewai_tokens.css
   此处同步: 研报页可直接引用这些令牌
   和谐度: 0.978 | 五神: 温润 0.948 / 克制 1.000 / 节律 1.000 / 层次 0.963 / 余韵 0.975
   ============================================ */

:root {
  /* GEP 色彩 — 温润 */
  --qw-gep-navy: #0a1124;
  --qw-gep-navy-surface: #102131;
  --qw-gep-gold: #b69226;
  --qw-gep-gold-muted: #a59566;
  --qw-gep-gold-subtle: rgba(184,148,46,0.08);
  --qw-gep-ink: #1a1a18;
  --qw-gep-ink-secondary: #4c5652;
  --qw-gep-ink-muted: #888888;
  --qw-gep-ink-whisper: #b0b0b0;
  --qw-gep-paper: #fefefe;
  --qw-gep-paper-warm: #f4f4f1;
  --qw-gep-rule: #e9e5e5;
  --qw-gep-rule-light: #e7e6e6;
  --qw-gep-red: #C0392B;
  --qw-gep-green: #1E8449;
  --qw-gep-blue-accent: #1a56db;

  /* GEP 排版 — 层次·节律 */
  --qw-gep-serif: 'Noto Serif SC', 'STSong', 'Songti SC', Georgia, serif;
  --qw-gep-sans: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  --qw-gep-size-base: 10.036937037800934pt;
  --qw-gep-size-huge: 26pt;
  --qw-gep-size-h1: 20pt;
  --qw-gep-size-h2: 15pt;
  --qw-gep-size-h3: 12.880078393998588pt;
  --qw-gep-size-small: 8.5pt;
  --qw-gep-size-tiny: 7pt;
  --qw-gep-leading-body: 6.258965453977348pt;
  --qw-gep-leading-heading: 3pt;
  --qw-gep-weight-heading: 700;
  --qw-gep-weight-body: 400;
  --qw-gep-letter-spacing-h1: -0.9840609792414649px;
  --qw-gep-letter-spacing-tag: 5px;

  /* GEP 间距 — 节律 */
  --qw-gep-col: 860px;
  --qw-gep-section-gap: 40px;
  --qw-gep-para-gap: 16px;
  --qw-gep-cover-pad-top: 140px;
  --qw-gep-cover-pad-bottom: 144px;
  --qw-gep-margin-top: 80pt;
  --qw-gep-margin-bottom: 72pt;
  --qw-gep-margin-left: 80pt;
  --qw-gep-margin-right: 80pt;
  --qw-gep-metric-strip-pad: 40px;

  /* GEP 线 — 克制·余韵 */
  --qw-gep-cover-line-w: 48px;
  --qw-gep-cover-line-h: 1.0px;
  --qw-gep-thin-rule-h: 0.3275890462586859px;
  --qw-gep-chapter-rule-len: 80px;
  --qw-gep-chapter-rule-h: 0.4px;
  --qw-gep-box-border-w: 0.4px;
  --qw-gep-quote-bar-w: 0.4px;

  /* GEP 图表 — 克制·数据墨水 */
  --qw-gep-chart-grid-alpha: 0.03;
  --qw-gep-chart-axis-alpha: 0.15;
  --qw-gep-chart-label-min: 9px;
  --qw-gep-chart-bar-max-w: 40px;
  --qw-gep-chart-line-w: 1.5px;
  --qw-gep-chart-symbol-size: 5px;
  --qw-gep-chart-bar-radius: 2 2 0 0px;

  /* GEP 节奏 — 垂直呼吸 */
  --qw-gep-baseline-grid: 4pt;
  --qw-gep-chapter-offset: 100pt;
  --qw-gep-heading-space-before: 1;
  --qw-gep-heading-space-after: 0.4;
  --qw-gep-table-row-pad: 8pt;

  --qw-gep-scale-ratio: 1.25;
}

/* ===== 全局重置 ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--qw-sans);
  font-size: var(--qw-text-base);
  line-height: var(--qw-leading-normal);
  color: var(--qw-text);
  background: var(--qw-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--qw-transition), color var(--qw-transition);
}

/* ===== 排版基础 ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--qw-serif);
  font-weight: var(--qw-weight-bold);
  line-height: var(--qw-leading-tight);
  color: var(--qw-text);
  margin: 0 0 var(--qw-space-md);
}

h1 { font-size: var(--qw-text-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--qw-text-xl); letter-spacing: -0.01em; }
h3 { font-size: var(--qw-text-lg); }
h4 { font-size: var(--qw-text-base); font-family: var(--qw-sans); }

p {
  margin: 0 0 var(--qw-space-md);
  color: var(--qw-text-secondary);
}

a {
  color: var(--qw-brand);
  text-decoration: none;
  transition: color var(--qw-transition-fast);
}

a:hover {
  color: var(--qw-brand-light);
}

blockquote {
  margin: var(--qw-space-lg) 0;
  padding: var(--qw-space-md) var(--qw-space-lg);
  border-left: 4px solid var(--qw-gold);
  background: var(--qw-insight-bg);
  border-radius: 0 var(--qw-radius-md) var(--qw-radius-md) 0;
  font-style: italic;
  color: var(--qw-text-secondary);
}

img {
  max-width: 100%;
  height: auto;
}

/* 选中 */
::selection {
  background: var(--qw-gold-subtle);
  color: var(--qw-text);
}