/* =========================================================================
   AVERA — Design Tokens (v2026)
   Graph-native OS for regulated medical-device development.
   --------------------------------------------------------------------------
   Signature moves:
     • Source Serif 4 (display)  ×  Inter (UI)  ×  JetBrains Mono (IDs)
     • Electric blue primary (#0D6EFD) over navy (#0A1628) authority surface
     • Brand gradient 0D6EFD → 3D8BFD → 6EA8FE, used sparingly
     • Full dark-mode parity — all semantic tokens flip via [data-theme="dark"]
     • No tagline. The node mark carries the brand.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,500;0,8..60,600;1,8..60,400&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ========================================================================
     CORE PALETTE — immutable brand primitives
     ======================================================================== */

  /* Blue scale (primary) */
  --blue-50:  #EEF5FF;
  --blue-100: #CFE2FF;
  --blue-200: #A3C6FE;
  --blue-300: #6EA8FE;  /* gradient end, focus ring base */
  --blue-400: #3D8BFD;  /* gradient mid, hover */
  --blue-500: #0D6EFD;  /* PRIMARY */
  --blue-600: #0958D1;  /* pressed */
  --blue-700: #0746A8;
  --blue-800: #04347F;
  --blue-900: #021F4F;

  /* Navy (authority surface) */
  --navy-950: #050B17;  /* deepest — dark-mode bg */
  --navy-900: #0A1628;  /* logo mark start, headings on light */
  --navy-800: #0F2440;  /* logo mark end, raised dark surface */
  --navy-700: #1A2F4D;  /* dark borders */
  --navy-600: #25406A;  /* dark-mode muted text */
  --navy-500: #355680;  /* dark-mode secondary */

  /* Slate (neutral) */
  --slate-50:  #F7F9FC;
  --slate-100: #EEF2F7;
  --slate-200: #E1E7EF;
  --slate-300: #C8D2DF;
  --slate-400: #93A2B6;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;

  /* Status colors (consistent across modes) */
  --ok-500:     #10B981;
  --ok-100:     #D1FAE5;
  --ok-700:     #047857;
  --warn-500:   #F59E0B;
  --warn-100:   #FEF3C7;
  --warn-700:   #B45309;
  --danger-500: #EF4444;
  --danger-100: #FEE2E2;
  --danger-700: #B91C1C;
  --info-500:   #0EA5E9;
  --info-100:   #E0F2FE;
  --info-700:   #0369A1;

  /* Brand gradient (the only gradient in the system) */
  --gradient-brand: linear-gradient(135deg, #0D6EFD 0%, #3D8BFD 50%, #6EA8FE 100%);
  --gradient-navy:  linear-gradient(135deg, #0A1628 0%, #0F2440 100%);

  /* ========================================================================
     SEMANTIC TOKENS — light mode defaults
     Flipped by [data-theme="dark"] block below.
     ======================================================================== */

  /* Surfaces */
  --bg:            #FFFFFF;
  --bg-subtle:     var(--slate-50);
  --bg-muted:      var(--slate-100);
  --bg-inverse:    var(--navy-900);
  --bg-raised:     #FFFFFF;  /* cards on white bg */

  /* Text */
  --fg-1:          var(--navy-900); /* strongest — headings */
  --fg-2:          var(--slate-700); /* body */
  --fg-3:          var(--slate-500); /* secondary / meta */
  --fg-4:          var(--slate-400); /* disabled / caption */
  --fg-on-accent:  #FFFFFF;
  --fg-on-inverse: #F7F9FC;

  /* Borders */
  --border:        var(--slate-200);
  --border-strong: var(--slate-300);
  --border-subtle: var(--slate-100);

  /* Accent */
  --accent:        var(--blue-500);
  --accent-hover:  var(--blue-600);
  --accent-pressed:var(--blue-700);
  --accent-soft:   var(--blue-50);
  --accent-soft-border: var(--blue-100);
  --accent-fg-on-soft:  var(--blue-700);

  /* Status */
  --ok:      var(--ok-500);
  --ok-soft: var(--ok-100);
  --ok-fg:   var(--ok-700);
  --warn:    var(--warn-500);
  --warn-soft: var(--warn-100);
  --warn-fg: var(--warn-700);
  --danger:  var(--danger-500);
  --danger-soft: var(--danger-100);
  --danger-fg: var(--danger-700);
  --info:    var(--info-500);
  --info-soft: var(--info-100);
  --info-fg: var(--info-700);

  /* ========================================================================
     TYPOGRAPHY
     ======================================================================== */

  /* Families */
  --font-display: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --font-sans:    'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Scale (px — line-height in /, letter-spacing in ()) */
  --fs-display: 72px;   /* /1.05  (-0.02em)   Source Serif 4 400 */
  --fs-h1:      48px;   /* /1.1   (-0.015em)  Source Serif 4 400 */
  --fs-h2:      32px;   /* /1.2   (-0.01em)   Source Serif 4 400 */
  --fs-h3:      24px;   /* /1.3   (-0.01em)   Inter 600           */
  --fs-h4:      18px;   /* /1.4               Inter 600           */
  --fs-lead:    18px;   /* /1.55              Inter 400           */
  --fs-body:    14px;   /* /1.6               Inter 400           */
  --fs-small:   13px;   /* /1.5               Inter 400           */
  --fs-caption: 12px;   /* /1.45              Inter 500           */
  --fs-micro:   11px;   /* /1.4   (+0.14em)   Inter 600 uppercase */
  --fs-mono:    13px;   /* /1.4               JetBrains Mono 500  */

  /* Weights */
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  /* Tracking */
  --tr-display: -0.02em;
  --tr-tight:   -0.01em;
  --tr-snug:    -0.005em;
  --tr-normal:  0;
  --tr-wide:    0.04em;
  --tr-caps:    0.14em;

  /* ========================================================================
     SPACING — 4px base
     ======================================================================== */
  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* ========================================================================
     RADII
     ======================================================================== */
  --radius-xs:  4px;    /* chips, badges */
  --radius-sm:  6px;    /* inputs, small buttons */
  --radius-md:  8px;    /* buttons */
  --radius-lg:  12px;   /* cards */
  --radius-xl:  16px;   /* hero cards, modals */
  --radius-2xl: 24px;   /* marketing sections */
  --radius-mark:40px;   /* logo mark container ONLY */
  --radius-pill: 999px;

  /* ========================================================================
     SHADOWS — restrained. Dark mode uses stronger shadows (see below).
     ======================================================================== */
  --shadow-xs: 0 1px 2px rgba(10, 22, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.08), 0 1px 2px rgba(10, 22, 40, 0.04);
  --shadow-md: 0 4px 12px rgba(10, 22, 40, 0.10), 0 2px 4px rgba(10, 22, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(10, 22, 40, 0.14), 0 4px 8px rgba(10, 22, 40, 0.06);
  --shadow-xl: 0 24px 64px rgba(10, 22, 40, 0.18);
  --shadow-focus: 0 0 0 3px rgba(13, 110, 253, 0.30);
  --shadow-focus-on-dark: 0 0 0 3px rgba(110, 168, 254, 0.45);

  /* ========================================================================
     MOTION
     ======================================================================== */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-linear: linear;
  --dur-fast:    120ms;
  --dur-base:    180ms;
  --dur-slow:    280ms;
  --dur-pulse:   1600ms;  /* node-pulse loading */

  /* ========================================================================
     LAYOUT
     ======================================================================== */
  --container-sm:  640px;
  --container-md:  960px;
  --container-lg:  1200px;
  --container-xl:  1440px;

  --nav-h:         64px;
  --sidebar-w:     264px;

  color-scheme: light;
}

/* =========================================================================
   DARK MODE — full parity. All semantic tokens flip.
   ========================================================================= */
[data-theme="dark"] {
  --bg:            var(--navy-950);
  --bg-subtle:     var(--navy-900);
  --bg-muted:      var(--navy-800);
  --bg-inverse:    #FFFFFF;
  --bg-raised:     var(--navy-800);

  --fg-1:          #F7F9FC;
  --fg-2:          #C8D2DF;
  --fg-3:          #93A2B6;
  --fg-4:          #64748B;
  --fg-on-accent:  #FFFFFF;
  --fg-on-inverse: var(--navy-900);

  --border:        var(--navy-700);
  --border-strong: var(--navy-600);
  --border-subtle: #112038;

  --accent:        var(--blue-400);
  --accent-hover:  var(--blue-300);
  --accent-pressed:var(--blue-500);
  --accent-soft:   rgba(13, 110, 253, 0.14);
  --accent-soft-border: rgba(61, 139, 253, 0.30);
  --accent-fg-on-soft: var(--blue-300);

  --ok-soft:     rgba(16, 185, 129, 0.15);
  --ok-fg:       #6EE7B7;
  --warn-soft:   rgba(245, 158, 11, 0.15);
  --warn-fg:     #FCD34D;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --danger-fg:   #FCA5A5;
  --info-soft:   rgba(14, 165, 233, 0.15);
  --info-fg:     #7DD3FC;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.55), 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.7);
  --shadow-focus: var(--shadow-focus-on-dark);

  color-scheme: dark;
}

/* =========================================================================
   BASE STYLES
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--fg-2);
  background: var(--bg);
  font-feature-settings: 'cv02', 'cv11', 'ss01';
}

::selection { background: var(--blue-200); color: var(--navy-900); }
[data-theme="dark"] ::selection { background: rgba(110, 168, 254, 0.35); color: #F7F9FC; }

/* =========================================================================
   TYPE UTILITIES — apply via class
   ========================================================================= */
.t-display {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  font-size: var(--fs-display);
  line-height: 1.05;
  letter-spacing: var(--tr-display);
  color: var(--fg-1);
  text-wrap: balance;
}
.t-h1 {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  font-size: var(--fs-h1);
  line-height: 1.1;
  letter-spacing: var(--tr-tight);
  color: var(--fg-1);
  text-wrap: balance;
}
.t-h2 {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  font-size: var(--fs-h2);
  line-height: 1.2;
  letter-spacing: var(--tr-tight);
  color: var(--fg-1);
  text-wrap: balance;
}
.t-h3 {
  font-family: var(--font-sans);
  font-weight: var(--fw-semi);
  font-size: var(--fs-h3);
  line-height: 1.3;
  letter-spacing: var(--tr-snug);
  color: var(--fg-1);
}
.t-h4 {
  font-family: var(--font-sans);
  font-weight: var(--fw-semi);
  font-size: var(--fs-h4);
  line-height: 1.4;
  color: var(--fg-1);
}
.t-lead {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--fg-2);
  text-wrap: pretty;
}
.t-body  { font-size: var(--fs-body);  line-height: 1.6;  color: var(--fg-2); }
.t-small { font-size: var(--fs-small); line-height: 1.5;  color: var(--fg-2); }
.t-caption {
  font-size: var(--fs-caption);
  line-height: 1.45;
  color: var(--fg-3);
}
.t-eyebrow {
  font-family: var(--font-sans);
  font-weight: var(--fw-semi);
  font-size: var(--fs-micro);
  line-height: 1.4;
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--accent);
}
.t-eyebrow--muted { color: var(--fg-3); }
.t-mono {
  font-family: var(--font-mono);
  font-weight: var(--fw-medium);
  font-size: var(--fs-mono);
  line-height: 1.4;
  color: var(--fg-1);
  font-variant-ligatures: none;
}
.t-mono--accent { color: var(--accent); }
.t-mono--muted  { color: var(--fg-3); }

.t-italic { font-style: italic; }

/* Display italic gets special treatment — this is the signature editorial note */
.t-display--italic, .t-h1--italic, .t-h2--italic {
  font-style: italic;
  letter-spacing: -0.015em;
}

/* =========================================================================
   NODE MARK — the brand device
   Use as an inline typographic element or a standalone mark.
   ========================================================================= */
.node-mark {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  background: var(--gradient-brand);
  border-radius: 50%;
  vertical-align: 0.12em;
  margin: 0 0.35em;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.12);
}
.node-mark--sm { width: 0.4em; height: 0.4em; }
.node-mark--lg { width: 0.7em; height: 0.7em; }

/* =========================================================================
   REQUIREMENT ID CHIP — mono, tight, top-right of any traceable card
   ========================================================================= */
.req-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--fw-medium);
  color: var(--accent);
  letter-spacing: 0.02em;
  padding: 3px 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-xs);
}

/* =========================================================================
   UTILITIES
   ========================================================================= */
.container { max-width: var(--container-lg); margin: 0 auto; padding: 0 var(--space-6); }
.container--sm { max-width: var(--container-sm); }
.container--md { max-width: var(--container-md); }
.container--xl { max-width: var(--container-xl); }

.divider { height: 1px; background: var(--border); border: 0; }
.divider-node {
  display: flex; align-items: center; gap: 16px;
  color: var(--border-strong);
}
.divider-node::before, .divider-node::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.divider-node__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gradient-brand);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
