/* ironwork — colour only. Belongs to a customer, not to a template.
   Generated by kit/make-palette.mjs from four decisions: ink #1A1714, accent
   #8A5A1C, paper #FFFDF9. Every role below was DERIVED until it cleared its
   contrast target against the ground it actually sits on, and the run is
   recorded at the end of this file.

   --p-* are primitives. A section may never reference one.
   --c-* are the roles a section may use, and the only ones. */
:root{
  --p-ink:#1A1714;
  --p-paper:#FFFDF9;
  --p-white:#ffffff;
  --p-accent:#8A5A1C;
  --p-tint:#f2f0ec;
  --p-hair:#e6e4e0;

  --c-surface:#FFFDF9;
  --c-surface-raised:#ffffff;
  --c-text:#1a1714;
  --c-text-muted:#767470;
  --c-text-subtle:#777571;
  --c-border:#e6e4e0;
  --c-accent:#8A5A1C;
  --c-on-accent:#ffffff;
  --c-accent-text:#8a5a1c;
  --c-focus-ring:#8a5a1c;
}

/* An inverted band is a SCOPE, not a set of extra tokens. Same role names,
   different values. A section must never declare a --c-* on itself, or this
   stops working: a property declared on an element beats one inherited from an
   ancestor regardless of specificity. */
[data-surface="inverse"]{
  --c-surface:#1A1714;
  --c-surface-raised:#2a2724;
  --c-text:#ffffff;
  --c-text-muted:#9f9e9c;
  --c-text-subtle:#888685;
  --c-border:#4c4a48;
  --c-accent:#a37d4c;
  --c-on-accent:#1A1714;
  --c-accent-text:#ad8c60;
  --c-focus-ring:#ad8c60;
}

/* ── DARK MODE ──────────────────────────────────────────────────────────────
   Not a second palette. The page set and the inverse set SWAP, which is the
   only arrangement that survives PLAN.md §10's trap: in dark mode "inverse" has
   to become LIGHTER, or an inverse band on a dark page is a black band on a
   black page. Both sets were already derived and proved above, so dark mode
   inherits 108 verified pairs rather than needing 108 more.

   Specificity, because this is where it goes wrong: [data-mode="dark"] and
   [data-surface="inverse"] are both (0,1,0), and a property declared ON an
   element beats one inherited from an ancestor. The two-selector rule below is
   (0,2,0) and is what makes an inverse band inside a dark page come out light.
   Order matters too — these must stay after the two blocks above. */
[data-mode="dark"]{
  --c-surface:#1A1714;
  --c-surface-raised:#2a2724;
  --c-text:#ffffff;
  --c-text-muted:#9f9e9c;
  --c-text-subtle:#888685;
  --c-border:#4c4a48;
  --c-accent:#a37d4c;
  --c-on-accent:#1A1714;
  --c-accent-text:#ad8c60;
  --c-focus-ring:#ad8c60;
}
[data-mode="dark"] [data-surface="inverse"]{
  --c-surface:#FFFDF9;
  --c-surface-raised:#ffffff;
  --c-text:#1a1714;
  --c-text-muted:#767470;
  --c-text-subtle:#777571;
  --c-border:#e6e4e0;
  --c-accent:#8A5A1C;
  --c-on-accent:#ffffff;
  --c-accent-text:#8a5a1c;
  --c-focus-ring:#8a5a1c;
}

/* auto — the site owner said "follow the visitor's device". Same values. */
@media (prefers-color-scheme: dark){
  [data-mode="auto"]{
    --c-surface:#1A1714;
    --c-surface-raised:#2a2724;
    --c-text:#ffffff;
    --c-text-muted:#9f9e9c;
    --c-text-subtle:#888685;
    --c-border:#4c4a48;
    --c-accent:#a37d4c;
    --c-on-accent:#1A1714;
    --c-accent-text:#ad8c60;
    --c-focus-ring:#ad8c60;
  }
  [data-mode="auto"] [data-surface="inverse"]{
    --c-surface:#FFFDF9;
    --c-surface-raised:#ffffff;
    --c-text:#1a1714;
    --c-text-muted:#767470;
    --c-text-subtle:#777571;
    --c-border:#e6e4e0;
    --c-accent:#8A5A1C;
    --c-on-accent:#ffffff;
    --c-accent-text:#8a5a1c;
    --c-focus-ring:#8a5a1c;
  }
}

/* verified 2026-09-06
   ok   page     text on surface               17.57:1  needs 4.5
   ok   page     text-muted on surface          4.59:1  needs 4.5
   ok   page     text-subtle on surface         4.53:1  needs 4.5
   ok   page     text on surface-raised        17.85:1  needs 4.5
   ok   page     text-muted on surface-raised   4.66:1  needs 4.5
   ok   page     accent-text on surface         5.81:1  needs 4.5
   ok   page     on-accent on accent             5.9:1  needs 4.5
   ok   page     border on surface              1.25:1  needs 1.2
   ok   page     focus-ring on surface          5.81:1  needs 3
   ok   inverse  text on surface               17.85:1  needs 4.5
   ok   inverse  text-muted on surface          6.67:1  needs 4.5
   ok   inverse  text-subtle on surface         4.93:1  needs 4.5
   ok   inverse  text on surface-raised        14.85:1  needs 4.5
   ok   inverse  text-muted on surface-raised   5.55:1  needs 4.5
   ok   inverse  accent-text on surface         5.69:1  needs 4.5
   ok   inverse  on-accent on accent            4.76:1  needs 4.5
   ok   inverse  border on surface              2.02:1  needs 1.2
   ok   inverse  focus-ring on surface          5.69:1  needs 3 */
