/* Uzei v2 design tokens. Every colour pair used by components.css is checked
   for contrast by tests/test_v2_tokens.py (4.5:1 for text, 3:1 for controls and the focus ring). */

:root {
  color-scheme: light;

  /* colour */
  --bg: #fafaf7;              /* warm paper (was a cool #f8fafc) */
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1a1a17;
  --muted: #66615a;
  --border: #e6e2da;
  --control-border: #857f74;
  --accent: #2d5e99;            /* the one accent: a muted ink blue */
  --accent-hover: #234a7a;
  --accent-ink: #ffffff;
  --accent-soft: #e9eff7;
  --accent-soft-ink: #234a7a;
  --success: #0a7550;
  --success-soft: #e3f6ee;
  --warning: #8a5600;
  --warning-soft: #fdf1da;
  --danger: #c0262d;
  --danger-hover: #9d1d23;
  --danger-ink: #ffffff;
  --danger-soft: #fdeaea;
  --focus: #2d5e99;
  --ink: #111111;
  --paper: #fafaf7;

  /* type */
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-12: .75rem;
  --fs-14: .875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-22: 1.375rem;
  --fs-28: 1.75rem;
  --fs-36: 2.25rem;
  --lh: 1.6;

  /* space (4pt) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;

  /* shape */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 16px;
  --shadow-1: 0 1px 3px rgb(60 50 30 / .07);
  --shadow-2: 0 4px 16px rgb(60 50 30 / .08);
  --shadow-3: 0 12px 36px rgb(60 50 30 / .13);

  /* layout */
  --content-max: 1120px;
  --measure: 72ch;
  --sidebar-w: 248px;
  --chat-panel-w: clamp(420px, 36vw, 560px);
  --hit-min: 40px;

  /* motion */
  --t-instant: 100ms;
  --t-quick: 200ms;
  --t-slow: 400ms;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* layers */
  --z-sticky: 10;
  --z-dropdown: 20;
  --z-drawer: 30;
  --z-modal: 40;
  --z-toast: 50;
}

@media (pointer: coarse) {
  :root { --hit-min: 44px; }
}

/* dark: the same block twice, once for the OS setting and once for a manual data-theme override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f141b;
    --surface: #171d26;
    --surface-2: #1f2733;
    --text: #e8edf3;
    --muted: #9db3cb;
    --border: #2a3441;
    --control-border: #7d8fa6;
    --accent: #6cb0ff;
    --accent-hover: #8fc3ff;
    --accent-ink: #06121f;
    --accent-soft: #14283f;
    --accent-soft-ink: #a9d1ff;
    --success: #4fd6a0;
    --success-soft: #11291f;
    --warning: #f2b756;
    --warning-soft: #2e2410;
    --danger: #ff8a8f;
    --danger-hover: #ffa9ad;
    --danger-ink: #1c0507;
    --danger-soft: #331517;
    --focus: #6cb0ff;
    --ink: #f2f2f2;
    --paper: #12161c;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-2: 0 4px 12px rgb(0 0 0 / .45);
    --shadow-3: 0 12px 32px rgb(0 0 0 / .55);
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141b;
  --surface: #171d26;
  --surface-2: #1f2733;
  --text: #e8edf3;
  --muted: #9db3cb;
  --border: #2a3441;
  --control-border: #7d8fa6;
  --accent: #6cb0ff;
  --accent-hover: #8fc3ff;
  --accent-ink: #06121f;
  --accent-soft: #14283f;
  --accent-soft-ink: #a9d1ff;
  --success: #4fd6a0;
  --success-soft: #11291f;
  --warning: #f2b756;
  --warning-soft: #2e2410;
  --danger: #ff8a8f;
  --danger-hover: #ffa9ad;
  --danger-ink: #1c0507;
  --danger-soft: #331517;
  --focus: #6cb0ff;
  --ink: #f2f2f2;
  --paper: #12161c;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-2: 0 4px 12px rgb(0 0 0 / .45);
  --shadow-3: 0 12px 32px rgb(0 0 0 / .55);
}
