/* munibase-tokens.css
 * -----------------------------------------------------------------
 * PALETTE TOKENS -- the colour source for the Munibase civic surfaces.
 *
 * Values are lifted verbatim from the design handoff's companion
 * palette file (four palettes x light/dark, Bureau being the default).
 *
 * WHY THIS FILE IS LOADED FIRST, AND WHAT IT ACTUALLY FIXES
 * --------------------------------------------------------
 * The companion file's header asserts that nothing in the repo defines
 * the --muni-* palette today. That is not true here, and the load order
 * below depends on the difference, so it is worth writing down.
 *
 * Eight of the twelve tokens the Admin scope layer consumes ARE already
 * defined, at :root, derived from MudBlazor's --mud-palette-*:
 *
 *   --muni-ink          munibase-civic.css
 *   --muni-paper        munibase-civic.css
 *   --muni-paper-soft   munibase-civic.css
 *   --muni-ink-soft     muni-components.css
 *   --muni-ink-mute     muni-components.css
 *   --muni-paper-edge   muni-components.css
 *   --muni-stamp        muni-components.css
 *   --muni-stamp-soft   muni-components.css
 *   --muni-accent       muni-components.css (flat hex)
 *
 * Five are genuinely undefined, and every rule referencing one of them
 * fails silently -- borders fall back to currentColor, backgrounds to
 * transparent, no console error:
 *
 *   --muni-rule         --muni-rule-soft
 *   --muni-primary      --muni-primary-soft
 *   --muni-accent-soft
 *
 * (InstanceDetail.razor has been writing var(--muni-rule, var(--muni-ink-mute))
 * with a hand-written fallback precisely because of this gap.)
 *
 * So this file loads BEFORE muni-components.css and munibase-civic.css.
 * Equal-specificity :root declarations mean the later file wins, which
 * gives exactly the behaviour we want while MudBlazor is still present:
 *
 *   - the five missing tokens get real values from here;
 *   - the nine Mud-derived tokens keep their Mud derivation, so the
 *     existing Admin theme is unchanged and dark mode still tracks
 *     MudThemeProvider.
 *
 * Landing this file is therefore visually inert on its own. It is the
 * prerequisite that makes munibase-admin-scope.css deployable.
 *
 * WHEN MUDBLAZOR GOES
 * -------------------
 * The [data-muni-palette][data-muni-mode] blocks below carry (0,2,0)
 * specificity and so already outrank the Mud-derived :root rules. Once
 * MudThemeProvider is removed, set the pair on <html> and this file
 * becomes the whole palette with no further edit:
 *
 *   <html data-muni-palette="bureau" data-muni-mode="light">
 *
 * Nothing writes those attributes today.
 *
 * Load order (Admin host head):
 *   1. fonts
 *   2. munibase-tokens.css        <- THIS FILE (palette)
 *   3. muni-components.css        <- shared .muni-* base + type tokens
 *   4. munibase-civic.css         <- shared civic surfaces
 *   5. munibase-admin.css         <- existing 34 KB, unchanged
 *   6. munibase-admin-scope.css   <- Admin density scope layer
 * -----------------------------------------------------------------
 */

/* --- DEFAULT - Bureau light ------------------------------------- */
:root,
[data-muni-palette="bureau"] {
  --muni-paper:#ECEBE3; --muni-paper-soft:#DEDCD0; --muni-paper-edge:#C6C3B3;
  --muni-ink:#14140D; --muni-ink-soft:#3A382C; --muni-ink-mute:#6B6853;
  --muni-rule:#B5B09A; --muni-rule-soft:#CFCAB5;
  --muni-primary:#2A3D1F; --muni-primary-soft:#D0D7C3;
  --muni-accent:#8C6420; --muni-accent-soft:#E8D8BC;
  --muni-stamp:#702618; --muni-stamp-soft:#E4CFC9;
}
[data-muni-palette="bureau"][data-muni-mode="dark"] {
  --muni-paper:#0E0F08; --muni-paper-soft:#161811; --muni-paper-edge:#24271E;
  --muni-ink:#DAE0C0; --muni-ink-soft:#B0B598; --muni-ink-mute:#797D66;
  --muni-rule:#2F3328; --muni-rule-soft:#1E211A;
  --muni-primary:#9BC07B; --muni-primary-soft:#1B2214;
  --muni-accent:#D9B063; --muni-accent-soft:#2A2114;
  --muni-stamp:#D68070; --muni-stamp-soft:#2C1C18;
}

/* Bureau dark is also the palette-less default. Palette and mode are
   independent switches with Bureau implicit, so a host that only writes
   data-muni-mode="dark" must still get dark tokens rather than silently
   falling back to light. */
[data-muni-mode="dark"]:not([data-muni-palette]) {
  --muni-paper:#0E0F08; --muni-paper-soft:#161811; --muni-paper-edge:#24271E;
  --muni-ink:#DAE0C0; --muni-ink-soft:#B0B598; --muni-ink-mute:#797D66;
  --muni-rule:#2F3328; --muni-rule-soft:#1E211A;
  --muni-primary:#9BC07B; --muni-primary-soft:#1B2214;
  --muni-accent:#D9B063; --muni-accent-soft:#2A2114;
  --muni-stamp:#D68070; --muni-stamp-soft:#2C1C18;
}

/* --- Ledger ---------------------------------------------------- */
[data-muni-palette="ledger"] {
  --muni-paper:#F5F1E8; --muni-paper-soft:#EDE7D7; --muni-paper-edge:#DDD4BD;
  --muni-ink:#1A1A1A; --muni-ink-soft:#3D3A33; --muni-ink-mute:#6B665A;
  --muni-rule:#C7BEA7; --muni-rule-soft:#E0D8C2;
  --muni-primary:#1F4D3A; --muni-primary-soft:#D7E2D8;
  --muni-accent:#A66B2E; --muni-accent-soft:#EEDFC8;
  --muni-stamp:#8B2A1F; --muni-stamp-soft:#E8D4CF;
}
[data-muni-palette="ledger"][data-muni-mode="dark"] {
  --muni-paper:#13140E; --muni-paper-soft:#1B1C15; --muni-paper-edge:#282A20;
  --muni-ink:#E8E4D6; --muni-ink-soft:#C9C3AF; --muni-ink-mute:#878371;
  --muni-rule:#3A3C30; --muni-rule-soft:#262821;
  --muni-primary:#6BA88A; --muni-primary-soft:#1F2A24;
  --muni-accent:#D4A35A; --muni-accent-soft:#2B2317;
  --muni-stamp:#D4756B; --muni-stamp-soft:#2F1F1C;
}

/* --- Records --------------------------------------------------- */
[data-muni-palette="records"] {
  --muni-paper:#EEF1F3; --muni-paper-soft:#E2E7EB; --muni-paper-edge:#CDD4D9;
  --muni-ink:#131A21; --muni-ink-soft:#334049; --muni-ink-mute:#5B6770;
  --muni-rule:#B4BEC6; --muni-rule-soft:#D5DDE2;
  --muni-primary:#1B3A57; --muni-primary-soft:#CFD9E4;
  --muni-accent:#886A1E; --muni-accent-soft:#E7DEC5;
  --muni-stamp:#7A1F2B; --muni-stamp-soft:#E5D0D4;
}
[data-muni-palette="records"][data-muni-mode="dark"] {
  --muni-paper:#0C1118; --muni-paper-soft:#131922; --muni-paper-edge:#1F2731;
  --muni-ink:#E3E8EE; --muni-ink-soft:#B8C2CD; --muni-ink-mute:#7A8693;
  --muni-rule:#2C3440; --muni-rule-soft:#1C232C;
  --muni-primary:#6A97C4; --muni-primary-soft:#1A2535;
  --muni-accent:#D4B068; --muni-accent-soft:#2A241A;
  --muni-stamp:#D87A85; --muni-stamp-soft:#2B1A1E;
}

/* --- Heritage -------------------------------------------------- */
[data-muni-palette="heritage"] {
  --muni-paper:#F1F3F1; --muni-paper-soft:#E4E9E4; --muni-paper-edge:#CDD5CD;
  --muni-ink:#10201B; --muni-ink-soft:#314440; --muni-ink-mute:#5B6D67;
  --muni-rule:#B2BFB8; --muni-rule-soft:#D3DDD6;
  --muni-primary:#0D5855; --muni-primary-soft:#CFE0DD;
  --muni-accent:#8E6A1F; --muni-accent-soft:#E7DEC6;
  --muni-stamp:#8B3A1F; --muni-stamp-soft:#ECD7CE;
}
[data-muni-palette="heritage"][data-muni-mode="dark"] {
  --muni-paper:#0A1413; --muni-paper-soft:#101C1B; --muni-paper-edge:#1D2A28;
  --muni-ink:#E0E8E5; --muni-ink-soft:#B8C3BF; --muni-ink-mute:#7B8884;
  --muni-rule:#283633; --muni-rule-soft:#182321;
  --muni-primary:#5FC4B9; --muni-primary-soft:#17302C;
  --muni-accent:#D6B06B; --muni-accent-soft:#2B2418;
  --muni-stamp:#D88872; --muni-stamp-soft:#2B1E1A;
}
