/*
  Harness design tokens. Source of truth: design system "Harness" (tokens.json).
  Light theme is primary; dark follows the OS unless data-theme is set on <html>.
*/
:root {
  color-scheme: light;

  /* Near-neutral, faintly warm greys. Each step reads on its own:
     bg-1 (thread) > bg-2 (fills: table heads, cards) > bg-0 (sidebar) > bg-3 (hover, user bubble). */
  --bg-0: #f3f3f0;
  --bg-1: #fdfdfc;
  --bg-2: #f6f6f4;
  --bg-3: #ecece9;
  --border: #e6e5e1;
  --border-strong: #d2d0ca;
  --fg: #1b1c1e;
  --fg-muted: #505259;
  --fg-subtle: #686a70;
  --primary: #1b1c1e;
  --primary-hover: #34363a;
  --on-primary: #ffffff;
  --accent: #2f5bea;
  --accent-soft: #edf1fd;
  /* Skills (docs/skills.md): the person's own saved tasks. */
  --skill: #7a3fd1;
  --skill-soft: #f3edfc;
  --focus: #2f5bea;
  --success: #18794e;
  --success-soft: #e9f7ef;
  --warning: #8f5400;
  --lamp: #e3962c;
  --warning-soft: #fdf3e2;
  --danger: #c2352e;
  --danger-soft: #fdecea;
  /* Project colors (docs/projects.md, «Цвет проекта»): only the project's mark is painted. Each reads ≥ 3:1
     on the sidebar as a 1.5px icon stroke, so yellow leans to mustard. */
  --pj-blue: #2f6fe0;
  --pj-violet: #7a4fd6;
  --pj-pink: #c8418a;
  --pj-red: #d0453b;
  --pj-orange: #c8651a;
  --pj-yellow: #a07e00;
  --pj-green: #2f8a4a;
  --pj-teal: #13868a;
  --cite-bg: #fff3bf;
  --cite-bg-strong: #ffeaa0;
  --scrim: rgba(27, 28, 30, 0.32);
  --tooltip-bg: #15171a;
  --tooltip-fg: #ffffff;
  /* Roles that differ between themes (dark values below). */
  /* Long answers in slightly softer ink than headings and controls (14.5:1 on bg-1). */
  --fg-prose: #27282b;
  --selected-bg: var(--accent-soft);
  /* The selected chat is a step darker than a hovered one, so selection always wins. */
  --side-active: #e2e2dd;
  --side-active-shadow: none;
  --seg-thumb: var(--bg-1);
  /* The composer is focused most of the time: a calm border, no blue. */
  --composer-focus-border: #bdbbb4;
  --composer-focus-ring: var(--shadow-sm);

  --shadow-sm: 0 1px 2px rgba(27, 28, 30, 0.05);
  --shadow-pop: 0 12px 32px rgba(27, 28, 30, 0.12), 0 0 0 1px rgba(27, 28, 30, 0.06);

  --font-sans: 'Golos Text Variable', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, Menlo, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --control-sm: 28px;
  --control-md: 36px;
  --control-lg: 44px;
  --titlebar-height: 52px;
  --sidebar-width: 272px;
  --thread-width: 700px;
  /* Side gutter grows with the window: 16px on a narrow window, 32px on a wide one. */
  --gutter: clamp(16px, 3.2vw, 32px);

  /* Feedback timing: see docs/ux-principles.md */
  --dur-instant: 80ms;
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --tooltip-delay: 450ms;
}

/* Dark: the same faintly warm neutrals as light, so switching themes keeps the character.
   The selected chat is a step lighter than a hovered one; the composer focus is calm, no blue glow. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg-0: #131312;
    --bg-1: #1b1b1a;
    --bg-2: #212120;
    --bg-3: #2a2a27;
    --border: #30302d;
    --border-strong: #44433f;
    --fg: #ededeb;
    --fg-muted: #b3b1ab;
    --fg-subtle: #96948e;
    --primary: #d9d8d4;
    --primary-hover: #e8e7e3;
    --on-primary: #1b1b1a;
    --accent: #7c9cff;
    --accent-soft: #1c2543;
    --skill: #b892f5;
    --skill-soft: #2a2140;
    --focus: #7c9cff;
    --success: #4cc38a;
    --success-soft: #13281d;
    --warning: #e5a54b;
    --lamp: #f3aa3c;
    --warning-soft: #2c2213;
    --danger: #f0706a;
    --danger-soft: #2f1718;
    --pj-blue: #7ea2ff;
    --pj-violet: #ad91ff;
    --pj-pink: #f07cb9;
    --pj-red: #f27c72;
    --pj-orange: #f2a160;
    --pj-yellow: #e6c450;
    --pj-green: #63c985;
    --pj-teal: #52c7c4;
    --cite-bg: #332c12;
    --cite-bg-strong: #463c17;
    --scrim: rgba(0, 0, 0, 0.5);
    --tooltip-bg: #ededeb;
    --tooltip-fg: #1b1b1a;
    --fg-prose: #d9d8d4;
    --selected-bg: var(--accent-soft);
    --side-active: #31312e;
    --side-active-shadow: none;
    --composer-focus-border: #5a5852;
    --composer-focus-ring: none;
    --seg-thumb: #3a3a36;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg-0: #131312;
  --bg-1: #1b1b1a;
  --bg-2: #212120;
  --bg-3: #2a2a27;
  --border: #30302d;
  --border-strong: #44433f;
  --fg: #ededeb;
  --fg-muted: #b3b1ab;
  --fg-subtle: #96948e;
  --primary: #d9d8d4;
  --primary-hover: #e8e7e3;
  --on-primary: #1b1b1a;
  --accent: #7c9cff;
  --accent-soft: #1c2543;
  --skill: #b892f5;
  --skill-soft: #2a2140;
  --focus: #7c9cff;
  --success: #4cc38a;
  --success-soft: #13281d;
  --warning: #e5a54b;
  --lamp: #f3aa3c;
  --warning-soft: #2c2213;
  --danger: #f0706a;
  --danger-soft: #2f1718;
  --pj-blue: #7ea2ff;
  --pj-violet: #ad91ff;
  --pj-pink: #f07cb9;
  --pj-red: #f27c72;
  --pj-orange: #f2a160;
  --pj-yellow: #e6c450;
  --pj-green: #63c985;
  --pj-teal: #52c7c4;
  --cite-bg: #332c12;
  --cite-bg-strong: #463c17;
  --scrim: rgba(0, 0, 0, 0.5);
  --tooltip-bg: #ededeb;
  --tooltip-fg: #1b1b1a;
  --fg-prose: #d9d8d4;
  --selected-bg: var(--accent-soft);
  --side-active: #31312e;
  --side-active-shadow: none;
  --composer-focus-border: #5a5852;
  --composer-focus-ring: none;
  --seg-thumb: #3a3a36;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
