/* Design tokens + EDITMODE block (tweaks persist here) */
const TWEAKS = /*EDITMODE-BEGIN*/{
  "accentCyan": "#5be8d4",
  "accentMagenta": "#ff5cc4",
  "amber": "#ffb347",
  "cream": "#e9d9b8",
  "dim": "#6e5a44",
  "bg": "#0b0603",
  "scanlineIntensity": 0.35,
  "crtFlicker": true,
  "vignette": true,
  "noiseGrain": true,
  "titleGlitch": true,
  "fontScale": 1.0,
  "miraFrame": "pixel",
  "heroLayout": "split",
  "buttonStyle": "boxshadow",
  "cursorBlink": true,
  "logDensity": "sparse",
  "copyTone": "sardonic",
  "terminalPrompt": "ovrdose://",
  "marqueeTicker": true,
  "overdosePulse": true,
  "bootIntro": true,
  "ambientHum": true,
  "showPressKit": true,
  "showDevLog": true,
  "pageWidth": 1440,
  "trailerSrc": "/assets/trailer-final-v2.mp4"
}/*EDITMODE-END*/;

// Load persisted overrides if any
try {
  const saved = localStorage.getItem('dbd_tweaks');
  if (saved) Object.assign(TWEAKS, JSON.parse(saved));
} catch (e) {}

window.TWEAKS = TWEAKS;

// Tiny helpers for commonly used components
const T = () => window.TWEAKS;

const Amber = ({ children, style }) => (
  <span style={{ color: T().amber, ...style }}>{children}</span>
);
const Cyan = ({ children, style }) => (
  <span style={{ color: T().accentCyan, ...style }}>{children}</span>
);
const Magenta = ({ children, style }) => (
  <span style={{ color: T().accentMagenta, ...style }}>{children}</span>
);
const Cream = ({ children, style }) => (
  <span style={{ color: T().cream, ...style }}>{children}</span>
);
const Dim = ({ children, style }) => (
  <span style={{ color: T().dim, ...style }}>{children}</span>
);

function useBreakpoint() {
  const [w, setW] = React.useState(window.innerWidth);
  React.useEffect(() => {
    const handler = () => setW(window.innerWidth);
    window.addEventListener('resize', handler);
    return () => window.removeEventListener('resize', handler);
  }, []);
  return { isMobile: w < 480, isTablet: w < 768, isNarrow: w < 640 };
}
window.useBreakpoint = useBreakpoint;

Object.assign(window, { Amber, Cyan, Magenta, Cream, Dim });
