/* ==========================================================================
   Design System: Variables, Themes, Typography, and Core Tokens
   Parametric Frame Layout Generator
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Fonts */
  --font-sans: 'Prompt', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Prompt', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Fluid Typography Scale (Smoothly scales from 360px to 1600px viewport) */
  --font-size-2xs: clamp(0.68rem, 0.66rem + 0.10vw, 0.75rem);   /* 10.8px - 12px */
  --font-size-xs:  clamp(0.75rem, 0.73rem + 0.10vw, 0.82rem);   /* 12px - 13.1px */
  --font-size-sm:  clamp(0.82rem, 0.79rem + 0.12vw, 0.90rem);   /* 13.1px - 14.4px */
  --font-size-base: clamp(0.88rem, 0.84rem + 0.18vw, 1.00rem);  /* 14px - 16px */
  --font-size-md:  clamp(1.00rem, 0.95rem + 0.22vw, 1.15rem);   /* 16px - 18.4px */
  --font-size-lg:  clamp(1.15rem, 1.09rem + 0.29vw, 1.35rem);   /* 18.4px - 21.6px */
  --font-size-xl:  clamp(1.30rem, 1.17rem + 0.58vw, 1.75rem);   /* 20.8px - 28px */
  --font-size-2xl: clamp(1.60rem, 1.41rem + 0.84vw, 2.25rem);   /* 25.6px - 36px */
  --font-size-3xl: clamp(2.00rem, 1.71rem + 1.29vw, 3.00rem);   /* 32px - 48px */

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Fluid Spacing & Gap Tokens */
  --space-2xs: clamp(2px, 0.2vw + 1px, 4px);
  --space-xs:  clamp(4px, 0.3vw + 3px, 8px);
  --space-sm:  clamp(8px, 0.5vw + 6px, 12px);
  --space-md:  clamp(12px, 0.8vw + 9px, 16px);
  --space-lg:  clamp(16px, 1.2vw + 12px, 24px);
  --space-xl:  clamp(24px, 1.8vw + 18px, 32px);

  /* Sizing & Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.3);
  --shadow-glow-cyan: 0 0 24px rgba(6, 182, 212, 0.35);
  --shadow-glow-amber: 0 0 24px rgba(245, 158, 11, 0.35);
  --shadow-glow-blue: 0 0 30px rgba(59, 130, 246, 0.4);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------------------------------------------------------
   Theme 1: Blueprint CAD Theme (Default)
   --------------------------------------------------------- */
[data-theme="blueprint"] {
  --bg-app: #071326;
  --bg-card: rgba(13, 29, 53, 0.78);
  --bg-card-hover: rgba(19, 41, 74, 0.85);
  --bg-card-active: rgba(28, 57, 100, 0.95);
  --bg-canvas: #09172e;
  --bg-input: #08162b;
  --bg-input-focus: #0c1e38;

  --border-subtle: rgba(56, 189, 248, 0.12);
  --border-card: rgba(56, 189, 248, 0.22);
  --border-focus: #38bdf8;
  --border-highlight: #00f2fe;

  --text-primary: #f0f9ff;
  --text-secondary: #93c5fd;
  --text-muted: #60a5fa;
  --text-dim: #3b82f6;

  --accent-primary: #38bdf8;
  --accent-primary-hover: #0ea5e9;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
  --accent-glow: rgba(56, 189, 248, 0.4);

  --wood-color: #d97706;
  --wood-color-light: #fbbf24;
  --steel-color: #38bdf8;
  --steel-color-angle: #818cf8;

  --dim-line-color: #38bdf8;
  --dim-text-color: #f0f9ff;
  --dim-clear-color: #34d399;
  --dim-oc-color: #fbbf24;

  --grid-line: rgba(56, 189, 248, 0.07);
  --grid-major: rgba(56, 189, 248, 0.15);

  --badge-bg: rgba(56, 189, 248, 0.15);
  --badge-text: #7dd3fc;
  --badge-border: rgba(56, 189, 248, 0.3);

  --summary-bg: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(37, 99, 235, 0.2));
  --summary-border: rgba(56, 189, 248, 0.35);
}

/* ---------------------------------------------------------
   Theme 2: Modern Dark Slate Theme
   --------------------------------------------------------- */
[data-theme="dark"] {
  --bg-app: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.75);
  --bg-card-hover: rgba(51, 65, 85, 0.85);
  --bg-card-active: rgba(71, 85, 105, 0.95);
  --bg-canvas: #0b1120;
  --bg-input: #1e293b;
  --bg-input-focus: #334155;

  --border-subtle: rgba(148, 163, 184, 0.1);
  --border-card: rgba(148, 163, 184, 0.2);
  --border-focus: #f59e0b;
  --border-highlight: #fbbf24;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #f59e0b;
  --accent-primary-hover: #d97706;
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --accent-glow: rgba(245, 158, 11, 0.4);

  --wood-color: #f59e0b;
  --wood-color-light: #fcd34d;
  --steel-color: #94a3b8;
  --steel-color-angle: #a78bfa;

  --dim-line-color: #f59e0b;
  --dim-text-color: #f8fafc;
  --dim-clear-color: #10b981;
  --dim-oc-color: #38bdf8;

  --grid-line: rgba(255, 255, 255, 0.04);
  --grid-major: rgba(255, 255, 255, 0.09);

  --badge-bg: rgba(245, 158, 11, 0.15);
  --badge-text: #fbbf24;
  --badge-border: rgba(245, 158, 11, 0.3);

  --summary-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(234, 88, 12, 0.18));
  --summary-border: rgba(245, 158, 11, 0.35);
}

/* ---------------------------------------------------------
   Theme 3: Clean Studio Light Theme
   --------------------------------------------------------- */
[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --bg-card-active: #f8fafc;
  --bg-canvas: #f8fafc;
  --bg-input: #f1f5f9;
  --bg-input-focus: #e2e8f0;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-card: rgba(15, 23, 42, 0.14);
  --border-focus: #2563eb;
  --border-highlight: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --accent-glow: rgba(37, 99, 235, 0.25);

  --wood-color: #b45309;
  --wood-color-light: #d97706;
  --steel-color: #475569;
  --steel-color-angle: #6366f1;

  --dim-line-color: #2563eb;
  --dim-text-color: #0f172a;
  --dim-clear-color: #059669;
  --dim-oc-color: #d97706;

  --grid-line: rgba(15, 23, 42, 0.05);
  --grid-major: rgba(15, 23, 42, 0.12);

  --badge-bg: rgba(37, 99, 235, 0.08);
  --badge-text: #1d4ed8;
  --badge-border: rgba(37, 99, 235, 0.2);

  --summary-bg: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(79, 70, 229, 0.1));
  --summary-border: rgba(37, 99, 235, 0.25);
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: var(--border-card);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}
