/* The colour palette: the one source of every colour token, for the default (dark) theme, the system's
   light scheme and the Theme button's [data-theme] blocks. The app loads this file before styles.css, and
   the website (bulbboard.com) copies it verbatim: the palette is the same in both. Colours
   are defined here and nowhere else (test/palette-css.test.ts); styles.css only uses them with var(). */

:root {
  --plum: #522d60;
  --mauve: #80426e;
  --peach: #f2a67b;
  --gold: #ffd38b;
  /* Selection marks (current view, queue item, chosen card): gold is 1.2:1 on light paper, so the light theme darkens it to 3:1 or more (WCAG 1.4.11). */
  --gold-mark: var(--gold);
  /* The dock handle's focus line on the terminal background: 4.8:1 (mauve was 2.67:1). */
  --handle-focus: #a46f98;

  /* Derived from the palette */
  --night: #1d0f23; /* page: plum pushed toward black */
  --panel: #28142f; /* raised areas */
  --line: #47284f; /* rules between rows */
  --ink: #fbefe4; /* body text, warm off-white */
  --ink-soft: #dcc6d4;
  --ink-faint: #ab8ea3;
  /* Outside the palette on purpose: "needs you" and "failed" must never read as "fine". */
  --rose: #ff8f8f;
  /* The lamps' looks (public/styles.css; the page that cannot load, src/icloud.ts, reads this file and the lamp block of
     styles.css and draws its lamps with them). Working: lit gold, steady. Calling: rose, pulsing. */
  --lamp-busy-face: radial-gradient(circle at 50% 50%, #fff7e6 0%, var(--gold) 42%, #c8934b 100%);
  --lamp-busy-edge: #e9b96a;
  --lamp-call-face-hi: #ffe6e6;
  --lamp-call-face-lo: #c24e5a;
  --lamp-call-face: radial-gradient(circle at 50% 50%, var(--lamp-call-face-hi) 0%, var(--rose) 45%, var(--lamp-call-face-lo) 100%);
  --lamp-call-edge: #f07b84;
  --lamp-call-pulse: calling 1.6s ease-in-out infinite;
  /* Quiet's dent: the inner shadow of its dark face, the same on every side (a shade off to one side moved the face's centre). */
  --lamp-dent: inset 0 0 2px rgb(0 0 0 / 0.6);
  /* The lamp's sizes, all whole pixels, so a lamp is the same shape at device pixel ratio 1 and 2 and its face and
     ring are centred on one point (docs/lamps.md has the table and where each is used). The ring is a band outside the
     face; the outer size is the face plus the ring on both sides. */
  --lamp-ring: 2px;
  --lamp-size-normal: 18px;
  --lamp-size-medium: 14px;
  --lamp-size-small: 12px;
  --lamp-size-tiny: 8px;
  --lamp-outer-normal: calc(var(--lamp-size-normal) + 2 * var(--lamp-ring));
  --lamp-outer-medium: calc(var(--lamp-size-medium) + 2 * var(--lamp-ring));
  --lamp-outer-small: calc(var(--lamp-size-small) + 2 * var(--lamp-ring));
  --lamp-outer-tiny: calc(var(--lamp-size-tiny) + 2 * var(--lamp-ring));

  /* Text in the palette's colours; the light theme darkens them to stay readable. */
  --accent-ink: var(--gold);
  /* What a module added (public/modules.js): its chip, its icons. Not the board's palette, on purpose. */
  --module: #c9a3e0;
  --module-bg: rgb(201 163 224 / 0.12);
  --busy-ink: var(--peach);
  /* "Waiting on others" text (.waiting-on, the Others chip): the peach of its lamp; on paper a darker peach, 4.9:1 or more on every surface it sits on. */
  --others-ink: var(--peach);
  /* "Working", in the gold of the working lamp. */
  --work-ink: var(--gold);
  --bad-ink: var(--rose);
  /* Waiting on someone else: amber, between idle gold and working peach. */
  --others: #e0a95a;

  /* Surfaces */
  --need-waiting-bg: #2f1530;
  --alert-bg: #3a1730;
  --danger-bg: #2c1230;
  --danger-line: #8a3a52;
  --board-hi: #34193d;
  --rail-bg: #231229; /* the rail, a shade under the page */
  --board-lo: #211026;
  /* The board's own sockets, a dot per lamp's place (public/styles.css, .status-board; src/icloud.ts): the board's look, not a lamp's, so no --lamp-* token. */
  --board-socket-hi: #46284f;
  --board-socket-lo: #2a1530;
  --socket: #170a1c;
  --socket-shadow: inset 0 2px 4px rgb(0 0 0 / 0.55), 0 1px 0 rgb(255 255 255 / 0.04);
  --lamp-off-hi: #46284f;
  --lamp-off-lo: #2a1530;
  /* A lamp's outline, 3:1 or more against every background a lamp sits on (WCAG 1.4.11): a stopped
     lamp's ring (3.9:1 or more here), and a rim around every lamp, which lit lamps need only on paper.
     The lamps' faces stay the same in both themes. */
  --lamp-off-ring: #a46f98;
  --lamp-rim: transparent;
  /* The rings of the lamps (README, The lamps) in the board's colours: rose round a call for you, gold
     for idle, peach on hold and at the plan limit. Paper darkens them to stay 3:1 or more. */
  --lamp-call-ring: #ff8f8f;
  --terminal-bg: #150b1a;
  /* The bright heart of the light that runs along the exchange's lines (exchange.js); the same in both themes. */
  --spark-hi: #fffaf0;
  /* Token chart columns: weekends on a faint band, today on a gold one. Washes, so bars stay the loudest. */
  --chart-weekend: rgb(255 255 255 / 0.045);
  --chart-today: rgb(255 211 139 / 0.11);
  --hover: rgb(82 45 96 / 0.25);
  --menu-shadow: 0 14px 36px rgb(0 0 0 / 0.45);
  /* Token chart, one colour per model family; checked with the dataviz palette validator. */
  --model-opus: #a66cc8;
  --model-sonnet: #d4724a;
  --model-haiku: #12a28a;
  --model-fable: #4f93e0;
  --model-other: #8a7d88;
  /* Where an agent or skill comes from (public/agents.js): its chip's text and border, its dot. */
  --origin-yours: var(--gold);
  --origin-web: #8fcdf0;
  --origin-bulbboard: var(--peach);
  --origin-review: #92d9a8;
  --origin-claude: #b4b8ff;
  --origin-unknown: var(--ink-faint);


  color-scheme: dark;
}

/* ---------- light theme ---------- */
/* The same four colours on warm paper, chosen by the system or the Theme button. Terminals stay
   dark in both: Claude Code draws its screen for a dark background. */

:root[data-theme='light'] {
  --night: #fbf4ee;
  --panel: #f5e9e1;
  --line: #e4d0d8;
  --ink: #2a1530;
  --ink-soft: #4f3550;
  --ink-faint: #7a5c74;
  --rose: #e0566b;
  --accent-ink: #80426e;
  --module: #6b3a8c;
  --module-bg: rgb(107 58 140 / 0.1);
  --busy-ink: #a2502a;
  --others-ink: #9a4a26;
  --work-ink: #8a5a12;
  --gold-mark: #8a5a12;
  --bad-ink: #b3263e;
  /* --bad-ink is 5.9:1 on --night; the menu's Remove… gets 7.1:1, 6.3:1 hovered. */
  --menu-danger-ink: #9e2038;
  --others: #c98a2e;
  --need-waiting-bg: #fbe6e6;
  --alert-bg: #fbe6e6;
  --danger-bg: #fbe6e6;
  --danger-line: #d68a98;
  --board-hi: #fffaf5;
  --rail-bg: #f7ece5;
  --board-lo: #f1e2d8;
  --board-socket-hi: #f6edf1;
  --board-socket-lo: #dccbd4;
  --socket: #ead9df;
  --socket-shadow: inset 0 2px 3px rgb(82 45 96 / 0.22), 0 1px 0 rgb(255 255 255 / 0.7);
  --lamp-off-hi: #f6edf1;
  --lamp-off-lo: #dccbd4;
  /* Mauve, 5.3:1 or more on every light background: the lamps' gold and peach are 1.0 to 2.9:1. */
  --lamp-off-ring: var(--mauve);
  --lamp-rim: var(--mauve);
  --lamp-call-ring: #b3263e;
  --hover: rgb(82 45 96 / 0.07);
  --menu-shadow: 0 12px 32px rgb(42 21 48 / 0.18);
  --chart-weekend: rgb(82 45 96 / 0.055);
  --chart-today: rgb(128 66 110 / 0.12);
  --model-opus: #8a4fb0;
  --model-sonnet: #c2643c;
  --model-haiku: #0b8a74;
  --model-fable: #2f6fc0;
  --model-other: #7a6f78;
  /* 4.5:1 or more on --night and --panel. */
  --origin-yours: #85570f;
  --origin-web: #1d6488;
  --origin-bulbboard: #9c4a24;
  --origin-review: #2b6a3d;
  --origin-claude: #4a4cad;
  --origin-unknown: #7a5c74;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --gold-mark: #8a5a12;
    --night: #fbf4ee;
    --panel: #f5e9e1;
    --line: #e4d0d8;
    --ink: #2a1530;
    --ink-soft: #4f3550;
    --ink-faint: #7a5c74;
    --rose: #e0566b;
    --accent-ink: #80426e;
    --module: #6b3a8c;
    --module-bg: rgb(107 58 140 / 0.1);
    --busy-ink: #a2502a;
    --others-ink: #9a4a26;
    --work-ink: #8a5a12;
    --bad-ink: #b3263e;
    --menu-danger-ink: #9e2038;
    --others: #c98a2e;
    --need-waiting-bg: #fbe6e6;
    --alert-bg: #fbe6e6;
    --danger-bg: #fbe6e6;
    --danger-line: #d68a98;
    --board-hi: #fffaf5;
    --rail-bg: #f7ece5;
    --board-lo: #f1e2d8;
    --board-socket-hi: #f6edf1;
    --board-socket-lo: #dccbd4;
    --socket: #ead9df;
    --socket-shadow: inset 0 2px 3px rgb(82 45 96 / 0.22), 0 1px 0 rgb(255 255 255 / 0.7);
    --lamp-off-hi: #f6edf1;
    --lamp-off-lo: #dccbd4;
    --lamp-off-ring: var(--mauve);
    --lamp-rim: var(--mauve);
    --lamp-call-ring: #b3263e;
    --hover: rgb(82 45 96 / 0.07);
    --menu-shadow: 0 12px 32px rgb(42 21 48 / 0.18);
    --chart-weekend: rgb(82 45 96 / 0.055);
    --chart-today: rgb(128 66 110 / 0.12);
    --model-opus: #8a4fb0;
    --model-sonnet: #c2643c;
    --model-haiku: #0b8a74;
    --model-fable: #2f6fc0;
    --model-other: #7a6f78;
    /* 4.5:1 or more on --night and --panel. */
    --origin-yours: #85570f;
    --origin-web: #1d6488;
    --origin-bulbboard: #9c4a24;
    --origin-review: #2b6a3d;
    --origin-claude: #4a4cad;
    --origin-unknown: #7a5c74;
    color-scheme: light;
  }
}

:root[data-theme='light'] .dock {
  --night: #1d0f23;
  --panel: #28142f;
  --line: #47284f;
  --ink: #fbefe4;
  --ink-soft: #dcc6d4;
  --ink-faint: #ab8ea3;
  --rose: #ff8f8f;
  --accent-ink: var(--gold);
  --gold-mark: var(--gold);
  --busy-ink: var(--peach);
  --work-ink: var(--gold);
  --bad-ink: var(--rose);
  --danger-line: #8a3a52;
  --lamp-off-hi: #46284f;
  --lamp-off-lo: #2a1530;
  --lamp-off-ring: #a46f98;
  --lamp-rim: transparent;
  --lamp-call-ring: #ff8f8f;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .dock {
    --night: #1d0f23;
    --panel: #28142f;
    --line: #47284f;
    --ink: #fbefe4;
    --ink-soft: #dcc6d4;
    --ink-faint: #ab8ea3;
    --rose: #ff8f8f;
    --accent-ink: var(--gold);
    --gold-mark: var(--gold);
    --busy-ink: var(--peach);
    --work-ink: var(--gold);
    --bad-ink: var(--rose);
    --danger-line: #8a3a52;
    --lamp-off-hi: #46284f;
    --lamp-off-lo: #2a1530;
    --lamp-off-ring: #a46f98;
    --lamp-rim: transparent;
    --lamp-call-ring: #ff8f8f;
    color-scheme: dark;
  }
}
