/*
 * 太虚宗统一设计系统规范 (TaiXu Design Foundation v2)
 * 中文阅读友好 · 自然现代高级 · 完整多端适配 · 高可访问性
 */

:root {
  color-scheme: light;
  
  /* 基础与表面色彩 (日间模式) */
  --txd-page: #f5f7f5;
  --txd-surface: #ffffff;
  --txd-surface-soft: #edf2ee;
  --txd-surface-card: #ffffff;
  --txd-ink: #141a16;
  --txd-ink-strong: #090c0a;
  --txd-muted: #5e6b63;
  --txd-muted-light: #88958c;
  --txd-line: #d8e0da;
  --txd-line-strong: #b4c2b8;
  --txd-line-subtle: rgba(31, 102, 85, 0.08);

  /* 主题品牌与语义色 (日间) */
  --txd-jade: #1f6655;
  --txd-jade-hover: #164c3f;
  --txd-jade-soft: #eaf4ef;
  --txd-jade-text: #174e40;
  
  --txd-gold: #a67625;
  --txd-gold-soft: #f7efe1;
  --txd-gold-hover: #8c601a;
  
  --txd-danger: #c0392b;
  --txd-danger-soft: #fdf0ed;
  --txd-success: #27ae60;
  --txd-success-soft: #edfbf3;
  --txd-info: #2980b9;
  --txd-info-soft: #ebf5fb;

  /* 字体系统 (中文优先现代化无衬线字族) */
  --txd-font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --txd-font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, Menlo, monospace;
  
  /* 字号阶梯 */
  --txd-text-xs: 0.75rem;    /* 12px */
  --txd-text-sm: 0.8125rem;  /* 13px */
  --txd-text-md: 0.875rem;   /* 14px 基础正文 */
  --txd-text-lg: 1rem;       /* 16px */
  --txd-title-sm: 1.125rem;  /* 18px 小标题 */
  --txd-title-md: 1.375rem;  /* 22px 模块标题 */
  --txd-title-lg: 1.75rem;   /* 28px 页面标题 */
  --txd-title-xl: 2.25rem;   /* 36px 大标题 */
  --txd-title-hero: clamp(2.25rem, 5vw, 3.5rem);

  --txd-leading-tight: 1.25;
  --txd-leading-snug: 1.45;
  --txd-leading-normal: 1.65;
  --txd-leading-relaxed: 1.8;

  /* 间距标尺 */
  --txd-space-1: 0.25rem;  /* 4px */
  --txd-space-2: 0.5rem;   /* 8px */
  --txd-space-3: 0.75rem;  /* 12px */
  --txd-space-4: 1rem;     /* 16px */
  --txd-space-5: 1.25rem;  /* 20px */
  --txd-space-6: 1.5rem;   /* 24px */
  --txd-space-8: 2rem;     /* 32px */
  --txd-space-10: 2.5rem;  /* 40px */
  --txd-space-12: 3rem;    /* 48px */
  --txd-space-16: 4rem;    /* 64px */

  /* 圆角标尺 */
  --txd-radius-xs: 4px;
  --txd-radius-sm: 6px;
  --txd-radius-control: 8px;
  --txd-radius-card: 12px;
  --txd-radius-panel: 16px;
  --txd-radius-modal: 20px;
  --txd-radius-round: 9999px;

  /* 尺寸与约束 */
  --txd-control-sm: 2rem;     /* 32px */
  --txd-control-md: 2.5rem;   /* 40px */
  --txd-control-lg: 2.75rem;  /* 44px */
  --txd-touch-min: 2.75rem;   /* 44px 移动端最低触控 */
  --txd-header-desktop: 3.75rem; /* 60px */
  --txd-header-mobile: 3.5rem;   /* 56px */
  --txd-container: 75rem;        /* 1200px */

  /* 阴影 */
  --txd-shadow-sm: 0 1px 3px rgba(18, 30, 23, 0.05);
  --txd-shadow-card: 0 4px 16px rgba(18, 30, 23, 0.06);
  --txd-shadow-popover: 0 12px 32px rgba(18, 30, 23, 0.12);
  --txd-shadow-modal: 0 24px 64px rgba(18, 30, 23, 0.18);

  /* 焦点与动效 */
  --txd-focus-ring: 0 0 0 3px rgba(31, 102, 85, 0.22);
  --txd-motion-fast: 140ms ease-out;
  --txd-motion-normal: 220ms ease-out;
  --txd-motion-smooth: 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* 夜间 / 暗色模式色彩系统 */
:root[data-theme="night"],
:root[data-theme="dark"],
html[data-theme="night"],
html[data-theme="dark"] {
  color-scheme: dark;
  
  --txd-page: #0d110e;
  --txd-surface: #141a16;
  --txd-surface-soft: #1b231e;
  --txd-surface-card: #141a16;
  --txd-ink: #edf2ee;
  --txd-ink-strong: #ffffff;
  --txd-muted: #8d9b91;
  --txd-muted-light: #67756b;
  --txd-line: rgba(255, 255, 255, 0.09);
  --txd-line-strong: rgba(255, 255, 255, 0.16);
  --txd-line-subtle: rgba(255, 255, 255, 0.05);

  --txd-jade: #329674;
  --txd-jade-hover: #3eb58c;
  --txd-jade-soft: #172d24;
  --txd-jade-text: #6fd3ae;

  --txd-gold: #d4a359;
  --txd-gold-soft: #2e2617;
  --txd-gold-hover: #e5be7a;

  --txd-danger: #e74c3c;
  --txd-danger-soft: #381a17;
  --txd-success: #2ecc71;
  --txd-success-soft: #153322;
  --txd-info: #3498db;
  --txd-info-soft: #182a38;

  --txd-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --txd-shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
  --txd-shadow-popover: 0 14px 38px rgba(0, 0, 0, 0.45);
  --txd-shadow-modal: 0 28px 72px rgba(0, 0, 0, 0.6);

  --txd-focus-ring: 0 0 0 3px rgba(50, 150, 116, 0.32);
}

@media (max-width: 768px) {
  :root {
    --txd-text-md: 0.875rem;
    --txd-text-lg: 0.9375rem;
    --txd-title-md: 1.25rem;
    --txd-title-lg: 1.5rem;
    --txd-title-xl: 1.875rem;
    --txd-control-md: 2.625rem;
    --txd-control-lg: 2.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --txd-motion-fast: 0ms;
    --txd-motion-normal: 0ms;
    --txd-motion-smooth: 0ms;
  }
}
