﻿/*
	EUtility design system: tokens.css
	-----------------------------------
	Every --ds-* token with plain, neutral defaults. An app's theme.css (loaded last) overrides them.
	Served at _content/EUtility/ds/tokens.css. Design: Ideas repo, docs/done/design-system.md.

	Load order: tokens.css, base.css, Bootstrap (if used), bootstrap.css, components.css, the app's theme.css.

	Light and dark: colors are written once with light-dark(light, dark). The browser picks one from color-scheme:
	the device's setting by default, or data-mode="light" / data-mode="dark" on <html> when the user picked one.
	An app that always uses one mode (House is always dark) sets data-mode on <html> for good.

	Derived tokens are worked out from the base colors with color-mix(), so a theme can set only the base colors.
	Set tokens on :root (or html), not on an element further down: a derived token is worked out where it's declared,
	so setting --ds-accent on a panel doesn't change that panel's --ds-accent-hover.
*/

:root {
	color-scheme: light dark;

	/* ---------- Color: base ---------- */

	--ds-bg: light-dark(#ffffff, #121214);
	--ds-surface: light-dark(#f6f6f7, #1b1b1f);
	--ds-surface-raised: light-dark(#ffffff, #24242a);
	--ds-text: light-dark(#1d1d1f, #ececef);
	--ds-muted: light-dark(#5f5f68, #a3a3ad);
	--ds-line: light-dark(#e2e2e6, #2e2e35);
	--ds-accent: light-dark(#2b5fd9, #7aa2ff);
	--ds-on-accent: light-dark(#ffffff, #0d1426);
	--ds-danger: light-dark(#b3261e, #ff8a80);
	--ds-on-danger: light-dark(#ffffff, #2a0705);
	--ds-success: light-dark(#2e7d32, #81c784);

	/* ---------- Color: derived ---------- */

	/* Borders of fields and outline buttons */
	--ds-line-strong: color-mix(in srgb, var(--ds-text) 28%, var(--ds-bg));
	/* Toward the text color: darker in light mode, lighter in dark mode */
	--ds-accent-hover: color-mix(in srgb, var(--ds-accent) 82%, var(--ds-text));
	/* Hovered rows and buttons, selected items */
	--ds-accent-tint: color-mix(in srgb, var(--ds-accent) 12%, var(--ds-bg));
	/* The accent as text (links, small labels); a theme darkens it when the accent is too light to read */
	--ds-accent-text: var(--ds-accent);
	/* The main button */
	--ds-primary: var(--ds-accent);
	--ds-on-primary: var(--ds-on-accent);
	/* The header bar */
	--ds-header-bg: var(--ds-bg);
	--ds-on-header: var(--ds-text);
	/* The error panel's background */
	--ds-danger-tint: color-mix(in srgb, var(--ds-danger) 10%, var(--ds-bg));
	/* Focus rings around fields and buttons */
	--ds-focus: color-mix(in srgb, var(--ds-accent) 45%, transparent);

	/* ---------- Type ---------- */

	--ds-font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--ds-font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--ds-font-label: var(--ds-font-body);
	--ds-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	/* Headings: House and IOU use italic, Venatio upright */
	--ds-display-style: normal;
	--ds-display-weight: 600;
	/* Letter spacing of the small uppercase labels */
	--ds-label-tracking: 0.08em;

	/* rem, so they follow the app's root font size (the core never sets it; IOU uses 17px) */
	--ds-text-xs: 0.75rem;
	--ds-text-sm: 0.875rem;
	--ds-text-base: 1rem;
	--ds-text-lg: 1.125rem;
	--ds-text-xl: 1.375rem;
	--ds-text-2xl: 1.75rem;
	--ds-text-3xl: 2.25rem;

	/* ---------- Space (4px base) ---------- */

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

	/* ---------- Shape and depth ---------- */

	--ds-radius-sm: 4px;
	--ds-radius: 6px;
	--ds-radius-lg: 10px;
	--ds-shadow-sm: 0 1px 2px light-dark(#0000001a, #00000066);
	--ds-shadow: 0 8px 24px light-dark(#00000026, #00000099);

	/* ---------- Motion (all turned off under prefers-reduced-motion, in base.css) ---------- */

	--ds-duration-fast: 150ms;
	--ds-duration: 300ms;
	--ds-ease: cubic-bezier(0.2, 0.7, 0.3, 1);

	/* ---------- Layout ---------- */

	--ds-content-width: 72rem;
	--ds-header-height: 56px;
}

/* A saved choice wins over the device's setting */
:root[data-mode="light"] {
	color-scheme: light;
}

:root[data-mode="dark"] {
	color-scheme: dark;
}
