This document outlines the styling and CSS guidelines for the Mathnotes project.
- NEVER hardcode values - Always use CSS custom properties (design tokens) from the theme
- Colors: Use theme variables like
var(--color-primary),var(--color-secondary), etc.- Use OKLCH color space for defining colors - provides better perceptual uniformity
- Spacing: Use spacing tokens:
var(--space-xs)throughvar(--space-3xl)- Also use gap tokens:
var(--gap-xs)throughvar(--gap-2xl)
- Also use gap tokens:
- Typography: Use font size tokens:
var(--font-size-xs)throughvar(--font-size-3xl)- Use line height tokens:
var(--line-height-tight),var(--line-height-base),var(--line-height-relaxed)
- Use line height tokens:
- Borders: Use border tokens:
- Widths:
var(--border-width-thin)throughvar(--border-width-heavy) - Radius:
var(--radius-sm),var(--radius-md),var(--radius-lg),var(--radius-full)
- Widths:
- Component Sizes: Use size tokens like
var(--size-input-base),var(--size-button-icon), etc. - Layout: Use content width tokens:
var(--width-content-base),var(--width-content-wide) - Heights: Use height tokens:
var(--height-input-min),var(--height-card-base), etc. - Shadows: Use shadow tokens:
var(--shadow-sm)throughvar(--shadow-xl) - Transitions: Use transition tokens:
var(--transition-fast),var(--transition-base),var(--transition-slow) - Z-index: Use z-index scale:
var(--z-base)throughvar(--z-tooltip) - Breakpoints: Reference breakpoint tokens in PostCSS:
var(--breakpoint-phone),var(--breakpoint-tablet), etc. - Transforms: Use transform tokens:
var(--translate-subtle),var(--translate-sm), etc.
- NEVER use inline styles - Always use CSS classes instead
- The codebase uses a modern CSS system with:
- CSS Modules for component-scoped styles (e.g.,
import styles from './Component.module.css') - Global styles in
/styles/directory - Theme variables defined in
/styles/theme.css - All inline styles have been removed - maintain this standard
- CSS Modules for component-scoped styles (e.g.,
- PostCSS for modern CSS features (nesting, custom media queries)
- CSS custom properties for theming (colors, spacing, typography)
- CSS entry point at
styles/main.cssprocessed by the build system - Hot module replacement in development for instant style updates
- Theme variables defined in
styles/theme.css, utilities instyles/utilities.css
- CSS changes in development have hot module replacement - no need to restart the server
- Always verify styles work in both light and dark modes
- Test responsive layouts on mobile devices
- No inline JavaScript - all scripts must be in external files
- No inline event handlers (onclick, onload)
- Use
addEventListenerand data attributes - Demos must be CSP-compliant