/* tokens.css — single source for rglabs.com.au, portal and free check.
   Added 22 Sep 2026 from the brand handoff §5. Values are unchanged from what the pages already
   used; the new names are for things that were hard-coded, plus the type scale.
   Handoff §5.3: both proposed severity changes ARE applied (22 Sep). Checked first that nothing
   depends on the old values: the portal's severity chips are hard-coded hex, --low was unused
   anywhere, and the six uses of --med are warning text and bars on white, where more contrast is
   better. The old values are noted beside each. */
:root {
  /* Surfaces */
  --paper:         #FAF8F3;
  --card:          #FFFFFF;
  --band:          #F2EFE6;
  --foot-bg:       #17211B;   /* dark bands, not only the footer */

  /* Text */
  --ink:           #17211B;   /* dark TEXT. Never a background. See handoff 5.1 */
  --body:          #3F4A42;   /* running text */
  --muted:         #5F6B60;   /* secondary text. 4.86:1 on --band - do not lighten */

  /* Lines */
  --line:          #E3E0D2;
  --line-strong:   #D6D2C0;

  /* Brand */
  --laurel:        #1E5130;
  --laurel-bright: #2A6B40;
  --laurel-wash:   #EAF0E6;
  --laurel-soft:   rgba(30, 81, 48, .07);
  --signal:        #76B900;   /* DARK GROUNDS ONLY. 2.1-2.4:1 on every light surface */

  /* Severity - never without a text label (WCAG 1.4.1) */
  --sev-critical:  #B3261E;
  --sev-high:      #A04A18;
  --sev-medium:    #7A5A10;   /* was #8C6A15: 4.3:1 on --band, under 4.5 */
  --sev-low:       #4E5B53;   /* was #1E5130, identical to --laurel, so a low finding read as brand */
  --sev-info:      #1D4ED8;

  /* Actions and status chips (29 Sep). Named so the console theme can restyle them; the light values
     are the exact hex portal.css hard-coded before, so nothing on a light page moves. */
  --action:        #1E5130;   /* primary button ground */
  --on-action:     #FAF8F3;   /* text on a primary button */
  --chip-crit-bg:  #FBEAE7;  --chip-crit-fg:  #9B2C1B;
  --chip-high-bg:  #FCEFE3;  --chip-high-fg:  #93551B;
  --chip-med-bg:   #F7F3DF;  --chip-med-fg:   #7A6414;
  --chip-low-bg:   #EAF3E4;  --chip-low-fg:   #1E5130;
  --chip-info-bg:  #E7EDFB;  --chip-info-fg:  #1D4ED8;

  /* Type families */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:  'Instrument Sans', -apple-system, system-ui, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  /* Type scale */
  --fs-hero:   clamp(44px, 6.5vw, 88px);
  --fs-h1:     clamp(38px, 5vw, 62px);
  --fs-h2:     clamp(30px, 3.6vw, 44px);
  --fs-h3:     clamp(20px, 2vw, 24px);
  --fs-lead:   18px;
  --fs-body:   16px;
  --fs-small:  14px;
  --fs-label:  12.5px;   /* --mono, uppercase, letter-spacing .14em */

  /* Layout and effect */
  --wrap:         1180px;
  --wrap-article: 960px;
  --card-shadow:  0 20px 44px -30px rgba(23, 33, 27, .28);
  --ease:         cubic-bezier(.22, .7, .25, 1);
}

/* Deprecated aliases - keep until the portal, login and free-check pages are migrated
   (handoff §5.1: their local --ink is a BACKGROUND and cannot be aliased), then delete. */
:root {
  --panel:         var(--card);
  --text:          var(--ink);
  --accent:        var(--laurel);
  --accent-bright: var(--laurel-bright);
  --accent-dim:    var(--laurel-wash);
  --crit:          var(--sev-critical);
  --bad:           var(--sev-critical);
  --high:          var(--sev-high);
  --med:           var(--sev-medium);
  --warn:          var(--sev-medium);
  --low:           var(--sev-low);
  --info:          var(--sev-info);
  --onink:         var(--paper);
}

/* ── Console theme (dark) ─────────────────────────────────────────────────────────────────────────
   Proposed 29 Sep 2026. NOT YET APPLIED: nothing sets data-theme="console" until the console restyle.
   Decided permanent: the internal console is dark, the client portal is light.

   Derived, not invented. The console design (28 Sep) is built on our own --ink: its page ground is
   exactly #17211B. Every value below keeps the HUE of an existing brand token and takes its lightness
   from the design, so the dark theme stays inside the brand family rather than beside it. Where the
   design sat a few degrees off-hue it has been pulled back: its green (#6FBF72) onto the --laurel hue,
   its amber (#E0A574) onto the --sev-high hue.

   Same variable NAMES as the light theme, so a page that opts in flips without renaming anything.
   --signal is unchanged: it was always dark-grounds-only. Contrast is against --paper (#17211B);
   every text value clears WCAG AA (4.5:1) with room to spare. */
/* .theme-dark (29 Sep, portal restyle): the same palette scoped to one element, for the dark panels
   on the light client portal (the report summary, "Questions"). Custom properties declared on an
   element apply to it and its descendants, so everything inside flips exactly as the console does.
   Caveat: the deprecated aliases further down (--panel, --text, --accent...) are resolved once at
   :root, so inside .theme-dark they still hold LIGHT values. Use the real token names there. */
:root[data-theme="console"], .theme-dark {
  /* Surfaces - the --ink hue, stepped */
  --paper:         #17211B;   /* = light --ink. Page ground */
  --card:          #17211B;   /* cards are separated by --line, as in the design, not by a lift */
  --card-raised:   #25322A;   /* selected row, active nav item */
  --band:          #131C17;   /* sunken: sidebar, side panel, inset boxes */
  --foot-bg:       #131C17;

  /* Text - light, in the --ink hue */
  --ink:           #EDF1EC;   /* 14.5:1  primary text */
  --body:          #D7E0DB;   /* 12.3:1 */
  --muted:         #A4B4AA;   /*  7.6:1  secondary text, table headers */

  /* Lines */
  --line:          #26342C;
  --line-strong:   #2D3B33;

  /* Brand */
  --laurel:        #6FBF8B;   /*  7.5:1  measured / pass. --laurel hue, lifted */
  --laurel-bright: #9BD4AF;
  --laurel-wash:   #1B2E22;   /* pass cell, Met selected */
  --laurel-soft:   rgba(111, 191, 139, .08);

  /* Severity - never without a text label (WCAG 1.4.1) */
  --sev-critical:  #EE948F;   /*  7.3:1  fail, ML0. --sev-critical hue */
  --sev-high:      #E09C74;   /*  7.2:1  needs action: primary button, attestation queue. --sev-high hue */
  --sev-medium:    #DEBE73;   /*  9.2:1 */
  --sev-low:       #ABBAB1;   /*  8.2:1 */
  --sev-info:      #7B9BF4;   /*  6.2:1 */

  /* Tinted grounds for the states that carry them in the design */
  --crit-wash:     #3A2120;   /* fail cell, ML0 chip, blocked button */
  --crit-ground:   #201717;   /* grade card, grading hero */
  --high-ground:   #1F1916;   /* attestation queue panel, deletion banner */
  --action:        #E09C74;   /* the design's primary button: amber, in the --sev-high hue */
  --on-action:     #17211B;   /*  7.2:1 on --action */

  /* Chips: each severity's own hue at low lightness, text in the lifted severity colour. 5.5-7:1 */
  --chip-crit-bg:  #3C1D1B;  --chip-crit-fg:  #EE948F;
  --chip-high-bg:  #3C271B;  --chip-high-fg:  #E09C74;
  --chip-med-bg:   #3C321B;  --chip-med-fg:   #DEBE73;
  --chip-low-bg:   #1B3C27;  --chip-low-fg:   #6FBF8B;
  --chip-info-bg:  #1B243C;  --chip-info-fg:  #7B9BF4;

  --card-shadow:   none;      /* a shadow on #17211B reads as a smudge; the design uses borders */

  /* The deprecated aliases read --paper / --ink, which have flipped meaning here. Pin the one
     whose name says what it is for. */
  --onink:         var(--ink);
}
