/* Horizons & Co — main app */
const { useState, useEffect } = React;
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "saffron",
"serif": "cormorant",
"density": "regular"
}/*EDITMODE-END*/;
const ACCENT_PALETTES = {
saffron: { c1: '#F2C744', c2: '#C99B1F', name: 'Saffron (brand)' },
rust: { c1: '#D9744A', c2: '#A8512F', name: 'Rust' },
olive: { c1: '#A8A642', c2: '#7E7B26', name: 'Olive' },
teal: { c1: '#3F8C84', c2: '#2A6863', name: 'Teal' },
};
const SERIF_OPTIONS = {
cormorant: { family: 'Cormorant Garamond', name: 'Cormorant (default)' },
playfair: { family: 'Playfair Display', name: 'Playfair Display' },
fraunces: { family: 'Fraunces', name: 'Fraunces' },
ibmplex: { family: 'IBM Plex Serif', name: 'IBM Plex Serif' },
};
function App() {
const [page, setPage] = useState('home');
const [locale, setLocale] = useState('EN');
const [modal, setModal] = useState({ open: false, prefill: null });
const [tweaks, setTweak] = window.useTweaks(TWEAK_DEFAULTS);
// Apply RTL on AR
useEffect(() => {
const root = document.documentElement;
if (locale === 'AR') {
root.classList.add('rtl');
root.setAttribute('dir', 'rtl');
root.setAttribute('lang', 'ar');
} else {
root.classList.remove('rtl');
root.setAttribute('dir', 'ltr');
root.setAttribute('lang', locale.toLowerCase());
}
}, [locale]);
// Apply tweaks
useEffect(() => {
const root = document.documentElement;
const a = ACCENT_PALETTES[tweaks.accent] || ACCENT_PALETTES.saffron;
root.style.setProperty('--saffron', a.c1);
root.style.setProperty('--saffron-deep', a.c2);
const s = SERIF_OPTIONS[tweaks.serif] || SERIF_OPTIONS.cormorant;
document.querySelectorAll('style[data-serif-override]').forEach(n => n.remove());
const style = document.createElement('style');
style.dataset.serifOverride = '1';
style.textContent = `
.serif, .serif-tight, .practice-card .pc-title, .hero-h1, .section-head h2,
.page-head h1, .insight-card .title, .award .band, .glance-cell .num, .outcome .stat,
.expert-card .name, .footer .brand, .cta-block h3, .profile-content h1,
.modal-aside h2, .office h4, .practice-hero h1, .timeline-step .yr,
.value h4, .modal-success h2, .practice-list-row, .contact-form h3, .nav-logo {
font-family: '${s.family}', 'Times New Roman', serif !important;
}
`;
document.head.appendChild(style);
}, [tweaks.accent, tweaks.serif]);
const t = makeT(locale);
const openConsult = (prefill) => setModal({ open: true, prefill });
const closeConsult = () => setModal({ open: false, prefill: null });
// Scroll to top on page change
useEffect(() => { window.scrollTo({ top: 0 }); }, [page]);
// Render page
let content = null;
if (page === 'home') content =