/* ============================================================
   YOUNG BULL, DESIGN TOKENS
   Bloomberg × engineering schematic × newsroom theater.
   One source of truth for color, type, motion, layer hues,
   and the 14-agent voice palette.
   ============================================================ */

/* ─── DARK (default) ─────────────────────────────────────────── */
:root,
html[data-yb-theme="dark"] {
  /* Surfaces */
  --bg:              #0e0e0e;     /* page floor */
  --bg-floor:        #121214;     /* the newsroom 'floor' */
  --bg-elev:         #1a1a1a;     /* card / panel body (NotebookLM-grade) */
  --bg-elev-2:       #1f1f22;
  --bg-sunk:         #08090b;     /* deepest recess */
  --bg-hover:        #232325;
  --grid:            #232323;     /* the 60px×60px schematic grid */
  --grid-soft:       #1c1c1e;

  /* Ink */
  --ink:             #f4f1e8;     /* primary, cream */
  --ink-body:        #d8d4c6;
  --ink-dim:         #b8b4a8;
  --ink-mute:        #6f6b5e;
  --ink-faint:       #4a463d;
  --ink-ghost:       #2c2925;

  /* Lines */
  --line:            #2a2a2a;
  --line-soft:       #1f1f1f;
  --line-strong:     #3a3a3a;
  --line-warm:       #2a2519;

  /* Brand & semantic */
  --gold:            #d4a843;
  --gold-bright:     #e6b84a;
  --gold-dim:        #a08234;
  --gold-deep:       #6f5824;
  --gold-soft:       rgba(212, 168, 67, 0.10);
  --gold-line:       rgba(212, 168, 67, 0.32);
  --gold-glow:       rgba(212, 168, 67, 0.45);

  --gain:            #5a9a4a;
  --gain-bright:     #7dc865;
  --gain-soft:       rgba(90, 154, 74, 0.12);
  --loss:            #c4423f;
  --loss-bright:     #e85a55;
  --loss-soft:       rgba(196, 66, 63, 0.12);
  --warn:            #c89a3a;

  /* ── 10 Physical Layers, the navigational palette ── */
  --layer-power:        #c8323c;
  --layer-cooling:      #3a7bd5;
  --layer-chips:        #c8ccd1;
  --layer-memory:       #d4a843;
  --layer-networking:   #2f9e57;
  --layer-photonics:    #7a5cc4;
  --layer-datacenter:   #1f9d92;
  --layer-defense:      #b8902a;
  --layer-sensing:      #d97a2c;
  --layer-space:        #4a6db8;

  --layer-power-wash:        rgba(200,  50,  60, 0.10);
  --layer-cooling-wash:      rgba( 58, 123, 213, 0.10);
  --layer-chips-wash:        rgba(200, 204, 209, 0.08);
  --layer-memory-wash:       rgba(212, 168,  67, 0.10);
  --layer-networking-wash:   rgba( 47, 158,  87, 0.10);
  --layer-photonics-wash:    rgba(122,  92, 196, 0.10);
  --layer-datacenter-wash:   rgba( 31, 157, 146, 0.10);
  --layer-defense-wash:      rgba(184, 144,  42, 0.10);
  --layer-sensing-wash:      rgba(217, 122,  44, 0.10);
  --layer-space-wash:        rgba( 74, 109, 184, 0.14);

  --anchor-band:    #f3d27a;
  --anchor-wash:    rgba(243, 210, 122, 0.14);

  /* ── 15 Agent Voice Colors, SACRED ── */
  --agent-analyst:       #d4a843;  /* mastermind, gold */
  --agent-leopold:       #7b6cff;  /* mastermind, electric violet, AGI thesis + shorts */
  --agent-bearguard:     #c4423f;  /* red, the bear */
  --agent-optimist:      #5a9a4a;  /* green, the bull */
  --agent-anchor:        #b8902a;  /* deep gold, the steady */
  --agent-burry:         #c9b89e;  /* paper-cream, the contrarian */
  --agent-cathie:        #67e8f9;  /* cyan, the futurist */
  --agent-degen:         #f472b6;  /* magenta, the gambler */
  --agent-sentinel:      #94a3b8;  /* slate, the watcher */
  --agent-floor:         #e6b84a;  /* amber, the floor specialist */
  --agent-nightshift:    #6366f1;  /* indigo, the night */
  --agent-dawnpatrol:    #fbbf24;  /* amber sunrise */
  --agent-macro:         #fb7185;  /* pink, the macro lens */
  --agent-earningshawk:  #d4a843;  /* event-gold */
  --agent-closebell:     #4a9b8e;  /* teal, the bell */

  /* ── Ambient mood washes (driven by current ET shift) ── */
  --ambient-night:       radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.10) 0%, transparent 55%);
  --ambient-dawn:        radial-gradient(ellipse at 50% 0%, rgba(251, 191, 36, 0.10) 0%, transparent 55%);
  --ambient-market:      radial-gradient(ellipse at 50% 0%, rgba(212, 168, 67, 0.05) 0%, transparent 60%);
  --ambient-afterhours:  radial-gradient(ellipse at 50% 0%, rgba( 74, 155, 142, 0.09) 0%, transparent 55%);
  --ambient-current:     var(--ambient-market);

  /* Type */
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans:  'Geist', 'Inter Tight', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Motion */
  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
  --ease-fast:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-stage:  cubic-bezier(0.2, 0, 0, 1);
  --t-fast:      160ms;
  --t-med:       240ms;
  --t-slow:      420ms;
  --t-stage:     680ms;

  /* Geometry */
  --radius:        2px;
  --radius-card:   3px;
  --radius-chip:   2px;
  --grid-px:       60px;
  --col-mega:      1480px;
  --col-wide:      1280px;
  --col:           1080px;

  --shadow-card:   0 1px 0 rgba(255,255,255,0.04) inset,
                   0 18px 48px rgba(0,0,0,0.55);
  --shadow-hover:  0 1px 0 rgba(255,255,255,0.06) inset,
                   0 24px 64px rgba(0,0,0,0.65);
}

/* ─── LIGHT, real reskin, NOT inversion ───────────────────────
   Banking paper. Warm cream surfaces. Gold deepened for contrast.
   Schematic grid stays as a faint warm hairline. */
html[data-yb-theme="light"] {
  --bg:              #faf8f1;
  --bg-floor:        #f3efe4;
  --bg-elev:         #ffffff;
  --bg-elev-2:       #f8f5ec;
  --bg-sunk:         #ebe7da;
  --bg-hover:        #f0ece0;
  --grid:            #e6e1d0;
  --grid-soft:       #ede9da;

  --ink:             #15181d;
  --ink-body:        #2a2e36;
  --ink-dim:         #4d5159;
  --ink-mute:        #7a7669;
  --ink-faint:       #aaa495;
  --ink-ghost:       #d4cebc;

  --line:            #d8d2bf;
  --line-soft:       #e6e1d0;
  --line-strong:     #b5ad96;
  --line-warm:       #d8c896;

  --gold:            #a8801a;         /* deepened for cream contrast */
  --gold-bright:     #c2962a;
  --gold-dim:        #8a6814;
  --gold-deep:       #5a4408;
  --gold-soft:       rgba(168, 128, 26, 0.10);
  --gold-line:       rgba(168, 128, 26, 0.35);
  --gold-glow:       rgba(168, 128, 26, 0.40);

  --gain:            #1f6b3a;
  --gain-bright:     #2a8a4e;
  --gain-soft:       rgba(31, 107, 58, 0.10);
  --loss:            #a3341f;
  --loss-bright:     #c14a30;
  --loss-soft:       rgba(163, 52, 31, 0.10);
  --warn:            #a87427;

  /* Layer hues, deepened where they were too light on cream */
  --layer-power:        #a82b34;
  --layer-cooling:      #2c5fa8;
  --layer-chips:        #6b7280;
  --layer-memory:       #a8801a;
  --layer-networking:   #246a3d;
  --layer-photonics:    #5a3e96;
  --layer-datacenter:   #16776e;
  --layer-defense:      #8a6814;
  --layer-sensing:      #b05a16;
  --layer-space:        #2d4b8c;

  --layer-power-wash:        rgba(168,  43,  52, 0.08);
  --layer-cooling-wash:      rgba( 44,  95, 168, 0.08);
  --layer-chips-wash:        rgba(107, 114, 128, 0.08);
  --layer-memory-wash:       rgba(168, 128,  26, 0.08);
  --layer-networking-wash:   rgba( 36, 106,  61, 0.08);
  --layer-photonics-wash:    rgba( 90,  62, 150, 0.08);
  --layer-datacenter-wash:   rgba( 22, 119, 110, 0.08);
  --layer-defense-wash:      rgba(138, 104,  20, 0.08);
  --layer-sensing-wash:      rgba(176,  90,  22, 0.08);
  --layer-space-wash:        rgba( 45,  75, 140, 0.08);

  --anchor-band:    #c2962a;
  --anchor-wash:    rgba(194, 150, 42, 0.12);

  /* Agent voice colors, deepened where needed for legibility */
  --agent-analyst:       #a8801a;
  --agent-leopold:       #4f3fd1;
  --agent-bearguard:     #a3341f;
  --agent-optimist:      #1f6b3a;
  --agent-anchor:        #8a6814;
  --agent-burry:         #7a6d52;
  --agent-cathie:        #146b7a;
  --agent-degen:         #a83478;
  --agent-sentinel:      #5a6068;
  --agent-floor:         #b07a16;
  --agent-nightshift:    #3d40a8;
  --agent-dawnpatrol:    #b07a16;
  --agent-macro:         #b04050;
  --agent-earningshawk:  #a8801a;
  --agent-closebell:     #1c6b62;

  --ambient-night:       radial-gradient(ellipse at 50% 0%, rgba( 61,  64, 168, 0.06) 0%, transparent 55%);
  --ambient-dawn:        radial-gradient(ellipse at 50% 0%, rgba(176, 122,  22, 0.06) 0%, transparent 55%);
  --ambient-market:      radial-gradient(ellipse at 50% 0%, rgba(168, 128,  26, 0.04) 0%, transparent 60%);
  --ambient-afterhours:  radial-gradient(ellipse at 50% 0%, rgba( 28, 107,  98, 0.06) 0%, transparent 55%);
  --ambient-current:     var(--ambient-market);

  --shadow-card:   0 1px 0 rgba(255,255,255,0.6) inset,
                   0 8px 24px rgba(40,30,10,0.10);
  --shadow-hover:  0 1px 0 rgba(255,255,255,0.8) inset,
                   0 14px 32px rgba(40,30,10,0.14);
}

/* ─── data-layer="X" cascades the layer-current tokens ───────── */
[data-layer="power"]      { --layer-current: var(--layer-power);      --layer-current-wash: var(--layer-power-wash); }
[data-layer="cooling"]    { --layer-current: var(--layer-cooling);    --layer-current-wash: var(--layer-cooling-wash); }
[data-layer="chips"]      { --layer-current: var(--layer-chips);      --layer-current-wash: var(--layer-chips-wash); }
[data-layer="memory"]     { --layer-current: var(--layer-memory);     --layer-current-wash: var(--layer-memory-wash); }
[data-layer="networking"] { --layer-current: var(--layer-networking); --layer-current-wash: var(--layer-networking-wash); }
[data-layer="photonics"]  { --layer-current: var(--layer-photonics);  --layer-current-wash: var(--layer-photonics-wash); }
[data-layer="datacenter"] { --layer-current: var(--layer-datacenter); --layer-current-wash: var(--layer-datacenter-wash); }
[data-layer="defense"]    { --layer-current: var(--layer-defense);    --layer-current-wash: var(--layer-defense-wash); }
[data-layer="sensing"]    { --layer-current: var(--layer-sensing);    --layer-current-wash: var(--layer-sensing-wash); }
[data-layer="space"]      { --layer-current: var(--layer-space);      --layer-current-wash: var(--layer-space-wash); }

/* data-agent="x" propagates voice color */
[data-agent="theanalyst"]     { --agent-color: var(--agent-analyst); }
[data-agent="bearguard"]      { --agent-color: var(--agent-bearguard); }
[data-agent="theoptimist"]    { --agent-color: var(--agent-optimist); }
[data-agent="anchor"]         { --agent-color: var(--agent-anchor); }
[data-agent="burry"]          { --agent-color: var(--agent-burry); }
[data-agent="cathie"]         { --agent-color: var(--agent-cathie); }
[data-agent="thedegen"]       { --agent-color: var(--agent-degen); }
[data-agent="sentinel"]       { --agent-color: var(--agent-sentinel); }
[data-agent="thefloor"]       { --agent-color: var(--agent-floor); }
[data-agent="nightshift"]     { --agent-color: var(--agent-nightshift); }
[data-agent="dawnpatrol"]     { --agent-color: var(--agent-dawnpatrol); }
[data-agent="themacro"]       { --agent-color: var(--agent-macro); }
[data-agent="earningshawk"]   { --agent-color: var(--agent-earningshawk); }
[data-agent="closebell"]      { --agent-color: var(--agent-closebell); }

/* ─── Base reset + typography ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  text-rendering: geometricPrecision;
}

body {
  font-family: var(--sans);
  font-size: 14px;
  /* Breathing room pass 2026-05-15: 1.55 -> 1.65 per
     site_config['site_overcrowded_critique_2026_05_15']. */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Schematic grid backdrop on the page floor. Subtle, it's the
   stage on which the room sits. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--grid-px) var(--grid-px);
  background-position: -1px -1px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--ambient-current);
  pointer-events: none;
  z-index: 1;
  transition: background var(--t-slow) var(--ease);
}

img, svg { display: block; max-width: 100%; }
button {
  font: inherit; color: inherit; background: none;
  border: 0; cursor: pointer;
}
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* Tabular numbers everywhere financial */
.num, .pct, [data-num], .yb-mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
.gain { color: var(--gain); }
.loss { color: var(--loss); }

/* ─── Page chrome shared across all pages ───────────────────── */
.yb-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
}
.container {
  max-width: var(--col-mega);
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 720px) {
  .container { padding: 0 16px; }
}

/* ─── Typography utility ────────────────────────────────────── */
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.eyebrow-gold {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.serif-h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(40px, 5.5vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.serif-h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.mono-display {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ─── Status dot (pulses for active agents) ─────────────────── */
@keyframes yb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.dot-live { animation: yb-pulse 2s ease-in-out infinite; }

/* ─── Focus ring ────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--gold);
  color: var(--bg);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
