/*
 * 智架 ListWizard design tokens — the single source for both the public site
 * (Jinja, served at /static/design/tokens.css) and the SPA (imported by
 * frontend/src/main.tsx). Change a value here and both surfaces follow.
 *
 * Fonts are self-hosted: Google Fonts is unreachable from mainland China, where
 * most of our sellers work. Chinese text falls back to the system CJK face
 * (PingFang SC on macOS, Microsoft YaHei on Windows, Noto Sans SC on Linux) —
 * a CJK webfont would be several MB.
 *
 * Dark mode: an explicit data-theme on <html> wins; otherwise the OS setting.
 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/poppins-600-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/poppins-700-latin.woff2') format('woff2');
}

:root {
  /* Type */
  --font-sans: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC',
    system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Poppins', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC',
    system-ui, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --text-xs: 0.75rem; /* 12 */
  --text-sm: 0.8125rem; /* 13 — table body */
  --text-base: 0.875rem; /* 14 — app body */
  --text-md: 1rem; /* 16 — site body */
  --text-lg: 1.125rem; /* 18 */
  --text-xl: 1.375rem; /* 22 — app page title */
  --text-2xl: 1.75rem; /* 28 */
  --text-3xl: 2.25rem; /* 36 — site section title */
  --text-4xl: 3.25rem; /* 52 — site hero */

  /* Space (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --row-h: 36px; /* data table row */
  --sidebar-w: 224px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;

  /* Color — light */
  --bg: #f7f8fa; /* app canvas */
  --surface: #ffffff; /* cards, tables, site body */
  --surface-2: #f1f4f8; /* table header, subtle fills */
  --surface-sunken: #eef2f7;
  --border: #e3e8ef;
  --border-strong: #cdd5df;
  --fg: #0f172a; /* ink */
  --fg-muted: #5b6678;
  --fg-subtle: #8a94a6;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8efff;
  --accent-fg: #ffffff;

  --cta: #f5b301; /* the one warm button, on dark bands only */
  --cta-fg: #1a1300;
  --band: #0f1f44; /* dark closing band on the site */
  --band-fg: #e8edf7;

  --success: #15803d;
  --success-soft: #e7f6ec;
  --warning: #b45309;
  --warning-soft: #fdf3e2;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --info: #0e7490;
  --info-soft: #e3f4f8;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.18);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.35);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #16213a;
    --surface-sunken: #0e1628;
    --border: #22304d;
    --border-strong: #2f4166;
    --fg: #e6ebf5;
    --fg-muted: #9aa6bd;
    --fg-subtle: #6b7891;
    --accent: #5b8cff;
    --accent-hover: #7aa2ff;
    --accent-soft: #1a2a52;
    --accent-fg: #0b1120;
    --band: #0a1530;
    --band-fg: #e6ebf5;
    --success: #4ade80;
    --success-soft: #12301f;
    --warning: #fbbf24;
    --warning-soft: #33260b;
    --danger: #f87171;
    --danger-soft: #3a1616;
    --info: #38bdf8;
    --info-soft: #0f2b3a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0b1120;
  --surface: #111a2e;
  --surface-2: #16213a;
  --surface-sunken: #0e1628;
  --border: #22304d;
  --border-strong: #2f4166;
  --fg: #e6ebf5;
  --fg-muted: #9aa6bd;
  --fg-subtle: #6b7891;
  --accent: #5b8cff;
  --accent-hover: #7aa2ff;
  --accent-soft: #1a2a52;
  --accent-fg: #0b1120;
  --band: #0a1530;
  --band-fg: #e6ebf5;
  --success: #4ade80;
  --success-soft: #12301f;
  --warning: #fbbf24;
  --warning-soft: #33260b;
  --danger: #f87171;
  --danger-soft: #3a1616;
  --info: #38bdf8;
  --info-soft: #0f2b3a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
