/* ==========================================================================
   Weather Caddy — Design Tokens
   --------------------------------------------------------------------------
   House lineage: the engraved-currency system from Policlimate, re-cut for
   turf. Same type stack (deliberate — these are sibling properties), same
   lathe-work and plate furniture, but the palette moves from Treasury green
   to fairway green, sand, and links sea-blue, and the ornament budget goes
   into botanical engraving rather than banknote scrollwork.

   Chart colours below are NOT decorative choices. Every ramp was run through
   the data-viz validator against the paper and night surfaces:
   lightness band, chroma floor, CVD separation (protan/deutan/tritan),
   normal-vision floor, and WCAG contrast. Do not hand-edit a hex here — re-run
   the validator and substitute a passing step.
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* ---- surface & ink ---------------------------------------------------- */
  --paper:          #f4ecd8;   /* the chart surface every ramp was validated against */
  --paper-light:    #faf4e4;
  --paper-2:        #ebdfc2;
  --paper-shadow:   #dbcda6;
  --ink:            #1f1a11;
  --ink-soft:       #473d29;
  --ink-faint:      #877959;

  /* ---- brand: the course ------------------------------------------------ */
  --turf:           #1b4b36;   /* primary. Deep bentgrass green — all engraving inks in this */
  --turf-2:         #0e2e21;
  --turf-tint:      #d8e5d9;
  --fairway:        #4e8065;
  --fairway-light:  #dce9dc;
  --links:          #547d91;   /* sea/sky — coastal and wind furniture */
  --links-light:    #dce9ed;
  --bunker:         #a97a2f;   /* sand/brass — accents, seals, serial numbers */
  --bunker-2:       #7e5a20;
  --bunker-light:   #d9ac5c;
  --flag:           #7a2420;   /* flagstick oxblood — corrections, closures, hazards */
  --flag-2:         #591a17;

  /* ---- botanical wash: decorative only, never data ---------------------- */
  --botanical-sage:   #71875f;
  --botanical-celadon:#b8c8a6;
  --botanical-gold:   #bd8b3e;
  --botanical-rose:   #9f4b48;
  --botanical-violet: #725a78;
  --paper-glow:       #fffaf0;

  /* ---- rules ------------------------------------------------------------ */
  --rule:       color-mix(in srgb, var(--ink) 32%, transparent);
  --rule-soft:  color-mix(in srgb, var(--ink) 16%, transparent);

  /* ---- type ------------------------------------------------------------- */
  --font-display: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --font-body:    "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-caps:    "Cinzel", "Trajan Pro", Georgia, serif;
  --font-ledger:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --step--2: clamp(.62rem, .58rem + .18vw, .7rem);
  --step--1: clamp(.76rem, .72rem + .2vw,  .86rem);
  --step-0:  clamp(.98rem, .94rem + .22vw, 1.08rem);
  --step-1:  clamp(1.2rem, 1.1rem + .5vw,  1.45rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw,   2rem);
  --step-3:  clamp(2rem,   1.6rem + 2vw,   3rem);
  --step-4:  clamp(2.6rem, 1.9rem + 3.4vw, 4.6rem);

  /* ---- data: categorical (identity) ------------------------------------- *
   * Fixed order. Never cycled. A 9th series folds into "Other" or facets.   */
  --cat-1: #1a6fb0;  /* sky blue      */
  --cat-2: #b85a12;  /* burnt orange  */
  --cat-3: #1f7a4d;  /* fairway green */
  --cat-4: #8446a8;  /* violet        */
  --cat-5: #ab2338;  /* crimson       */
  --cat-6: #0a8f7f;  /* teal          */

  /* ---- data: playability status (reserved; never a series colour) ------- *
   * Always shipped with an icon AND a text label — never colour alone.      */
  --state-prime:   #1f7a4d;  /* Prime      */
  --state-caution: #ab7a12;  /* Caution    */
  --state-rough:   #b52d3a;  /* Rough Go   */
  --state-hold:    #69439e;  /* Hold (lightning / severe) */

  /* ---- data: sequential (wind speed, rainfall, magnitude) --------------- */
  --seq-1: #82adc4;
  --seq-2: #5b93b1;
  --seq-3: #376f93;
  --seq-4: #1f5474;
  --seq-5: #0c3b57;

  /* ---- data: diverging (temperature / departure from normal) ------------ */
  --div-cool-4: #1f5474;
  --div-cool-3: #376f93;
  --div-cool-2: #5b93b1;
  --div-cool-1: #82adc4;
  --div-mid:    #a49b86;   /* neutral, never a hue */
  --div-warm-1: #cb9a6c;
  --div-warm-2: #b8763f;
  --div-warm-3: #9c4e26;
  --div-warm-4: #772c1b;

  /* ---- chart furniture -------------------------------------------------- */
  --chart-surface: var(--paper);
  --chart-grid:    color-mix(in srgb, var(--ink) 11%, transparent);
  --chart-axis:    color-mix(in srgb, var(--ink) 34%, transparent);
  --chart-label:   var(--ink-soft);
  --chart-muted:   var(--ink-faint);
}

/* ==========================================================================
   Night round. Selected, not flipped: every step re-picked and re-validated
   against the #16211c surface.
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  --night-on: 0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:        #16211c;
    --paper-light:  #1e2b24;
    --paper-2:      #121a16;
    --paper-shadow: #0c130f;
    --ink:          #eae2cc;
    --ink-soft:     #c3bda6;
    --ink-faint:    #8c8871;

    --turf:          #7fb99a;
    --turf-2:        #a8d4bd;
    --turf-tint:     #1d3329;
    --fairway:       #5f9e7d;
    --fairway-light: #1d3329;
    --links:         #7fa9bd;
    --links-light:   #1b2c33;
    --bunker:        #d0a45c;
    --bunker-2:      #b1873f;
    --bunker-light:  #3a2e18;
    --flag:          #d4756a;
    --flag-2:        #b0554b;
    --botanical-sage: #8eaa79;
    --botanical-celadon: #314737;
    --botanical-gold: #d0a45c;
    --botanical-rose: #d4756a;
    --botanical-violet: #aa88b3;
    --paper-glow: #233129;

    --rule:      color-mix(in srgb, var(--ink) 30%, transparent);
    --rule-soft: color-mix(in srgb, var(--ink) 14%, transparent);

    --cat-1: #4e9ad6; --cat-2: #d17a38; --cat-3: #3fa571;
    --cat-4: #a875d6; --cat-5: #e0616f; --cat-6: #26a496;

    --state-prime:   #39996a;
    --state-caution: #b58a20;
    --state-rough:   #d6486a;
    --state-hold:    #8f7ccc;

    --seq-1: #2b5f7c; --seq-2: #3d7d9c; --seq-3: #5a9cba;
    --seq-4: #82bdd6; --seq-5: #b4dcea;

    --div-cool-4: #82bdd6; --div-cool-3: #5a9cba;
    --div-cool-2: #3d7d9c; --div-cool-1: #2b5f7c;
    --div-mid:    #6d6a5e;
    --div-warm-1: #8a4028; --div-warm-2: #a85a35;
    --div-warm-3: #c4784c; --div-warm-4: #dc9f6e;

    --chart-surface: #16211c;
    --chart-grid:  color-mix(in srgb, var(--ink) 12%, transparent);
    --chart-axis:  color-mix(in srgb, var(--ink) 32%, transparent);
  }
}

/* Explicit toggle must win in both directions. */
:root[data-theme="dark"] {
  --paper: #16211c; --paper-light: #1e2b24; --paper-2: #121a16; --paper-shadow: #0c130f;
  --ink: #eae2cc; --ink-soft: #c3bda6; --ink-faint: #8c8871;
  --turf: #7fb99a; --turf-2: #a8d4bd; --turf-tint: #1d3329;
  --fairway: #5f9e7d; --fairway-light: #1d3329;
  --links: #7fa9bd; --links-light: #1b2c33;
  --bunker: #d0a45c; --bunker-2: #b1873f; --bunker-light: #3a2e18;
  --flag: #d4756a; --flag-2: #b0554b;
  --botanical-sage: #8eaa79; --botanical-celadon: #314737;
  --botanical-gold: #d0a45c; --botanical-rose: #d4756a;
  --botanical-violet: #aa88b3; --paper-glow: #233129;
  --rule: color-mix(in srgb, var(--ink) 30%, transparent);
  --rule-soft: color-mix(in srgb, var(--ink) 14%, transparent);
  --cat-1: #4e9ad6; --cat-2: #d17a38; --cat-3: #3fa571;
  --cat-4: #a875d6; --cat-5: #e0616f; --cat-6: #26a496;
  --state-prime: #39996a; --state-caution: #b58a20;
  --state-rough: #d6486a; --state-hold: #8f7ccc;
  --seq-1: #2b5f7c; --seq-2: #3d7d9c; --seq-3: #5a9cba; --seq-4: #82bdd6; --seq-5: #b4dcea;
  --div-cool-4: #82bdd6; --div-cool-3: #5a9cba; --div-cool-2: #3d7d9c; --div-cool-1: #2b5f7c;
  --div-mid: #6d6a5e;
  --div-warm-1: #8a4028; --div-warm-2: #a85a35; --div-warm-3: #c4784c; --div-warm-4: #dc9f6e;
  --chart-surface: #16211c;
  --chart-grid: color-mix(in srgb, var(--ink) 12%, transparent);
  --chart-axis: color-mix(in srgb, var(--ink) 32%, transparent);
}
