/* Design tokens: every colour, size, depth and motion the kit uses.
   Two colourways, both whole: Ink (dark) and Paper (light). Ink is the
   default; Paper is used when the browser asks for a light scheme, or when
   the person picks it (data-colourway on the root element).
   The page is near-monochrome. Colour means one of three things:
     signal  a state (live, wait, bad, ok): a dot, words, a wash or a fill
     kind    which sort of thing a mark stands for (six equal hues)
     data    how much (one ramp from quiet to live)
   A control that is on takes --on-fill, with --on-mark for the mark drawn on it, and never the main
   button's --solid and --onsolid: a ticked box, a picked radio, a filter's check, a tickable tile's tick.
   Four on states keep colours of their own and stay as they are: a switch that is on, a chosen day in a
   calendar and today's disc in a month are filled live, and the tick beside a picked option in a list is
   drawn live. A selected row's wash is a ground, not a control.
   Depth is the step of the ground and a real shadow, never an outline.
   The pointer carries a light: raised areas catch it softly, and the edge
   of a floating surface brightens where the pointer is near. In Paper the
   light is a soft cool shade, since a light does not show on a light ground.
   A state may take a whole piece as its ground; a fill may glow where the
   light means live or done.
   Wait is a light colour in both colourways, so what stands on it is dark in both. In Paper it is a
   yellow too light to write with: its words are in ink beside its mark, a raised part on its ground
   goes lighter, and nothing on its ground glows. */

/* A colourway is the page's (on the root), or a part's: any element marked data-colourway="ink" or
   "paper" takes that colourway whole, with everything inside it. --colourway says which one is in force. */
:root, [data-colourway="ink"] {
  color-scheme: dark;
  --colourway: ink;
  /* Grounds: the page (g0), an area on it (g1), a raised block (g2), a floating surface (g3) */
  --g0: #0e0e0e;
  --g1: #141414;
  --g2: #1b1b1b;
  --g3: #232323;
  --g-hover: rgba(242, 242, 240, 0.045);
  --g-press: rgba(242, 242, 240, 0.08);
  /* Text: ink for reading, ink2 secondary, ink3 labels; ink4 is a mark only */
  --ink:  #f2f2f0;
  --ink2: rgba(242, 242, 240, 0.74);
  --ink3: rgba(242, 242, 240, 0.56);
  --ink4: rgba(242, 242, 240, 0.24);
  /* Hairlines: dividers (hair) and control rings (hair2) */
  --hair:  rgba(242, 242, 240, 0.09);
  --hair2: rgba(242, 242, 240, 0.2);
  /* The solid fill of the main button, and the text on it */
  --solid:   #f2f2f0;
  --onsolid: #111111;
  /* The fill of a control that is on, and the mark drawn on it */
  --on-fill: #f2f2f0;
  --on-mark: #111111;
  /* Signals: the base for dots and fills; -text when it is words */
  --live: #4f9fe6;
  --wait: #ff9d3c;
  --bad:  #ff4d44;
  --ok:   #5cc27e;
  --live-text: #6db1f0;
  --wait-text: #ffab57;
  --bad-text:  #ff6a62;
  --ok-text:   #6fd08f;
  --on-signal: #0e0e0e;
  /* Grounds: a signal as the whole ground of a piece; what is written on it is --on-signal, and --on-wait on the wait ground */
  /* What is written on a wait ground or a wait fill, and the mark drawn on one */
  --on-wait: #0e0e0e;
  /* The steps of a wait ground: a field or a raised part on it (g2), and a part raised again (g3) */
  --wait-g2: rgba(14, 14, 14, 0.09);
  --wait-g3: rgba(14, 14, 14, 0.15);
  /* How strongly a lit fill glows on a wait ground */
  --wait-glow: 70%;
  /* How much of the wait ground its wash holds */
  --wait-wash-part: 14%;
  --live-ground: #4f9fe6;
  --wait-ground: #ff9d3c;
  --bad-ground:  #ff4d44;
  --ok-ground:   #5cc27e;
  /* Kinds: seven hues of one weight, for lanes, marks and chips */
  --hue-1: #6aa9ee;
  --hue-2: #a08bf0;
  --hue-3: #4fc3b2;
  --hue-4: #e8a94e;
  --hue-5: #ec7f9d;
  --hue-6: #9ecb5a;
  --hue-7: #d98ae6;
  /* The core of the loading light */
  --light-core: #dff0ff;
  /* A page of a document shown on a screen: paper in both colourways, and what is written on it */
  --page: #f4f3ee;
  --on-page: #1a1a18;
  /* Shadows under floating surfaces, and the veil behind a sheet */
  --shade: rgba(0, 0, 0, 0.62);
  --shade-deep: rgba(0, 0, 0, 0.78);
  --veil: rgba(8, 8, 8, 0.58);
  /* The pointer's light: on a raised area, and on a floating surface's edge near the pointer */
  --pointer-light: rgba(226, 238, 255, 0.07);
  --edge-near: rgba(196, 226, 255, 0.5);
  /* How strongly a lit fill glows: a live bar, a done dot, a date tile lit from below */
  --glow: 70%;
  --skel: rgba(242, 242, 240, 0.06);
  --skel-lit: rgba(242, 242, 240, 0.14);
}

@media (prefers-color-scheme: light) {
  :root:not([data-colourway="ink"]) {
    color-scheme: light;
    --colourway: paper;
    --g0: #e9e9e6; --g1: #f1f1ef; --g2: #f8f8f6; --g3: #ffffff;
    --g-hover: rgba(23, 23, 23, 0.04); --g-press: rgba(23, 23, 23, 0.075);
    --ink: #171717; --ink2: rgba(23, 23, 23, 0.74); --ink3: rgba(23, 23, 23, 0.62); --ink4: rgba(23, 23, 23, 0.24);
    --hair: rgba(23, 23, 23, 0.1); --hair2: rgba(23, 23, 23, 0.2);
    --solid: #171717; --onsolid: #f5f5f5;
    --on-fill: #171717; --on-mark: #f5f5f5;
    --live: #2d6fc4; --wait: #f2a900; --bad: #d8352b; --ok: #2f8a4e;
    --live-text: #2a67b5; --wait-text: #171717; --bad-text: #b42a21; --ok-text: #287542;
    --on-signal: #ffffff; --on-wait: #171717; --wait-g2: rgba(255, 255, 255, 0.42); --wait-g3: rgba(255, 255, 255, 0.64); --wait-glow: 0%; --wait-wash-part: 38%;
    --live-ground: #2d6fc4; --wait-ground: #ffcb2e; --bad-ground: #cf3127; --ok-ground: #2a7d46;
    --hue-1: #2d6fc4; --hue-2: #6a55c8; --hue-3: #1f8f80; --hue-4: #a9690a; --hue-5: #c24670; --hue-6: #5d8a1e; --hue-7: #a23fb5;
    --light-core: #ffffff; --page: #ffffff; --on-page: #171717;
    --shade: rgba(20, 20, 18, 0.2); --shade-deep: rgba(20, 20, 18, 0.3); --veil: rgba(40, 40, 36, 0.34);
    --pointer-light: rgba(34, 58, 98, 0.075); --edge-near: rgba(30, 64, 122, 0.55); --glow: 38%;
    --skel: rgba(23, 23, 23, 0.055); --skel-lit: rgba(23, 23, 23, 0.12);
  }
}
:root[data-colourway="paper"], [data-colourway="paper"] {
  color-scheme: light;
  --colourway: paper;
  --g0: #e9e9e6; --g1: #f1f1ef; --g2: #f8f8f6; --g3: #ffffff;
  --g-hover: rgba(23, 23, 23, 0.04); --g-press: rgba(23, 23, 23, 0.075);
  --ink: #171717; --ink2: rgba(23, 23, 23, 0.74); --ink3: rgba(23, 23, 23, 0.62); --ink4: rgba(23, 23, 23, 0.24);
  --hair: rgba(23, 23, 23, 0.1); --hair2: rgba(23, 23, 23, 0.2);
  --solid: #171717; --onsolid: #f5f5f5;
    --on-fill: #171717; --on-mark: #f5f5f5;
  --live: #2d6fc4; --wait: #f2a900; --bad: #d8352b; --ok: #2f8a4e;
  --live-text: #2a67b5; --wait-text: #171717; --bad-text: #b42a21; --ok-text: #287542;
  --on-signal: #ffffff; --on-wait: #171717; --wait-g2: rgba(255, 255, 255, 0.42); --wait-g3: rgba(255, 255, 255, 0.64); --wait-glow: 0%; --wait-wash-part: 38%;
  --live-ground: #2d6fc4; --wait-ground: #ffcb2e; --bad-ground: #cf3127; --ok-ground: #2a7d46;
  --hue-1: #2d6fc4; --hue-2: #6a55c8; --hue-3: #1f8f80; --hue-4: #a9690a; --hue-5: #c24670; --hue-6: #5d8a1e; --hue-7: #a23fb5;
  --light-core: #ffffff; --page: #ffffff; --on-page: #171717;
  --shade: rgba(20, 20, 18, 0.2); --shade-deep: rgba(20, 20, 18, 0.3); --veil: rgba(40, 40, 36, 0.34);
  --pointer-light: rgba(34, 58, 98, 0.075); --edge-near: rgba(30, 64, 122, 0.55); --glow: 38%;
  --skel: rgba(23, 23, 23, 0.055); --skel-lit: rgba(23, 23, 23, 0.12);
}

/* What is made from a colourway's colours is made again wherever a colourway is set, so a part in
   another colourway has its own washes, ramp, rings and depth. */
:root, [data-colourway] {
  /* Washes: a signal or a kind laid thin over a ground */
  --live-wash: color-mix(in srgb, var(--live) 14%, transparent);
  --wait-wash: color-mix(in srgb, var(--wait-ground) var(--wait-wash-part), transparent);
  --bad-wash:  color-mix(in srgb, var(--bad) 12%, transparent);
  --ok-wash:   color-mix(in srgb, var(--ok) 14%, transparent);
  /* Data: one ramp, from almost nothing to live */
  --data-1: color-mix(in srgb, var(--live) 14%, var(--g2));
  --data-2: color-mix(in srgb, var(--live) 32%, var(--g2));
  --data-3: color-mix(in srgb, var(--live) 54%, var(--g2));
  --data-4: color-mix(in srgb, var(--live) 78%, var(--g2));
  --data-5: var(--live);
  /* Rings: a control's edge is an inset line, not a border */
  --ring:       inset 0 0 0 1px var(--hair2);
  --ring-soft:  inset 0 0 0 1px var(--hair);
  --ring-hover: inset 0 0 0 1px var(--ink3);
  --ring-field: inset 0 0 0 1.5px var(--live);
  --focus:      0 0 0 3px color-mix(in srgb, var(--live) 34%, transparent);
  /* Depth: 1 sits on the page, 2 floats over it, 3 is a sheet over the veil */
  --depth-1: 0 1px 2px -1px var(--shade);
  --depth-2: 0 12px 32px -14px var(--shade), 0 2px 6px -2px var(--shade);
  --depth-3: 0 36px 90px -24px var(--shade-deep), 0 8px 22px -10px var(--shade);
}

:root {
  /* Faces: Sora for titles, Geist for reading and for figures (tabular) */
  --font-display: "Sora", var(--db-font-heading, ui-sans-serif, system-ui, sans-serif);
  --font-text:    "Geist", var(--db-font-body, ui-sans-serif, system-ui, sans-serif);
  /* Type sizes: six, each used for its role, with no cap on how many a screen uses.
     Title 34 (--fs-title-l), figure 30 (--fs-figure), heading 22 (--fs-title-s),
     lead 17 (--fs-lead), body 15 (--fs-body), label 13 (--fs-label). */
  --fs-label:   13px;
  --fs-body:    15px;
  --fs-lead:    17px;
  --fs-title-s: 22px;
  --fs-title-l: 34px;
  --fs-figure:  30px;
  /* Spacing */
  --space-4: 4px; --space-6: 6px; --space-8: 8px; --space-10: 10px; --space-12: 12px; --space-16: 16px;
  --space-20: 20px; --space-24: 24px; --space-32: 32px; --space-40: 40px; --space-56: 56px;
  /* Radii: 6 for marks, 8 for controls, 12 for blocks, 16 for sheets */
  --radius-3: 3px; --radius-6: 6px; --radius-8: 8px; --radius-12: 12px; --radius-16: 16px; --radius-pill: 999px;
  /* Control heights */
  --h-24: 24px; --h-28: 28px; --h-32: 32px; --h-36: 36px; --row: 44px;
  /* Layout */
  --top: 56px; --rail-w: 56px; --tray-w: 400px;
  /* How far the pointer's light reaches */
  --light-reach: 520px;
  /* Motion: how long, and how it moves */
  --dur-90: 90ms;      /* a click */
  --dur-140: 140ms;    /* hover and focus */
  --dur-240: 240ms;    /* a tray, a menu */
  --dur-420: 420ms;    /* a sheet, rows rising in */
  --dur-480: 480ms;    /* a carried cluster moving to its new place and form */
  --dur-700: 700ms;    /* a state washing across a surface */
  --dur-1100: 1100ms;  /* a flash on what changed */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-carry: cubic-bezier(0.32, 0.72, 0, 1);   /* a carried cluster: off at once, a long settle, no overshoot */
  --ease-settle: cubic-bezier(0.18, 1.12, 0.3, 1);
  --ease-through: cubic-bezier(0.55, 0.05, 0.3, 0.95);
  --op-disabled: 0.45;
}
