/* ============================================================
   Palettes — nine colour schemes for the maintained Pixel style.

   Each palette defines only primitives (--p-*). The active style sheet
   maps them onto its own semantic tokens, so adding a palette never
   means touching a style.

   Keep the swatch colours in ui.js PALETTES in step with these.
   ============================================================ */

/* Before a choice is made, follow the system: Paper by day, Moonlight by night. */
:root,
:root[data-palette="paper"] {
  color-scheme: light;

  --p-bg: #ffffff;
  --p-surface: #ffffff;
  --p-surface-alt: #f4f4f2;
  --p-sunken: #fafaf8;

  --p-ink: #0a0a0a;
  --p-ink-dim: #55534e;
  --p-ink-faint: #8b8880;

  --p-accent: #0a0a0a;
  --p-accent-ink: #ffffff;
  --p-highlight: #ffe680;      /* the marker-pen yellow behind a hovered word */
  --p-highlight-ink: #0a0a0a;

  --p-line: #e5e5e2;
  --p-line-strong: #cfcec8;
  --p-edge: #0a0a0a;

  --p-good: #1a7f37;
  --p-bad: #c1121f;
  --p-scrim: rgba(10, 10, 10, 0.34);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-palette]) {
    color-scheme: dark;

    --p-bg: #12101c;
    --p-surface: #1a1729;
    --p-surface-alt: #241f3a;
    --p-sunken: #0d0b16;

    --p-ink: #ece8ff;
    --p-ink-dim: #a49dd0;
    --p-ink-faint: #746c9c;

    --p-accent: #ffd447;
    --p-accent-ink: #17131f;
    --p-highlight: #ffd447;
    --p-highlight-ink: #17131f;

    --p-line: #302b50;
    --p-line-strong: #453e6e;
    --p-edge: #ffd447;

    --p-good: #5ce85c;
    --p-bad: #ff5f5f;
    --p-scrim: rgba(5, 4, 10, 0.72);
  }
}

/* ------------------------------------------------------------ Moonlight */

:root[data-palette="moonlight"] {
  color-scheme: dark;

  --p-bg: #12101c;
  --p-surface: #1a1729;
  --p-surface-alt: #241f3a;
  --p-sunken: #0d0b16;

  --p-ink: #ece8ff;
  --p-ink-dim: #a49dd0;
  --p-ink-faint: #746c9c;

  --p-accent: #ffd447;
  --p-accent-ink: #17131f;
  --p-highlight: #ffd447;
  --p-highlight-ink: #17131f;

  --p-line: #302b50;
  --p-line-strong: #453e6e;
  --p-edge: #ffd447;

  --p-good: #5ce85c;
  --p-bad: #ff5f5f;
  --p-scrim: rgba(5, 4, 10, 0.72);
}

/* ------------------------------------------------------------ Obsidian v2
   Neutral near-black with no colour cast. V2 replaces the original palette:
   its colour values are unchanged while pixel.css owns its square geometry. */

:root[data-palette="obsidian"] {
  color-scheme: dark;

  --p-bg: #0c0c0c;
  --p-surface: #101010;
  --p-surface-alt: #141414;
  --p-sunken: #080808;

  --p-ink: #f2f2f2;
  --p-ink-dim: #b5b5b5;
  --p-ink-faint: #7d7d7d;

  --p-accent: #f2f2f2;
  --p-accent-ink: #0c0c0c;
  --p-highlight: #f2f2f2;
  --p-highlight-ink: #0c0c0c;

  --p-line: #252525;
  --p-line-strong: #383838;
  --p-edge: #f2f2f2;

  --p-good: #79d991;
  --p-bad: #ff7070;
  --p-scrim: rgba(0, 0, 0, 0.8);
}

/* ------------------------------------------------------------ Obsidian v3
   A colour-only fork of Paper. There are intentionally no v3 component or
   geometry overrides in pixel.css: it follows the original Pixel/Paper
   structure exactly and swaps only these colour primitives. */

:root[data-palette="obsidian-v3"] {
  color-scheme: dark;

  --p-bg: #0c0c0c;
  --p-surface: #101010;
  --p-surface-alt: #141414;
  --p-sunken: #080808;

  --p-ink: #f2f2f2;
  --p-ink-dim: #b5b5b5;
  --p-ink-faint: #7d7d7d;

  --p-accent: #f2f2f2;
  --p-accent-ink: #0c0c0c;
  --p-highlight: #f2f2f2;
  --p-highlight-ink: #0c0c0c;

  --p-line: #252525;
  --p-line-strong: #383838;
  --p-edge: #f2f2f2;

  --p-good: #79d991;
  --p-bad: #ff7070;
  --p-scrim: rgba(0, 0, 0, 0.8);
}

/* ------------------------------------------------------------ Terminal */

:root[data-palette="terminal"] {
  color-scheme: dark;

  --p-bg: #050806;
  --p-surface: #0a120c;
  --p-surface-alt: #101d14;
  --p-sunken: #030503;

  /* Soft white-green reads far better than pure phosphor for body text. */
  --p-ink: #d7ffe4;
  --p-ink-dim: #6fd694;
  --p-ink-faint: #3f8f5c;

  --p-accent: #4dff88;
  --p-accent-ink: #041008;
  --p-highlight: #4dff88;
  --p-highlight-ink: #041008;

  --p-line: #1d4a2f;
  --p-line-strong: #2f7a4c;
  --p-edge: #4dff88;

  --p-good: #4dff88;
  --p-bad: #ff6b6b;
  --p-scrim: rgba(2, 6, 3, 0.76);
}

/* ------------------------------------------------------------ Amber */

:root[data-palette="amber"] {
  color-scheme: dark;

  --p-bg: #0d0a06;
  --p-surface: #16110a;
  --p-surface-alt: #211910;
  --p-sunken: #080603;

  --p-ink: #ffdfb0;
  --p-ink-dim: #c9975a;
  --p-ink-faint: #8a6534;

  --p-accent: #ffb000;
  --p-accent-ink: #1a1204;
  --p-highlight: #ffb000;
  --p-highlight-ink: #1a1204;

  --p-line: #402e15;
  --p-line-strong: #6b4d22;
  --p-edge: #ffb000;

  --p-good: #b6d94a;
  --p-bad: #ff6b4a;
  --p-scrim: rgba(8, 6, 3, 0.76);
}

/* ------------------------------------------------------------ Reader Dark
   Warm sepia, low blue light — easy on the eyes for night reading. */

:root[data-palette="reader-dark"] {
  color-scheme: dark;

  --p-bg: #1c1712;
  --p-surface: #26201a;
  --p-surface-alt: #322a20;
  --p-sunken: #16120e;

  --p-ink: #e8d9b5;
  --p-ink-dim: #b3a077;
  --p-ink-faint: #7d6f4f;

  --p-accent: #e8c468;
  --p-accent-ink: #1c1712;
  --p-highlight: #e8c468;
  --p-highlight-ink: #1c1712;

  --p-line: #3d3325;
  --p-line-strong: #574a34;
  --p-edge: #e8c468;

  --p-good: #b9c96a;
  --p-bad: #d97a5a;
  --p-scrim: rgba(15, 12, 8, 0.72);
}

/* ------------------------------------------------------------ Reader Light
   Warm cream paper — a bright sibling of Reader Dark for daytime reading. */

:root[data-palette="reader-light"] {
  color-scheme: light;

  --p-bg: #f1e1c9;
  --p-surface: #f8efdc;
  --p-surface-alt: #e6d3ac;
  --p-sunken: #ecdbb8;

  --p-ink: #34281b;
  --p-ink-dim: #5f4f38;
  --p-ink-faint: #8f7a57;

  --p-accent: #b6811e;
  --p-accent-ink: #f8efdc;
  --p-highlight: #d9a94a;
  --p-highlight-ink: #34281b;

  --p-line: #e2cfa0;
  --p-line-strong: #cbb47c;
  --p-edge: #34281b;

  --p-good: #5c7a2e;
  --p-bad: #a8442a;
  --p-scrim: rgba(52, 40, 27, 0.34);
}

/* ------------------------------------------------------------ Olive
   Four-tone handheld LCD: light ground, very dark ink, no true black. */

:root[data-palette="olive"] {
  color-scheme: light;

  --p-bg: #c4cfa1;
  --p-surface: #d3dcb2;
  --p-surface-alt: #aab88a;
  --p-sunken: #b7c394;

  --p-ink: #1b2910;
  --p-ink-dim: #3a4a20;
  --p-ink-faint: #5c6d38;

  --p-accent: #1b2910;
  --p-accent-ink: #d3dcb2;
  --p-highlight: #8b9a6b;
  --p-highlight-ink: #0f1a08;

  --p-line: #9aa87c;
  --p-line-strong: #7d8c60;
  --p-edge: #1b2910;

  --p-good: #2f6b1f;
  --p-bad: #8f2020;
  --p-scrim: rgba(27, 41, 16, 0.55);
}
