/* Art direction: Physics education tool → Warm, curious, approachable
   Palette: Dark slate/navy foundation with warm amber accent — "lightbulb moment" feel
   Typography: Instrument Serif (display) + Satoshi (body) — curious elegance meets clarity
   Density: Spacious — breathing room for thinking */

/* ============== TYPE SCALE ============== */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);

  /* Spacing (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Fonts */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 780px;
  --content-wide: 1200px;
}

/* ============== LIGHT MODE ============== */
:root, [data-theme="light"] {
  --color-bg:             #f5f3ef;
  --color-surface:        #faf9f6;
  --color-surface-2:      #ffffff;
  --color-surface-offset: #edeae4;
  --color-surface-offset-2: #e5e2db;
  --color-surface-dynamic: #dedad2;
  --color-divider:        #d4d0c8;
  --color-border:         #c9c5bc;

  --color-text:           #1a1a1a;
  --color-text-muted:     #6b6860;
  --color-text-faint:     #a9a69e;
  --color-text-inverse:   #faf9f6;

  /* Accent: Warm amber — the "lightbulb" color */
  --color-primary:        #c47a1a;
  --color-primary-hover:  #a86614;
  --color-primary-active: #8c5210;
  --color-primary-highlight: #f5e6cc;
  --color-primary-subtle: #fdf5e8;

  /* Success green */
  --color-success:        #3d7a3d;
  --color-success-highlight: #e6f2e6;

  /* Error */
  --color-error:          #c0392b;
  --color-error-highlight: #fce8e6;

  /* User bubble */
  --color-user-bubble:    #2c3e50;
  --color-user-text:      #f5f3ef;

  /* AI bubble */
  --color-ai-bubble:      #faf9f6;
  --color-ai-text:        #1a1a1a;

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.1);
}

/* ============== DARK MODE ============== */
[data-theme="dark"] {
  --color-bg:             #141414;
  --color-surface:        #1c1c1c;
  --color-surface-2:      #242424;
  --color-surface-offset: #1a1a1a;
  --color-surface-offset-2: #222222;
  --color-surface-dynamic: #2c2c2c;
  --color-divider:        #2a2a2a;
  --color-border:         #363636;

  --color-text:           #e8e6e1;
  --color-text-muted:     #908d86;
  --color-text-faint:     #5c5a55;
  --color-text-inverse:   #1a1a1a;

  --color-primary:        #e0a040;
  --color-primary-hover:  #c88c30;
  --color-primary-active: #b07820;
  --color-primary-highlight: #2e2618;
  --color-primary-subtle: #221e16;

  --color-success:        #5fa85f;
  --color-success-highlight: #1e2e1e;

  --color-error:          #e74c3c;
  --color-error-highlight: #2e1a18;

  --color-user-bubble:    #e0a040;
  --color-user-text:      #141414;

  --color-ai-bubble:      #1c1c1c;
  --color-ai-text:        #e8e6e1;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:             #141414;
    --color-surface:        #1c1c1c;
    --color-surface-2:      #242424;
    --color-surface-offset: #1a1a1a;
    --color-surface-offset-2: #222222;
    --color-surface-dynamic: #2c2c2c;
    --color-divider:        #2a2a2a;
    --color-border:         #363636;
    --color-text:           #e8e6e1;
    --color-text-muted:     #908d86;
    --color-text-faint:     #5c5a55;
    --color-text-inverse:   #1a1a1a;
    --color-primary:        #e0a040;
    --color-primary-hover:  #c88c30;
    --color-primary-active: #b07820;
    --color-primary-highlight: #2e2618;
    --color-primary-subtle: #221e16;
    --color-success:        #5fa85f;
    --color-success-highlight: #1e2e1e;
    --color-error:          #e74c3c;
    --color-error-highlight: #2e1a18;
    --color-user-bubble:    #e0a040;
    --color-user-text:      #141414;
    --color-ai-bubble:      #1c1c1c;
    --color-ai-text:        #e8e6e1;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  }
}
