/* Colour tokens for both themes. Every colour on the site comes from here, so a theme is one block of values.
   Dark is the default; light applies when the visitor chose it (data-theme="light", set by /theme.js) or, with no choice
   made and no script, when the system prefers light. */
:root{
  color-scheme:dark;
  --s0:#1c1b19;
  --s1:#232220;
  --s2:#252422;
  --s3:#272624;
  --s4:#292825;
  --s5:#2d2c29;
  --s6:#2f2e2b;
  --s7:#363431;
  --s8:#393733;
  --s9:#3a3835;
  --s10:#3f3d39;
  --s11:#45433e;
  --s12:#4a4843;
  --text:#efede9;
  --text2:#cbc8c1;
  --muted:#b0ada6;
  --faint:#9f9b94;
  --zero:#6e6a64;
  --accent:#f28c38;
  --accent-hover:#f5a45c;
  --link:#f6b27a;
  --link-hover:#fbd0a8;
  --on-accent:#1b1a18;
  --second:#3fc1b0;
  --second-text:#a7e6dc;
  --second-line:#2b5f58;
  --bad:#ee7d6b;
  --bad2:#e5645f;
  --bad-text:#f3b0a5;
  --bad-bg:#2a1513;
  --bad-line:#5a2e29;
  --warn:#e7b04a;
  --warn-bg:#1d1a10;
  --warn-line:#4a3f1f;
  --warn-text:#e8d9a6;
  --good:#a8c85a;
  --hi:#ffffff;
  --wash:rgba(255,255,255,.035);
  --shadow-k:1;
  --bg:var(--s1); --sunk:var(--s0); --panel:var(--s4); --card:var(--s4); --panel2:var(--s5); --raised:var(--s5);
  --line:var(--s9); --line2:var(--s11); --grid:var(--s10); --base:var(--s12); --fg:var(--text);
}
:root[data-theme="light"]{
  color-scheme:light;
  --s0:#ece8e0;
  --s1:#f5f3ee;
  --s2:#f8f6f1;
  --s3:#faf8f4;
  --s4:#ffffff;
  --s5:#fbf9f5;
  --s6:#f1eee7;
  --s7:#e8e4db;
  --s8:#ebe7de;
  --s9:#e2ddd2;
  --s10:#d9d3c6;
  --s11:#d0c9ba;
  --s12:#c4bcab;
  --text:#1f1d1a;
  --text2:#423f39;
  --muted:#5f5b53;
  --faint:#6f6a61;
  --zero:#c9c2b3;
  --accent:#d9731a;
  --accent-hover:#c4640f;
  --link:#a24c07;
  --link-hover:#7a3604;
  --on-accent:#1b1a18;
  --second:#1a9686;
  --second-text:#0f6b5f;
  --second-line:#a6ddd4;
  --bad:#d6513c;
  --bad2:#c8403b;
  --bad-text:#9c2a1a;
  --bad-bg:#fdecea;
  --bad-line:#f0b9b1;
  --warn:#a8620a;
  --warn-bg:#fdf4dc;
  --warn-line:#ecd08a;
  --warn-text:#7a5200;
  --good:#5f9a1f;
  --hi:#000000;
  --wash:rgba(0,0,0,.04);
  --shadow-k:.4;
}
@media (prefers-color-scheme:light){
  :root:not([data-theme]){
    color-scheme:light;
    --s0:#ece8e0;
  --s1:#f5f3ee;
  --s2:#f8f6f1;
  --s3:#faf8f4;
  --s4:#ffffff;
  --s5:#fbf9f5;
  --s6:#f1eee7;
  --s7:#e8e4db;
  --s8:#ebe7de;
  --s9:#e2ddd2;
  --s10:#d9d3c6;
  --s11:#d0c9ba;
  --s12:#c4bcab;
  --text:#1f1d1a;
  --text2:#423f39;
  --muted:#5f5b53;
  --faint:#6f6a61;
  --zero:#c9c2b3;
  --accent:#d9731a;
  --accent-hover:#c4640f;
  --link:#a24c07;
  --link-hover:#7a3604;
  --on-accent:#1b1a18;
  --second:#1a9686;
  --second-text:#0f6b5f;
  --second-line:#a6ddd4;
  --bad:#d6513c;
  --bad2:#c8403b;
  --bad-text:#9c2a1a;
  --bad-bg:#fdecea;
  --bad-line:#f0b9b1;
  --warn:#a8620a;
  --warn-bg:#fdf4dc;
  --warn-line:#ecd08a;
  --warn-text:#7a5200;
  --good:#5f9a1f;
  --hi:#000000;
  --wash:rgba(0,0,0,.04);
  --shadow-k:.4;
  }
}
:root[data-theme="dark"]{color-scheme:dark}

/* The switch itself. It stays hidden until /theme.js has run, because it cannot work without it. */
.theme-toggle{display:none;width:36px;height:36px;flex:none;border:0;border-radius:8px;background:none;color:var(--muted);cursor:pointer;align-items:center;justify-content:center;padding:0}
:root[data-theme] .theme-toggle{display:inline-flex}
.theme-toggle:hover{background:var(--s6);color:var(--text)}
.theme-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle .i-moon{display:none}
:root[data-theme="light"] .theme-toggle .i-sun{display:none}
:root[data-theme="light"] .theme-toggle .i-moon{display:block}

/* iPhones and iPads zoom the whole page in when a field with text under 16px is focused. On touch screens and narrow ones every
   field is therefore at least 16px. It is !important so that no page's own field style (several are more specific, and set a
   smaller size) can bring the zoom back. Pinch zoom stays on: the viewport is not locked. */
@media (pointer: coarse), (max-width: 800px){
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size:16px !important; }
}

/* Phones get bigger text. Every size under 17px is written as var(--fs-N, Npx), N being its size on a wide screen (--fs-12_5 is
   12.5px), so these lines set the phone sizes for the whole site: nothing is smaller than 13px, and reading text is 15 to 17px.
   The second query is a phone held sideways. Write new small text the same way, or phones will not enlarge it. */
@media (max-width:800px), (pointer:coarse) and (max-height:500px){
  :root{
    --fs-9:13px; --fs-10:13px; --fs-10_5:13px; --fs-11:13px; --fs-11_5:13px;
    --fs-12:14px; --fs-12_5:14px;
    --fs-13:15px; --fs-13_5:15px;
    --fs-14:16px; --fs-14_5:16px;
    --fs-15:17px; --fs-15_5:17px; --fs-16:17px;
  }
}
