@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700;800&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ============================================================
   TYPEFORGE — GLOBAL DESIGN SYSTEM
   Graphite × Technical Precision
   ============================================================ */

:root {
  /* ── Backgrounds ── */
  --bg-base:        #09090b;
  --bg-surface:     #121215;
  --bg-elevated:    #1c1c21;
  --bg-card:        #121215;
  --bg-card-hover:  #18181b;

  /* ── Primary Brand: Precision Steel Blue ── */
  --brand:          #3b5c8f;
  --brand-light:    #60a5fa;
  --brand-dark:     #2563eb;
  --brand-glow:     rgba(96, 165, 250, 0.08);
  --brand-glow-sm:  rgba(96, 165, 250, 0.04);

  /* ── Secondary: Muted Slate ── */
  --teal:           #27272a;
  --teal-light:     #3f3f46;
  --teal-dark:      #18181b;
  --teal-glow:      rgba(255, 255, 255, 0.02);
  --teal-glow-sm:   rgba(255, 255, 255, 0.01);

  /* ── Accent: Warm Terracotta Action ── */
  --peach:          #c2583b;
  --peach-glow:     rgba(194, 88, 59, 0.12);

  /* ── Supporting Colors ── */
  --coral:          #ef4444;
  --coral-glow:     rgba(239, 68, 68, 0.05);
  --mint:           #10b981;
  --mint-glow:      rgba(16, 185, 129, 0.05);
  --gold:           #f59e0b;
  --gold-glow:      rgba(245, 158, 11, 0.05);
  --amber:          #d97706;
  --sky:            #38bdf8;
  --sky-glow:       rgba(56, 189, 248, 0.05);
  --accent:         #6366f1;
  --accent-glow:    rgba(99, 102, 241, 0.05);
  --violet:         #4f46e5;

  /* ── Semantic Colors ── */
  --success:        #10b981;
  --success-bg:     rgba(16, 185, 129, 0.08);
  --warning:        #f59e0b;
  --warning-bg:     rgba(245, 158, 11, 0.08);
  --error:          #ef4444;
  --error-bg:       rgba(239, 68, 68, 0.08);
  --info:           #3b82f6;
  --info-bg:        rgba(59, 130, 246, 0.08);

  /* ── Text ── */
  --text-1:  #f4f4f5;
  --text-2:  #a1a1aa;
  --text-3:  #5c5c63;
  --text-4:  #3f3f46;

  /* ── Borders ── */
  --border-1: rgba(255, 255, 255, 0.06);
  --border-2: rgba(255, 255, 255, 0.12);
  --border-3: rgba(255, 255, 255, 0.2);
  --border-brand: rgba(255, 255, 255, 0.1);
  --border-teal: rgba(255, 255, 255, 0.08);

  /* ── Glassmorphism ── */
  --glass-bg:        #121215;
  --glass-bg-light:  #18181b;
  --glass-border:    #27272a;
  --glass-blur:      none;
  --glass-blur-sm:   none;

  /* ── Typography ── */
  --font-display: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', 'JetBrains Mono', monospace;

  /* ── Font Sizes ── */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  clamp(2.25rem, 4vw + 1rem, 3rem);
  --text-6xl:  clamp(2.75rem, 5vw + 1rem, 3.75rem);
  --text-7xl:  clamp(3.25rem, 6vw + 1rem, 4.5rem);
  --text-8xl:  clamp(4rem, 8vw + 1rem, 6rem);

  /* ── Line Heights ── */
  --leading-tight:  1.2;
  --leading-snug:   1.35;
  --leading-normal: 1.5;
  --leading-loose:  1.8;

  /* ── Letter Spacing ── */
  --tracking-tight:  -0.02em;
  --tracking-snug:   -0.01em;
  --tracking-normal: 0em;
  --tracking-wide:   0.03em;
  --tracking-wider:  0.06em;

  /* ── Spacing ── */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;
  --sp-32: 128px;

  /* ── Border Radius ── */
  --r-sm:   4px;
  --r-md:   6px;
  --r-lg:   8px;
  --r-xl:   8px;
  --r-2xl:  8px;
  --r-3xl:  8px;
  --r-4xl:  8px;
  --r-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm:       none;
  --shadow-md:       none;
  --shadow-lg:       none;
  --shadow-xl:       none;
  --shadow-brand:    none;
  --shadow-brand-lg: none;
  --shadow-teal:     none;
  --shadow-teal-lg:  none;

  /* ── Transitions ── */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:     cubic-bezier(0.7, 0, 0.84, 0);
  --ease-inout:  cubic-bezier(0.83, 0, 0.17, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.68, -0.6, 0.32, 1.6);
  --ease-expo:   cubic-bezier(0.19, 1, 0.22, 1);

  --duration-fast:    100ms;
  --duration-base:    150ms;
  --duration-slow:    250ms;
  --duration-slower:  350ms;
  --duration-slowest: 600ms;

  /* ── Z-Index Scale ── */
  --z-0:        0;
  --z-10:       10;
  --z-20:       20;
  --z-30:       30;
  --z-overlay:  100;
  --z-modal:    200;
  --z-toast:    300;
  --z-nav:      400;
  --z-a11y:     500;

  /* ── Layout ── */
  --container-sm:   640px;
  --container-md:   768px;
  --container-lg:   1024px;
  --container-xl:   1280px;
  --container-2xl:  1440px;

  /* ── Accessibility overrides (set via JS) ── */
  --a11y-font-scale: 1;
  --a11y-focus-ring-color: var(--brand-light);
}

/* ── Accessibility: High Contrast ── */
html.a11y-high-contrast {
  --text-1: #ffffff;
  --text-2: #e0e0e0;
  --bg-base: #000000;
  --bg-surface: #0a0a0a;
  --border-2: rgba(255,255,255,0.3);
}

/* ── Accessibility: Dyslexia Font ── */
html.a11y-dyslexia {
  --font-body: 'OpenDyslexic', 'Comic Sans MS', sans-serif;
  --font-display: 'OpenDyslexic', 'Comic Sans MS', sans-serif;
}

/* ── Accessibility: Reduce Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* ── CSS Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: calc(16px * var(--a11y-font-scale));
  scroll-padding-top: 100px;
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-1);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  word-break: break-word;
  overflow-wrap: break-word;
}

.page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Sticky footer: no void below footer when main is stretched */
.page-content > footer.footer,
.page-content > .footer {
  margin-top: auto;
  flex-shrink: 0;
}

img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
p { line-height: var(--leading-loose); }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
  color: var(--text-1);
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: var(--r-sm);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Text Selection ── */
::selection {
  background: var(--brand-glow);
  color: var(--text-1);
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--a11y-focus-ring-color, var(--brand-light));
  outline-offset: 3px;
  border-radius: 4px;
}

html.a11y-no-focus :focus-visible { outline: none; }
html.a11y-fat-focus :focus-visible { outline-width: 4px; outline-offset: 5px; }

/* ── Container ── */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--sp-6);
}
.container-sm  { max-width: var(--container-sm);  }
.container-md  { max-width: var(--container-md);  }
.container-lg  { max-width: var(--container-lg);  }
.container-2xl { max-width: var(--container-2xl); }

/* ── Typography Utilities ── */
.font-display { font-family: var(--font-display); }
.font-mono    { font-family: var(--font-mono); }
.text-xs   { font-size: var(--text-xs);   }
.text-sm   { font-size: var(--text-sm);   }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg);   }
.text-xl   { font-size: var(--text-xl);   }
.text-2xl  { font-size: var(--text-2xl);  }
.text-3xl  { font-size: var(--text-3xl);  }
.text-4xl  { font-size: var(--text-4xl);  }
.text-5xl  { font-size: var(--text-5xl);  }
.font-300 { font-weight: 300; }
.font-400 { font-weight: 400; }
.font-500 { font-weight: 500; }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }
.font-800 { font-weight: 800; }
.font-900 { font-weight: 900; }
.tracking-tight  { letter-spacing: var(--tracking-tight); }
.tracking-wide   { letter-spacing: var(--tracking-wide); }
.tracking-wider  { letter-spacing: var(--tracking-wider); }
.text-1 { color: var(--text-1); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-4 { color: var(--text-4); }
.text-brand  { color: var(--brand); }
.text-teal   { color: var(--teal); }
.text-coral  { color: var(--coral); }
.text-mint   { color: var(--mint); }
.text-gold   { color: var(--gold); }
.text-sky    { color: var(--sky); }
.text-peach  { color: var(--peach); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ── Refactored Text Styles (No Gradients) ── */
.gradient-text,
.gradient-text-warm,
.gradient-text-teal,
.gradient-text-mint {
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: initial !important;
}
.gradient-text {
  color: var(--text-1);
}
.gradient-text-warm {
  color: var(--peach);
}
.gradient-text-teal {
  color: var(--brand-light);
}
.gradient-text-mint {
  color: var(--mint);
}

/* ── Layout Utilities ── */
.flex         { display: flex; }
.inline-flex  { display: inline-flex; }
.grid         { display: grid; }
.block        { display: block; }
.hidden       { display: none !important; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.items-start  { align-items: flex-start; }
.items-center { align-items: center; }
.items-end    { align-items: flex-end; }
.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.flex-1   { flex: 1; }
.flex-none { flex: none; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* ── Glass ── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  transition:
    background var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}
.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-2);
  box-shadow: none;
}

/* ── Glow Utilities (Flattened) ── */
.glow-brand { border-color: var(--border-2); }
.glow-teal  { border-color: var(--border-2); }

/* ── Sections ── */
section { position: relative; }
.section-pad    { padding-block: var(--sp-16); }
.section-pad-sm { padding-block: var(--sp-8); }

/* ── Dividers ── */
.divider {
  height: 1px;
  background: var(--border-1);
  width: 100%;
}

/* ── Overflow ── */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* ── Position ── */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }
.inset-0  { inset: 0; }

/* ── Width/Height ── */
.w-full   { width: 100%; }
.h-full   { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ── Rounded ── */
.rounded-sm   { border-radius: var(--r-sm); }
.rounded-md   { border-radius: var(--r-md); }
.rounded-lg   { border-radius: var(--r-lg); }
.rounded-xl   { border-radius: var(--r-xl); }
.rounded-2xl  { border-radius: var(--r-2xl); }
.rounded-full { border-radius: var(--r-full); }

/* ── Misc ── */
.pointer    { cursor: pointer; }
.select-none { user-select: none; }
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.z-nav     { z-index: var(--z-nav); }
.z-modal   { z-index: var(--z-modal); }
.z-overlay { z-index: var(--z-overlay); }
.z-toast   { z-index: var(--z-toast); }
.z-a11y    { z-index: var(--z-a11y); }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root {
    --text-5xl: 2.5rem;
    --text-6xl: 3rem;
    --text-7xl: 3.5rem;
    --text-8xl: 4rem;
  }
  .container { padding-inline: var(--sp-4); }
  .section-pad { padding-block: var(--sp-8); }
  .md\:hidden { display: none !important; }
  .md\:flex-col { flex-direction: column !important; }
}
@media (min-width: 769px) {
  .sm\:hidden { display: none !important; }
}
