# Styling & Theming ## CSS Architecture - **Framework:** Tailwind CSS 4 via `@tailwindcss/vite` plugin - **Colour space:** OKLCH (CSS `oklch()` function) - **Theming:** CSS custom properties on `:root`, switched via `.dark` / `.light` class on `` - **Font:** Geist Variable (loaded locally) - **Border radius:** `0.625rem` (global `--radius` token) --- ## Theme Variables Defined in `src/index.css` as CSS custom properties. All colours use OKLCH values. ### Core Tokens | Variable | Purpose | | ---------------------- | -------------------------- | | `--background` | Page background | | `--foreground` | Default text colour | | `--card` | Card background | | `--card-foreground` | Card text colour | | `--primary` | Brand / accent colour | | `--primary-foreground` | Text on primary background | | `--secondary` | Secondary surfaces | | `--muted` | Muted backgrounds | | `--muted-foreground` | Muted text | | `--accent` | Interactive accent colour | | `--destructive` | Error / delete actions | | `--border` | Default border colour | | `--input` | Input field border | | `--ring` | Focus ring colour | ### Chart Tokens | Variable | Purpose | | ----------- | -------------- | | `--chart-1` | Chart colour 1 | | `--chart-2` | Chart colour 2 | | `--chart-3` | Chart colour 3 | | `--chart-4` | Chart colour 4 | | `--chart-5` | Chart colour 5 | ### Sidebar Tokens | Variable | Purpose | | ---------------------- | ------------------ | | `--sidebar-background` | Sidebar background | | `--sidebar-foreground` | Sidebar text | | `--sidebar-primary` | Active item text | | `--sidebar-accent` | Active item bg | | `--sidebar-border` | Sidebar border | | `--sidebar-ring` | Sidebar focus ring | --- ## Dark / Light Mode Theme toggling is managed by `useThemeStore` (Zustand, persisted to `localStorage`). The `setTheme` action applies the corresponding class to `document.documentElement`: ```ts document.documentElement.classList.remove('light', 'dark'); document.documentElement.classList.add(theme); ``` Tailwind's `darkMode: 'class'` strategy detects the class and applies `dark:` variants. Both `.dark` and `.light` rulesets are defined in `index.css` with different OKLCH values for all tokens. --- ## Responsive Breakpoints Standard Tailwind defaults: | Breakpoint | Min-width | Typical usage | | ---------- | --------- | -------------------- | | `sm` | 640 px | 3-col grids | | `md` | 768 px | 4-col grids, sidebar | | `lg` | 1024 px | 5-col grids | | `xl` | 1280 px | 6-col grids | | `2xl` | 1536 px | 7-col grids | --- ## Animation Utilities | Class | Effect | | -------------------- | ------------------------------------------ | | `animate-page-enter` | Fade + slide-up on page mount | | `animate-card-enter` | Staggered fade-in for card grids | | `animate-in fade-in` | Generic fade-in with configurable duration | Card staggering is achieved via inline `animation-delay` based on the card index. --- ## Component Styling (shadcn/ui) UI primitives in `src/components/ui/` use: - `class-variance-authority` (via shadcn internals) for variant props - `cn()` utility (`src/lib/utils.ts`) = `clsx` + `tailwind-merge` for conflict-free class composition - All colours reference CSS custom property tokens, not hard-coded values