/* ═══════════════════════════════════════════════════════════════
   COINBRIDGE DESIGN SYSTEM & GLOBAL ROOT
   Engineered for maximum rendering performance and UI consistency.
═══════════════════════════════════════════════════════════════ */

:root {
  /* ── 1. CORE COLOR PALETTE ── */
  --white:          #ffffff;
  --black:          #000000;
  --transparent:    transparent;

  /* Background Depths */
  --bg-base:        #f8fafc; /* Main page background */
  --bg-surface:     #ffffff; /* Card background */
  --bg-raised:      #f1f5f9; /* Hover states & slight elevations */
  --bg-sunken:      #e2e8f0; /* Deep inset backgrounds */

  /* Ink / Typography (Premium Slate) */
  --ink-display:    #020617; /* Massive H1s - Maximum contrast */
  --ink-primary:    #0f172a; /* Standard text & H2-H6 */
  --ink-secondary:  #475569; /* Subtitles & lead paragraphs */
  --ink-tertiary:   #64748b; /* Meta data & timestamps */
  --ink-quaternary: #94a3b8; /* Disabled text & placeholders */

  /* ── 2. BRAND ACCENTS (CoinBridge Blue) ── */
  --cb-blue-50:     #eff6ff; /* Soft backgrounds, tags */
  --cb-blue-100:    #dbeafe; /* Subtle highlights */
  --cb-blue-200:    #bfdbfe; /* Borders & dividers */
  --cb-blue-300:    #93c5fd; /* Soft interactive elements */
  --cb-blue-400:    #60a5fa; /* Hover states */
  --cb-blue-500:    #3b82f6; /* Primary brand identity */
  --cb-blue-600:    #2563eb; /* Primary buttons & active states */
  --cb-blue-700:    #1d4ed8; /* Deep hover states */
  --cb-blue-800:    #1e40af; /* High contrast brand accents */
  --cb-blue-900:    #1e3a8a; /* Nav headers */
  --cb-blue-950:    #172554; /* Dark mode base equivalents */

  /* ── 3. SEMANTIC COLORS (Trading & System) ── */
  /* Buy / Success / Growth */
  --trade-buy-soft: #dcfce7;
  --trade-buy-mid:  #4ade80;
  --trade-buy-hard: #16a34a;
  
  /* Sell / Error / Decline */
  --trade-sell-soft:#fee2e2;
  --trade-sell-mid: #f87171;
  --trade-sell-hard:#dc2626;

  /* Warning / Pending */
  --sys-warn-soft:  #fef3c7;
  --sys-warn-hard:  #d97706;

  /* ── 4. SPACING SYSTEM (8pt Grid) ── */
  --space-1:   0.25rem;  /* 4px */
  --space-2:   0.5rem;   /* 8px */
  --space-3:   0.75rem;  /* 12px */
  --space-4:   1rem;     /* 16px */
  --space-5:   1.25rem;  /* 20px */
  --space-6:   1.5rem;   /* 24px */
  --space-8:   2rem;     /* 32px */
  --space-10:  2.5rem;   /* 40px */
  --space-12:  3rem;     /* 48px */
  --space-16:  4rem;     /* 64px */
  --space-20:  5rem;     /* 80px */
  --space-24:  6rem;     /* 96px */
  --space-32:  8rem;     /* 128px */
  --space-40:  10rem;    /* 160px */

  /* ── 5. TYPOGRAPHY SCALES (Fluid & Static) ── */
  /* Font Families */
  --font-sans: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Font Sizes */
  --text-xs:   0.75rem;  /* 12px */
  --text-sm:   0.875rem; /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg:   1.125rem; /* 18px */
  --text-xl:   1.25rem;  /* 20px */
  --text-2xl:  1.5rem;   /* 24px */
  --text-3xl:  1.875rem; /* 30px */
  --text-4xl:  2.25rem;  /* 36px */
  --text-5xl:  3rem;     /* 48px */
  
  /* Fluid Display Sizes (Scales with viewport) */
  --text-display-1: clamp(3.5rem, 7vw, 6.5rem);
  --text-display-2: clamp(2.5rem, 5vw, 4.5rem);

  /* Letter Spacing (Tracking) */
  --track-tightest:-0.05em;
  --track-tighter: -0.03em;
  --track-tight:   -0.01em;
  --track-normal:  0em;
  --track-wide:    0.02em;
  --track-wider:   0.05em;
  --track-widest:  0.1em;

  /* Line Heights */
  --lead-none:   1;
  --lead-tight:  1.1;
  --lead-snug:   1.25;
  --lead-normal: 1.5;
  --lead-relaxed:1.625;
  --lead-loose:  2;

  /* ── 6. ELEVATION & SHADOWS ── */
  --shadow-sm:    0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md:    0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg:    0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-xl:    0 20px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --shadow-2xl:   0 25px 50px -12px rgba(15, 23, 42, 0.15);
  --shadow-inner: inset 0 2px 4px 0 rgba(15, 23, 42, 0.03);
  
  /* Brand Glows */
  --glow-blue:    0 0 24px -4px rgba(37, 99, 235, 0.4);
  --glow-green:   0 0 24px -4px rgba(22, 163, 74, 0.4);

  /* ── 7. BORDER RADII ── */
  --rad-none: 0px;
  --rad-sm:   0.25rem;  /* 4px */
  --rad-md:   0.375rem; /* 6px */
  --rad-lg:   0.5rem;   /* 8px */
  --rad-xl:   0.75rem;  /* 12px */
  --rad-2xl:  1rem;     /* 16px */
  --rad-3xl:  1.5rem;   /* 24px */
  --rad-full: 9999px;   /* Pills & Circles */

  /* ── 8. Z-INDEX SYSTEM ── */
  --z-hide:      -1;
  --z-base:       0;
  --z-elevated:   10;
  --z-dropdown:   50;
  --z-sticky:     100;
  --z-overlay:    500;
  --z-modal:      1000;
  --z-toast:      1500;

  /* ── 9. TRANSITIONS & EASING ── */
  --ease-linear:  linear;
  --ease-in:      cubic-bezier(0.4, 0, 1, 1);
  --ease-out:     cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:  cubic-bezier(0.22, 1, 0.36, 1); /* Apple-style spring */
  
  --dur-fast:     150ms;
  --dur-base:     300ms;
  --dur-slow:     500ms;
  --dur-reveal:   800ms;
}

/* ═══════════════════════════════════════════════════════════════
   MODERN CSS RESET
   Destroys browser inconsistencies & prepares the DOM.
═══════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  line-height: var(--lead-normal);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background-color: var(--white);
  color: var(--ink-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Media defaults */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Form element resets */
input, button, textarea, select {
  font: inherit;
  color: inherit;
  border: none;
  background: transparent;
  outline: none;
}

button {
  cursor: pointer;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* Selection State */
::selection {
  background-color: var(--cb-blue-200);
  color: var(--cb-blue-900);
}

/* Scrollbar Styling for Webkit */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--ink-300);
  border-radius: var(--rad-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-400);
}

/* ═══════════════════════════════════════════════════════════════
   GLOBAL TYPOGRAPHY UTILITIES
═══════════════════════════════════════════════════════════════ */
.text-display {
  font-size: var(--text-display-1);
  font-weight: 900;
  letter-spacing: var(--track-tightest);
  line-height: var(--lead-none);
}

.text-h2 {
  font-size: var(--text-display-2);
  font-weight: 800;
  letter-spacing: var(--track-tighter);
  line-height: var(--lead-tight);
}

.text-body-lead {
  font-size: var(--text-xl);
  font-weight: 300;
  letter-spacing: var(--track-tight);
  line-height: var(--lead-relaxed);
  color: var(--ink-secondary);
}

.text-mono {
  font-family: var(--font-mono);
  letter-spacing: var(--track-normal);
}

/* Utility Colors */
.text-brand    { color: var(--cb-blue-600); }
.text-success  { color: var(--trade-buy-hard); }
.text-error    { color: var(--trade-sell-hard); }
.text-muted    { color: var(--ink-tertiary); }