// app.jsx — main App: routing state + tweaks panel + density / direction switching const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "direction": "soil", "hero": "kinetic", "palette": ["#1a3a2a", "#c9a961", "#e8e2d0"], "density": 1.0, "dark": false, "subBrand": "minerals", "sectionOrder": ["intro", "stats", "minerals", "feature", "lands", "visit", "projects", "cta"] }/*EDITMODE-END*/; function applyPalette(p) { if (!Array.isArray(p) || p.length < 3) return; const r = document.documentElement.style; r.setProperty('--forest', p[0]); r.setProperty('--gold', p[1]); r.setProperty('--paper', p[2]); // also derive a tinted bg-elevated: r.setProperty('--paper-soft', p[2]); } function App() { const [t, setTweak] = useTweaks(TWEAK_DEFAULTS); const [page, setPage] = React.useState('home'); const [subBrand, setSubBrand] = React.useState(t.subBrand || 'minerals'); // sync direction + dark + palette + density to root html element React.useEffect(() => { const html = document.documentElement; html.classList.toggle('dir-bedrock', t.direction === 'bedrock'); html.classList.toggle('dir-soil', t.direction !== 'bedrock'); html.classList.toggle('dark', !!t.dark); html.style.setProperty('--density-scale', t.density); applyPalette(t.palette); }, [t.direction, t.dark, t.density, t.palette]); // scroll to top on page change React.useEffect(() => { window.scrollTo({ top: 0, behavior: 'instant' }); }, [page]); // simple reveal-on-scroll observer React.useEffect(() => { const els = document.querySelectorAll('.reveal'); if (!('IntersectionObserver' in window)) return; const io = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); } }); }, { threshold: 0.12 }); els.forEach(el => io.observe(el)); return () => io.disconnect(); }, [page]); const renderPage = () => { switch (page) { case 'about': return ; case 'minerals': return ; case 'lands': return ; case 'visit': return ; case 'projects': return ; case 'insights': return ; case 'careers': return ; case 'contact': return ; default: return ; } }; // Section reorder helper — move section up/down const moveSection = (idx, dir) => { const order = [...t.sectionOrder]; const ni = idx + dir; if (ni < 0 || ni >= order.length) return; [order[idx], order[ni]] = [order[ni], order[idx]]; setTweak('sectionOrder', order); }; const resetOrder = () => setTweak('sectionOrder', TWEAK_DEFAULTS.sectionOrder); return ( {renderPage()} setTweak('direction', v)} /> setTweak('hero', v)} /> setTweak('palette', v)} /> setTweak('dark', v)} /> setTweak('density', v)} /> {page === 'home' && ( {t.sectionOrder.map((s, i) => ( {i + 1}. {s} moveSection(i, -1)} disabled={i === 0} style={{ background: 'rgba(0,0,0,0.06)', border: 'none', padding: '2px 6px', borderRadius: 4, cursor: i === 0 ? 'not-allowed' : 'pointer', opacity: i === 0 ? 0.4 : 1 }}>↑ moveSection(i, +1)} disabled={i === t.sectionOrder.length - 1} style={{ background: 'rgba(0,0,0,0.06)', border: 'none', padding: '2px 6px', borderRadius: 4, cursor: i === t.sectionOrder.length - 1 ? 'not-allowed' : 'pointer', opacity: i === t.sectionOrder.length - 1 ? 0.4 : 1 }}>↓ ))} )} ); } ReactDOM.createRoot(document.getElementById('root')).render();