/* ==================================================================================
   Brookfield · one design foundation
   ----------------------------------------------------------------------------------
   Loaded first by BOTH apps (Portfolio Intelligence and the Knowledge Hub) so the
   platform reads as one product. This file owns primitives only — colour, type,
   space, radius, elevation, motion, focus — plus a handful of shared primitives
   (.u-* utilities). App stylesheets consume these tokens and must not redefine a
   raw hex value.

   Design intent (benchmarked against how the strategy houses present knowledge):
   editorial restraint, not dashboard noise. White paper, deep navy ink, one blue
   reserved for things you can act on, gold reserved for vetted knowledge. Density
   is earned by hierarchy, never by shrinking type.
   ================================================================================== */

:root {
  color-scheme: light;

  /* ---- ink: cool navy-grey ramp. 900 is headline + primary surface ---- */
  --c-ink-900: #061A26;
  --c-ink-800: #0B2433;
  --c-ink-700: #163445;
  --c-ink-600: #2B4859;
  --c-ink-500: #4A6475;
  --c-ink-400: #4F6675;   /* --muted:   6.0:1 on canvas, 5.6:1 on panel — AA at 11px */
  --c-ink-300: #5B7382;   /* --muted-2: 5.0:1 on canvas, 4.6:1 on panel — a label is still text */

  /* ---- paper: warm near-white, sampled off the Academy mockups ----
     #FCFBF9 is the page, #F6F4F1 the band a section sits on, #FFFFFF a card. The warmth is
     about one per cent; any more and it reads as beige rather than as paper. ---- */
  --c-n-0:   #FFFFFF;
  --c-n-25:  #FCFBF9;
  --c-n-50:  #F8F6F3;
  --c-n-100: #F6F4F1;
  --c-n-150: #EFECE6;
  --c-n-200: #E6E1D9;
  --c-n-300: #D4CEC4;

  /* ---- burgundy: interaction only. Never decoration.
     The house accent, #6E1530, measured off the primary button in the mockups. Ink stays
     cool navy against it — warm paper, cool type, one warm accent. ---- */
  --c-blue-800: #4E0D1F;
  --c-blue-700: #5E1227;
  --c-blue-600: #6E1530;
  --c-blue-500: #8A2440;
  --c-blue-100: #E9D7DB;
  --c-blue-50:  #F8F0F1;

  /* ---- gold: vetted / certified knowledge, and learning ---- */
  --c-gold-700: #8A6516;
  --c-gold-600: #A87C1E;
  --c-gold-100: #F3E7C9;
  --c-gold-50:  #FBF4E2;

  /* ---- semantic. Bad leans orange so it never reads as the burgundy accent. ---- */
  --c-good-700: #2F6B4F; --c-good-50: #E9F1EB;
  --c-warn-700: #8A5A1E; --c-warn-50: #FAF2E2;
  --c-bad-700:  #A3261F; --c-bad-50:  #FAEAE6;
  --c-teal-600: #2A6F73; --c-teal-50: #E7F0F0;
  --c-plum-600: #6B3C8F; --c-plum-50: #F2EAF8;

  /* ---- semantic surface aliases: the names app CSS should use ---- */
  --ink:        var(--c-ink-900);
  --ink-2:      var(--c-ink-700);
  --text:       var(--c-ink-800);
  --text-2:     var(--c-ink-500);
  --muted:      var(--c-ink-400);
  --muted-2:    var(--c-ink-300);
  --canvas:     var(--c-n-0);
  --page:       var(--c-n-25);
  --panel:      var(--c-n-50);
  --panel-2:    var(--c-n-100);
  --rule:       var(--c-n-200);
  --rule-soft:  var(--c-n-150);
  --accent:     var(--c-blue-600);
  --accent-ink: var(--c-blue-700);
  --accent-hi:  var(--c-blue-500);
  --accent-soft: var(--c-blue-50);
  --accent-line: var(--c-blue-100);
  --on-ink:     #FFFFFF;
  --on-accent:  #FFFFFF;
  --highlight:  #F7E6A8;

  /* ---- categorical ramp for data series ----
     Eight slots, led by the accent and muted to sit on warm paper. Charts used to pick their
     own blues and cyans per page, which is why no two analytics screens agreed. The -hi
     variants are the same hues lifted for an inverted surface (agent logs, dark heroes). ---- */
  --cat-1: #6E1530;  --cat-1-hi: #E09BA8;
  --cat-2: #1D3557;  --cat-2-hi: #9FB6D4;
  --cat-3: #2A6F73;  --cat-3-hi: #7FC4C8;
  --cat-4: #A87C1E;  --cat-4-hi: #DCBB72;
  --cat-5: #4F6B52;  --cat-5-hi: #9DBFA2;
  --cat-6: #8A4B6B;  --cat-6-hi: #D3A0B8;
  --cat-7: #5D6270;  --cat-7-hi: #B0B6C2;
  --cat-8: #B0A79A;  --cat-8-hi: #D8D0C6;
  /* text on an inverted surface, in three weights */
  --on-dark-1: rgba(255, 255, 255, .92);
  --on-dark-2: rgba(255, 255, 255, .74);
  --on-dark-3: rgba(255, 255, 255, .48);

  /* ---- content layers (Bronze / Silver / Gold) ---- */
  --bronze: #8A5A2B; --bronze-soft: #F5EADE;
  --silver: #54616E; --silver-soft: #EAEEF1;
  --gold:   var(--c-gold-700); --gold-soft: var(--c-gold-50);

  /* ---- type ---- */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, "Iowan Old Style", Charter, "Palatino Linotype", "Book Antiqua", ui-serif, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --t-3xs: .6875rem;  /* 11 — labels, legal */
  --t-2xs: .75rem;    /* 12 — meta */
  --t-xs:  .8125rem;  /* 13 — dense UI */
  --t-sm:  .875rem;   /* 14 — secondary body */
  --t-md:  .9375rem;  /* 15 — UI body (default) */
  --t-base: 1rem;     /* 16 */
  --t-lg:  1.125rem;  /* 18 */
  --t-xl:  1.3125rem; /* 21 */
  --t-2xl: 1.625rem;  /* 26 */
  --t-3xl: 2.125rem;  /* 34 */
  --t-4xl: 2.75rem;   /* 44 */

  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-ui: 1.5;
  --lh-read: 1.65;

  --w-reg: 400; --w-med: 500; --w-semi: 600; --w-bold: 700;
  --track-tight: -0.015em;
  --track-label: .07em;

  /* ---- space: 4px base ---- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px; --s-10: 72px;

  /* ---- radius ---- */
  --rad-xs: 4px; --rad-sm: 6px; --rad: 8px; --rad-lg: 12px; --rad-xl: 18px; --rad-pill: 999px;

  /* ---- elevation: three steps, all restrained ---- */
  --el-1: 0 1px 2px rgba(32, 26, 20, .05), 0 0 0 1px rgba(32, 26, 20, .05);
  --el-2: 0 2px 4px rgba(32, 26, 20, .04), 0 8px 20px -12px rgba(32, 26, 20, .18);
  --el-3: 0 24px 56px -20px rgba(32, 26, 20, .30), 0 2px 8px rgba(32, 26, 20, .07);
  --ring: 0 0 0 3px var(--accent-line);
  --scrim: rgba(28, 22, 18, .44);

  /* ---- motion ---- */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: .13s; --t-mid: .22s; --t-slow: .4s;

  /* ---- layout ---- */
  --shell-top: 56px;
  --shell-nav: 248px;
  --measure: 68ch;        /* reading column */
  --page-max: 1400px;
}

/* ---------------------------------------------------------------------------------
   Dark mode. Same semantics, inverted paper. Blue lifts so it still reads as
   "actionable" on a dark field; gold warms so Gold stays the premium layer.
   --------------------------------------------------------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --c-ink-900: #F2F6F9;
  --c-ink-800: #E4EAEF;
  --c-ink-700: #CFD9E1;
  --c-ink-600: #AEBDC8;
  --c-ink-500: #94A5B2;
  --c-ink-400: #8195A4;   /* --muted:   5.8:1 on canvas */
  --c-ink-300: #76899A;   /* --muted-2: 5.0:1 on canvas */

  --c-n-0:   #1A1714;
  --c-n-25:  #131110;
  --c-n-50:  #221E1A;
  --c-n-100: #2A2521;
  --c-n-150: #332D28;
  --c-n-200: #3E372F;
  --c-n-300: #524A40;

  --accent:      #D98FA0;
  --accent-ink:  #EBAFBA;
  --accent-hi:   #E59FAD;
  --accent-soft: #2C1A1E;
  --accent-line: #4A2B31;
  --on-accent:   #1A0A0F;
  --on-ink:      #1A0A0F;
  --highlight:   #5E4E12;

  --c-good-700: #6FC79C; --c-good-50: #16281F;
  --c-warn-700: #DBA63F; --c-warn-50: #2B2214;
  --c-bad-700:  #F09287; --c-bad-50:  #2E1A16;
  --c-teal-600: #6FC2C7; --c-teal-50: #142627;
  --c-plum-600: #B88FDC; --c-plum-50: #221A2D;
  --c-gold-700: #D9B25E; --c-gold-50: #2A2114; --c-gold-100: #3A2E18;

  --bronze: #C99A66; --bronze-soft: #2A2016;
  --silver: #B3ABA0; --silver-soft: #262220;
  --gold:   #D9B25E; --gold-soft: #2A2114;

  --el-1: 0 1px 2px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 250, 245, .06);
  --el-2: 0 2px 6px rgba(0, 0, 0, .35), 0 10px 24px -14px rgba(0, 0, 0, .7);
  --el-3: 0 28px 60px -22px rgba(0, 0, 0, .85), 0 2px 8px rgba(0, 0, 0, .5);
  --scrim: rgba(12, 9, 7, .68);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --c-ink-900: #F2F6F9; --c-ink-800: #E4EAEF; --c-ink-700: #CFD9E1; --c-ink-600: #AEBDC8;
    --c-ink-500: #94A5B2; --c-ink-400: #8195A4; --c-ink-300: #76899A;
    --c-n-0:   #1A1714;
    --c-n-25:  #131110;
    --c-n-50:  #221E1A;
    --c-n-100: #2A2521;
    --c-n-150: #332D28;
    --c-n-200: #3E372F;
    --c-n-300: #524A40;

    --accent:      #D98FA0;
    --accent-ink:  #EBAFBA;
    --accent-hi:   #E59FAD;
    --accent-soft: #2C1A1E;
    --accent-line: #4A2B31;
    --on-accent:   #1A0A0F;
    --on-ink:      #1A0A0F;
    --highlight:   #5E4E12;

    --c-good-700: #6FC79C; --c-good-50: #16281F;
    --c-warn-700: #DBA63F; --c-warn-50: #2B2214;
    --c-bad-700:  #F09287; --c-bad-50:  #2E1A16;
    --c-teal-600: #6FC2C7; --c-teal-50: #142627;
    --c-plum-600: #B88FDC; --c-plum-50: #221A2D;
    --c-gold-700: #D9B25E; --c-gold-50: #2A2114; --c-gold-100: #3A2E18;

    --bronze: #C99A66; --bronze-soft: #2A2016;
    --silver: #B3ABA0; --silver-soft: #262220;
    --gold:   #D9B25E; --gold-soft: #2A2114;

    --el-1: 0 1px 2px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 250, 245, .06);
    --el-2: 0 2px 6px rgba(0, 0, 0, .35), 0 10px 24px -14px rgba(0, 0, 0, .7);
    --el-3: 0 28px 60px -22px rgba(0, 0, 0, .85), 0 2px 8px rgba(0, 0, 0, .5);
    --scrim: rgba(12, 9, 7, .68);
  }
}

/* ---------------------------------------------------------------------------------
   reset + base
   --------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font: var(--w-reg) var(--t-md)/var(--lh-ui) var(--font-sans);
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--rule-soft); margin: var(--s-6) 0; }

h1, h2, h3, h4, h5 { margin: 0; color: var(--ink); font-weight: var(--w-reg); }
h1 { font-family: var(--font-display); font-size: var(--t-3xl); line-height: var(--lh-tight); letter-spacing: var(--track-tight); }
h2 { font-family: var(--font-display); font-size: var(--t-xl); line-height: var(--lh-snug); letter-spacing: var(--track-tight); }
h3 { font-size: var(--t-base); font-weight: var(--w-semi); line-height: var(--lh-snug); }
h4, h5 { font-size: var(--t-sm); font-weight: var(--w-semi); }

/* Numerals in data contexts never go proportional */
table, .u-num, [class*="num"] { font-variant-numeric: tabular-nums; }

::selection { background: var(--accent-line); color: var(--ink); }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--rad-xs);
}
mark { background: var(--highlight); color: var(--ink); padding: 0 2px; border-radius: 2px; }
code, kbd, samp { font-family: var(--font-mono); font-size: .9em; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-n-300); border-radius: var(--rad-pill); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------------------------
   shared primitives — the few things worth having identical in both apps
   --------------------------------------------------------------------------------- */

/* An eyebrow: the only place small-caps tracking is allowed. */
.u-eyebrow {
  font-size: var(--t-3xs); font-weight: var(--w-semi); letter-spacing: var(--track-label);
  text-transform: uppercase; color: var(--muted);
}
.u-measure { max-width: var(--measure); }
.u-muted { color: var(--muted); }
.u-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.u-skip {
  position: fixed; left: var(--s-2); top: -60px; z-index: 999;
  background: var(--ink); color: var(--on-ink); padding: var(--s-2) var(--s-4);
  border-radius: var(--rad-sm); transition: top var(--t-fast) var(--ease);
}
.u-skip:focus { top: var(--s-2); text-decoration: none; }

/* Prose: a reading column with real editorial rhythm. */
.u-prose { max-width: var(--measure); font-size: var(--t-base); line-height: var(--lh-read); color: var(--text); }
.u-prose > * + * { margin-top: 1em; }
.u-prose h2 { margin-top: 1.8em; font-size: var(--t-xl); }
.u-prose h3 { margin-top: 1.6em; }
.u-prose ul, .u-prose ol { padding-left: 1.3em; }
.u-prose li + li { margin-top: .4em; }
.u-prose blockquote {
  margin-left: 0; padding-left: var(--s-4); border-left: 2px solid var(--accent-line);
  color: var(--text-2); font-style: italic;
}
.u-prose table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.u-prose th, .u-prose td { border-bottom: 1px solid var(--rule-soft); padding: var(--s-2) var(--s-3); text-align: left; vertical-align: top; }
.u-prose th { font-weight: var(--w-semi); color: var(--ink); background: var(--panel); }
