--- alwaysApply: true description: CSS Variables theme system best practices --- # CSS Variables Theme System ## Core Principle: Pure CSS Variables for Theming This project uses **CSS Variables exclusively** for theming. No Tailwind `dark:` classes or conditional CSS classes. ## ✅ Architecture Pattern ### CSS Structure ```css :root { /* Light theme (default values) */ --background: #f1f5f9; --foreground: #0f172a; --primary: #0891b2; --success: #059669; --destructive: #dc2626; --accent: #d97706; --purple: #8b5cf6; --yellow: #eab308; --green: #059669; --blue: #2563eb; --gray: #6b7280; --gray-light: #e5e7eb; } .dark { /* Dark theme (override values) */ --background: #1e293b; --foreground: #f1f5f9; --primary: #06b6d4; --success: #10b981; --destructive: #ef4444; --accent: #f59e0b; --purple: #8b5cf6; --yellow: #eab308; --green: #10b981; --blue: #3b82f6; --gray: #9ca3af; --gray-light: #374151; } ``` ### Theme Application - **Single source of truth**: [ThemeContext.tsx](mdc:src/contexts/ThemeContext.tsx) applies theme class to `document.documentElement` - **No duplication**: Theme is applied only once, not in multiple places - **SSR safe**: Initial theme from server-side preferences ## ✅ Component Usage Patterns ### Correct: Using CSS Variables ```tsx // ✅ GOOD: CSS Variables in className