/* ==========================================================================
   CGS Advisors design tokens, v1.2 (2026-10-04: lifecycle state tokens, section 9; 2026-10-20: print document tokens, section 10; 2026-10-22: heat shading, section 11)
   The single source of truth for CGS visual style.

   Provenance
   [observed] measured on www.cgsadvisors.com on 2026-09-21
   [derived]  added by us so the brand works in documents, apps and dark mode
              (accessible text variants, dark theme, larger type steps)

   Rules for anyone (or any tool) using this file
   1. Components may use ONLY the tokens below. No hex codes, px sizes,
      font names, shadows or radii written directly in a component rule.
   2. Structural keywords are fine: 0, auto, 100%, 1fr, none, inherit,
      currentColor, transparent, flex/grid values, unitless counts.
   3. The one exception is the width inside a @media query. CSS cannot read
      a variable there, so the breakpoint values are listed at the bottom
      of this file for reference.
   4. Need something new? Add a token here first, then use it.
   ========================================================================== */

:root {
  /* ---- 1. Primitives: the raw palette. Do not use these in components. ---- */
  --cgs-orange-300: #FF8B52;   /* [derived] AA-contrast orange for text on dark */
  --cgs-orange-500: #F26522;   /* [observed] CGS brand orange: logo, icons, rules */
  --cgs-orange-700: #B94A0F;   /* [derived] AA-contrast orange for text on white */
  --cgs-rosewood-300: #C98685; /* [derived] AA-contrast rosewood for text/glyphs on dark */
  --cgs-rosewood-500: #995958; /* [observed] secondary accent (search link); also AA on white */
  --cgs-amber-300: #E0A83E;    /* [derived] AA-contrast amber for text/glyphs on dark */
  --cgs-amber-500: #B8860B;    /* [derived] muted amber: large fills and graphics only (3:1) */
  --cgs-amber-700: #7A5209;    /* [derived] AA-contrast amber for text on white */
  --cgs-green-300: #7FB56C;    /* [derived] AA-contrast green for text/glyphs on dark */
  --cgs-green-500: #4C7A3D;    /* [derived] muted green; also AA on white */

  --cgs-neutral-0:   #FFFFFF;  /* [observed] page white */
  --cgs-neutral-100: #F0F0F0;  /* [observed] light grey band */
  --cgs-neutral-200: #DDDDDD;  /* [observed] hairline border */
  --cgs-neutral-300: #BBBBBB;  /* [observed] strong border */
  --cgs-neutral-400: #A8A8A8;  /* [derived] muted text on dark */
  --cgs-neutral-600: #6B6B6B;  /* [derived] muted text on white, AA */
  --cgs-neutral-700: #555555;  /* [observed] site body text */
  --cgs-neutral-750: #444444;  /* [observed] common text grey */
  --cgs-neutral-800: #333333;  /* [observed] headings */
  --cgs-neutral-850: #2B2B2B;  /* [derived] dark surface */
  --cgs-neutral-875: #222222;  /* [derived] dark band */
  --cgs-neutral-900: #191919;  /* [observed] near-black text, dark page */

  /* ---- 2. Semantic color: what components use. Light theme is the default. ---- */
  --color-bg: var(--cgs-neutral-0);
  --color-bg-alt: var(--cgs-neutral-100);
  --color-surface: var(--cgs-neutral-0);
  --color-text: var(--cgs-neutral-750);
  --color-text-strong: var(--cgs-neutral-800);
  --color-text-muted: var(--cgs-neutral-600);
  --color-border: var(--cgs-neutral-200);
  --color-border-strong: var(--cgs-neutral-300);
  --color-brand: var(--cgs-orange-500);        /* fills, rules, icons, large text */
  --color-brand-text: var(--cgs-orange-700);   /* small text and links on light */
  --color-on-brand: var(--cgs-neutral-0);      /* large or bold text on brand fill only */
  --color-chain: var(--cgs-neutral-800);       /* primary chevrons */
  --color-support: var(--cgs-neutral-700);     /* enabling / secondary blocks */
  --color-on-fill: var(--cgs-neutral-0);       /* text on chain and support fills */
  --color-secondary: var(--cgs-rosewood-500);

  /* Status (goal/measure tracking, 2026-09-29 decision). Orange is never a status colour;
     always pair with the glyph (● ◐ ▲ ○), never colour alone. */
  --color-status-not-achieving: var(--cgs-rosewood-500);
  --color-status-at-risk: var(--cgs-amber-700);
  --color-status-on-track: var(--cgs-green-500);
  --color-status-no-data: var(--cgs-neutral-600);

  /* ---- 3. Typography ---- */
  --font-heading: 'Montserrat', 'Segoe UI', system-ui, sans-serif;  /* [observed] */
  --font-body: 'Raleway', 'Segoe UI', system-ui, sans-serif;        /* [observed] */

  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;  /* [derived] code only */

  --weight-regular: 400;   /* [observed] site headings and body */
  --weight-medium: 500;    /* [derived] display headings on screen */
  --weight-semibold: 600;  /* [derived] emphasis, labels */

  --text-xs: 0.75rem;      /* 12px [observed] nav */
  --text-sm: 0.8125rem;    /* 13px [observed] site body */
  --text-md: 0.875rem;     /* 14px [observed] footer headings */
  --text-base: 1rem;       /* 16px [derived] document and app body */
  --text-lg: 1.125rem;     /* 18px [observed] h5 */
  --text-xl: 1.5rem;       /* 24px [observed] h2 */
  --text-2xl: 2.25rem;     /* 36px [derived] */
  --text-3xl: clamp(2.25rem, 6vw, 4rem); /* [derived] display */
  --text-chain: clamp(0.9375rem, 1.45vw, 1.125rem); /* [derived] fluid type inside chevrons */

  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading-normal: 1.6;   /* [derived] site body runs looser at 2.2 */

  --tracking-none: normal;
  --tracking-nav: 0.025em;   /* [observed] 0.3px at 12px */
  --tracking-label: 0.05em;  /* [observed] 0.7px at 14px */
  --tracking-wide: 0.12em;   /* [derived] small uppercase eyebrows */

  --measure: 65ch;           /* comfortable line length for running text */

  /* ---- 4. Spacing: the CGS site's own 1.5x scale plus one small step ---- */
  --space-3xs: 0.25rem;      /* [derived] */
  --space-2xs: 0.44rem;      /* [observed] */
  --space-xs: 0.67rem;       /* [observed] */
  --space-s: 1rem;           /* [observed] */
  --space-m: 1.5rem;         /* [observed] */
  --space-l: 2.25rem;        /* [observed] */
  --space-xl: 3.38rem;       /* [observed] */
  --space-2xl: 5.06rem;      /* [observed] */

  /* ---- 5. Shape: CGS is square. The logo is a square with one cut corner. ---- */
  --radius-none: 0;          /* [observed] every control on the site is square */
  --border-thin: 1px;
  --border-thick: 3px;
  --border-bar: 5px;

  /* ---- 6. Layout ---- */
  --content-max: 74rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --band-pad: clamp(2rem, 5vw, 3.5rem);
  --col-sm: 11rem;           /* minimum column width, small (swatches) */
  --col-md: 16rem;           /* minimum column width, medium (cards) */
  --col-lg: 18rem;           /* minimum column width, large (do / don't) */
  --meta-col: 8rem;          /* label column beside specimens and bars */
  --label-col: 12rem;        /* wide label column */

  /* ---- 7. Motion and state ---- */
  --duration-fast: 0.2s;
  --opacity-soft: 0.85;
  --hover-brightness: 1.15;
  --ring-gap: 0.1875rem;
  --ring-width: 0.375rem;

  /* ---- 8. Component dimensions (value chain) ---- */
  --chain-height: 7rem;
  --row-height: 4rem;
  --chevron-notch: 1.375rem;
  --chevron-overlap: 1.125rem;
  --marker-bar: 0.3125rem;
  --arrow-width: 0.375rem;
  --arrow-height: 0.5625rem;
  --id-column: 2.875rem;
  --cover-ratio: 17 / 22;    /* portrait cover art (papers), US Letter shape: width over height, so the box is reserved before the image loads. Change it here only. */
  --size-logo: 2rem;         /* the CGS cut-corner mark in an app header (Executive Insights Portal, 2026-11-16) */

  /* ---- 9. Lifecycle state (EA v2, 2026-10-04) ----
     As-Built solid · In Flight striped · To-Be "about to emerge" (a faint tint of the element's colour,
     dashed outline) · Retired very light grey. State is texture and opacity, never hue, so it works
     with any colour coding. Used by the EA tool; meant for roadmaps and decks too. */
  --stripe: 0.3rem;          /* In Flight: width of each coloured stripe */
  --stripe-gap: 0.6rem;      /* In Flight: one stripe plus its gap */
  --stripe-angle: 135deg;
  --lc-emerge: 18%;          /* To-Be: share of the element's colour mixed into the surface */
  --lc-retired: var(--cgs-neutral-100);  /* Retired fill */
  --duration-emerge: 0.45s;  /* To-Be elements fading in when the view steps forward (off under reduced motion) */

  /* ---- 10. Print documents (2026-10-19): the CGS document footer standard (CLAUDE.md "Every document footer") ---- */
  --page-width: 8.5in;       /* US Letter */
  --page-height: 11in;
  --page-margin: 1in;
  --footer-margin: 0.5in;    /* bottom edge to the footer */
  --footer-logo: 0.48in;     /* orange square logo, far left, behind the text */
  --footer-indent: 27pt;     /* footer text clears the logo */
  --color-footer-text: #1F1F1F; /* [observed] footer line 1, the approved sample Doc */
  --text-print-body: 10.5pt; /* [derived] document body in print */
  --text-print-small: 8.5pt; /* [derived] dense tables and footer */

  /* ---- 10b. Document Designer (2026-11-03): styling for generated Google Docs.
     Docs needs plain hex colors and points, so tools/page-to-doc/build.ps1 resolves these --doc-* tokens
     (following var() and color-mix) into a generated Theme.gs. Edit them here only, then rebuild. ---- */
  --doc-font-heading: var(--font-heading);   /* first family in the stack is used */
  --doc-font-body: var(--font-body);
  --doc-weight-heading: var(--weight-semibold);
  --doc-color-heading: var(--color-text-strong);
  --doc-color-body: var(--color-text);
  --doc-color-muted: var(--color-text-muted);
  --doc-color-rule: var(--color-brand);
  --doc-title-size: 28pt;
  --doc-subtitle-size: 14pt;
  --doc-h1-size: 20pt;
  --doc-h1-size-report: 26pt;
  --doc-h2-size: 15pt;
  --doc-h3-size: 12pt;
  --doc-body-size: var(--text-print-body);
  --doc-small-size: var(--text-print-small);
  --doc-title-space-below: 6pt;
  --doc-subtitle-space-below: 10pt;
  --doc-h1-space-above: 18pt;
  --doc-h1-space-below: 8pt;
  --doc-h2-space-above: 14pt;
  --doc-h2-space-below: 6pt;
  --doc-h3-space-above: 10pt;
  --doc-h3-space-below: 4pt;
  --doc-body-space-below: 6pt;
  --doc-line-spacing: 115;   /* percent; 100 is single */
  --doc-density-brief: 0.85; /* multiplies heading and body spacing */
  --doc-density-pack: 1;
  --doc-density-report: 1.25;
  --doc-rule-width: 2.25pt;  /* orange rule under H1, H2, and the cover */
  --doc-rule-padding: 4pt;
  --doc-table-head-fill: var(--color-chain);
  --doc-table-head-text: var(--color-on-fill);
  --doc-table-zebra-fill: var(--color-bg-alt);
  --doc-table-row-fill: var(--color-surface);
  --doc-table-border: var(--color-border);
  --doc-table-border-width: 0.75pt;
  --doc-cell-padding: 4pt;
  --doc-cell-space: 2pt;     /* paragraph space inside table cells */
  --doc-callout-bar-width: 3.75pt;
  --doc-callout-padding: 8pt;
  --doc-callout-decision-bar: var(--color-brand);
  --doc-callout-decision-fill: var(--color-heat-low);
  --doc-callout-note-bar: var(--color-support);
  --doc-callout-note-fill: var(--color-bg-alt);
  --doc-callout-risk-bar: var(--color-secondary);
  --doc-callout-risk-fill: color-mix(in srgb, var(--color-secondary) var(--heat-low), var(--color-surface));
  --table-min: 40rem;        /* [derived] wide comparison tables scroll sideways below this on a phone */

  /* ---- 11. Heat shading (2026-10-22): opportunity heatmaps. Share of the brand color mixed into the surface.
     Shading only; no scale is implied. Always pair a shade with a text label, never color alone. ---- */
  --heat-high: 60%;
  --heat-medium: 32%;
  --heat-low: 12%;
  --color-heat-high: color-mix(in srgb, var(--color-brand) var(--heat-high), var(--color-surface));
  --color-heat-medium: color-mix(in srgb, var(--color-brand) var(--heat-medium), var(--color-surface));
  --color-heat-low: color-mix(in srgb, var(--color-brand) var(--heat-low), var(--color-surface));

  /* ---- Breakpoints (reference only; media queries need literal values) ----
     --bp-chain:  1040px   stack the value chain vertically
     --bp-tablet: 900px    stack three-column detail
     --bp-phone:  820px    single-column enabling functions                    */
}

/* Dark theme: same tokens, different values. The pattern below is required so
   the viewer's system setting and an explicit choice both work. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: var(--cgs-neutral-900);
    --color-bg-alt: var(--cgs-neutral-875);
    --color-surface: var(--cgs-neutral-850);
    --color-text: var(--cgs-neutral-200);
    --color-text-strong: var(--cgs-neutral-100);
    --color-text-muted: var(--cgs-neutral-400);
    --color-border: var(--cgs-neutral-750);
    --color-border-strong: var(--cgs-neutral-700);
    --color-brand-text: var(--cgs-orange-300);
    --color-chain: var(--cgs-neutral-750);
    --color-support: var(--cgs-neutral-700);
    --color-status-not-achieving: var(--cgs-rosewood-300);
    --color-status-at-risk: var(--cgs-amber-300);
    --color-status-on-track: var(--cgs-green-300);
    --color-status-no-data: var(--cgs-neutral-400);
    --lc-retired: var(--cgs-neutral-875);
  }
}
:root[data-theme="dark"] {
  --color-bg: var(--cgs-neutral-900);
  --color-bg-alt: var(--cgs-neutral-875);
  --color-surface: var(--cgs-neutral-850);
  --color-text: var(--cgs-neutral-200);
  --color-text-strong: var(--cgs-neutral-100);
  --color-text-muted: var(--cgs-neutral-400);
  --color-border: var(--cgs-neutral-750);
  --color-border-strong: var(--cgs-neutral-700);
  --color-brand-text: var(--cgs-orange-300);
  --color-chain: var(--cgs-neutral-750);
  --color-support: var(--cgs-neutral-700);
  --color-status-not-achieving: var(--cgs-rosewood-300);
  --color-status-at-risk: var(--cgs-amber-300);
  --color-status-on-track: var(--cgs-green-300);
  --color-status-no-data: var(--cgs-neutral-400);
  --lc-retired: var(--cgs-neutral-875);
}

/* ---- front-door additions (Iris, 2026-11-16): loader only; not in the source tokens file ---- */
:root {
  --size-loader-logo: 3rem;     /* CGS cut-corner mark on the loading screen */
  --duration-pulse: 1.4s;       /* one pass of the loader sliver */
}
