/* Colour tokens per theme. reader.css and pygments.css use only these variables, so a theme
   is one block here and one entry in boot.js (its bar colour).

   Solarized: base03 #002b36  base02 #073642  base01 #586e75  base00 #657b83
              base0  #839496  base1  #93a1a1  base2  #eee8d5  base3  #fdf6e3
              yellow #b58900  orange #cb4b16  red    #dc322f  magenta #d33682
              violet #6c71c4  blue   #268bd2  cyan   #2aa198  green   #859900 */

:root,
[data-theme="solarized-light"] {
  color-scheme: light;
  --bg: #fdf6e3;
  --bg-alt: #eee8d5;
  /* base01, not the canonical base00: 4.99:1 on base3 against 4.13:1. */
  --fg: #586e75;
  --fg-strong: #073642;
  --fg-muted: #93a1a1;
  --rule: #d9d2c5;
  /* 3.41:1 on base3, so links are always underlined as well. */
  --link: #268bd2;
  --accent: #cb4b16;
  --mark: rgb(181 137 0 / 0.28);
  --mark-line: #b58900;
  --mark-other: rgb(108 113 196 / 0.22);
  --mark-other-line: #6c71c4;
  --find: rgb(38 139 210 / 0.22);
  --find-current: rgb(203 75 22 / 0.45);
  --code-fg: #586e75;
  --err: #dc322f;
  --shade: rgb(7 54 66 / 0.25);

  --syn-kw: #859900;
  --syn-str: #2aa198;
  --syn-num: #2aa198;
  --syn-com: #93a1a1;
  --syn-fn: #268bd2;
  --syn-builtin: #d33682;
  --syn-op: #657b83;

  --ansi-red: #dc322f;
  --ansi-green: #859900;
  --ansi-yellow: #b58900;
  --ansi-blue: #268bd2;
  --ansi-magenta: #d33682;
  --ansi-cyan: #2aa198;
}

[data-theme="solarized-dark"] {
  color-scheme: dark;
  --bg: #002b36;
  --bg-alt: #073642;
  /* base1, the mirror of the choice above: 5.7:1 on base03 against 4.75:1 for base0. */
  --fg: #93a1a1;
  --fg-strong: #eee8d5;
  --fg-muted: #657b83;
  --rule: #0f4756;
  --link: #268bd2;
  --accent: #cb4b16;
  --mark: rgb(181 137 0 / 0.38);
  --mark-line: #b58900;
  --mark-other: rgb(108 113 196 / 0.34);
  --mark-other-line: #8b8fd6;
  --find: rgb(38 139 210 / 0.35);
  --find-current: rgb(203 75 22 / 0.65);
  --code-fg: #93a1a1;
  --err: #dc322f;
  --shade: rgb(0 0 0 / 0.45);

  --syn-kw: #859900;
  --syn-str: #2aa198;
  --syn-num: #2aa198;
  --syn-com: #657b83;
  --syn-fn: #268bd2;
  --syn-builtin: #d33682;
  --syn-op: #839496;
}

[data-theme="plain-light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #f3f3f1;
  --fg: #222222;
  --fg-strong: #000000;
  --fg-muted: #717171;
  --rule: #dddddd;
  --link: #0b57d0;
  --accent: #a4380f;
  --mark: #fff3a3;
  --mark-line: #b08a00;
  --mark-other: #e4defc;
  --mark-other-line: #6b5bc4;
  --find: #cfe4ff;
  --find-current: #ffb066;
  --code-fg: #222222;
  --err: #c0261d;
  --shade: rgb(0 0 0 / 0.25);

  --syn-kw: #a31f34;
  --syn-str: #0f5a8a;
  --syn-num: #0f5a8a;
  --syn-com: #717171;
  --syn-fn: #6b3fb3;
  --syn-builtin: #8a4a00;
  --syn-op: #222222;

  --ansi-red: #c0261d;
  --ansi-green: #2b7a0b;
  --ansi-yellow: #8a6100;
  --ansi-blue: #0b57d0;
  --ansi-magenta: #a3248f;
  --ansi-cyan: #0b7285;
}

[data-theme="plain-dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-alt: #171717;
  --fg: #dcdcdc;
  --fg-strong: #ffffff;
  --fg-muted: #8c8c8c;
  --rule: #2e2e2e;
  --link: #7ab7ff;
  --accent: #ffa657;
  --mark: rgb(255 214 10 / 0.3);
  --mark-line: #ffd60a;
  --mark-other: rgb(160 140 255 / 0.3);
  --mark-other-line: #b4a6ff;
  --find: rgb(10 132 255 / 0.4);
  --find-current: rgb(255 159 10 / 0.7);
  --code-fg: #dcdcdc;
  --err: #ff7b72;
  --shade: rgb(0 0 0 / 0.6);

  --syn-kw: #ff7b72;
  --syn-str: #a5d6ff;
  --syn-num: #79c0ff;
  --syn-com: #8c8c8c;
  --syn-fn: #d2a8ff;
  --syn-builtin: #ffa657;
  --syn-op: #dcdcdc;

  --ansi-red: #ff7b72;
  --ansi-green: #7ee787;
  --ansi-yellow: #e3b341;
  --ansi-blue: #7ab7ff;
  --ansi-magenta: #d2a8ff;
  --ansi-cyan: #76e3ea;
}

/* Black on white with nothing in between, for e-ink: greys dither, colours vanish, and
   every repaint is slow and leaves ghosts. Syntax is told apart by weight and slant
   (pygments.css), and reader.css turns off everything that moves. */
[data-theme^="eink"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #ffffff;
  --fg: #000000;
  --fg-strong: #000000;
  --fg-muted: #000000;
  --rule: #000000;
  --link: #000000;
  --accent: #000000;
  --mark: transparent;
  --mark-line: #000000;
  --mark-other: transparent;
  --mark-other-line: #000000;
  --find: transparent;
  --find-current: transparent;
  --code-fg: #000000;
  --err: #000000;
  --shade: transparent;

  --syn-kw: #000000;
  --syn-str: #000000;
  --syn-num: #000000;
  --syn-com: #000000;
  --syn-fn: #000000;
  --syn-builtin: #000000;
  --syn-op: #000000;

  --ansi-red: #000000;
  --ansi-green: #000000;
  --ansi-yellow: #000000;
  --ansi-blue: #000000;
  --ansi-magenta: #000000;
  --ansi-cyan: #000000;

  /* The lines that frame the page, top and bottom: grey, which nearly every e-ink screen
     can show, so they sit behind the text instead of competing with it. */
  --edge: #555555;
  --edge-faint: #a0a0a0;
}

/* The same page for an e-ink screen that has colour. Text and rules stay black; code,
   printed colours and errors get colour back. Such screens wash colours out, so these are
   darker and more saturated than they would be on glass. */
[data-theme="eink-colour"] {
  --link: #0033b3;
  --err: #b00000;
  --mark: #ffe14d;
  --mark-line: #000000;
  --mark-other: #c9bdff;
  --mark-other-line: #000000;
  --find: #a8d4ff;
  --find-current: #ffb066;

  --syn-kw: #0033b3;
  --syn-str: #067d17;
  --syn-num: #1750eb;
  --syn-com: #4a4a4a;
  --syn-fn: #7a2e9d;
  --syn-builtin: #9a4a00;
  --syn-op: #000000;

  --ansi-red: #b00000;
  --ansi-green: #067d17;
  --ansi-yellow: #8a6100;
  --ansi-blue: #0033b3;
  --ansi-magenta: #8a1a9a;
  --ansi-cyan: #00627a;
}

/* The text size is set by boot.js as a pixel value; type and spacing are in rem and follow.
   The column, one for prose, code, outputs and tables alike, is in pixels so that it does
   not: changing the text size must not also change how wide the page is. reader.js has
   the same numbers, to know which steps make a difference on the current screen. */
:root { --size: 19px; --measure: 700px; }
[data-width="n"] { --measure: 600px; }
[data-width="m"] { --measure: 700px; }
[data-width="w"] { --measure: 820px; }
[data-width="x"] { --measure: 1040px; }
[data-width="f"] { --measure: 100vw; }
