/* ============================================================
 *  乾元科技 · 语义颜色令牌（全站唯一颜色表）
 *  - Next 页面经 app/globals.css @import 打包；
 *  - /listing-analyzer/ 等静态页直接 <link> 本文件。
 *  三层规则：
 *    1. :root 默认浅色（JS 关闭、系统浅色）
 *    2. 系统深色且未手动选浅色 → 深色（JS 关闭时也生效）
 *    3. data-theme="dark"（由 /qy-theme-init.js 在首帧前写入）→ 深色
 * ============================================================ */
:root {
  color-scheme: light;
  --qy-bg: #f7f5f0;
  --qy-surface: #ffffff;
  --qy-surface-subtle: #eeebe4;
  --qy-text: #182323;
  --qy-text-2: #4b5859;
  --qy-text-3: #5d696a;
  --qy-border: #c8cfcc;
  --qy-border-subtle: #dadfd9;
  --qy-border-strong: #7d8886; /* 表单字段边界，≥3:1 */
  --qy-accent: #087482;
  --qy-accent-hover: #075e6a;
  --qy-on-accent: #ffffff;
  --qy-accent-subtle: #e0efed;
  --qy-focus: #095fca;
  --qy-success: #236b45;
  --qy-warning: #885a0b;
  --qy-danger: #af3434;
  --qy-shadow: 0 10px 30px -18px rgba(24, 35, 35, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --qy-bg: #131d1f;
    --qy-surface: #1c292c;
    --qy-surface-subtle: #223237;
    --qy-text: #f3f2eb;
    --qy-text-2: #b8c7c8;
    --qy-text-3: #a1b5b7;
    --qy-border: #4b6368;
    --qy-border-subtle: #344b50;
    --qy-border-strong: #6f8a90;
    --qy-accent: #78cdd2;
    --qy-accent-hover: #9adde0;
    --qy-on-accent: #102326;
    --qy-accent-subtle: #213e43;
    --qy-focus: #8ebeff;
    --qy-success: #92d3ac;
    --qy-warning: #f0c772;
    --qy-danger: #ffa6a0;
    --qy-shadow: 0 14px 34px -20px rgba(0, 0, 0, 0.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --qy-bg: #131d1f;
  --qy-surface: #1c292c;
  --qy-surface-subtle: #223237;
  --qy-text: #f3f2eb;
  --qy-text-2: #b8c7c8;
  --qy-text-3: #a1b5b7;
  --qy-border: #4b6368;
  --qy-border-subtle: #344b50;
  --qy-border-strong: #6f8a90;
  --qy-accent: #78cdd2;
  --qy-accent-hover: #9adde0;
  --qy-on-accent: #102326;
  --qy-accent-subtle: #213e43;
  --qy-focus: #8ebeff;
  --qy-success: #92d3ac;
  --qy-warning: #f0c772;
  --qy-danger: #ffa6a0;
  --qy-shadow: 0 14px 34px -20px rgba(0, 0, 0, 0.7);
}

html {
  background: var(--qy-bg);
  color: var(--qy-text);
}

/* 用户手动切换时短暂开启颜色过渡；首帧、系统事件不加；减少动效时关闭 */
html.qy-theme-anim,
html.qy-theme-anim *,
html.qy-theme-anim *::before,
html.qy-theme-anim *::after {
  transition: color 0.14s ease, background-color 0.14s ease,
    border-color 0.14s ease, fill 0.14s ease, stroke 0.14s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  html.qy-theme-anim,
  html.qy-theme-anim *,
  html.qy-theme-anim *::before,
  html.qy-theme-anim *::after {
    transition: none !important;
  }
}
