/* Flora's design tokens: the palette, the type and spacing scales, and the
 * shared measurements. Split out of app.css on 2026-10-14 so the tokens load
 * once, before every component rule that consumes them: base.html and
 * login.html link this file BEFORE app.css, and each link's `?v=` is a hash
 * of that file's own bytes (`app/flora/static_version.py`;
 * `docs/flora-stylesheet-versions.md` has the changeover entry). Nothing in
 * this file draws anything.
 *
 * Every colour is a token defined on the bare :root, so the light palette is
 * complete without a media query. The dark palette lives in its own sheet,
 * tokens-dark.css, linked after this one behind
 * `media="(prefers-color-scheme: dark)"`; it redefines tokens only, and a test
 * holds its set of colour names equal to the set declared here. No component
 * may declare a colour that exists solely inside a media or [data-theme]
 * block. (Until 2026-10-15 two dark blocks sat at the foot of this file; they
 * moved, and no page ever set data-theme.)
 *
 * State colours are Okabe-Ito and are never the only channel carrying meaning.
 * Green is deliberately absent as a state colour: the primary reader has
 * blue-green colour vision deficiency, and green against red is the pairing
 * that fails. Flag states use a tick, a cross and a neutral mark instead.
 */

:root {
  /* Native widgets (select popups, scrollbars, date and file pickers) render
     light here; tokens-dark.css declares `dark` for a dark preference. */
  color-scheme: light;

  /* Violet-biased neutrals. The institute is Violet, the platform is Flora. */
  --ground:  #EDEAF1;
  --paper:   #FCFBFD;
  --card:    #FFFFFF;
  --card-2:  #F6F3F8;
  --card-3:  #EDE8F2;
  --ink:     #231E2D;
  --ink-2:   #52495F;
  --ink-3:   #867D93;
  --rule:    #DDD5E4;
  --rule-2:  #C8BED3;
  --hair:    #EEE9F2;
  /* THE EDGE OF A CONTROL, and it is not `--rule`. A hairline between two rows
     and the boundary of something you can click are different jobs, and one
     token was doing both: measured, `--rule` against `--ground` is 1.20:1 and
     against `--paper` 1.38:1, so the column picker's whole outline sat at a
     fifth of the 3:1 that WCAG 2.1 SC 1.4.11 asks of a control's boundary.
     Patrick, 2026-09-18: "a light purple box that I can barely see, which was
     the problem."

     THE FIX IS LUMINANCE, NOT HUE, and that is the point rather than a detail.
     The primary reader has blue-green colour vision deficiency, so a boundary
     told apart by hue is a boundary that may not be there at all; a boundary
     told apart by lightness survives every colour vision deficiency there is.
     #766C81 measures 4.17:1 on `--ground`, 4.81:1 on `--paper`, 4.96:1 on
     `--card`, 4.51:1 on `--card-2` and 4.12:1 on `--card-3`, so it clears 3:1
     on every surface a control on this page can sit on, with room to spare.
     tests/flora/test_control_contrast.py recomputes all of those from this file
     rather than trusting the comment. */
  --edge:    #766C81;
  /* THE PLATFORM'S VIOLET, AND IT IS NOT ONE OF THE BRAND FILES' FILLS.
     VRI's real brand assets arrived on 2026-09-28 and the mark is now drawn
     from them, in `app/flora/templates/_brand_mark.html` and
     `/static/brand/emblem-32.svg`. The brand set is not internally consistent
     about its own purple. Read out of the exports' `fill` attributes:
     `#A594C9` in the 16, 24, 32 and 48px emblem weights and in `favicon-32.svg`;
     `#9A8CB7` in the 72px `emblem - a - standart`; `#8072AA` in
     `vertical logo.svg` (that last one measured by Patrick, not read here).

     So there is no single brand hex to adopt, and this token stayed #7B5EA7.
     An asset fill and a UI token answer different questions. A fill is what one
     drawing is coloured at one size. A token is what every link, focus ring,
     violet chip and inline mark on this surface resolves to, which makes it
     load bearing for contrast in a way a decorative fill is not.

     Measured against `--paper`, by the WCAG 2.1 relative-luminance formula:
     #A594C9 is 2.65:1, #9A8CB7 is 2.99:1, #8072AA is 4.15:1, and #7B5EA7 is
     5.09:1. `a { color: var(--violet) }` is link TEXT, which SC 1.4.3 holds to
     4.5:1, so this token is the only one of the four that clears the bar and
     promoting any brand fill into it would have failed link text on every page.
     The brand purples are fine where they actually sit, and NOT because they
     clear a lower bar: #A594C9 is 2.73:1 on white, so it would fail SC 1.4.11's
     3:1 too. No contrast minimum binds either of its two uses. One is a browser
     tab tile, which is outside the page. The other is base-wiki.html's 26px
     header logo, which carries `alt=""` beside an <h1> naming the product, so
     it is decoration whose information is already in adjacent text. A mark that
     could be deleted without losing a fact is not held to a ratio; link text is.

     Nothing here adds a fourth purple. The inline mark takes this token through
     `currentColor`, the fetched file keeps the brand's own fill because a
     fetched SVG cannot inherit one, and no new hex was introduced anywhere. */
  --violet:     #7B5EA7;
  --violet-w:   #F1EBF8;
  --on-violet:  #FFFFFF;

  /* States, Okabe-Ito. Paired with a word and a glyph wherever they are used. */
  --ok:      #0072B2;  --ok-w:    #E3EFF9;
  --warn:    #E69F00;  --warn-w:  #FBF1DC;
  --muted:   #867D93;  --muted-w: #EFECF3;
  --alert:   #D55E00;  --alert-w: #FBE7DA;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --lift: 0 1px 1px rgba(35, 30, 45, .04), 0 8px 22px -18px rgba(35, 30, 45, .4);
  --wrap: 1180px;

  /* THE FLOATING CHAT DOCK'S FOOTPRINT, declared here so that everything else
     pinned to the foot of the viewport clears it by reading a number rather than
     by guessing one. Two boxes both anchored to the bottom right of the window
     overlap unless one of them is told how much room the other takes, and that
     is exactly what happened: the compound list's control bar is sticky at
     `bottom: 0` and the dock is fixed at `bottom: 18px`, so the Ask button was
     painted over the column picker and took every click aimed at it. */
  --askdock-inset: 18px;
  /* The launcher: 13px text on a 1px border and 11px of padding above and
     below, so 13 + 22 + 2 = 37px tall, plus its own 18px inset and an 18px gap.
     73, rounded up. The arithmetic is written out because the number is the
     only thing another rule reads and a stale comment is how it drifts. */
  --askdock-h: 74px;
  /* The open panel: `min(380px, 100vw - 36px)` wide, plus its inset and a gap.
     A CEILING, NOT A WIDTH. The panel narrows with the viewport and this does
     not, so whatever reserves it has to clamp it. See `.tablebar` below. */
  --askdock-w: 416px;

  /* THE TYPE AND SPACING SCALES, added 2026-10-14 when the tokens split out of
     app.css. Each token is a size the sheet already repeated three or more
     times, named by its value so the name cannot drift from what it resolves
     to. NOTHING WAS CONSOLIDATED: a size used twice or once stays a literal in
     app.css, and no two tokens were merged for being near each other. The
     substitution is mechanical and proven by the identity script in the
     changeover commit: same selector, same property, same computed value. */
  --fs-11:  11px;
  --fs-115: 11.5px;
  --fs-12:  12px;
  --fs-125: 12.5px;
  --fs-13:  13px;
  --fs-135: 13.5px;
  --fs-21:  21px;
  /* Flex and grid gaps. `--sp-12` and `--fs-12` resolve alike by coincidence
     of the scale, not by relation; neither may be swapped for the other. */
  --sp-3:  3px;
  --sp-4:  4px;
  --sp-5:  5px;
  --sp-6:  6px;
  --sp-7:  7px;
  --sp-10: 10px;
  --sp-12: 12px;
  /* Corner radii. */
  --r-6:  6px;
  --r-7:  7px;
  --r-8:  8px;
  --r-9:  9px;
  --r-11: 11px;
}
