/* Design tokens (planning/08_Visual_Design.md). The only place colour values appear.
   Light is the default; dark follows the OS unless the user picks a theme (data-theme on <html>). */

:root {
  color-scheme: light;

  /* Neutrals */
  --surface-page: #fafafa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f5f5f5;
  --border: #e5e5e5;
  --border-strong: #8f8f8f;
  --text: #0a0a0a;
  --text-secondary: #525252;
  --text-tertiary: #6b6b6b;
  --text-disabled: #a3a3a3;
  --accent: #0a0a0a;
  --accent-hover: #262626;
  --accent-contrast: #ffffff;
  --shadow-raised: 0 1px 2px rgb(0 0 0 / .06), 0 4px 12px rgb(0 0 0 / .08);
  --select-arrow: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23525252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");

  /* Status: text / tint */
  --danger: #b42318;    --danger-tint: #fef3f2;
  --warning: #a15c07;   --warning-tint: #fffaeb;
  --success: #067647;   --success-tint: #ecfdf3;
  --info: #175cd3;      --info-tint: #eff8ff;

  /* Schedule activities: background / text (schedule views only) */
  --activity-break-bg: #d7ece8;    --activity-break-text: #1f5e55;
  --activity-lunch-bg: #efe6d5;    --activity-lunch-text: #6b4f1d;
  --activity-training-bg: #e6e1f2; --activity-training-text: #4b3d7a;
  --activity-coaching-bg: #e3ebf6; --activity-coaching-text: #274b7a;
  --activity-meeting-bg: #e8e8e8;  --activity-meeting-text: #404040;
  --activity-nesting-bg: #e6efdd;  --activity-nesting-text: #3e5a26;
  --activity-sick-bg: #f7dede;     --activity-sick-text: #8a1f1f;
  --activity-late-bg: #f7e6d3;     --activity-late-text: #7a4312;
  --activity-overtime-bg: #d9eedf; --activity-overtime-text: #1e5b2d;
  --activity-vto-bg: #f0f0f0;      --activity-vto-text: #404040;
  --time-off-bg: #f3e6f1;          --time-off-text: #6e2a63;       /* time off: a layer over the schedule */

  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-xs: 0.75rem;     --leading-xs: 1rem;
  --text-sm: 0.8125rem;   --leading-sm: 1.25rem;
  --text-base: 0.875rem;  --leading-base: 1.375rem;
  --text-md: 1rem;        --leading-md: 1.5rem;
  --text-lg: 1.25rem;     --leading-lg: 1.75rem;
  --text-xl: 1.75rem;     --leading-xl: 2.25rem;
  --text-wallboard: clamp(2.5rem, 6vw, 6rem);

  /* Space, shape */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-8: 48px;
  --radius-sm: 4px; --radius: 6px; --radius-lg: 10px;
  --row-compact: 32px;
  --control-height: 36px;
  --sidebar-width: 224px;
}

/* Dark tokens, shared by the OS preference and an explicit choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-page: #0a0a0a;
    --surface: #141414;
    --surface-raised: #1c1c1c;
    --surface-muted: #1a1a1a;
    --border: #2a2a2a;
    --border-strong: #6b6b6b;
    --text: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-tertiary: #8a8a8a;
    --text-disabled: #525252;
    --accent: #f5f5f5;
    --accent-hover: #d4d4d4;
    --accent-contrast: #0a0a0a;
    --shadow-raised: none;
    --select-arrow: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    --danger: #f97066;  --danger-tint: rgb(249 112 102 / .12);
    --warning: #fdb022; --warning-tint: rgb(253 176 34 / .12);
    --success: #47cd89; --success-tint: rgb(71 205 137 / .12);
    --info: #53b1fd;    --info-tint: rgb(83 177 253 / .12);
    --activity-break-bg: #1d3531;    --activity-break-text: #9fd6cc;
    --activity-lunch-bg: #3a3122;    --activity-lunch-text: #e3cfa6;
    --activity-training-bg: #2e2843; --activity-training-text: #c6bbea;
    --activity-coaching-bg: #1f2d42; --activity-coaching-text: #a9c4ea;
    --activity-meeting-bg: #262626;  --activity-meeting-text: #d4d4d4;
    --activity-nesting-bg: #26321d;  --activity-nesting-text: #bcd6a4;
    --activity-sick-bg: #401c1c;     --activity-sick-text: #f2a9a9;
    --activity-late-bg: #3d2a17;     --activity-late-text: #eec192;
    --activity-overtime-bg: #1b3524; --activity-overtime-text: #9fdcb0;
    --activity-vto-bg: #222222;      --activity-vto-text: #c4c4c4;
    --time-off-bg: #3a2236;          --time-off-text: #e6b6dc;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-page: #0a0a0a;
  --surface: #141414;
  --surface-raised: #1c1c1c;
  --surface-muted: #1a1a1a;
  --border: #2a2a2a;
  --border-strong: #6b6b6b;
  --text: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-tertiary: #8a8a8a;
  --text-disabled: #525252;
  --accent: #f5f5f5;
  --accent-hover: #d4d4d4;
  --accent-contrast: #0a0a0a;
  --shadow-raised: none;
  --select-arrow: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  --danger: #f97066;  --danger-tint: rgb(249 112 102 / .12);
  --warning: #fdb022; --warning-tint: rgb(253 176 34 / .12);
  --success: #47cd89; --success-tint: rgb(71 205 137 / .12);
  --info: #53b1fd;    --info-tint: rgb(83 177 253 / .12);
  --activity-break-bg: #1d3531;    --activity-break-text: #9fd6cc;
  --activity-lunch-bg: #3a3122;    --activity-lunch-text: #e3cfa6;
  --activity-training-bg: #2e2843; --activity-training-text: #c6bbea;
  --activity-coaching-bg: #1f2d42; --activity-coaching-text: #a9c4ea;
  --activity-meeting-bg: #262626;  --activity-meeting-text: #d4d4d4;
  --activity-nesting-bg: #26321d;  --activity-nesting-text: #bcd6a4;
  --activity-sick-bg: #401c1c;     --activity-sick-text: #f2a9a9;
  --activity-late-bg: #3d2a17;     --activity-late-text: #eec192;
  --activity-overtime-bg: #1b3524; --activity-overtime-text: #9fdcb0;
  --activity-vto-bg: #222222;      --activity-vto-text: #c4c4c4;
  --time-off-bg: #3a2236;          --time-off-text: #e6b6dc;
}

/* Color presets (Settings → Organization), pasted after the base rules above, which they leave as they are.

   Classic is the base rules: with no data-palette on <html>, or one that names no preset (say "classic"), nothing
   below changes what's on screen; only the --swatch-* tokens at the end of each theme are set. With
   data-palette="ocean", "indigo", "plum" or "navy", the whole install takes that preset, and each person's light,
   dark or system choice still applies to it.

   Each preset sets its tokens in a light block and in two dark ones, as the base does: dark from the OS unless the
   person chose light, and dark chosen. Every dark block sets the same tokens as its light block and is one step more
   specific. It has to be: the light block, :root[data-palette="ocean"], is as specific as the base's own dark
   selector, :root:not([data-theme="light"]), and comes after it, so it beats the base in dark mode; only a more
   specific preset dark block puts dark values back.

     light          :root[data-palette="ocean"]                                    (0,2,0)
     dark, the OS   @media (prefers-color-scheme: dark) {
                      :root[data-palette="ocean"]:not([data-theme="light"])        (0,3,0)
                    }
     dark, chosen   :root[data-palette="ocean"][data-theme="dark"]                 (0,3,0)

   A preset's own tokens are the accent (primary buttons, links, the focus ring, checked boxes, the selected tab, the
   E mark, the now line) and new tokens for the menu (--nav-*). The schedule's floor is shared by them all:
   activities a step livelier, each in its Classic hue (meeting and VTO keep their grays), and the coverage strip's
   fills (--coverage-*). Status colors aren't touched.

   Navy's menu is navy in the light theme as well as the dark, the one menu that's dark in both, so it has words of
   its own (--nav-text, --nav-text-secondary, --nav-text-tertiary), and its current item is lime on a lifted navy.
   Lime is there and nowhere else, so it's never taken for success's green. Navy's Settings menu is on the page, so
   its current item is the accent's tint and ink (--nav-settings-current, --nav-settings-current-text), as the other
   presets' are. In the dark, Navy's menu is a step deeper and what's on it a step quieter, so it sits with the page.

   Four components have no tokens of their own to take a preset, so they're the only selectors here besides :root,
   and they set custom properties only, so each component's own rule still draws it:
   - the sidebar and the phone bar: their surface, hover, borders and button border become the menu's. Navy's take
     the menu's words as well, and its light ink for the focus ring, a link, the E and the bell's count;
   - the current menu item (the sidebar's, the phone bar's, the Settings menu's): the accent's tint and ink, but on
     Navy's menu, lime on a lifted navy;
   - the coverage strip and its three legend swatches: the livelier fills in place of the status tints, which badges
     and banners keep everywhere else;
   - a selected tab, filled with the accent: a figure on it (a draft's coverage, the wallboard's out of adherence, a
     search's count) in the tab's own ink, as Classic's gray would all but vanish on a preset's accent, and a faded
     count would fall short of 4.5:1.
   They need no dark versions: the tokens they read change with the theme at :root.

   --swatch-<name> is each preset's accent in the current theme, Classic's too, for a swatch beside each choice on
   the settings page whichever preset is on (style="--swatch: var(--swatch-ocean)" with .legend__swatch--token). */


/* Light */

/* Ocean: a calm sea blue */
:root[data-palette="ocean"] {
  --accent: #026582;
  --accent-hover: #00536c;
  --accent-contrast: #ffffff;
  --nav-surface: #eaf6fc;
  --nav-surface-hover: #dceff7;
  --nav-border: #d4e2e9;
  --nav-border-strong: #7c878c;
  --nav-current: #cbe9f6;
  --nav-current-text: #004e64;
}

/* Indigo: a deep blue violet */
:root[data-palette="indigo"] {
  --accent: #5446d5;
  --accent-hover: #4630c0;
  --accent-contrast: #ffffff;
  --nav-surface: #f1f3ff;
  --nav-surface-hover: #e7eafe;
  --nav-border: #dcdeee;
  --nav-border-strong: #83848e;
  --nav-current: #dde1ff;
  --nav-current-text: #4129b9;
}

/* Plum: a rich purple */
:root[data-palette="plum"] {
  --accent: #863aab;
  --accent-hover: #742597;
  --accent-contrast: #ffffff;
  --nav-surface: #f8f0fd;
  --nav-surface-hover: #f2e6f8;
  --nav-border: #e5dcea;
  --nav-border-strong: #88828b;
  --nav-current: #efdafb;
  --nav-current-text: #6e1e91;
}

/* Navy: a deep navy, with lime in the menu */
:root[data-palette="navy"] {
  --accent: #26476b;
  --accent-hover: #183555;
  --accent-contrast: #ffffff;
  --nav-surface: #15283c;
  --nav-surface-hover: #1f354c;
  --nav-border: #2a3b4e;
  --nav-border-strong: #718295;
  --nav-current: #253f5a;
  --nav-current-text: #bfdc04;
  --nav-text: #ffffff;
  --nav-text-secondary: #b6c3d1;
  --nav-text-tertiary: #91a0b1;
  --nav-settings-current: #d8e3f0;
  --nav-settings-current-text: #1b395a;
}

/* The schedule's floor, the same in every preset */
:root:is([data-palette="ocean"], [data-palette="indigo"], [data-palette="plum"], [data-palette="navy"]) {
  --activity-break-bg: #bae9e1;    --activity-break-text: #005c52;
  --activity-lunch-bg: #f0ddb9;    --activity-lunch-text: #6b4a05;
  --activity-training-bg: #e1d5fb; --activity-training-text: #4f3a8b;
  --activity-coaching-bg: #cce0fa; --activity-coaching-text: #1d4b86;
  --activity-nesting-bg: #d6e9c3;  --activity-nesting-text: #3a5b1a;
  --activity-sick-bg: #fdcdcd;     --activity-sick-text: #8f1c1e;
  --activity-late-bg: #f8d8b3;     --activity-late-text: #7f4101;
  --activity-overtime-bg: #bee9cb; --activity-overtime-text: #135e29;
  --time-off-bg: #f2d5ee;          --time-off-text: #752869;
  --coverage-under: #ffc1bb;
  --coverage-short: #ffd891;
  --coverage-over: #c0deff;
}

/* Swatches for the settings page */
:root {
  --swatch-classic: #0a0a0a;
  --swatch-ocean: #026582;
  --swatch-indigo: #5446d5;
  --swatch-plum: #863aab;
  --swatch-navy: #26476b;
}

/* Dark, from the OS unless the person chose light */
@media (prefers-color-scheme: dark) {
  /* Ocean: a calm sea blue */
  :root[data-palette="ocean"]:not([data-theme="light"]) {
    --accent: #73b7cb;
    --accent-hover: #89c6d8;
    --accent-contrast: #011a21;
    --nav-surface: #091a1e;
    --nav-surface-hover: #0e272d;
    --nav-border: #1d3137;
    --nav-border-strong: #68787c;
    --nav-current: #0c333d;
    --nav-current-text: #aee1f0;
  }

  /* Indigo: a deep blue violet */
  :root[data-palette="indigo"]:not([data-theme="light"]) {
    --accent: #a6acff;
    --accent-hover: #b9bfff;
    --accent-contrast: #131428;
    --nav-surface: #141526;
    --nav-surface-hover: #1f2037;
    --nav-border: #2a2c41;
    --nav-border-strong: #727380;
    --nav-current: #282a4b;
    --nav-current-text: #cfd4ff;
  }

  /* Plum: a rich purple */
  :root[data-palette="plum"]:not([data-theme="light"]) {
    --accent: #d2a0ee;
    --accent-hover: #e0b2f9;
    --accent-contrast: #1c1023;
    --nav-surface: #1c1322;
    --nav-surface-hover: #2a1c32;
    --nav-border: #35283c;
    --nav-border-strong: #79717d;
    --nav-current: #382542;
    --nav-current-text: #ebc8ff;
  }

  /* Navy: a deep navy, with lime in the menu */
  :root[data-palette="navy"]:not([data-theme="light"]) {
    --accent: #9fbcde;
    --accent-hover: #b2cce9;
    --accent-contrast: #0c1928;
    --nav-surface: #102234;
    --nav-surface-hover: #192e45;
    --nav-border: #243547;
    --nav-border-strong: #6b7c8f;
    --nav-current: #1f3953;
    --nav-current-text: #abcf02;
    --nav-text: #f5f5f5;
    --nav-text-secondary: #afbccb;
    --nav-text-tertiary: #8b9aab;
    --nav-settings-current: #1e3043;
    --nav-settings-current-text: #c3d6ee;
  }

  /* The schedule's floor, the same in every preset */
  :root:is([data-palette="ocean"], [data-palette="indigo"], [data-palette="plum"], [data-palette="navy"]):not([data-theme="light"]) {
    --activity-break-bg: #02423a;    --activity-break-text: #91e5d7;
    --activity-lunch-bg: #4a350d;    --activity-lunch-text: #f0d49b;
    --activity-training-bg: #382a5f; --activity-training-text: #d6c9ff;
    --activity-coaching-bg: #1a355d; --activity-coaching-text: #b5d3ff;
    --activity-nesting-bg: #293f17;  --activity-nesting-text: #c2e2a4;
    --activity-sick-bg: #5c1d20;     --activity-sick-text: #ffbbbb;
    --activity-late-bg: #522e01;     --activity-late-text: #fcc994;
    --activity-overtime-bg: #084424; --activity-overtime-text: #a1e8b5;
    --time-off-bg: #4d2447;          --time-off-text: #f6beea;
    --coverage-under: #6b2523;
    --coverage-short: #614501;
    --coverage-over: #214262;
  }

  /* Swatches for the settings page */
  :root:not([data-theme="light"]) {
    --swatch-classic: #f5f5f5;
    --swatch-ocean: #73b7cb;
    --swatch-indigo: #a6acff;
    --swatch-plum: #d2a0ee;
    --swatch-navy: #9fbcde;
  }
}

/* Dark, chosen */

/* Ocean: a calm sea blue */
:root[data-palette="ocean"][data-theme="dark"] {
  --accent: #73b7cb;
  --accent-hover: #89c6d8;
  --accent-contrast: #011a21;
  --nav-surface: #091a1e;
  --nav-surface-hover: #0e272d;
  --nav-border: #1d3137;
  --nav-border-strong: #68787c;
  --nav-current: #0c333d;
  --nav-current-text: #aee1f0;
}

/* Indigo: a deep blue violet */
:root[data-palette="indigo"][data-theme="dark"] {
  --accent: #a6acff;
  --accent-hover: #b9bfff;
  --accent-contrast: #131428;
  --nav-surface: #141526;
  --nav-surface-hover: #1f2037;
  --nav-border: #2a2c41;
  --nav-border-strong: #727380;
  --nav-current: #282a4b;
  --nav-current-text: #cfd4ff;
}

/* Plum: a rich purple */
:root[data-palette="plum"][data-theme="dark"] {
  --accent: #d2a0ee;
  --accent-hover: #e0b2f9;
  --accent-contrast: #1c1023;
  --nav-surface: #1c1322;
  --nav-surface-hover: #2a1c32;
  --nav-border: #35283c;
  --nav-border-strong: #79717d;
  --nav-current: #382542;
  --nav-current-text: #ebc8ff;
}

/* Navy: a deep navy, with lime in the menu */
:root[data-palette="navy"][data-theme="dark"] {
  --accent: #9fbcde;
  --accent-hover: #b2cce9;
  --accent-contrast: #0c1928;
  --nav-surface: #102234;
  --nav-surface-hover: #192e45;
  --nav-border: #243547;
  --nav-border-strong: #6b7c8f;
  --nav-current: #1f3953;
  --nav-current-text: #abcf02;
  --nav-text: #f5f5f5;
  --nav-text-secondary: #afbccb;
  --nav-text-tertiary: #8b9aab;
  --nav-settings-current: #1e3043;
  --nav-settings-current-text: #c3d6ee;
}

/* The schedule's floor, the same in every preset */
:root:is([data-palette="ocean"], [data-palette="indigo"], [data-palette="plum"], [data-palette="navy"])[data-theme="dark"] {
  --activity-break-bg: #02423a;    --activity-break-text: #91e5d7;
  --activity-lunch-bg: #4a350d;    --activity-lunch-text: #f0d49b;
  --activity-training-bg: #382a5f; --activity-training-text: #d6c9ff;
  --activity-coaching-bg: #1a355d; --activity-coaching-text: #b5d3ff;
  --activity-nesting-bg: #293f17;  --activity-nesting-text: #c2e2a4;
  --activity-sick-bg: #5c1d20;     --activity-sick-text: #ffbbbb;
  --activity-late-bg: #522e01;     --activity-late-text: #fcc994;
  --activity-overtime-bg: #084424; --activity-overtime-text: #a1e8b5;
  --time-off-bg: #4d2447;          --time-off-text: #f6beea;
  --coverage-under: #6b2523;
  --coverage-short: #614501;
  --coverage-over: #214262;
}

/* Swatches for the settings page */
:root[data-theme="dark"] {
  --swatch-classic: #f5f5f5;
  --swatch-ocean: #73b7cb;
  --swatch-indigo: #a6acff;
  --swatch-plum: #d2a0ee;
  --swatch-navy: #9fbcde;
}

/* The components with no tokens of their own (see the top): custom properties only */

/* The sidebar and the phone bar take the menu's colors */
:root:is([data-palette="ocean"], [data-palette="indigo"], [data-palette="plum"], [data-palette="navy"])
  :is(.sidebar, .phonebar) {
  --surface: var(--nav-surface);
  --surface-muted: var(--nav-surface-hover);
  --border: var(--nav-border);
  --border-strong: var(--nav-border-strong);
}

/* Navy's menu is navy in the light too, so it takes the menu's words as well, and draws in the menu's light ink what
   the accent draws elsewhere (the focus ring, a link such as the phone menu's account, the E) and the bell's count,
   with navy on them */
:root[data-palette="navy"] :is(.sidebar, .phonebar) {
  --text: var(--nav-text);
  --text-secondary: var(--nav-text-secondary);
  --text-tertiary: var(--nav-text-tertiary);
  --accent: var(--nav-text);
  --accent-contrast: var(--nav-surface);
  --info: var(--nav-text);
}

/* The current menu item: the accent's tint and ink */
:root:is([data-palette="ocean"], [data-palette="indigo"], [data-palette="plum"])
  :is(.sidebar__link, .settings__link)[aria-current="page"] {
  --surface-muted: var(--nav-current);
  --text: var(--nav-current-text);
}

/* Navy's current items: the menu's lime on a lifted navy, and the Settings menu's, on the page, the accent's tint and
   ink */
:root[data-palette="navy"] .sidebar__link[aria-current="page"] {
  --surface-muted: var(--nav-current);
  --text: var(--nav-current-text);
}

:root[data-palette="navy"] .settings__link[aria-current="page"] {
  --surface-muted: var(--nav-settings-current);
  --text: var(--nav-settings-current-text);
}

/* The coverage strip and its legend: livelier fills than the status tints */
:root:is([data-palette="ocean"], [data-palette="indigo"], [data-palette="plum"], [data-palette="navy"])
  :is(.coverage, .legend__swatch--under, .legend__swatch--short, .legend__swatch--over) {
  --danger-tint: var(--coverage-under);
  --warning-tint: var(--coverage-short);
  --info-tint: var(--coverage-over);
}

/* A selected tab: a figure on it in the tab's own ink (search.css fades a count unless told otherwise) */
:root:is([data-palette="ocean"], [data-palette="indigo"], [data-palette="plum"], [data-palette="navy"])
  .segmented__item[aria-current="page"] {
  --text-secondary: var(--accent-contrast);
  --search-count-opacity: 1;
}
