/* ─────────────────────────────────────────────────────────────
   LAYER 1 — PRIMITIVE TOKENS
   Raw values, no meaning. Referenced by nothing except layer 2.

   This is the ONLY file in the UI allowed to contain a raw hex
   value. tools/lint-tokens.php enforces that.

   Values come from DESIGN.md §2. A primitive is never given a role
   name (§2 T2) — there is no --color-primary here on purpose, and
   the family names below (stone, azure, moss, amber, clay) describe
   appearance precisely because roles belong in layer 2.

   TWO THEMES, ONE RAMP. Light and dark are derived independently in
   DESIGN.md, not inverted, so both sets of values live here as one
   ramp ordered by lightness. Layer 2 decides which rung a role points
   at per theme. That keeps this file free of the word "dark".

   Every ratio quoted here is computed by tools/check-contrast.php,
   not written by hand. Run it after any edit.
   ───────────────────────────────────────────────────────────── */

:root {
  /* ── Stone — the neutrals. Near-zero chroma on purpose: property
        photos, scanned invoices and uploaded documents appear
        throughout the app, and a tinted grey shifts against every
        one of them (DESIGN.md §2). ── */
  --stone-0:   #FFFFFF;
  --stone-25:  #FAFAF8;
  --stone-50:  #F4F4F1;
  --stone-75:  #F1F1EC;
  --stone-150: #E3E3DE;
  --stone-400: #A0A19A;
  --stone-500: #8D8D87;
  --stone-550: #6D6E67;
  --stone-600: #6A6E6B;
  --stone-800: #34352F;
  --stone-880: #202120;
  --stone-920: #191A18;
  --stone-940: #171815;
  --stone-950: #171A18;

  /* ── Azure — the one accent. Actions, links and focus only.
        Blue, not green: green means "paid and current" here, and an
        accent colliding with a status weakens both (DESIGN.md §2). ── */
  --azure-300: #8AAEF5;
  --azure-600: #1F53B8;
  --azure-980: #0F1420;

  /* ── Status hues. Each carries a text value per theme plus a tint
        per theme, because a chip is text on a tint and both must clear
        4.5:1 in both themes independently (DESIGN.md §2 "Contrast"). ── */

  /* Paid / current */
  --moss-400: #2A9B7E;
  --moss-700: #1D6B57;
  --moss-50:  #E7F1EC;
  --moss-960: #16261F;

  /* Due soon */
  --amber-500: #B0802C;
  --amber-800: #7A5410;
  --amber-50:  #FAF0DB;
  --amber-960: #2A2113;

  /* Overdue / escalated */
  --clay-400: #D56763;
  --clay-700: #A3302C;
  --clay-50:  #FAE9E7;
  --clay-960: #2B1614;
}

/* ─────────────────────────────────────────────────────────────
   RGB COMPANIONS

   Bootstrap's colour utilities are not styleable the normal way.
   `.text-success`, `.bg-danger` and their ~1,000 siblings in this
   app resolve as

       color: rgba(var(--bs-success-rgb), var(--bs-text-opacity)) !important

   so they cannot be pointed at a colour token — only at an R, G, B
   triplet, and only through --bs-*-rgb. Feeding them needs the raw
   channels, and layer 1 is the one place raw values are legal.

   Every triplet below is the decomposition of the hex directly above
   it in this file. tools/check-contrast.php asserts that they match,
   so the two cannot drift apart silently.
   ───────────────────────────────────────────────────────────── */
:root {
  --stone-0-rgb:    255, 255, 255;
  --stone-50-rgb:   244, 244, 241;
  --stone-75-rgb:   241, 241, 236;
  --stone-400-rgb:  160, 161, 154;
  --stone-600-rgb:  106, 110, 107;
  --stone-950-rgb:  23, 26, 24;

  --azure-300-rgb:  138, 174, 245;
  --azure-600-rgb:  31, 83, 184;

  --moss-400-rgb:   42, 155, 126;
  --moss-700-rgb:   29, 107, 87;

  --amber-500-rgb:  176, 128, 44;
  --amber-800-rgb:  122, 84, 16;

  --clay-400-rgb:   213, 103, 99;
  --clay-700-rgb:   163, 48, 44;
}

/* ─────────────────────────────────────────────────────────────
   DOMAIN HUES — colour that says WHERE YOU ARE, not what state
   something is in.

   Added on the product owner's instruction, overriding DESIGN.md
   §7 "don't colour-code beyond the five states". The exception is
   recorded in docs/design-plans/00-design-md-reconciliation.md §8.
   The brief's concern was a grid turning into fruit salad; the
   mitigation is that these four never appear as a chip. A chip is
   a pill with text and always means STATE. These are icon wells
   and section headings, and always mean PLACE.

   Hues were chosen arithmetically, not by eye, from the gaps left
   by the colours already in use (overdue 2, due 38, paid 165,
   action azure 221). All four sit at least 30 degrees from every
   one of those and from each other.

   Every value below was filtered on contrast before it was
   written here: each -600 clears 4.5:1 on white, on the page
   ground and on its own -50 tint; each -300 does the same on the
   dark surface, the dark page and its own -960 tint. Asserted in
   tools/check-contrast.php so none of it can drift.
   ───────────────────────────────────────────────────────────── */

:root {
  /* Portfolio — properties, units, leases, vacancies */
  --estate-600: #5138B2;
  --estate-50:  #F5F4FB;
  --estate-300: #8F7DD9;
  --estate-960: #0A0811;

  /* People — tenants, staff, viewing requests */
  --people-600: #A238B2;
  --people-50:  #FAF4FB;
  --people-300: #C363D2;
  --people-960: #100811;

  /* Money — invoices, payments, deposits, statements */
  --ledger-600: #B23871;
  --ledger-50:  #FBF4F7;
  --ledger-300: #D26598;
  --ledger-960: #11080C;

  /* Upkeep — maintenance, documents, exits */
  --upkeep-600: #457E28;
  --upkeep-50:  #F6FBF4;
  --upkeep-300: #64BE37;
  --upkeep-960: #0B1108;
}

/* ─────────────────────────────────────────────────────────────
   CHART STEPS

   Charts need their own steps, and this is not a style preference.
   A status CHIP carries text, so DESIGN.md's "colour never travels
   alone" holds and the chip colours can sit close together. A pie
   SEGMENT is colour and nothing else, and the chip colours fail
   badly there: run through the dataviz validator, the shipped
   due-amber and overdue-red measure deltaE 1.8 under deuteranopia
   and 11.6 for normal vision — below the hard floor of 15. Two
   slices of an invoice-status doughnut were effectively the same
   colour for everyone, and identical for red-green colourblind
   readers.

   So the chart steps keep each status HUE but push the amber
   toward gold and spread the lightness, which is what buys the
   separation. Values below are whatever passed the validator, not
   whatever looked right.

   Reused rather than duplicated: the categorical slots are the
   domain hues (estate/upkeep/ledger) and the greens and reds are
   existing steps. Only the gold and two dark steps are new.
   ───────────────────────────────────────────────────────────── */

:root {
  /* Gold — "due" as a chart fill. The shipped amber is too near the
     red once it loses its label. */
  --gold-600: #B8860B;
  --gold-400: #C9A62B;

  /* Dark-mode chart steps, selected against the dark surface rather
     than flipped from the light ones. */
  --upkeep-400: #57A82F;
  --clay-450:   #D9635C;
}
