/* OpenBonds design tokens (css/tokens.css). The ONLY file in the site that holds colour hex values.
   Dark is the default (the logo is orange on black); light sits behind the toggle, html[data-theme="light"].
   The selectors are not tied to :root, so a subtree can carry its own theme: <div data-theme="light"> gets the light
   values (styleguide.html uses this to show both themes side by side).

   Contrast on --paper, WCAG 2.1 (checked by script, see DESIGN.md "Colour"):
     dark   ink 16.4  ink-2 12.3  muted 6.8  faint 5.1  orange-ink 8.5  up 11.8  down 7.0  warn 11.8
     light  ink 15.4  ink-2 10.8  muted 5.3  faint 4.8  orange-ink 5.0  up 4.6   down 4.9  warn 4.8
     primary button text (#0c0a08 on --orange) 7.6 in both themes.
   Light theme: --orange and --orange-2 are fills only (2.3:1 and 2.9:1 as text). Orange text is --orange-ink; display
   text of 24px and up (the italic word in h1/h2, big accent figures) may use --orange-display (light 3.8:1, AA large).
   Light theme: --faint text belongs on --paper or --panel only; on --paper-2 or --paper-3 use --muted or stronger. */

:root,
[data-theme="dark"] {
  --paper: #0c0a08;
  --paper-2: #13100c;
  --paper-3: #1b1712;
  --panel: rgba(19, 16, 12, .88);
  --ink: #f1e9dc;
  --ink-2: #d6cbb9;
  --muted: #a39582;
  --faint: #8d806e;
  --rule: #2c251d;
  --rule-2: #1f1a14;
  --field: #100d0a;
  --field-edge: #4a3f33;
  --orange: #ff7a00;          /* brand, fills */
  --orange-2: #ff9633;        /* hover fill */
  --orange-ink: #ff8c26;      /* orange text */
  --orange-display: var(--orange-ink); /* orange display text (24px and up): the italic word in a headline */
  --orange-soft: rgba(255, 122, 0, .12);
  --on-orange: #0c0a08;       /* text on an orange fill, both themes */
  --up: #9fd4ac;
  --down: #ff6a55;
  --warn: #f2c14e;
  --up-soft: rgba(159, 212, 172, .12);
  --down-soft: rgba(255, 106, 85, .12);
  --warn-soft: rgba(242, 193, 78, .12);

  --nav-bg: rgba(12, 10, 8, .94);
  --hover: rgba(241, 233, 220, .035);
  --shade: rgba(0, 0, 0, .55);
  --scrim: rgba(6, 5, 4, .7);
  --selection: rgba(255, 122, 0, .3);

  /* the code-run background (js/ui/codebg.js reads these): ink alpha for plain and keyword text, orange flash alpha.
     base.css masks it down to about a third under the reading column, so these are its strength in the margins */
  --codebg-lo: .06;
  --codebg-hi: .11;
  --codebg-flash: .24;
  /* the hero yield surface (js/ui/surface.js): the line colour, its alpha at the back and at the front */
  --surface-line: var(--orange);
  --surface-back: .16;
  --surface-front: .92;

  color-scheme: dark;
}

[data-theme="light"] {
  --paper: #f4eee4;
  --paper-2: #ece4d7;
  --paper-3: #e3d9c8;
  --panel: rgba(244, 238, 228, .9);
  --ink: #1c1712;
  --ink-2: #3b332a;
  --muted: #6c6052;
  --faint: #74675a;
  --rule: #cdbfa9;
  --rule-2: #ddd2c1;
  --field: #fbf7f0;
  --field-edge: #a3957f;
  --orange: #ff7a00;
  --orange-2: #e56a00;
  --orange-ink: #a84a00;
  --orange-display: #c45a00;  /* 3.8:1 on --paper: AA for text of 24px and up only; smaller orange text stays --orange-ink */
  --orange-soft: rgba(255, 122, 0, .12);
  --on-orange: #0c0a08;
  --up: #2f7a4a;
  --down: #b3402c;
  --warn: #8a6100;
  --up-soft: rgba(47, 122, 74, .1);
  --down-soft: rgba(179, 64, 44, .1);
  --warn-soft: rgba(138, 97, 0, .1);

  --nav-bg: rgba(244, 238, 228, .95);
  --hover: rgba(28, 23, 18, .035);
  --shade: rgba(28, 23, 18, .14);
  --scrim: rgba(28, 23, 18, .4);
  --selection: rgba(255, 122, 0, .22);

  /* grey mono on cream reads more easily than the same alpha on black: fainter here, so it never prints like a watermark */
  --codebg-lo: .028;
  --codebg-hi: .05;
  --codebg-flash: .3;
  --surface-line: var(--orange-ink);
  --surface-back: .18;
  --surface-front: .9;

  color-scheme: light;
}

/* type, motion and geometry: the same in both themes */
:root {
  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --code: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.22, .61, .21, 1);
  --radius: 2px;
  --nav-h: 60px;
  --wrap: 1180px;
  --wrap-wide: 1280px;
  --gutter: 16px;
  --z-nav: 30;
  --z-menu: 40;
  --z-overlay: 60;
  --z-toast: 70;
}
/* mobile first: 16px gutters under 640px, 24px to 899px, 32px and the 66px nav from 900px */
@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 900px) { :root { --gutter: 32px; --nav-h: 66px; } }
