// VibeAlchemy Marketing · App root with hash routing + theme toggle
// Same key as the React app (ui/src/main.jsx) so theme carries between
// marketing ↔ /app without re-prompting the user.
const THEME_STORAGE_KEY = 'va_theme';
// Legacy key from the marketing prototype — read once for back-compat,
// then write through to the unified key.
const LEGACY_KEY = 'va-marketing-theme';
function readInitialTheme() {
try {
const stored = localStorage.getItem(THEME_STORAGE_KEY)
|| localStorage.getItem(LEGACY_KEY);
if (stored === 'dark' || stored === 'light') return stored;
} catch (_) {}
return 'dark';
}
function App() {
const route = useRoute();
const [theme, setTheme] = useState(readInitialTheme);
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.setAttribute('data-grain', '1');
try { localStorage.setItem(THEME_STORAGE_KEY, theme); } catch (_) {}
}, [theme]);
const toggleTheme = () => setTheme((t) => (t === 'dark' ? 'light' : 'dark'));
let page;
if (route === '/' || route === '') page =