/**
 * Colour tokens for phone and desk: the one home of every colour the pocket
 * sheets, exchange.css, the shared static/css sheets and the pocket
 * templates use (docs/features/POCKET_NAV_THEME.md). Names say the role; a
 * pocket-loaded sheet never writes a colour literal. pocket.css keeps its
 * --pocket-* names as aliases of these, and the --color-* names below stay
 * for the desk and the scripts that read them.
 *
 * :root holds the values the desk draws. The pocket layout's <html> carries
 * data-surface="pocket", and the Caliche & Mesquite block below replaces them
 * there; names only pocket pages draw (kinds, the dock pill) live only in it.
 * The display settings (static/pocket/display.js) add data-theme="dark" and
 * data-contrast="more" to that <html>; their blocks follow, last wins.
 * tests/test_pocket_contrast.py holds the text of every theme to 7:1 on paper and card.
 *
 * Hammers and other level prices use ink. Green and red are for
 * a change (Δ) only. Sex hues stay the existing male / female / Mixed
 * pair. The page canvas is one paper color. Cards stay white on top of it.
 */
:root {
    /* Surfaces and text */
    --paper: #f4f6f8;
    --card: #ffffff;
    --ink: #111827;
    --ink-2: #475569;
    --muted: #5b6474;
    --line: #e2e6eb;
    --line-soft: #eef1f4;

    /* Text on a filled surface: brand fills, the dark chrome, ink/danger/good fills, photos and scrims */
    --on-brand: #ffffff;
    --on-chrome: #ffffff;
    --on-fill: #ffffff;
    --on-photo: #ffffff;

    /* Older greys (import, species resolve, typeahead, horn potential, charts) */
    --ink-strong: #1a1a1a;
    --ink-heading: #1f2937;
    --hint-strong: #444444;
    --hint: #666666;
    --table-label: #6b7280;
    --input-hint: #667085;
    --share-copy: #64748b;
    --line-table: #e0e0e0;
    --line-divider: #e5e7eb;
    --line-input: #d0d5dd;
    --line-field: #cccccc;
    --table-head-bg: #f5f5f5;
    --error-list-bg: #f9f9f9;
    --import-bg: #f9fafb;
    --surface-muted: #f4f4f2;

    /* Brand (the indigo accent), focus (teal) and chrome */
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-soft: #eef2ff;
    --brand-line: #c7d2fe;
    --brand-band: #a5b4fc;
    --brand-glow: rgba(79, 70, 229, 0.28);
    --brand-glow-strong: rgba(79, 70, 229, 0.35);
    --focus: #00695c;
    --focus-ring: rgba(0, 105, 92, 0.1);
    --focus-ring-strong: rgba(0, 105, 92, 0.12);
    --focus-tint: rgba(0, 105, 92, 0.08);
    --opener-bg: rgba(0, 105, 92, 0.08);
    --chrome: #1e293b;
    --chrome-text: #cbd5e1;
    --chrome-shadow: rgba(15, 23, 42, 0.18);
    --toast-bg: #333333;
    --header: #2c3e50;
    --install-cta-from: #2c3e50;
    --install-cta-to: #3498db;
    --dock-bg: rgba(255, 255, 255, 0.96);
    --on-brand-20: rgba(255, 255, 255, 0.2);
    --on-brand-28: rgba(255, 255, 255, 0.28);
    --on-brand-30: rgba(255, 255, 255, 0.3);
    --on-brand-78: rgba(255, 255, 255, 0.78);
    --on-chrome-80: rgba(255, 255, 255, 0.8);
    --on-brand-85: rgba(255, 255, 255, 0.85);

    /* Change (Δ) */
    --up: #2e7d32;
    --up-bg: rgba(46, 125, 50, 0.12);
    --up-light: #4caf50;
    --down: #dc2626;
    --down-bg: rgba(220, 38, 38, 0.1);
    --flat-bg: rgba(107, 114, 128, 0.1);
    --na-bg: rgba(107, 114, 128, 0.05);

    /* Sex */
    --male: #1565c0;
    --male-bg: #e3f2fd;
    --female: #c2185b;
    --female-bg: #fce4ec;
    --mixed: #e67e22;
    --mixed-bg: #fff3e0;
    --defaulted: #e65100;
    --defaulted-line: #ff9800;
    --defaulted-bg: #fff3e0;

    /* Danger and errors */
    --danger: #dc3545;
    --danger-press: #c82333;
    --danger-press-bg: rgba(220, 53, 69, 0.1);
    --danger-strong: #dc2626;
    --danger-text: #b91c1c;
    --danger-ink: #991b1b;
    --danger-bg: #fef2f2;
    --danger-bg-strong: #fee2e2;
    --danger-line: #fecaca;
    --danger-disabled: #f87171;
    --alert-error: #c0392b;
    --alert-error-bg: #fce4e4;
    --invalid: #c53030;
    --invalid-bg: #fff5f5;
    --invalid-line: #feb2b2;
    --invalid-ring: rgba(197, 48, 48, 0.25);
    --import-error-bg: #f8d7da;

    /* Success */
    --good: #2e7d32;
    --success: #16a34a;
    --success-ink: #166534;
    --success-text: #15803d;
    --success-bg: #f0fdf4;
    --success-bg-strong: #dcfce7;
    --success-line: #bbf7d0;
    --alert-success: #27ae60;
    --alert-success-bg: #d5f5e3;
    --valid: #2d7a3d;
    --valid-bg: #d4edda;
    --good-bg: #e8f5e9;
    --add-bg: #f0fff4;
    --add-line: #68d391;

    /* Warnings, notes and info */
    --warning-bg: #fff3cd;
    --warning-ink: #856404;
    --alert-warning: #92400e;
    --alert-warning-bg: #fef3c7;
    --help-bg: #fffbeb;
    --help-line: #f59e0b;
    --help-ink: #78350f;
    --help-title: #92400e;
    --note: #e67e22;
    --note-bg: #fff3e0;
    --high: #b45309;
    --high-bg: #fef3c7;
    --stale: #9a3412;
    --stale-bg: rgba(234, 88, 12, 0.14);
    --callout-bg: #fdf1d8;
    --callout-line: #f1dfae;
    --callout-ink: #5a3a00;
    --record: #b7791f;
    --star: #f5a623;
    --info-bg: #eff6ff;
    --info-line: #bfdbfe;
    --selected-bg: #f0f7ff;

    /* Pedigree, Exchange and charts */
    --gold: #c8960c;
    --silver: #5c6778;
    --ped: #9a5b13;
    --ped-bg: #fdf2e3;
    --save: #e11d48;
    --photo-placeholder: linear-gradient(180deg, #c9d8e4 0%, #e6d9bd 58%, #c7a56d 100%);
    --photo-none: rgba(17, 24, 39, 0.55);
    --chart-label: #6b6b6b;

    /* Scrims and shadow colours (--shade-*: custom.css owns --shadow-* on the desk) */
    --scrim: rgba(0, 0, 0, 0.5);
    --scrim-help: rgba(0, 0, 0, 0.4);
    --scrim-menu: rgba(0, 0, 0, 0.3);
    --scrim-busy: rgba(17, 24, 39, 0.45);
    --scrim-badge: rgba(17, 24, 39, 0.7);
    --shade-sm: rgba(0, 0, 0, 0.05);
    --shade-md: rgba(0, 0, 0, 0.08);
    --shade-pop: rgba(0, 0, 0, 0.15);
    --shade-sheet: rgba(0, 0, 0, 0.18);
    --shade-modal: rgba(0, 0, 0, 0.2);
    --shade-bar: rgba(15, 23, 42, 0.28);
    --shade-menu: rgba(16, 24, 40, 0.12);
    --shade-text: rgba(15, 23, 42, 0.8);

    /* The desk and scripts read these names. */
    --color-ink: var(--ink);
    --color-paper: var(--paper);
    --color-delta-up: var(--up);
    --color-delta-up-bg: var(--up-bg);
    --color-delta-down: var(--down);
    --color-delta-down-bg: var(--down-bg);
    --color-sex-male: var(--male);
    --color-sex-male-bg: var(--male-bg);
    --color-sex-female: var(--female);
    --color-sex-female-bg: var(--female-bg);
    --color-sex-mixed: var(--mixed);
    --color-sex-mixed-bg: var(--mixed-bg);
}

/* Caliche & Mesquite, light (docs/features/POCKET_NAV_THEME.md A4, with its four contrast adjustments).
   Older role names take the A4 role they draw, so each hue family has one value. */
:root[data-surface="pocket"] {
    /* Surfaces and text */
    --paper: #f5f1ea;
    --card: #ffffff;
    --ink: #141210;
    --ink-2: #3b352d;
    --muted: #544c3f;
    --line: #e4ddd2;
    --line-soft: #ece6dc;
    --line-strong: #857b6d;

    --ink-strong: var(--ink);
    --ink-heading: var(--ink);
    --hint-strong: var(--ink-2);
    --hint: var(--muted);
    --table-label: var(--muted);
    --input-hint: var(--muted);
    --share-copy: var(--muted);
    --chart-label: var(--muted);
    --line-table: var(--line);
    --line-divider: var(--line);
    --line-input: var(--line-strong);
    --line-field: var(--line-strong);
    --table-head-bg: var(--paper);
    --error-list-bg: var(--paper);
    --import-bg: var(--paper);
    --surface-muted: var(--paper);

    /* Brand (dark green), focus and chrome */
    --brand: #1b4634;
    --brand-dark: #163b2d;
    --brand-soft: #dcebe2;
    --brand-line: #b5d3c3;
    --brand-band: #8fd3b1;
    --brand-glow: rgba(27, 70, 52, 0.28);
    --brand-glow-strong: rgba(27, 70, 52, 0.35);
    --focus: var(--brand);
    --focus-ring: rgba(27, 70, 52, 0.1);
    --focus-ring-strong: rgba(27, 70, 52, 0.12);
    --focus-tint: rgba(27, 70, 52, 0.08);
    --opener-bg: rgba(27, 70, 52, 0.08);
    --chrome: #163b2d;
    --chrome-line: var(--chrome);
    --chrome-text: #cfe6da;
    --chrome-pill: #8fd3b1;
    --on-chrome-pill: #121009;
    --header: var(--chrome);
    --install-cta-from: var(--brand-dark);
    --install-cta-to: var(--brand);
    --toast-bg: var(--ink);

    /* Change (Δ) */
    --up: #115d2d;
    --up-bg: #dff1e5;
    --down: #9a241d;
    --down-bg: #fbe3df;

    /* Sex */
    --male: #174e9e;
    --male-bg: #dfeafb;
    --female: #9c1655;
    --female-bg: #fbe0ea;
    --mixed: #544c3f;
    --mixed-bg: #eee7dc;

    /* Detail kinds: the kind toolbar's label and the hero's left rule */
    --kind-yours: var(--brand);
    --kind-yours-bg: var(--brand-soft);
    --kind-shared: #39434f;
    --kind-shared-bg: #e3e8ee;
    --kind-lot: #6e4700;
    --kind-lot-bg: #fbeccb;
    --kind-listing: #7f3a13;
    --kind-listing-bg: #fbe5d8;
    --kind-sample: #5a4300;
    --kind-sample-bg: #f3e3b5;

    /* Danger and errors draw as down */
    --danger: var(--down);
    --danger-press: #7d1d17;
    --danger-press-bg: rgba(154, 36, 29, 0.1);
    --danger-strong: var(--down);
    --danger-text: var(--down);
    --danger-ink: var(--down);
    --danger-bg: var(--down-bg);
    --danger-bg-strong: var(--down-bg);
    --danger-line: #e8b4ac;
    --alert-error: var(--down);
    --alert-error-bg: var(--down-bg);
    --invalid: var(--down);
    --invalid-bg: var(--down-bg);
    --invalid-line: #e8b4ac;
    --invalid-ring: rgba(154, 36, 29, 0.25);
    --import-error-bg: var(--down-bg);

    /* Success draws as up */
    --good: var(--up);
    --success: var(--up);
    --success-ink: var(--up);
    --success-text: var(--up);
    --success-bg: var(--up-bg);
    --success-bg-strong: var(--up-bg);
    --success-line: #a9d4b5;
    --alert-success: var(--up);
    --alert-success-bg: var(--up-bg);
    --valid: var(--up);
    --valid-bg: var(--up-bg);
    --good-bg: var(--up-bg);
    --add-bg: var(--up-bg);
    --add-line: #a9d4b5;

    /* Warnings, notes and info draw as the lot amber, stale as the listing rust, info as the shared slate */
    --warning-bg: var(--kind-lot-bg);
    --warning-ink: var(--kind-lot);
    --alert-warning: var(--kind-lot);
    --alert-warning-bg: var(--kind-lot-bg);
    --help-bg: var(--kind-lot-bg);
    --help-line: #c9a861;
    --help-ink: var(--kind-lot);
    --help-title: var(--kind-lot);
    --note: var(--kind-lot);
    --note-bg: var(--kind-lot-bg);
    --high: var(--kind-lot);
    --high-bg: var(--kind-lot-bg);
    --defaulted: var(--kind-lot);
    --defaulted-line: #c9a861;
    --defaulted-bg: var(--kind-lot-bg);
    --stale: var(--kind-listing);
    --stale-bg: var(--kind-listing-bg);
    --callout-bg: var(--kind-lot-bg);
    --callout-line: #e3cf9c;
    --callout-ink: var(--kind-lot);
    --record: var(--gold);
    --info-bg: var(--kind-shared-bg);
    --info-line: #c5ced9;
    --selected-bg: var(--brand-soft);

    /* Pedigree and Exchange */
    --gold: #664d12;
    --silver: #474e5a;
    --ped: var(--gold);
    --ped-bg: var(--kind-lot-bg);
    --save: var(--down);
}

/* Night (docs/features/POCKET_NAV_THEME.md A4; the ⋮ Night setting, or the system's dark scheme when it is Auto).
   Names the light block aliases (danger as down, warnings as the lot amber...) follow it; these are the values. */
:root[data-surface="pocket"][data-theme="dark"] {
    color-scheme: dark;

    /* Surfaces and text */
    --paper: #121009;
    --card: #1e1a15;
    --ink: #f8f4ed;
    --ink-2: #dcd4c7;
    --muted: #b8ae9f;
    --line: #4a4237;
    --line-soft: #36302a;
    --line-strong: #8a8071;

    /* Fills are light at night: text on brand, ink, danger and good fills is the paper */
    --on-brand: #121009;
    --on-fill: #121009;
    --on-brand-20: rgba(18, 16, 9, 0.2);
    --on-brand-28: rgba(18, 16, 9, 0.28);
    --on-brand-30: rgba(18, 16, 9, 0.3);
    --on-brand-78: rgba(18, 16, 9, 0.78);
    --on-brand-85: rgba(18, 16, 9, 0.85);

    /* Brand (mint on night), focus and chrome */
    --brand: #8fd3b1;
    --brand-dark: #7cc4a0;
    --brand-soft: #1f3a2f;
    --brand-line: #2d5443;
    --brand-glow: rgba(143, 211, 177, 0.2);
    --brand-glow-strong: rgba(143, 211, 177, 0.28);
    --focus-ring: rgba(143, 211, 177, 0.25);
    --focus-ring-strong: rgba(143, 211, 177, 0.3);
    --focus-tint: rgba(143, 211, 177, 0.1);
    --opener-bg: rgba(143, 211, 177, 0.1);
    --chrome: #1f3a2f;
    --chrome-line: #2d5443;
    --chrome-shadow: rgba(0, 0, 0, 0.4);
    --install-cta-from: var(--chrome);
    --install-cta-to: #2d5443;
    --dock-bg: rgba(30, 26, 21, 0.96);

    /* Change (Δ) */
    --up: #7ad99a;
    --up-bg: #1d3a28;
    --down: #ff9f91;
    --down-bg: #44221e;

    /* Sex */
    --male: #a4c6ff;
    --male-bg: #1e2d45;
    --female: #ffa3c6;
    --female-bg: #45202f;
    --mixed: #b8ae9f;
    --mixed-bg: #2c2720;

    /* Detail kinds */
    --kind-shared: #c5ced9;
    --kind-shared-bg: #2a303a;
    --kind-lot: #f6d27d;
    --kind-lot-bg: #3d3012;
    --kind-listing: #f5ad88;
    --kind-listing-bg: #3f261a;
    --kind-sample: #f3d98a;
    --kind-sample-bg: #3a2f0c;

    /* Lines and presses of the aliased roles */
    --danger-press: #ffbdb3;
    --danger-press-bg: rgba(255, 159, 145, 0.12);
    --danger-line: #6b3a33;
    --invalid-line: #6b3a33;
    --invalid-ring: rgba(255, 159, 145, 0.3);
    --success-line: #2f5a3c;
    --add-line: #2f5a3c;
    --help-line: #8a7440;
    --defaulted-line: #8a7440;
    --callout-line: #5c4a1f;
    --info-line: #4a5361;

    /* Pedigree */
    --gold: #e8cb86;
    --silver: #c5ced9;
}

/* High contrast (the ⋮ setting, or the system's more-contrast preference when it is Auto): secondary text reads as
   ink, lines as the strong line, the dock's labels as white. */
:root[data-surface="pocket"][data-contrast="more"] {
    --ink-2: #141210;
    --muted: #3b352d;
    --line: #5c544a;
    --line-soft: #5c544a;
    --line-strong: #3b352d;
    --chrome-text: #ffffff;
}

/* High contrast at night: every name the block above sets, on a black paper. */
:root[data-surface="pocket"][data-theme="dark"][data-contrast="more"] {
    --paper: #000000;
    --card: #14110c;
    --ink: #ffffff;
    --ink-2: #ffffff;
    --muted: #e6dfd4;
    --line: #a39888;
    --line-soft: #a39888;
    --line-strong: #d0c6b6;
    --chrome-text: #ffffff;
}
