/*
 * Design tokens — the one place colours, type, radii and motion are defined.
 * Shared by the dashboard, the public dealer list and, later, Mohair Connect.
 *
 * The feel: Apple's soft glass — translucent layers over a quiet gradient,
 * big round corners, springy motion — with mohair's long, soft fibres as the
 * motif: a fuzzy halo around cards and a faint fibre texture in the background.
 *
 * Chart colours are validated for colour-blind separation (see app/lib/garn.mjs);
 * change them only by re-running the dataviz validator.
 */

:root {
  color-scheme: light;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;

  /* Surfaces */
  --bg: #f5f1f8;
  --bg-tone-1: #ece2f5;
  --bg-tone-2: #f8ece8;
  --bg-tone-3: #e6eef7;
  --glass: rgba(255, 255, 255, 0.64);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-soft: rgba(255, 255, 255, 0.42);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-line: rgba(84, 56, 120, 0.1);
  --surface: #ffffff;
  --halo: rgba(160, 130, 200, 0.28);
  --fiber: rgba(100, 66, 133, 0.05);

  /* Ink */
  --ink: #1f1a26;
  --ink-2: #4b4454;
  --ink-3: #6f6878;
  --line: rgba(60, 40, 90, 0.1);
  --grid: rgba(60, 40, 90, 0.08);

  /* Brand */
  --accent: #644285;
  --accent-hover: #563873;
  --accent-soft: rgba(100, 66, 133, 0.1);
  --accent-softer: rgba(100, 66, 133, 0.06);
  --accent-ink: #ffffff;
  --focus: #7d5bb0;

  /* Status — reserved; always with an icon or a word, never colour alone */
  --good: #2e7d4f;
  --good-soft: rgba(46, 125, 79, 0.12);
  --warn: #9a6200;
  /* Potential shops on the map of white spots */
  --pk-butik: #c7631a;
  --warn-soft: rgba(196, 138, 42, 0.16);
  --bad: #b3261e;
  --bad-soft: rgba(179, 38, 30, 0.1);

  /* Økonomi: the expense groups in fixed order + money in (validated, plan § 8) */
  --oek-varekoeb: #eb6834;
  --oek-loen: #2a78d6;
  --oek-it: #eda100;
  --oek-lokaler: #4a3aa7;
  --oek-fragt: #e87ba4;
  --oek-marketing: #008300;
  --oek-admin: #9b9aa3;
  --oek-ind: #1baf7a;
  --oek-b2c: #9b59d0; /* private customers (B2C), apart from the dealers (validated 29/9) */

  /* Lager → Priser: the parts of a price — aliases of the validated Økonomi colours */
  /* The seller's colour card: the colours of Leopold's own sheet, and one per month on its way */
  --fk-groen: #6aa84f;
  --fk-gul: #ffff00;
  --fk-orange: #ff9900;
  --fk-roed: #ff0000;
  --fk-md-0: #4a86e8;
  --fk-md-1: #8e7cc3;
  --fk-md-2: #d5a6bd;
  --fk-md-3: #76a5af;
  --fk-md-4: #f6b26b;
  --fk-md-5: #a4c2f4;
  --fk-md-6: #b4a7d6;
  --fk-md-7: #ea9999;

  --pris-garn: var(--oek-varekoeb);
  --pris-fragt: var(--oek-loen);
  --pris-overs: var(--oek-ind);
  --pris-butik: var(--oek-it);
  --pris-moms: var(--oek-admin);
  /* "solgt for": a lighter step of the same hue, opaque so gridlines stay behind it */
  --pris-spor: color-mix(in srgb, var(--oek-ind) 26%, var(--surface));

  /* Yarns (categorical, fixed order) */
  --garn-brushed_lace: #b8692a;
  --garn-boucle: #7048a8;
  --garn-single_kid: #4c8a2e;
  --garn-double_kid: #2a6fc0;

  /* Categories (ordinal: most recent darkest) */
  --kat-aktiv: #4f3278;
  --kat-hvilende: #8566b4;
  --kat-inaktiv: #b29dd6;
  --kat-slettes: #9b9aa3;
  --kat-ny: #2a6fc0;
  --kat-ukendt: #9b9aa3;
  --kat-spaerret: #c4453a;
  --kat-anden: #b7b4bd;
  --maerke-roed: #d0463b;
  --maerke-gul: #d9a21b;
  --maerke-groen: #3f8f3a;

  /* Brand fills (buttons, logo mark, meters) */
  --maerke-fra: #7a55a6;
  --maerke-til: #4f3278;
  --knap-fra: #7652a3;
  --knap-til: #5b3a85;
  --knap-fra-hover: #7f5bad;
  --knap-til-hover: #634090;
  --accent-gloed: rgba(100, 66, 133, 0.35);
  --paa-accent: #ffffff;
  --hvid-kant: rgba(255, 255, 255, 0.22);
  --logo-bund: #ffffff;
  --skygge-bag: rgba(20, 12, 30, 0.28);

  /* Initials when a dealer has no logo — six soft yarn-dyed gradients */
  --avatar-0: linear-gradient(145deg, #8a67b8, #5b3a85);
  --avatar-1: linear-gradient(145deg, #c98b54, #9a5a26);
  --avatar-2: linear-gradient(145deg, #6fa556, #3f7426);
  --avatar-3: linear-gradient(145deg, #5f95d6, #2a5fa6);
  --avatar-4: linear-gradient(145deg, #b07fb0, #7a4a7f);
  --avatar-5: linear-gradient(145deg, #7fa0b0, #47687a);

  /* Paper: printing has no theme */
  --print-papir: #ffffff;
  --print-blaek: #000000;
  --print-kant: #cccccc;

  /* Shape and depth */
  --r-xl: 32px;
  --r-l: 24px;
  --r-m: 18px;
  --r-s: 12px;
  --r-xs: 8px;
  --shadow-s: 0 1px 2px rgba(40, 20, 60, 0.05), 0 2px 8px rgba(40, 20, 60, 0.05);
  --shadow: 0 1px 1px rgba(40, 20, 60, 0.04), 0 10px 30px rgba(40, 20, 60, 0.07), 0 30px 70px rgba(40, 20, 60, 0.05);
  --shadow-l: 0 2px 4px rgba(40, 20, 60, 0.06), 0 20px 50px rgba(40, 20, 60, 0.12), 0 40px 100px rgba(40, 20, 60, 0.08);
  --blur: saturate(180%) blur(28px);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --fast: 160ms;
  --mid: 320ms;
  --slow: 620ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="hoer"]) {
    color-scheme: dark;
    --bg: #111016;
    --bg-tone-1: #231a33;
    --bg-tone-2: #2a1c22;
    --bg-tone-3: #16202c;
    --glass: rgba(34, 30, 42, 0.62);
    --glass-strong: rgba(38, 34, 47, 0.9);
    --glass-soft: rgba(34, 30, 42, 0.4);
    --glass-edge: rgba(255, 255, 255, 0.08);
    --glass-line: rgba(255, 255, 255, 0.07);
    --surface: #1c1a22;
    --halo: rgba(150, 110, 210, 0.2);
    --fiber: rgba(200, 180, 240, 0.04);
    --ink: #f3eff8;
    --ink-2: #c9c2d3;
    --ink-3: #9d95a8;
    --line: rgba(255, 255, 255, 0.09);
    --grid: rgba(255, 255, 255, 0.07);
    --accent: #9c7bd4;
    --accent-hover: #b096e0;
    --accent-soft: rgba(156, 123, 212, 0.16);
    --accent-softer: rgba(156, 123, 212, 0.08);
    --accent-ink: #15121b;
    --focus: #b89ae8;
    --good: #6cc38f;
    --good-soft: rgba(108, 195, 143, 0.14);
    --oek-varekoeb: #d95926;
    --oek-loen: #3987e5;
    --oek-it: #c98500;
    --oek-lokaler: #9085e9;
    --oek-fragt: #d55181;
    --oek-marketing: #008300;
    --oek-admin: #8d8b96;
    --oek-ind: #199e70;
    --oek-b2c: #a57ddc;
    --pris-spor: color-mix(in srgb, var(--oek-ind) 38%, var(--surface));
    --warn: #e0a84a;
    --pk-butik: #f0913f;
    --warn-soft: rgba(224, 168, 74, 0.16);
    --bad: #f08079;
    --bad-soft: rgba(240, 128, 121, 0.14);
    --garn-brushed_lace: #bf7c3f;
    --garn-boucle: #9876cc;
    --garn-single_kid: #64a248;
    --garn-double_kid: #5a93db;
    --kat-aktiv: #c6b2ea;
    --kat-hvilende: #8f72c4;
    --kat-inaktiv: #5e4690;
    --kat-slettes: #6f6e78;
    --kat-ny: #5a93db;
    --kat-ukendt: #6f6e78;
    --kat-spaerret: #e0736a;
    --kat-anden: #5d5b64;
    --maerke-roed: #e0736a;
    --maerke-gul: #e3b74a;
    --maerke-groen: #6cbf5d;
    --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-l: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 60px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111016;
  --bg-tone-1: #231a33;
  --bg-tone-2: #2a1c22;
  --bg-tone-3: #16202c;
  --glass: rgba(34, 30, 42, 0.62);
  --glass-strong: rgba(38, 34, 47, 0.9);
  --glass-soft: rgba(34, 30, 42, 0.4);
  --glass-edge: rgba(255, 255, 255, 0.08);
  --glass-line: rgba(255, 255, 255, 0.07);
  --surface: #1c1a22;
  --halo: rgba(150, 110, 210, 0.2);
  --fiber: rgba(200, 180, 240, 0.04);
  --ink: #f3eff8;
  --ink-2: #c9c2d3;
  --ink-3: #9d95a8;
  --line: rgba(255, 255, 255, 0.09);
  --grid: rgba(255, 255, 255, 0.07);
  --accent: #9c7bd4;
  --accent-hover: #b096e0;
  --accent-soft: rgba(156, 123, 212, 0.16);
  --accent-softer: rgba(156, 123, 212, 0.08);
  --accent-ink: #15121b;
  --focus: #b89ae8;
  --good: #6cc38f;
  --good-soft: rgba(108, 195, 143, 0.14);
  --warn: #e0a84a;
  --warn-soft: rgba(224, 168, 74, 0.16);
  --oek-varekoeb: #d95926;
  --oek-loen: #3987e5;
  --oek-it: #c98500;
  --oek-lokaler: #9085e9;
  --oek-fragt: #d55181;
  --oek-marketing: #008300;
  --oek-admin: #8d8b96;
  --oek-ind: #199e70;
  --oek-b2c: #a57ddc;
  --pris-spor: color-mix(in srgb, var(--oek-ind) 38%, var(--surface));
  --pk-butik: #f0913f;
  --bad: #f08079;
  --bad-soft: rgba(240, 128, 121, 0.14);
  --garn-brushed_lace: #bf7c3f;
  --garn-boucle: #9876cc;
  --garn-single_kid: #64a248;
  --garn-double_kid: #5a93db;
  --kat-aktiv: #c6b2ea;
  --kat-hvilende: #8f72c4;
  --kat-inaktiv: #5e4690;
  --kat-slettes: #6f6e78;
  --kat-ny: #5a93db;
  --kat-ukendt: #6f6e78;
  --kat-spaerret: #e0736a;
  --kat-anden: #5d5b64;
  --maerke-roed: #e0736a;
  --maerke-gul: #e3b74a;
  --maerke-groen: #6cbf5d;
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-l: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 60px rgba(0, 0, 0, 0.45);
}

/*
 * "Hør" — the warm alternative: undyed linen and oat instead of lavender,
 * the same purple for actions. Chart colours are shared with Lavendel, so
 * the validated palette holds.
 */
:root[data-theme="hoer"] {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-tone-1: #ebe0cc;
  --bg-tone-2: #f3e3da;
  --bg-tone-3: #e4e7dc;
  --glass: rgba(255, 252, 246, 0.66);
  --glass-strong: rgba(255, 252, 246, 0.88);
  --glass-soft: rgba(255, 252, 246, 0.45);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-line: rgba(90, 70, 40, 0.12);
  --surface: #fffcf6;
  --halo: rgba(190, 160, 110, 0.3);
  --fiber: rgba(120, 90, 50, 0.06);
  --ink: #2a2319;
  --ink-2: #544a3d;
  --ink-3: #7a6f60;
  --line: rgba(90, 70, 40, 0.12);
  --grid: rgba(90, 70, 40, 0.09);
  --accent-soft: rgba(100, 66, 133, 0.1);
  --accent-softer: rgba(120, 90, 50, 0.07);
}
