/* =========================================================
   Prism AI — Foundations
   Colors + Typography tokens for all surfaces.
   Import this file wherever you design.
   ========================================================= */

/* ---------- Fonts ---------- */
/* Inter for UI, JetBrains Mono for code/technical fields.
   Loaded from Google Fonts CDN; ship self-hosted copies in fonts/
   for offline/production use. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ---------- Brand color ---------- */
  /* The single accent. Used sparingly — primary buttons, focus rings, links,
     active states, selection, the Prism mark itself. Never as a large fill. */
  --blue-50:  #EFF4FF;
  --blue-100: #DBE6FF;
  --blue-200: #B8CEFF;
  --blue-300: #8FB0FF;
  --blue-400: #5E8DFF;
  --blue-500: #3F77FF;
  --blue-600: #2F6BFF;  /* ← canonical brand accent */
  --blue-700: #2457D6;
  --blue-800: #1D47AE;
  --blue-900: #163985;

  /* ---------- Neutrals (light mode) ---------- */
  --white:      #FFFFFF;
  --neutral-25:  #FCFCFC;
  --neutral-50:  #F7F7F8;
  --neutral-100: #F1F1F2;
  --neutral-200: #E5E7EB;   /* canonical hairline border (light) */
  --neutral-300: #D4D4D8;
  --neutral-400: #A1A1AA;
  --neutral-500: #71717A;
  --neutral-600: #52525B;
  --neutral-700: #3F3F46;
  --neutral-800: #27272A;
  --neutral-900: #18181B;
  --neutral-950: #0D0D0D;   /* canonical dark-mode background */
  --black:      #000000;

  /* ---------- Semantic (functional) ---------- */
  --green-500:  #16A34A;   /* success */
  --amber-500:  #F59E0B;   /* warning */
  --red-500:    #EF4444;   /* error/destructive */

  /* ---------- Go Pro gradient ----------
     The ONLY place gradients are allowed on UI chrome.
     Used for the "Go Pro" CTA button and paywall headings. */
  --pro-gradient: linear-gradient(135deg, #2F6BFF 0%, #7C3AED 60%, #EC4899 100%);

  /* =========================================================
     Semantic tokens — LIGHT mode (default)
     Use these in components, not raw palette colors.
     ========================================================= */
  --bg:          var(--white);         /* page background */
  --bg-subtle:   var(--neutral-50);    /* rails, sidebar, code blocks */
  --bg-muted:    var(--neutral-100);   /* hover fills, chip bg */
  --bg-inverse:  var(--neutral-950);

  --surface:           var(--white);   /* cards, modals, popovers */
  --surface-raised:    var(--white);   /* modal on top of backdrop */
  --surface-overlay:   rgba(13,13,13,.45); /* modal backdrop */

  --fg:          var(--neutral-900);   /* primary text */
  --fg-muted:    var(--neutral-600);   /* secondary text */
  --fg-subtle:   var(--neutral-500);   /* meta, timestamps */
  --fg-disabled: var(--neutral-400);
  --fg-inverse:  var(--white);
  --fg-onAccent: var(--white);

  --border:          var(--neutral-200);   /* hairline 1px */
  --border-strong:   var(--neutral-300);
  --border-focus:    var(--blue-600);

  --accent:          var(--blue-600);
  --accent-hover:    var(--blue-700);
  --accent-pressed:  var(--blue-800);
  --accent-subtle:   var(--blue-50);        /* max allowed colored fill */
  --accent-fg:       var(--white);

  --success: var(--green-500);
  --warning: var(--amber-500);
  --danger:  var(--red-500);

  /* Shadows — keep minimal. Popovers + modals only. */
  --shadow-sm: 0 1px 2px rgba(13,13,13,.04);
  --shadow-md: 0 2px 8px rgba(13,13,13,.06), 0 1px 2px rgba(13,13,13,.04);
  --shadow-lg: 0 12px 32px rgba(13,13,13,.10), 0 2px 8px rgba(13,13,13,.06);

  /* Radii */
  --radius-sm:   6px;                  /* small chrome */
  --radius-md:   8px;                  /* menu / tooltip (rounded-lg) */
  --radius-lg:  12px;                  /* card */
  --radius-xl:  16px;                  /* rounded-2xl — inputs, large containers */
  --radius-full: 9999px;               /* pills, avatars, chips */

  /* Spacing scale (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;

  /* Sizing */
  --sidebar-collapsed: 52px;
  --sidebar-expanded:  260px;
  --composer-max:      768px;
  --dialog-sm:         28rem;   /* max-w-md  */
  --dialog-lg:         48rem;   /* max-w-3xl */

  /* Motion */
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-emphasis: cubic-bezier(.3, 0, 0, 1);
  --dur-fast:   120ms;
  --dur-base:   180ms;
  --dur-slow:   240ms;

  /* =========================================================
     Typography — raw
     ========================================================= */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'Menlo', monospace;

  --fs-xs:   12px;
  --fs-sm:   14px;   /* base UI */
  --fs-base: 16px;   /* chat body */
  --fs-lg:   18px;
  --fs-xl:   20px;
  --fs-2xl:  24px;   /* section titles */
  --fs-3xl:  30px;
  --fs-4xl:  36px;   /* page / hero titles */
  --fs-5xl:  48px;

  --fw-regular:  400;
  --fw-medium:   500;   /* buttons, chips */
  --fw-semibold: 600;   /* headings */
  --fw-bold:     700;   /* rare accents */

  --lh-tight:  1.2;
  --lh-snug:   1.35;
  --lh-normal: 1.5;     /* default density */
  --lh-loose:  1.7;

  --tracking-tight: -0.02em;
  --tracking-snug:  -0.01em;
  --tracking-wide:   0.02em;
}

/* =========================================================
   DARK mode tokens
   ========================================================= */
[data-theme="dark"] {
  --bg:          var(--neutral-950);
  --bg-subtle:   #141414;
  --bg-muted:    #1C1C1C;
  --bg-inverse:  var(--white);

  --surface:         #141414;
  --surface-raised:  #1A1A1A;
  --surface-overlay: rgba(0,0,0,.60);

  --fg:          #FAFAFA;
  --fg-muted:    #A1A1AA;
  --fg-subtle:   #71717A;
  --fg-disabled: #52525B;
  --fg-inverse:  var(--neutral-950);
  --fg-onAccent: var(--white);

  --border:        #262626;
  --border-strong: #333333;
  --border-focus:  var(--blue-500);

  --accent:         var(--blue-500);
  --accent-hover:   var(--blue-400);
  --accent-pressed: var(--blue-600);
  --accent-subtle:  rgba(47,107,255,.14);
  --accent-fg:      var(--white);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.40);
  --shadow-md: 0 2px 8px rgba(0,0,0,.50), 0 1px 2px rgba(0,0,0,.40);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.60), 0 2px 8px rgba(0,0,0,.50);
}

/* =========================================================
   Element-level semantic defaults
   Components can rely on these; override as needed.
   ========================================================= */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, .h1 {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg);
}
h2, .h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--fg);
}
h3, .h3 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--fg);
}
h4, .h4 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--fg);
}

.p, p {
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--fg);
}
.p-lg { font-size: var(--fs-base); line-height: var(--lh-normal); }
.p-sm { font-size: var(--fs-sm); color: var(--fg-muted); }
.meta { font-size: var(--fs-xs); color: var(--fg-subtle); }

code, kbd, samp, .code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--fg);
}
pre.code-block {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow-x: auto;
  line-height: var(--lh-normal);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-subtle); color: var(--fg); }
