RAIA™ Specification

2.22 Theme System & CSS Variables Reference

The Theme System is how RAIA's documentation stays consistent and adaptive. Instead of hardcoding colors like #4f46e5 everywhere, we use CSS variables like var(--blue). This means if we want to change the brand color site-wide, we update one line instead of hunting through 50 files. It also powers dark mode automatically.

← Back to Developer Hub TEXTBOOK SPECIFICATION
🟢 In Plain English

The Theme System is how RAIA's documentation stays consistent and adaptive. Instead of hardcoding colors like #4f46e5 everywhere, we use CSS variables like var(--blue). This means if we want to change the brand color site-wide, we update one line instead of hunting through 50 files. It also powers dark mode automatically.

The unified CSS variable system powering adaptive theming, dark mode support, and consistent visual identity across all RAIA (Real estate Artificial Intelligence Agent) documentation and portal surfaces.

CSS Variables Dark Mode Ready Brand Consistency Zero Hardcoded Colors
47
CSS variables defined — colors, typography, spacing, and surfaces
100%
Browser support — works in all modern browsers without polyfills
1
Source of truth — update once, propagates everywhere instantly
0
Build-time dependencies — pure CSS, no preprocessors required

Section A What Is the Theme System?

The Theme System is RAIA's centralized approach to styling. Instead of hardcoding colors, fonts, and spacing values throughout the codebase, we define them once as CSS custom properties (variables) and reference them everywhere. This creates a single source of truth for the entire visual identity.

Define Variables :root { --blue: #4f46e5; } One place, all values Reference Documentation color: var(--blue) Portal UI background: var(--blue) Email Templates border: 2px var(--blue) Updates Instant Propagation Change --blue once → All surfaces update Single source of truth → Zero hardcoded values → Instant brand updates Define Reference Propagate

Why CSS Variables?

CSS variables solve three critical problems that plague traditional styling approaches:

Traditional Approach (Bad)
  • Hardcoded hex colors scattered everywhere
  • Find-and-replace nightmares on rebrand
  • Dark mode requires duplicate stylesheets
  • Impossible to maintain consistency
CSS Variables (Good)
  • One definition, infinite references
  • Update once, propagates everywhere
  • Dark mode is just variable swapping
  • Enforced consistency by design

Section B Using Themes

Color Palette

RAIA (Real estate Artificial Intelligence Agent) uses a carefully curated color system built around three brand colors:

Variable Value Usage Sample
--blue #4f46e5 Primary brand color, CTAs, links
--sky #0ea5e9 Info states, data visualization
--green #059669 Success states, verified badges
--amber #d97706 Warnings, dev-only sections
--red #dc2626 Errors, critical alerts

Typography

Two font stacks power all RAIA (Real estate Artificial Intelligence Agent) surfaces:

/* Body Text */
--font-body: 'Inter', system-ui, sans-serif;

/* Code & Monospace */
--font-mono: 'JetBrains Mono', 'Menlo', monospace;
💡
Always Use Variable, Never Hardcode

Write font-family: var(--font-body), not font-family: 'Inter'. This ensures fallback fonts work correctly and future font changes propagate automatically.

Spacing & Layout

Surface colors create visual hierarchy and depth:

  • 1
    --bg — Page Background

    The base canvas. Usually #ffffff in light mode, #0d1117 in dark mode.

  • 2
    --bg-card — Card Surfaces

    Slightly elevated surfaces for content cards. Creates subtle depth on top of --bg.

  • 3
    --bg-elev — Elevated Surfaces

    Headers, sticky nav, modals. The highest layer in the surface hierarchy.


🔒 Developer-Only Section — Architecture & Migration

Section C Architecture

:root { CSS Custom Properties } Global scope — accessible by all elements Documentation Pages unify_docs.py template Inherits all variables Portal Frontend Next.js + Tailwind CSS-in-JS references Email Templates Inline styles fallback Graceful degradation [data-theme="dark"] { Override Variables } Same variable names, different values → instant dark mode theme.js injects [data-theme="dark"] on <html> All var(--*) references pick up new values automatically

Complete Variable Reference

Category Variable Light Value Dark Value
Surfaces --bg #ffffff #0d1117
--bg-card #f9fafb #161b22
--bg-elev #f3f4f6 #1c2128
Text --text #111827 #e6edf3
--text-dim #6b7280 #7d8590
--text-faint #9ca3af #484f58
Borders --border #e5e7eb #30363d
--border-bright #c7d2fe #6366f1

Dark Mode Implementation

Dark mode is implemented via theme.js, which runs before first paint:

// theme.js
(function() {
  const savedTheme = localStorage.getItem('theme');
  const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
  const theme = savedTheme || (prefersDark ? 'dark' : 'light');
  document.documentElement.setAttribute('data-theme', theme);
})();
⚠️
Flash of Unstyled Content (FOUC)

Always load theme.js in <head> before any CSS. If it loads after, users see a white flash on dark mode loads.

Migration Guide: Hardcoded Colors → Variables

When auditing old files, use these regex patterns to find and replace hardcoded colors:

# Find all hex colors
grep -rn "#[0-9a-fA-F]\{6\}" docs/raw/*.html

# Replace common patterns
sed -i 's/color:#4f46e5/color:var(--blue)/g' file.html
sed -i 's/background:#ffffff/background:var(--bg)/g' file.html
sed -i 's/border.*#e5e7eb/border-color:var(--border)/g' file.html
Automated Linter

The unify_docs.py compiler includes a linter that warns when hardcoded hex colors are found in raw HTML files. These warnings appear during compilation but don't block the build.