/* hagents design tokens. Source of truth: DESIGN.md. Dark is the default theme. Light is opt-in:
   set data-theme="light" on the root or on any element. Contrast ratios are WCAG 2.x, measured. */

:root {
	/* Core palette */
	--hg-ultramarine: #2B3CC2;        /* accent. Paper text on it: 7.7:1 */
	--hg-ultramarine-deep: #1F2C99;   /* accent hover */
	--hg-ultramarine-soft: #E7E9FA;   /* selected rows, accent tags. Ultramarine text on it: 6.9:1 */
	--hg-ultramarine-light: #8E9BFF;  /* accent in dark mode. On Night: 7.4:1 */
	--hg-paper: #F8F7F0;              /* shared with Heinrichs.ai */
	--hg-white: #FFFFFF;
	--hg-mist: #DCE5E3;               /* shared with Heinrichs.ai */
	--hg-steel: #C1C1C1;              /* shared with Heinrichs.ai */
	--hg-slate: #5B6168;              /* shared. On Paper: 5.8:1 */
	--hg-ink: #051A1E;                /* shared. On Paper: 17:1 */
	--hg-night: #0B1416;              /* dark ground */
	--hg-night-2: #121D20;            /* dark surface */
	--hg-night-3: #1A272B;            /* dark raised surface, hover */
	--hg-fog: #9AA6A4;                /* secondary text in dark mode. On Night: 7.4:1 */
	--hg-petrol: #004852;             /* Heinrichs.ai brand colour; in hagents only for "running" */

	/* Agent palette: square avatar tiles with white initials (all at least 5.2:1).
	   An agent colour always comes with initials and a name. Never use it for status. */
	--hg-agent-teal: #0F7A6E;
	--hg-agent-ocean: #1F6A8A;
	--hg-agent-violet: #6B4FA0;
	--hg-agent-plum: #8C2F6B;
	--hg-agent-rose: #A3365C;
	--hg-agent-rust: #8A4B14;
	--hg-agent-olive: #7A6A12;
	--hg-agent-moss: #4F6B1F;
	--hg-agent-graphite: #4D5560;

	/* Type */
	--hg-font: "Schibsted Grotesk", Arial, sans-serif;
	--hg-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	/* Shape and space */
	--hg-radius-sm: 2px;
	--hg-radius: 3px;
	--hg-radius-lg: 4px;
	--hg-space-1: 4px;
	--hg-space-2: 8px;
	--hg-space-3: 12px;
	--hg-space-4: 16px;
	--hg-space-5: 24px;
	--hg-space-6: 32px;
	--hg-space-7: 48px;
	--hg-space-8: 64px;
	--hg-ease: cubic-bezier(0.16, 1, 0.3, 1);   /* expo-out, shared with Heinrichs.ai */
}

/* Semantic tokens: dark, the default. Any element can force a theme with data-theme. */
:root,
[data-theme="dark"] {
	--hg-bg: var(--hg-night);
	--hg-surface: var(--hg-night-2);
	--hg-surface-quiet: var(--hg-night-3);
	--hg-text: var(--hg-paper);
	--hg-text-2: var(--hg-fog);
	--hg-rule: rgba(248, 247, 240, 0.14);
	--hg-border-strong: #3A474A;
	--hg-accent: var(--hg-ultramarine-light);
	--hg-accent-hover: #A9B3FF;
	--hg-accent-soft: #1D2552;
	--hg-accent-text: var(--hg-night);
	--hg-focus: var(--hg-ultramarine-light);
	--hg-rungs-ink: rgba(248, 247, 240, 0.14);
	--hg-running: #7FB3BA;  --hg-running-soft: #12333A;
	--hg-waiting: #F0B54A;  --hg-waiting-soft: #3A2A0E;
	--hg-done: #6FCB8D;     --hg-done-soft: #12301E;
	--hg-failed: #FF7A66;   --hg-failed-soft: #3A1714;
	--hg-blocked: var(--hg-paper); --hg-blocked-soft: #1E2B2E;
	/* Rungs pattern: the shared Heinrichs.ai texture. In hagents it also marks "blocked by budget". */
	--hg-rungs: repeating-linear-gradient(180deg, var(--hg-rungs-ink) 0 2px, transparent 2px 4px);
	color-scheme: dark;
}

/* Semantic tokens: light, opt-in. */
[data-theme="light"] {
	--hg-bg: var(--hg-paper);
	--hg-surface: var(--hg-white);
	--hg-surface-quiet: var(--hg-mist);
	--hg-text: var(--hg-ink);
	--hg-text-2: var(--hg-slate);
	--hg-rule: rgba(5, 26, 30, 0.14);
	--hg-border-strong: var(--hg-steel);
	--hg-accent: var(--hg-ultramarine);
	--hg-accent-hover: var(--hg-ultramarine-deep);
	--hg-accent-soft: var(--hg-ultramarine-soft);
	--hg-accent-text: var(--hg-paper);
	--hg-focus: var(--hg-ultramarine);
	--hg-rungs-ink: rgba(5, 26, 30, 0.16);

	/* Status. Each pair: text/dot colour, chip fill. Never rely on colour alone: always add the word. */
	--hg-running: var(--hg-petrol);   --hg-running-soft: var(--hg-mist);   /* 8.0:1 */
	--hg-waiting: #9A5B00;            --hg-waiting-soft: #FBEFD9;          /* 4.8:1 */
	--hg-done: #2E7045;               --hg-done-soft: #E2F0E6;             /* 5.1:1 */
	--hg-failed: #C42A18;             --hg-failed-soft: #FBE5E1;           /* 4.7:1 */
	--hg-blocked: var(--hg-ink);      --hg-blocked-soft: #E7E6DF;          /* 14.3:1, plus the rungs pattern */

	/* Rungs pattern: the shared Heinrichs.ai texture. In hagents it also marks "blocked by budget". */
	--hg-rungs: repeating-linear-gradient(180deg, var(--hg-rungs-ink) 0 2px, transparent 2px 4px);
	color-scheme: light;
}
