/* Relationship Map — Design Tokens
 * Single source of truth for color, type, spacing, radii, shadows.
 * Usage: import this file; scope body / root to .theme-dark (default) or .theme-light.
 */

:root {
  /* ── Font stacks ──────────────────────────────────────────────────────── */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ── Base color ramp (Tailwind slate) ─────────────────────────────────── */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* ── Accent & state ───────────────────────────────────────────────────── */
  --blue-300:  #93c5fd;
  --blue-400:  #60a5fa;
  --blue-500:  #3b82f6;
  --blue-600:  #2563eb;
  --blue-700:  #1d4ed8;
  --blue-800:  #1e40af;
  --blue-950:  #1e3a5f;

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;

  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;

  --indigo-400: #818cf8;
  --indigo-500: #6366f1;

  --red-300:   #fca5a5;
  --red-600:   #dc2626;
  --red-950:   #3f1d1d;

  /* ── Node type palette (semantic — this is the brand) ─────────────────── */
  --node-person-fill:       #3b82f6;
  --node-person-stroke:     #1e40af;
  --node-org-fill:          #ea580c;
  --node-org-stroke:        #7c2d12;
  --node-gov-fill:          #7c3aed;
  --node-gov-stroke:        #4c1d95;
  --node-academic-fill:     #059669;
  --node-academic-stroke:   #064e3b;
  --node-other-fill:        #64748b;
  --node-other-stroke:      #334155;

  --edge-default:    var(--slate-700);
  --edge-hover:      var(--slate-500);
  --edge-financial:  var(--green-600);
  --edge-financial-hover: var(--green-400);

  /* ── Type scale ───────────────────────────────────────────────────────── */
  --fs-9:   9px;   /* node sublabel */
  --fs-10: 10px;   /* micro meta, kbd */
  --fs-11: 11px;   /* node label, small meta */
  --fs-12: 12px;   /* card label, small body */
  --fs-13: 13px;   /* button, nav */
  --fs-14: 14px;   /* body, input */
  --fs-15: 15px;   /* app/panel title */
  --fs-16: 16px;   /* subtitle */
  --fs-18: 18px;   /* section heading */
  --fs-32: 32px;   /* hero greeting */

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --fw-black:    800;

  /* ── Spacing (4-based, but the scale is dense) ────────────────────────── */
  --sp-1:  2px;
  --sp-2:  4px;
  --sp-3:  6px;
  --sp-4:  8px;
  --sp-5:  10px;
  --sp-6:  12px;
  --sp-7:  14px;
  --sp-8:  16px;
  --sp-10: 24px;
  --sp-12: 32px;
  --sp-14: 48px;
  --sp-16: 56px;
  --sp-18: 80px;

  /* ── Radii ────────────────────────────────────────────────────────────── */
  --r-4:  4px;
  --r-5:  5px;
  --r-6:  6px;
  --r-7:  7px;
  --r-8:  8px;
  --r-10: 10px;
  --r-12: 12px;
  --r-14: 14px;

  /* ── Borders ──────────────────────────────────────────────────────────── */
  --bw-1: 1px;
  --bw-15: 1.5px;
  --bw-2: 2px;
  --bw-25: 2.5px;
  --bw-3:  3px;

  /* ── Shadows ──────────────────────────────────────────────────────────── */
  --shadow-dropdown-dark:   0 8px 32px rgba(0,0,0,0.5);
  --shadow-dropdown-light:  0 8px 24px rgba(0,0,0,0.14);
  --shadow-hero-dark:       0 12px 40px rgba(0,0,0,0.5);
  --shadow-hero-light:      0 12px 40px rgba(0,0,0,0.14);
  --shadow-input-light:     0 2px 8px rgba(0,0,0,0.06);
  --ring-focus:             0 0 0 3px rgba(59,130,246,0.12);
  --glow-amber:             drop-shadow(0 0 10px rgba(251,191,36,0.4));
  --glow-indigo:            drop-shadow(0 0 7px rgba(99,102,241,0.55));
  --glow-node-hover:        drop-shadow(0 0 8px rgba(255,255,255,0.15));
  --glow-financial-edge:    drop-shadow(0 0 5px rgba(74,222,128,0.5));

  /* ── Motion ───────────────────────────────────────────────────────────── */
  --dur-fast:  0.10s;
  --dur-ui:    0.15s;
  --dur-panel: 0.25s;
  --dur-fade:  0.28s;
  --ease:      ease;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Dark theme (default) ─────────────────────────────────────────────────── */
.theme-dark, :root {
  --bg-canvas:   var(--slate-900);  /* the outermost body, behind everything */
  --bg-surface:  var(--slate-800);  /* toolbar, panels, modals */
  --bg-inset:    var(--slate-900);  /* inputs, sunken wells within a surface */
  --bg-hover:    var(--slate-700);
  --bg-hover-strong: var(--slate-600);
  --bg-active-chip:  var(--blue-950);
  --bg-active-chip-text: var(--blue-300);

  --border-default: var(--slate-700);
  --border-subtle:  var(--slate-800);

  --fg-strong:   var(--slate-100);
  --fg:          var(--slate-300);
  --fg-muted:    var(--slate-500);
  --fg-faint:    var(--slate-600);
  --fg-on-accent: #ffffff;

  --accent:          var(--blue-500);
  --accent-hover:    var(--blue-600);
  --accent-faint:    var(--blue-400);
}

.theme-light {
  --bg-canvas:   var(--slate-100);
  --bg-surface:  #ffffff;
  --bg-inset:    #f8fafc;
  --bg-hover:    var(--slate-100);
  --bg-hover-strong: var(--slate-200);
  --bg-active-chip:  #dbeafe;
  --bg-active-chip-text: var(--blue-700);

  --border-default: var(--slate-200);
  --border-subtle:  var(--slate-100);

  --fg-strong:   var(--slate-900);
  --fg:          var(--slate-700);
  --fg-muted:    var(--slate-500);
  --fg-faint:    var(--slate-400);
  --fg-on-accent: #ffffff;

  --accent:          var(--blue-500);
  --accent-hover:    var(--blue-600);
  --accent-faint:    var(--blue-700);
}

/* ── Semantic type classes ────────────────────────────────────────────────── */
body, .rm-body {
  font-family: var(--font-sans);
  color: var(--fg-strong);
  background: var(--bg-canvas);
  font-size: var(--fs-14);
  line-height: 1.5;
}

.rm-hero           { font-size: var(--fs-32); font-weight: var(--fw-black);    letter-spacing: -0.5px; line-height: 1.15; }
.rm-h1             { font-size: var(--fs-18); font-weight: var(--fw-bold);     line-height: 1.3; }
.rm-panel-title    { font-size: var(--fs-15); font-weight: var(--fw-bold);     line-height: 1.3; }
.rm-subtitle       { font-size: var(--fs-16); color: var(--fg-muted); }
.rm-body-text      { font-size: var(--fs-14); font-weight: var(--fw-regular); }
.rm-small          { font-size: var(--fs-13); font-weight: var(--fw-medium); }
.rm-meta           { font-size: var(--fs-12); color: var(--fg-muted); }
.rm-meta-sm        { font-size: var(--fs-11); color: var(--fg-muted); }
.rm-card-label     { font-size: var(--fs-14); font-weight: var(--fw-bold);    text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); }
.rm-field-label    { font-size: var(--fs-12); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.05em;  color: var(--fg-muted); }
.rm-kbd            { font-family: var(--font-mono); font-size: var(--fs-11); font-weight: var(--fw-semibold); padding: 2px 7px; border: 1px solid var(--border-default); border-radius: var(--r-4); background: var(--bg-inset); color: var(--fg-muted); }
.rm-mono           { font-family: var(--font-mono); }
.rm-node-label     { font-size: var(--fs-11); font-weight: var(--fw-semibold); }
.rm-node-sublabel  { font-size: var(--fs-9);  font-weight: var(--fw-regular); }
