// Public landing entry — renders LandingV1 full-bleed and responsive.
// No DesignCanvas / TweaksPanel wrappers (those were designer preview).

const { useState, useEffect } = React;

function PublicLanding() {
  const [width, setWidth] = useState(typeof window !== 'undefined' ? window.innerWidth : 1280);
  useEffect(() => {
    const onResize = () => setWidth(window.innerWidth);
    window.addEventListener('resize', onResize);
    return () => window.removeEventListener('resize', onResize);
  }, []);

  // Pick `width` mode: < 600 = mobile, otherwise desktop. LandingV1 internally
  // adapts based on its `width` prop.
  const renderWidth = width < 600 ? 390 : 1280;

  return (
    <div style={{ width: '100%', minHeight: '100vh' }}>
      <LandingV1
        width={renderWidth}
        source={new URLSearchParams(location.search).get('utm_source') || 'facebook'}
      />
    </div>
  );
}

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