/*
 * Per-tenant CSS-variable overrides. Loaded after static/css/app.css so its
 * declarations win. Override Bulma's CSS custom properties only — anything
 * Bulma exposes solely at SCSS-compile time cannot be tenant-swapped here.
 *
 * Swap-atomicity contract: any process that replaces this file MUST do so
 * via either
 *   (a) rename-style atomic write — write a sibling temp file and `mv` it
 *       over theme.css (atomic on the same filesystem); or
 *   (b) reload-on-command — replace by any means, then issue an explicit
 *       reload (e.g. `caddy reload`, app SIGHUP) that flushes any cached
 *       view of the previous contents.
 * Plain in-place truncate-then-write is not acceptable.
 *
 * --- Variable contract (Task 22) ---
 * Per-tier accents — 4 families × 4 properties × 2 modes = 32 declarations.
 * SCSS consumes them via `var(--tna-tier-bg)` etc. after `_tier-accents.scss`
 * remaps the family-specific variable to the generic --tna-tier-* slot
 * (selected by the .tna-tier-{purple,blue,green,grey} class on an ancestor).
 *
 *   --tna-tier-{purple,blue,green,grey}-bg      — section / card background
 *   --tna-tier-{purple,blue,green,grey}-border  — section / card border
 *   --tna-tier-{purple,blue,green,grey}-dot     — tier-colour dot fill
 *   --tna-tier-{purple,blue,green,grey}-fg      — body text on tier bg
 *
 * Dashboard-level vars (not tier-scoped):
 *   --tna-overdue-pill-bg / --tna-overdue-pill-fg  — overdue badge
 *   --tna-empty-state-fg                            — "No contacts" copy
 *
 * Partial-override caveat: tenants who override only some of the 32 slots
 * leave the rest at the values declared here. There is no fallback chain to
 * Bulma defaults for tier vars, so a half-overridden palette renders as a
 * mix of tenant-set and these-defaults values. Override all or none per
 * family for predictable results.
 *
 * Browser support: `@media (prefers-color-scheme)` requires Chrome 76+,
 * Firefox 67+, Safari 12.1+, Edge 79+. Older browsers see light mode only.
 *
 * Spelling: "grey" (British) matches `tier.Tier.ColourFamily` values in
 * internal/tier/tier.go. Do not rename to "gray" — the attribute/class
 * binding will break.
 */
:root {
	/* Tier accents — light mode. Mirrors PoC Tailwind palette
	   (bg-{family}-50 / border-{family}-200 / bg-{family}-500 / text-gray-900). */
	--tna-tier-purple-bg: #faf5ff;
	--tna-tier-purple-border: #e9d5ff;
	--tna-tier-purple-dot: #a855f7;
	--tna-tier-purple-fg: #111827;

	--tna-tier-blue-bg: #eff6ff;
	--tna-tier-blue-border: #bfdbfe;
	--tna-tier-blue-dot: #3b82f6;
	--tna-tier-blue-fg: #111827;

	--tna-tier-green-bg: #f0fdf4;
	--tna-tier-green-border: #bbf7d0;
	--tna-tier-green-dot: #22c55e;
	--tna-tier-green-fg: #111827;

	--tna-tier-grey-bg: #f9fafb;
	--tna-tier-grey-border: #e5e7eb;
	--tna-tier-grey-dot: #9ca3af;
	--tna-tier-grey-fg: #111827;

	/* Dashboard surfaces — light mode. */
	--tna-overdue-pill-bg: #fee2e2;
	--tna-overdue-pill-fg: #b91c1c;
	--tna-approaching-pill-bg: #fef3c7;
	--tna-approaching-pill-fg: #92400e;
	--tna-ontrack-pill-bg: #dcfce7;
	--tna-ontrack-pill-fg: #166534;
	--tna-empty-state-fg: #6b7280;
}

@media (prefers-color-scheme: dark) {
	:root {
		/* Tier accents — dark mode. Backgrounds shifted to ~12-18% lightness
		   with the family hue retained; borders one stop lighter; dots lifted
		   for visibility; foreground near-white. AA-verified against bg in
		   g-testing-exec.md. */
		--tna-tier-purple-bg: #2a1a40;
		--tna-tier-purple-border: #5b3a8a;
		--tna-tier-purple-dot: #c084fc;
		--tna-tier-purple-fg: #f5f5f5;

		--tna-tier-blue-bg: #1a2540;
		--tna-tier-blue-border: #3a5a9a;
		--tna-tier-blue-dot: #60a5fa;
		--tna-tier-blue-fg: #f5f5f5;

		--tna-tier-green-bg: #14301f;
		--tna-tier-green-border: #2f6a47;
		--tna-tier-green-dot: #4ade80;
		--tna-tier-green-fg: #f5f5f5;

		--tna-tier-grey-bg: #1f2937;
		--tna-tier-grey-border: #4b5563;
		--tna-tier-grey-dot: #9ca3af;
		--tna-tier-grey-fg: #f5f5f5;

		/* Dashboard surfaces — dark mode. */
		--tna-overdue-pill-bg: #3a1a1a;
		--tna-overdue-pill-fg: #fca5a5;
		--tna-approaching-pill-bg: #3a2a14;
		--tna-approaching-pill-fg: #fcd34d;
		--tna-ontrack-pill-bg: #14301f;
		--tna-ontrack-pill-fg: #86efac;
		--tna-empty-state-fg: #9ca3af;
	}
}
