/* ============================================================================
   Mendel design tokens
   ============================================================================

   Every colour, space, and size decision in the app is made once, here.
   Templates and components.css reference these names and never a literal.

   The rule that makes this worth having: a token names a MEANING, not an
   appearance. `--tone-waiting` is "blocked on the user"; it happens to be
   amber. Renaming it to `--amber` would let a template pick amber because
   amber looked nice, which is exactly how the app arrived at forty
   hand-chosen hex values saying nothing consistent.

   ---- Tone ----------------------------------------------------------------

   The six tones are not a palette. They are `domain.Tone` in
   internal/domain/lifecycle.go, mirrored here one-for-one:

       ToneNeutral  ToneProgress  ToneWaiting  ToneSuccess  ToneWarning  ToneFailure

   Go decides which tone a thing is; CSS decides only what that tone looks
   like. Adding a seventh colour here without a seventh domain.Tone means a
   template is once again choosing colour by eye, and the lint test in
   internal/web/templates_test.go will say so.

   Each tone carries three values, and they are not interchangeable:

       --tone-N        the line: borders, rules, bar fills, dots
       --tone-N-bg     the fill: callout and badge backgrounds
       --tone-N-ink    text ON that fill; contrast-checked against it

   Never put --tone-N-ink on the page background, and never put --ink-1 on a
   --tone-N-bg fill. The pairs are the unit.
*/

:root {
    /* ---- Tone: neutral -----------------------------------------------------
       Nothing has happened yet, or does not apply here. Deliberately grey:
       an unstarted thing must not compete with a live one. */
    --tone-neutral:     #6c757d;
    --tone-neutral-bg:  #e9ecef;
    --tone-neutral-ink: #383d41;

    /* ---- Tone: progress ----------------------------------------------------
       Mendel is working. Nothing is needed from the reader. Blue reads as
       "informational, in motion" without implying either alarm or completion. */
    --tone-progress:     #1a6dd4;
    --tone-progress-bg:  #ddeafb;
    --tone-progress-ink: #10457f;

    /* ---- Tone: waiting -----------------------------------------------------
       Blocked on the reader. This is the single most important state in the
       app, so it gets the most arresting non-alarming colour. */
    --tone-waiting:     #d99100;
    --tone-waiting-bg:  #fdf3d7;
    --tone-waiting-ink: #7a5200;

    /* ---- Tone: success ----------------------------------------------------- */
    --tone-success:     #1e8e46;
    --tone-success-bg:  #dcf3e4;
    --tone-success-ink: #12622f;

    /* ---- Tone: warning -----------------------------------------------------
       Something is off but nothing has failed. Distinct from `waiting`
       (which is a request) and from `failure` (which is an outcome). */
    --tone-warning:     #d3660c;
    --tone-warning-bg:  #fdeadb;
    --tone-warning-ink: #7d3a06;

    /* ---- Tone: failure ----------------------------------------------------- */
    --tone-failure:     #cf2438;
    --tone-failure-bg:  #fbdde1;
    --tone-failure-ink: #7d1522;

    /* ---- Brand -------------------------------------------------------------
       Not here. The brand colours (--brand, --brand-hover, --brand-on,
       --brand-strong, --brand-tint, --brand-canvas, ...) are brand.css,
       generated from the brand palette in mendelweb's lib/palette.ts, which
       the logo, the marketing site and this app all draw from.

       Iris is a chrome and identity colour: primary buttons, the selected
       place in the nav, markers beside things that are the user's or the
       brand's. It is NOT a tone, and it was chosen because no tone is near
       it: grey, blue, amber, green, orange and crimson are all taken, and
       violet is not. An iris button means "the main thing to press": it is a
       solid fill with white words, where the tones' badges are pale fills
       with dark ones. In the app it is never text: text beside it stays in
       the inks below, and text on it takes --brand-on over --brand-strong.
       Lines and borders take --brand. In the logo it is the one line that
       ships. */

    /* ---- Surfaces ----------------------------------------------------------
       Four depths, and four is the budget. Each must be distinguishable from
       its neighbours at a glance or it is not carrying information. */
    --surface-page:   #f4f4ef;  /* behind everything */
    --surface-card:   #ffffff;  /* raised content */
    --surface-sunken: #f8f8f4;  /* inset within a card: logs, code, table heads */
    --surface-hover:  #ecece5;

    /* ---- Ink ---------------------------------------------------------------
       Three weights of body text plus inverse. `--ink-3` is the floor: it is
       the lightest text allowed to carry meaning. Anything fainter is
       decoration and should not exist. */
    --ink-1:       #262b31;  /* headings, primary content */
    --ink-2:       #3f464e;  /* secondary content, descriptions; the logo's slate */
    --ink-3:       #6b737c;  /* labels, timestamps, hints */
    --ink-inverse: #ffffff;

    /* ---- Lines ------------------------------------------------------------- */
    --line:        #e3e3db;
    --line-strong: #cbcbc1;

    /* ---- Chart series ------------------------------------------------------
       Identity, not state: the tone colours above mean something (success,
       failure) and are never reused for "series 3". Assigned in this order and
       never cycled; a series past the last folds into --chart-other. Validated
       as a set against the card surface for colour-vision separation between
       neighbours in a stack (worst adjacent CVD delta E 9.1). Three sit below
       3:1 contrast on white, so a chart using them always has a table view. */
    --chart-1: #2a78d6;  /* blue */
    --chart-2: #eb6834;  /* orange */
    --chart-3: #1baf7a;  /* aqua */
    --chart-4: #eda100;  /* yellow */
    --chart-5: #e87ba4;  /* magenta */
    --chart-6: #008300;  /* green */
    --chart-other: #b4b4aa;

    /* ---- Focus -------------------------------------------------------------
       One focus treatment everywhere, never removed. */
    --focus-ring: 0 0 0 3px rgba(26, 109, 212, 0.35);

    /* ---- Space -------------------------------------------------------------
       A 4px scale. Every margin, padding, and gap in the app is one of these
       eight values; that constraint is most of what makes a page look
       deliberate rather than assembled. */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --sp-7: 48px;
    --sp-8: 64px;

    /* ---- Type --------------------------------------------------------------
       Six sizes. Sizes carry hierarchy; weight and colour carry emphasis
       within a level. */
    --text-xs:   0.75rem;   /* 12px - eyebrow labels, table meta */
    --text-sm:   0.8125rem; /* 13px - secondary text, log lines */
    --text-base: 0.9375rem; /* 15px - body */
    --text-md:   1.0625rem; /* 17px - card titles */
    --text-lg:   1.375rem;  /* 22px - page titles */
    --text-xl:   1.75rem;   /* 28px - metrics */

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    --leading-tight: 1.3;
    --leading-body:  1.55;

    /* ---- Radius ------------------------------------------------------------ */
    --radius-sm:   4px;
    --radius-md:   6px;
    --radius-lg:   10px;
    --radius-pill: 999px;

    /* ---- Elevation ---------------------------------------------------------
       Two levels. Shadows separate layers; they are not decoration, so a card
       sitting on the page gets --shadow-1 and a thing floating above the page
       gets --shadow-2, and nothing gets both. */
    --shadow-1: 0 1px 2px rgba(16, 22, 26, 0.06), 0 1px 3px rgba(16, 22, 26, 0.05);
    --shadow-2: 0 8px 24px rgba(16, 22, 26, 0.14);

    /* ---- Layout ------------------------------------------------------------ */
    --page-max: 1180px;
    --measure:  68ch;   /* readable line length for prose */
    --nav-h:    52px;
}
