/* ==========================================================================
   Grey Sky Capital: design tokens, GSCD-2.1 "Instrument"
   Source of truth: "Palette and Type Reference" sheet. Values below are
   copied verbatim; do not introduce colours, families or sizes outside it.

   Dark ("instrument") is the default on :root.
   Light ("paper") applies to any element with [data-theme="light"].
   Components use only the semantic tokens (--bg, --text, --accent ...),
   so a section flips theme by changing one attribute.
   ========================================================================== */

:root {
  /* ---- Raw palette: dark / instrument ---- */
  --slate-900: #0D1215;   /* deep */
  --slate-800: #141B1F;   /* page */
  --slate-700: #1E262A;   /* raised */
  --slate-600: #2C363B;   /* hairline */

  --grey-100: #F2F4F2;    /* heading on dark (also paper-100) */
  --grey-300: #C8D0CD;    /* body on dark (also paper-300) */
  --grey-400: #94A1A7;    /* muted on dark, floor */
  --grey-500: #6E7C82;    /* borders only, both themes */

  --lime:  #C4F25A;       /* accent, data-1 */
  --flare: #FF8A52;       /* caution, data-2 */
  --azure: #7FA8FF;       /* global, data-3 */
  --ember: #FF9A66;       /* negative, data-5 */
  --pink:  #FF6EC7;       /* neon pink: Smart Foundation accent (fill only on paper) */
  --yellow: #FFEA3D;      /* neon yellow: Strategy Four accent (fill only on paper) */

  /* ---- Raw palette: light / paper ---- */
  --paper-100: #F2F4F2;   /* page */
  --paper-200: #E7EAE8;   /* deep */
  --paper-300: #C8D0CD;   /* hairline only */

  --ink-head:  #0D1215;   /* heading on paper */
  --ink-body:  #1E262A;   /* body on paper */
  --ink-muted: #556166;   /* muted on paper, floor */

  --rust:      #A83F0F;   /* accent, link */
  --azure-ink: #1F4EBF;   /* global, data-3 */
  --moss:      #3F5416;   /* positive, data-1 */
  --ember-ink: #9A3A0E;   /* negative, data-5 */


  /* ---- Semantic: dark (default) ---- */
  --bg:          var(--slate-800);
  --bg-deep:     var(--slate-900);
  --bg-raised:   var(--slate-700);
  --hairline:    var(--slate-600);
  --border:      var(--grey-500);

  --text-head:   var(--grey-100);
  --text:        var(--grey-300);
  --text-muted:  var(--grey-400);

  --accent:      var(--lime);      /* text-safe accent on this surface */
  --fill:        var(--lime);      /* solid accent fill */
  --fill-ink:    #0D1215;          /* text on any fill */
  --fill-alt:    var(--flare);
  --pos:         var(--lime);
  --neg:         var(--ember);
  --global:      var(--azure);
  --focus:       var(--lime);

  color-scheme: dark;

  /* ---- Type: Archivo + IBM Plex Mono; Kalam for the founders' letter only ---- */
  --font-sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-hand: 'Kalam', 'Segoe Print', 'Bradley Hand', cursive;   /* founders' letter only */

  /* size / line-height / tracking, from the reference scale */
  --hero-size: 72px;       --hero-lh: 0.94;   --hero-tr: -0.035em;
  --d1-size: 46px;         --d1-lh: 1.0;      --d1-tr: -0.035em;
  --d2-size: 34px;         --d2-lh: 1.06;     --d2-tr: -0.025em;
  --d3-size: 22px;         --d3-lh: 1.15;     --d3-tr: -0.02em;
  --lead-size: 18px;       --lead-lh: 1.55;
  --body-size: 16px;       --body-lh: 1.6;
  --data-size: 13px;       --data-lh: 1.7;
  --legal-size: 12px;      --legal-lh: 1.75;
  --eyebrow-size: 11px;    --eyebrow-tr: 0.14em;

  /* ---- Layout ---- */
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  --space-chapter: clamp(96px, 10vw, 144px);   /* a real change of subject */
  --space-continue: clamp(56px, 6vw, 80px);    /* one idea carrying on into the next */
  --nav-h: 72px;
  --ease: cubic-bezier(.2, .7, .1, 1);

  /* Depth: charts take their depth from light (DESIGN-SYSTEM.md, Charts). Each is layered over a fill colour.
     --lit-col for upright columns, --lit-bar for horizontal bars, --lit-drop the tight shadow under a mark,
     --lit-well the recessed track a bar runs in, --lit-bead a round marker lit from the top left. */
  --lit-col: linear-gradient(180deg, color-mix(in srgb, var(--paper-100) 26%, transparent), transparent 36%),
             linear-gradient(90deg, color-mix(in srgb, var(--ink-head) 24%, transparent), transparent 22%, color-mix(in srgb, var(--paper-100) 22%, transparent) 40%, transparent 62%, color-mix(in srgb, var(--ink-head) 18%, transparent));
  --lit-bar: linear-gradient(180deg, color-mix(in srgb, var(--paper-100) 36%, transparent), color-mix(in srgb, var(--paper-100) 6%, transparent) 45%, transparent 60%, color-mix(in srgb, var(--ink-head) 20%, transparent));
  --lit-drop: 0 1px 1px color-mix(in srgb, var(--ink-head) 18%, transparent), 0 6px 12px -8px color-mix(in srgb, var(--ink-head) 50%, transparent);
  --lit-well: inset 0 1px 2px color-mix(in srgb, var(--ink-head) 22%, transparent), inset 0 -1px 0 color-mix(in srgb, var(--paper-100) 70%, transparent);
  --lit-bead: radial-gradient(circle at 34% 30%, color-mix(in srgb, var(--paper-100) 55%, transparent), transparent 58%);
}

/* Fluid down-scaling of the display sizes on small screens only.
   At >= 1024px every size is exactly the reference value. */
@media (max-width: 1023px) {
  :root {
    --hero-size: clamp(44px, 6.4vw + 18px, 72px);
    --d1-size: clamp(34px, 2.4vw + 22px, 46px);
    --d2-size: clamp(26px, 1.6vw + 18px, 34px);
  }
}

[data-theme="light"] {
  --bg:          var(--paper-100);
  --bg-deep:     var(--paper-200);
  --bg-raised:   var(--paper-100);
  --hairline:    var(--paper-300);
  --border:      var(--grey-500);

  --text-head:   var(--ink-head);
  --text:        var(--ink-body);
  --text-muted:  var(--ink-muted);

  --accent:      var(--rust);
  --fill:        var(--lime);      /* lime is fill-only on paper */
  --fill-ink:    #0D1215;
  --fill-alt:    var(--flare);     /* flare is fill-only on paper */
  --pos:         var(--moss);
  --neg:         var(--ember-ink);
  --global:      var(--azure-ink);
  --focus:       var(--rust);

  color-scheme: light;
}

/* Re-enter the dark register inside a light section (e.g. the AIF card). */
[data-theme="dark"] {
  --bg: var(--slate-800); --bg-deep: var(--slate-900); --bg-raised: var(--slate-700);
  --hairline: var(--slate-600); --border: var(--grey-500);
  --text-head: var(--grey-100); --text: var(--grey-300); --text-muted: var(--grey-400);
  --accent: var(--lime); --fill: var(--lime); --fill-ink: #0D1215; --fill-alt: var(--flare);
  --pos: var(--lime); --neg: var(--ember); --global: var(--azure); --focus: var(--lime);
  color-scheme: dark;
}
