/* ==========================================================================
   ABK UI · Design tokens
   手写体 + 纸张质感 + 墨色层级的简约设计系统。
   所有颜色、圆角、间距、动效都从这里取，组件文件不写魔法值。
   ========================================================================== */

:root {
  /* ---- 字体 ---- */
  --font-hand: "LXGW WenKai", "Ma Shan Zheng", "Caveat", "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", cursive;
  --font-ui: "LXGW WenKai", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "LXGW WenKai Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;

  --lh-tight: 1.25;
  --lh-normal: 1.6;
  --lh-loose: 1.85;

  /* ---- 字体大小：手机端稍小 ---- */
  --fw-regular: 400;
  --fw-bold: 700;

  /* ---- 间距（8px 基） ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;

  /* ---- 圆角 ---- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* ---- 动效 ---- */
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --dur-slow: 360ms;

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

  /* ---- 纸张 ---- */
  --paper-grain: none;
}

/* 默认种子 #496a78；颜色由 assets/js/demo-palette.js 的角色映射生成。 */
:root,
[data-theme="light"] {
  color-scheme: light;

  --bg: #f5fafd;
  --bg-raised: #ffffff;
  --bg-sunken: #eaeef2;
  --bg-input: #f0f4f7;
  --ink: #171c1f;
  --ink-soft: #40484c;
  --ink-muted: #4e565a;
  --ink-faint: #576064;
  --line: #c0c8cc;
  --line-strong: #70787d;
  --accent: #0c6780;
  --accent-ink: #ffffff;
  --accent-soft: #baeaff;
  --accent-soft-ink: #004d62;
  --accent-line: #c0c8cc;
  --danger: #ba1a1a;
  --danger-ink: #ffffff;
  --danger-soft: #ffdad6;
  --danger-soft-ink: #93000a;
  --info: #4c616b;
  --info-ink: #ffffff;
  --info-soft: #cfe6f1;
  --info-soft-ink: #354a53;
  --success: #2f6a40;
  --success-ink: #ffffff;
  --success-soft: #b2f2bc;
  --success-soft-ink: #00210b;
  --warning: #875300;
  --warning-ink: #ffffff;
  --warning-soft: #ffddb9;
  --warning-soft-ink: #2b1700;
  --scrim: #0000006b;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .06), 0 1px 1px rgb(0 0 0 / .04);
  --shadow-md: 0 6px 16px -6px rgb(0 0 0 / .22), 0 1px 2px rgb(0 0 0 / .06);
  --shadow-lg: 0 22px 48px -18px rgb(0 0 0 / .32), 0 2px 6px rgb(0 0 0 / .06);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0f1417;
  --bg-raised: #1b2023;
  --bg-sunken: #0a0f11;
  --bg-input: #252b2d;
  --ink: #dee3e6;
  --ink-soft: #c0c8cc;
  --ink-muted: #bac2c7;
  --ink-faint: #b2babf;
  --line: #40484c;
  --line-strong: #8a9296;
  --accent: #89d0ed;
  --accent-ink: #003545;
  --accent-soft: #004d62;
  --accent-soft-ink: #baeaff;
  --accent-line: #40484c;
  --danger: #ffb4ab;
  --danger-ink: #690005;
  --danger-soft: #93000a;
  --danger-soft-ink: #ffdad6;
  --info: #b3cad5;
  --info-ink: #1e333c;
  --info-soft: #354a53;
  --info-soft-ink: #cfe6f1;
  --success: #96d5a1;
  --success-ink: #003918;
  --success-soft: #13512a;
  --success-soft-ink: #b2f2bc;
  --warning: #ffb964;
  --warning-ink: #472a00;
  --warning-soft: #663e00;
  --warning-soft-ink: #ffddb9;
  --scrim: #00000094;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-md: 0 8px 20px -8px rgb(0 0 0 / .65), 0 1px 2px rgb(0 0 0 / .4);
  --shadow-lg: 0 26px 56px -20px rgb(0 0 0 / .8), 0 2px 8px rgb(0 0 0 / .4);
}

/* ---------------------------------------------------------------- 无障碍 */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
  }
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (prefers-contrast: more) {
  :root,
  :root[data-theme] {
    --line: var(--ink-muted);
    --line-strong: var(--ink-soft);
  }
}
