/*
 * MeroScore colour tokens: the ONLY file that may contain colour literals
 * (the stylelint rule in .stylelintrc.json enforces it). Everything else,
 * theme, blocks, hover card and the admin app, reads these custom
 * properties. Documented in AGENTS.md.
 *
 * Light is the default (white page, cool greys, red accent); dark is a fully supported
 * alternative. The theme is chosen before first paint by an inline script
 * that sets <html data-theme="light|dark"> (Ui\DesignTokens), so there is no
 * flash. The selectors work on any element, which is how the dev-only token
 * reference page (/design-tokens/) shows both themes side by side. With no attribute at all (no JS, or a bare page) the :root values
 * below, light, apply.
 */

:root,
[data-theme="light"] {
	color-scheme: light;

	--bg: #F6F7F9; /* page background */
	--surface: #FFFFFF; /* cards, panels, popovers */
	--surface-2: #F0F2F5; /* inset areas: tracks, avatar circles, table headers, skeletons */
	--line: rgba(11, 18, 32, 0.09); /* hairline dividers, default card borders */
	--line-strong: rgba(11, 18, 32, 0.16); /* table header rule, hover borders */
	--control-line: rgba(11, 18, 32, 0.56); /* input / secondary-button outlines: 3:1 against the surface (WCAG 1.4.11) */
	--text: #0B1220;
	--muted: #5B6475;

	--accent: #E11D3C; /* fills: primary buttons, live dots, progress, active indicator */
	--accent-text: #C8102E; /* crimson AS small text or icons (links, active nav label) */
	--accent-deep: #7C0F26; /* pressed states, destructive fill */
	--accent-tint: rgba(225, 29, 60, 0.08); /* selected rows, "You" pills, active nav background */
	--accent-tint-strong: rgba(225, 29, 60, 0.14);
	--on-accent: #FFFFFF; /* text on --accent fills and on photo overlays */
	--danger-text: var(--accent-deep); /* destructive action text and outline: 10:1 on the light surface */

	--positive: #146C42; /* gains and upward movement. Darker than the brief's #1E9E5A (3.4:1 on white) so it also clears 4.5:1 on its own tint */
	--positive-tint: rgba(20, 108, 66, 0.12);

	--info: #1D5FD1; /* a four, links to neutral data; 5.9:1 on white */
	--info-tint: rgba(29, 95, 209, 0.10);

	--gold: #D8A94E; /* captain / vice-captain badges and awards, never text */
	--on-gold: #0B1220;
	--on-positive: #FFFFFF; /* lettering on a --positive fill */

	--scrim: rgba(11, 18, 32, 0.45); /* modal and drawer backdrop */
	--overlay-dark: rgba(11, 18, 32, 0.62); /* text-protection layer over photos and covers */
	--overlay-strong: rgba(11, 18, 32, 0.88);
	--ink: #0B1220; /* a dark bar that stays dark in both themes (the live card's tab bar) */
	--on-ink: #FFFFFF;
	--toast-bg: var(--text);
	--toast-text: var(--bg);

	/* The ground graphic and jerseys are literal turf and kit colours, the same in both themes. */
	--pitch-grass: #3F7552;
	--pitch-grass-alt: #447B57;
	--pitch-strip: #9C8253;
	--pitch-line: rgba(255, 255, 255, 0.55);
	--pitch-text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); /* keeps jersey initials legible on the turf */
	--kit-1: #2A2C31; /* jersey bases, one per real-life team; white initials sit on all of them (>= 5:1) */
	--kit-2: #34363B;
	--kit-3: #3E4046;
	--kit-4: #4A4C52;
	--kit-5: #5A5C63;
	/* The squad pitch cards: the ground's outer ring, the role pills and the captain badges (the same in both themes). */
	--ground-ring: #F4ECD2;
	--role-wk: #F2B705;
	--role-bat: #5BC0F8;
	--role-ar: #B79BFF;
	--role-bowl: #FF8FA3;
	--badge-captain: #F2B705;
	--badge-vice: #C9CED8;
	--on-badge: #14161A;
	--on-crest: #0B1220; /* lettering on the white crest disc */

	/* Team crest placeholder: hsl(<per-team hue> s l) */
	--crest-s: 45%;
	--crest-l: 88%;
	--crest-ring-l: 75%; /* lightness of the placeholder's inset ring */
	--crest-ring: rgba(11, 18, 32, 0.10);
	--crest-disc: #FFFFFF; /* uploaded crests sit on a white disc: most are drawn for white */
	--crest-fallback-bg: hsl(var(--team-hue, 215) var(--crest-s) var(--crest-l)); /* generated badge of a team with no crest and no colour */
	--crest-fallback-fg: var(--text);
	--crest-badge-edge: rgba(11, 18, 32, 0.16);
	--chip-text: #3F4757; /* neutral chip text: 7:1 on --surface-2 */

	--skeleton-base: var(--surface-2);
	--skeleton-shine: rgba(255, 255, 255, 0.65);

	/* Badge icon system: the exact values of docs/design/badges/badge-icon-system.svg. A frame ring is a vertical metal
	   gradient (-hi at the top to -lo at the bottom): bronze, silver, gold for tiers; steel for one-time and community
	   badges; crimson for limited editions (with ribbon tails). The tier is always also written in text, never the colour alone. */
	--tier-bronze-hi: #F0BC8A;
	--tier-bronze-lo: #94572B;
	--tier-silver-hi: #F1F3F6;
	--tier-silver-lo: #8E96A3;
	--tier-gold-hi: #F6DE9B;
	--tier-gold-lo: #C48A2A;
	--tier-steel-hi: #6C7078;
	--tier-steel-lo: #2A2C31;
	--tier-crimson-hi: #F3647A;
	--tier-crimson-lo: #A50F27;
	--badge-disc: #17181B; /* the dark inner disc the glyph sits on, the same in both themes */
	--badge-glyph: #F5F3EF; /* the glyph strokes and lettering */
	--badge-edge: #1A1A1A; /* the thin outline that keeps the frame visible on the page */
	--badge-dash: rgba(245, 243, 239, 0.28); /* the dashed inner ring (dropped at 24 and 32 px) */
	--badge-chip: #E31837; /* the count chip, and the optional accent ring */
	--badge-chip-text: #FFFFFF;
	--badge-ribbon-a: #E31837; /* the ribbon tails of a limited edition */
	--badge-ribbon-b: #9C1029;
}

[data-theme="dark"] {
	color-scheme: dark;

	--bg: #0B0E14;
	--surface: #141821;
	--surface-2: #1B202B;
	--line: rgba(240, 244, 250, 0.09);
	--line-strong: rgba(240, 244, 250, 0.16);
	--control-line: rgba(240, 244, 250, 0.50);
	--text: #F0F4FA;
	--muted: #98A2B3;

	--accent: #E11D3C;
	--accent-text: #FF4D68;
	--accent-deep: #7C0F26;
	--accent-tint: rgba(225, 29, 60, 0.16);
	--accent-tint-strong: rgba(225, 29, 60, 0.22);
	--danger-text: var(--accent-text); /* the deep crimson is too dark on the dark surface */
	--on-accent: #FFFFFF;

	--positive: #34C77B;
	--positive-tint: rgba(52, 199, 123, 0.14);

	--gold: #D8A94E;
	--on-gold: #0B1220;
	--on-positive: #0B1220;

	--info: #6FA2FF;
	--info-tint: rgba(111, 162, 255, 0.16);
	--ink: #05070B;

	--scrim: rgba(0, 0, 0, 0.62);
	--overlay-dark: rgba(0, 0, 0, 0.62);
	--overlay-strong: rgba(0, 0, 0, 0.88);

	--crest-s: 28%;
	--crest-l: 26%;
	--crest-ring-l: 40%;
	--crest-ring: rgba(240, 244, 250, 0.14);
	--crest-badge-edge: rgba(240, 244, 250, 0.22);
	--chip-text: #C4CCDA;

	--skeleton-shine: rgba(240, 244, 250, 0.06);

	/* In dark mode the steel ring lifts and the edge turns light so the frame stays visible on the dark page; the other metals are as on the sheet. */
	--tier-steel-hi: #9AA0AB;
	--tier-steel-lo: #565A63;
	--badge-edge: #F5F3EF;
}
