/* palette.css — every colour on the site, in one place.
   CSS and the canvas pen (js/palette.js) both read these tokens, so a new palette is an edit here.

   Each token is an RGB triplet ("29, 40, 70"), so any use can add its own alpha:
     CSS:    rgba(var(--ink-rgb), .55)          or the colour aliases at the bottom (var(--ink))
     canvas: col("ink", .55) from js/palette.js  (token name without the "--" and "-rgb")
   A stroke in js/ink.js can name any token: sk.add(pts, { col: "pencil" }).

   Text contrast on --paper (worked out for this file): ink 13.6:1, text 13.3:1, pen-soft-text 7.9:1,
   red 7.2:1, cobalt 7.2:1, emerald-text 6.3:1, soft 6.1:1, pen-faint-text 5.0:1. Pencil, vermilion, gold,
   highlight, mint, cerulean, kraft, coral and shimmer-mint are for marks and washes only, never for text.
   Every text colour except pen-faint-text stays above 5.4:1 on the raised paper, the WhatsApp-green bubble
   and the mint ledger too; the lettering on kraft (ink, pen-soft-text, red) stays above 5.2:1.
   pen-faint-text is only ever on bare paper.
   The canvases letter in pen strokes about 1 px wide, which only partly cover their pixels, so lettering
   gets tokens darker than the lines beside it (pen-soft-text vs pen-soft) and is drawn solid: penStyle and
   penWidth in js/ink.js. Measured on rendered 1x pixels (glyph cores against the local ground, Fig. 1-4,
   Sheet 05, 404): navy 12.9:1, soft lettering 6.9-7.9:1, red 6.6-7.3:1, faint 4.7:1 (before: 1.9-4.3:1).

   Keep the commas: rgba(r, g, b, a) is the legacy syntax, and browsers blend gradients of legacy colours in
   sRGB; the modern rgb(r g b / a) form switches gradients to Oklab and shifts every grid line slightly.

   The colour aliases (--paper, --ink …) are worked out on :root: an element that sets its own
   --paper-rgb must also set --paper: rgb(var(--paper-rgb)). */
:root {
  /* ---------- paper ---------- */
  --paper-rgb: 250, 247, 240;          /* the sheet, crisp warm white (#faf7f0); also <meta name="theme-color"> in every page */
  --paper-hi-rgb: 255, 253, 248;       /* raised paper: Fig. 2 chips, the chat phone, legal tables and cards */
  --paper-label-rgb: 251, 249, 243;    /* the ground under Fig. 3's map labels */
  --paper-glint-rgb: 247, 243, 232;    /* light on the cursor nib */
  --bubble-in-rgb: 255, 254, 250;      /* Fig. 4 chat: messages in */
  --bubble-out-rgb: 220, 242, 216;     /* Fig. 4 chat: messages out, WhatsApp green */
  --grid-rgb: 64, 116, 186;            /* graph-paper rules */
  --fiber-rgb: 110, 90, 60;            /* paper fibres */
  --fiber-speck-rgb: 120, 100, 70;     /* specks in the paper */

  /* ---------- ink ---------- */
  --ink-rgb: 29, 40, 70;               /* headings, rules, outlines (#1d2846) */
  --ink-1-rgb: 28, 39, 69;             /* the pen: each stroke picks one of four shades */
  --ink-2-rgb: 33, 45, 80;
  --ink-3-rgb: 26, 36, 65;
  --ink-4-rgb: 36, 49, 91;
  --ink-wet-rgb: 46, 72, 170;          /* the cursor's trace while wet; it dries to --ink-1 */
  --ink-bleed-rgb: 34, 48, 95;         /* headings soaking into the paper */
  --ink-bead-rgb: 36, 53, 110;         /* the drop on the cursor nib */
  --text-rgb: 42, 42, 48;              /* body text */
  --soft-rgb: 84, 93, 119;             /* secondary text */
  --pen-soft-rgb: 79, 90, 120;         /* the pen's lighter lines */
  --pen-faint-rgb: 141, 151, 174;      /* the pen's faintest lines */
  --pen-soft-text-rgb: 66, 76, 106;    /* the pen's secondary lettering ("TALKS TO THE TERMINAL"): darker than its lines, since thin letters only half cover their pixels */
  --pen-faint-text-rgb: 96, 106, 134;  /* the pen's tertiary lettering (map soundings, "(CLICK TO TRY AGAIN)") */
  --tick-read-rgb: 44, 79, 158;        /* Fig. 4: read ticks, blue felt */

  /* ---------- red pencil ---------- */
  --red-rgb: 152, 46, 29;              /* red text, in CSS and red-pencil lettering on the canvases (drawn solid, never with the grain) */
  --pencil-rgb: 194, 65, 46;           /* decorative red only (not for text) */
  --pencil-grain-rgb: 204, 66, 40;     /* the grain of red-pencil strokes */
  --pencil-mark-rgb: 178, 58, 38;      /* Fig. 2b ledger: red ticks and the eraser's dust */

  /* ---------- shadows and paper effects ---------- */
  --shadow-rgb: 60, 44, 20;            /* drop shadows of things lying on the paper */
  --shadow-seam-rgb: 70, 52, 24;       /* the seams between sheets */
  --shadow-vignette-rgb: 120, 100, 68; /* the page's darker edges, light on warm white */
  --tool-shadow-rgb: 70, 74, 92;       /* Fig. 2b: shadows of the pen and pencil */
  --tool-shadow-deep-rgb: 58, 64, 86;
  --sheen-rgb: 255, 255, 255;          /* the wet shine on fresh ink */

  /* ---------- Fig. 2b props: the fountain pen, pencil, eraser and ruler ---------- */
  --prop-paper-rgb: 246, 241, 228;
  --prop-paper-2-rgb: 239, 232, 214;
  --prop-nib-rgb: 236, 230, 214;
  --prop-wood-rgb: 234, 220, 192;      /* sharpened pencil wood */
  --prop-pencil-light-rgb: 211, 98, 75;
  --prop-pencil-dark-rgb: 154, 48, 32;
  --prop-pencil-line-rgb: 125, 36, 22;
  --prop-pencil-tip-rgb: 181, 54, 31;
  --prop-foil-rgb: 243, 227, 200;      /* the pencil's stamped lettering */
  --prop-eraser-rgb: 250, 246, 236;
  --prop-steel-rgb: 154, 156, 166;
  --prop-steel-hi-rgb: 239, 233, 220;
  --prop-silhouette-rgb: 42, 36, 24;   /* the blurred shadow under each prop */

  /* ---------- coloured inks and washes ---------- */
  --cobalt-rgb: 44, 79, 158;           /* blue felt pen: links, chips, tabs, hover and focus; counting pebbles */
  --emerald-rgb: 37, 122, 79;          /* savings, verified, WhatsApp green (marks); counting pebbles */
  --emerald-text-rgb: 30, 104, 66;     /* emerald for words */
  --vermilion-rgb: 217, 72, 38;        /* caps hit, exclusions, rubber stamps */
  --gold-rgb: 224, 163, 48;            /* EMV chip, counting pebbles */
  --gold-hi-rgb: 246, 226, 160;
  --gold-lo-rgb: 168, 120, 38;
  --highlight-rgb: 250, 224, 107;      /* yellow highlighter */
  --mint-rgb: 230, 240, 225;           /* ledger tint */
  --cerulean-rgb: 90, 167, 214;        /* water */
  --kraft-rgb: 229, 211, 176;          /* manila folder, tag, the counting board */
  --coral-rgb: 240, 150, 128;          /* hologram shimmer, with mint */
  --shimmer-mint-rgb: 150, 220, 196;

  /* ---------- colour aliases for CSS ---------- */
  --paper: rgb(var(--paper-rgb));
  --ink: rgb(var(--ink-rgb));
  --text: rgb(var(--text-rgb));
  --soft: rgb(var(--soft-rgb));
  --red: rgb(var(--red-rgb));
  --pencil: rgb(var(--pencil-rgb));
  --grid: rgba(var(--grid-rgb), .085);
  --grid2: rgba(var(--grid-rgb), .16);
  --cobalt: rgb(var(--cobalt-rgb));
  --emerald-text: rgb(var(--emerald-text-rgb));
}

/* ---------- the coloured inks in the page ---------- */
/* :root in front of each selector: this file loads before site.css, and these rules must win over its plainer ones */
:root a, :root .contact .mail { color: var(--cobalt); }
:root a:hover, :root .top nav a:hover, :root .top nav a:hover .n, :root .contact .mail:hover { color: var(--red); }
:root .top nav a, :root .mark { color: var(--ink); }
:root :focus-visible, :root .stamp:focus-visible, :root .pocket .chip:focus-visible { outline-color: var(--cobalt); }
:root .stamp .v, :root .pocket .chip .t { color: var(--cobalt); }
:root .stamp:hover .v, :root .pocket .chip:hover .t { color: var(--ink); }
:root .stamp[aria-selected="true"] .v, :root .pocket .chip:hover .t {
  background: linear-gradient(176deg, transparent 52%, rgba(var(--highlight-rgb), .85) 54% 90%, transparent 92%);
}
:root .stamp[aria-selected="true"] .k { color: var(--red); }
:root .pocket .chip.asked .t { color: var(--soft); background: none; }
/* the answer line in Fig. 4, highlighted: an underline drawn thick and behind the words, so it follows each line */
:root .fig4 .msg:has(.why) .lead {
  text-decoration: underline rgba(var(--highlight-rgb), .62) .48em; text-underline-offset: -.34em; text-decoration-skip-ink: none;
}
:root .panel .say strong, :root .lede strong { background: linear-gradient(176deg, transparent 56%, rgba(var(--highlight-rgb), .7) 58% 92%, transparent 94%); }
