/* ============================================================
Ilha de Ajustes (Tweaks) — variações ao vivo. Português.
============================================================ */
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"heroBg": "dusk",
"accent": "coral",
"headlineFont": "geometric",
"rhythm": "alternating",
"marqueeSpeed": 48
}/*EDITMODE-END*/;
const ACCENTS = {
coral: { accent: '#E77E7C', a2: '#F2B53B', a3: '#0082B8' },
yellow: { accent: '#F2B53B', a2: '#E77E7C', a3: '#0082B8' },
multicolor: { accent: '#E77E7C', a2: '#F2B53B', a3: '#0082B8' },
};
function applyTweaks(t){
const root = document.documentElement;
const body = document.body;
root.dataset.heroBg = t.heroBg;
const a = ACCENTS[t.accent] || ACCENTS.coral;
root.style.setProperty('--accent', a.accent);
root.style.setProperty('--accent-2', a.a2);
root.style.setProperty('--accent-3', a.a3);
body.dataset.accent = t.accent;
root.style.setProperty('--font-display', t.headlineFont === 'serif'
? "'Newsreader', Georgia, serif"
: "'Jost', system-ui, sans-serif");
body.dataset.headline = t.headlineFont;
body.dataset.rhythm = t.rhythm;
root.style.setProperty('--marquee-duration', t.marqueeSpeed + 's');
}
function TweaksApp(){
const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
React.useEffect(() => { applyTweaks(t); }, [t]);
return (
setTweak('heroBg', v)}
/>
setTweak('accent', v)}
/>
setTweak('rhythm', v)}
/>
setTweak('headlineFont', v)}
/>
setTweak('marqueeSpeed', v)}
/>
);
}
(function bootstrap(){
let saved = {};
try { saved = JSON.parse(localStorage.getItem('tweaks') || '{}'); } catch(e){}
applyTweaks(Object.assign({}, TWEAK_DEFAULTS, saved));
const mount = document.getElementById('tweaks-root');
if (mount && window.ReactDOM) {
ReactDOM.createRoot(mount).render();
}
})();