/* ============================================================
   Aura Workshop — Design System v1.0
   ArchitectUX: CSS Variables, Typography, Spacing, Theme Tokens
   ============================================================ */

/* ----- Design Tokens (light theme — default) ----- */
:root {
  /* === Brand Colors === */
  --brand-cyan: #00e5cc;
  --brand-cyan-hover: #00c4af;
  --brand-cyan-light: #33ead6;
  --brand-cyan-dim: rgba(0, 229, 204, 0.08);
  --brand-cyan-glow: rgba(0, 229, 204, 0.15);

  --brand-violet: #7c5cfc;
  --brand-violet-hover: #6a4be8;
  --brand-violet-dim: rgba(124, 92, 252, 0.08);
  --brand-violet-glow: rgba(124, 92, 252, 0.15);

  --brand-amber: #f59e0b;
  --brand-amber-dim: rgba(245, 158, 11, 0.08);

  /* === Brand Gradients === */
  --gradient-brand: linear-gradient(135deg, #00e5cc 0%, #7c5cfc 100%);
  --gradient-brand-subtle: linear-gradient(135deg, rgba(0,229,204,0.06) 0%, rgba(124,92,252,0.04) 100%);
  --gradient-brand-glow: radial-gradient(circle at 50% 0%, rgba(0,229,204,0.12) 0%, transparent 60%);

  /* === Surface Colors (Light) === */
  --color-bg: #ffffff;
  --color-bg-elevated: #f8f9fb;
  --color-bg-card: #f1f3f7;
  --color-bg-surface: #e8ebf1;
  --color-bg-input: #ffffff;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-hover: rgba(0, 0, 0, 0.14);
  --color-border-accent: rgba(0, 229, 204, 0.4);
  --color-border-focus: rgba(0, 229, 204, 0.5);

  /* === Text Colors (Light) === */
  --color-text-primary: #1a1d2e;
  --color-text-secondary: #4a4f66;
  --color-text-muted: #7c8199;
  --color-text-dim: #a8adc4;
  --color-text-on-accent: #000000;

  /* === Semantic Colors === */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;

  /* === Typography Scale (16px base = 1rem) === */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', ui-monospace, monospace;

  --text-xs: 0.6875rem;    /* 11px */
  --text-sm: 0.8125rem;    /* 13px */
  --text-base: 0.9375rem;  /* 15px */
  --text-md: 1.0625rem;    /* 17px */
  --text-lg: 1.25rem;      /* 20px */
  --text-xl: 1.5rem;       /* 24px */
  --text-2xl: 1.875rem;    /* 30px */
  --text-3xl: 2.375rem;    /* 38px */
  --text-hero: 2.75rem;    /* 44px */

  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  --tracking-tight: -0.025em;
  --tracking-normal: -0.005em;
  --tracking-wide: 0.02em;
  --tracking-caps: 0.075em;

  /* === Spacing System (4px grid) === */
  --space-0: 0;
  --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 */

  /* === Border Radius === */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* === Shadows === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(0, 229, 204, 0.12);

  /* === Transitions === */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-smooth: 0.3s ease;
  --transition-slow: 0.4s ease;

  /* === Z-Index Scale === */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* === Container Widths === */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 780px;
  --container-xl: 960px;

  /* === Component Tokens === */
  --btn-height: 44px;
  --input-height: 44px;
  --icon-sm: 16px;
  --icon-md: 24px;
  --icon-lg: 32px;
}

/* ----- Dark Theme ----- */
[data-theme="dark"] {
  --color-bg: #0f1117;
  --color-bg-elevated: #161922;
  --color-bg-card: #1c1f2e;
  --color-bg-surface: #232738;
  --color-bg-input: #1c1f2e;
  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-hover: rgba(255, 255, 255, 0.12);
  --color-border-accent: rgba(0, 229, 204, 0.3);
  --color-border-focus: rgba(0, 229, 204, 0.4);

  --color-text-primary: #e4e6eb;
  --color-text-secondary: #b0b4c4;
  --color-text-muted: #8b8fa3;
  --color-text-dim: #5a5e72;
  --color-text-on-accent: #000000;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(0, 229, 204, 0.15);
}

/* ----- System Preference (when no explicit theme set) ----- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0f1117;
    --color-bg-elevated: #161922;
    --color-bg-card: #1c1f2e;
    --color-bg-surface: #232738;
    --color-bg-input: #1c1f2e;
    --color-border: rgba(255, 255, 255, 0.06);
    --color-border-hover: rgba(255, 255, 255, 0.12);
    --color-border-accent: rgba(0, 229, 204, 0.3);
    --color-border-focus: rgba(0, 229, 204, 0.4);

    --color-text-primary: #e4e6eb;
    --color-text-secondary: #b0b4c4;
    --color-text-muted: #8b8fa3;
    --color-text-dim: #5a5e72;
    --color-text-on-accent: #000000;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px rgba(0, 229, 204, 0.15);
  }
}

/* ============================================================
   Base Reset & Global Styles
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-smooth),
              color var(--transition-smooth);
}

/* Selection */
::selection {
  background: rgba(0, 229, 204, 0.2);
  color: var(--color-text-primary);
}

/* Focus visible — global ring */
:focus-visible {
  outline: 2px solid var(--brand-cyan);
  outline-offset: 2px;
}

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

/* ============================================================
   Typography Utility Classes
   ============================================================ */
.text-hero {
  font-size: var(--text-hero);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text-heading-1 {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text-heading-2 {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-normal);
}

.text-heading-3 {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-snug);
}

.text-body {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

.text-caption {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--color-text-muted);
}

.text-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.text-gradient-cyan {
  background: linear-gradient(135deg, var(--color-text-primary) 30%, var(--brand-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
