// App — composes ocean + hero + tweaks panel + custom cursor.

const TWEAK_DEFAULTS = {
  baseLevel: 0.42,
  tideAmp: 0.07,
  tideLoop: 25,
  waveAmp: 22,
  washHeight: 120,
  washInterval: 8,
  timeScale: 1,
  shallowColor: "#9FC6D6",
  deepColor: "#7FB3C9",
  wordmarkFont: "fraunces",
  wordmarkItalic: false,
};

const Cursor = () => {
  const dotRef = React.useRef(null);
  const ringRef = React.useRef(null);
  React.useEffect(() => {
    let x = -50, y = -50, rx = -50, ry = -50;
    const onMove = (e) => { x = e.clientX; y = e.clientY; };
    window.addEventListener('pointermove', onMove);
    let raf;
    const loop = () => {
      rx += (x - rx) * 0.12;
      ry += (y - ry) * 0.12;
      if (dotRef.current) dotRef.current.style.transform = `translate(${x - 3}px, ${y - 3}px)`;
      if (ringRef.current) ringRef.current.style.transform = `translate(${rx - 14}px, ${ry - 14}px)`;
      raf = requestAnimationFrame(loop);
    };
    raf = requestAnimationFrame(loop);
    return () => { cancelAnimationFrame(raf); window.removeEventListener('pointermove', onMove); };
  }, []);
  return (
    <>
      <div ref={ringRef} style={{
        position: 'fixed', left: 0, top: 0, width: 28, height: 28,
        border: '1px solid rgba(26,58,74,0.45)', borderRadius: '50%',
        pointerEvents: 'none', zIndex: 9998, mixBlendMode: 'multiply',
      }} />
      <div ref={dotRef} style={{
        position: 'fixed', left: 0, top: 0, width: 6, height: 6,
        background: 'var(--ink)', borderRadius: '50%',
        pointerEvents: 'none', zIndex: 9999,
      }} />
    </>
  );
};

const App = () => {
  const tweaks = TWEAK_DEFAULTS;
  const [introDone, setIntroDone] = React.useState(false);

  return (
    <>
      <Ocean tweaks={tweaks} />
      <Fish />
      <Hero tweaks={tweaks} />
      <Bubbles />
      <WaitlistCounter />
      <Starfish />
      <Socials />
      <Cursor />
      {!introDone && <Intro onDone={() => setIntroDone(true)} />}
    </>
  );
};

ReactDOM.createRoot(document.getElementById('root')).render(<App />);
