/* contribgraph theme tokens — Daylight.
 *
 * Swap this ONE file to reskin. Nothing downstream hardcodes a colour: the heat
 * scale is derived from --cg-accent via color-mix, so changing the accent moves
 * all four levels together and they stay in the same hue family.
 *
 * Palette source: C:\CascadeProjects\Hub\brand\daylight-design-system.md
 *
 * The scale is SEQUENTIAL (magnitude): one hue, light -> dark, no rainbow. The
 * step percentages below are not taste — they were solved against the palette
 * validator to satisfy two separate constraints:
 *
 *   1. empty vs. lowest-activity must be unmistakable, because that boundary is
 *      the one where a misread changes the MEANING (worked that day vs. didn't).
 *      Measured normal-vision dE: 17.1 light / 19.7 dark, against a floor of 15.
 *      The naive 26% first step scored 5.9 and was genuinely ambiguous.
 *   2. within-ramp steps as wide as one hue permits: dE 9.4 light / 8.7 dark.
 *      Four steps of a single hue cannot reach 15 — that is geometry, not an
 *      oversight — so exact counts are always available on hover AND keyboard
 *      focus, with a per-cell aria-label. That readout is the required relief
 *      for the sub-3:1 contrast of the pale steps; do not remove it.
 *
 * Luminance is strictly monotonic in both modes (light .943->.149 descending,
 * dark .016->.347 ascending), which is the correct check for a sequential ramp.
 * Re-run the validator if you change --cg-accent.
 */

:root {
  /* surfaces */
  --cg-bg:          #f7f5f1;   /* warm paper, never stark white */
  --cg-card:        #ffffff;
  --cg-border:      #e3ddd1;

  /* text */
  --cg-fg:          #1c1917;
  --cg-fg-secondary:#57534e;
  --cg-fg-muted:    #78716c;   /* dense/small-text variant, needs the contrast */

  /* the ONE accent — no second hue anywhere in this widget */
  --cg-accent:      #b8481f;
  --cg-accent-dim:  rgba(184, 72, 31, 0.08);

  /* heat scale. L0 is "no commits" — deliberately NOT part of the ramp: it is
   * the spec's documented mid-tone surface, a neutral, so it reads as off
   * rather than as a faint value. */
  --cg-l0: #efece4;
  --cg-l1: color-mix(in srgb, var(--cg-accent) 46%, var(--cg-card));
  --cg-l2: color-mix(in srgb, var(--cg-accent) 68%, var(--cg-card));
  --cg-l3: color-mix(in srgb, var(--cg-accent) 88%, var(--cg-card));
  --cg-l4: color-mix(in srgb, var(--cg-accent) 78%, var(--cg-fg));

  /* geometry */
  --cg-cell:        11px;
  --cg-gap:         3px;
  --cg-radius:      2px;

  /* type */
  --cg-font-ui:     Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --cg-font-mono:   "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --cg-font-display:Fraunces, Georgia, "Times New Roman", serif;
}

/* Dark variant — for the Saddle, ModelReins internal panels, and anything else
 * that is a terminal rather than a coffee. Opt in with data-cg-theme="dark",
 * or let it follow the OS via the media query below.
 *
 * Selected, not flipped: the accent is lifted to #e06a3c so it clears the dark
 * ground, and the ramp is re-mixed toward --cg-card (dark) instead of white,
 * then validated separately against that surface. */
[data-cg-theme="dark"] {
  --cg-bg:          #17150f;
  --cg-card:        #1f1c15;
  --cg-border:      #332e23;
  --cg-fg:          #f2ece0;
  --cg-fg-secondary:#c2b9a6;
  --cg-fg-muted:    #8a8172;
  --cg-accent:      #e06a3c;
  --cg-accent-dim:  rgba(224, 106, 60, 0.14);
  --cg-l0:          #26221a;
  /* L4 mixes toward --cg-fg, which is now light, so the top step brightens
   * instead of darkening — correct direction for light-on-dark. */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-cg-theme="light"]) {
    --cg-bg:          #17150f;
    --cg-card:        #1f1c15;
    --cg-border:      #332e23;
    --cg-fg:          #f2ece0;
    --cg-fg-secondary:#c2b9a6;
    --cg-fg-muted:    #8a8172;
    --cg-accent:      #e06a3c;
    --cg-accent-dim:  rgba(224, 106, 60, 0.14);
    --cg-l0:          #26221a;
  }
}
