// All landing sections for Graphyti — v2: dual-vertical (robotics + AI film), neon pink

// =============== HERO ===============
const Hero = ({ onWaitlist }) => {
  const [time, setTime] = React.useState(new Date());
  React.useEffect(() => {
    const t = setInterval(() => setTime(new Date()), 1000);
    return () => clearInterval(t);
  }, []);
  const ts = time.toISOString().slice(11, 19) + 'Z';

  // Cycle the hero clip
  const clips = [
  { src: 'media/city-carousel.mp4', poster: 'media/posters/city-carousel.png', label: 'CITY_CAROUSEL_01' },
  { src: 'media/warehouse-liminal.mp4', poster: 'media/posters/warehouse-liminal.png', label: 'WAREHOUSE_LIMINAL_03' },
  { src: 'media/arcade-city.mp4', poster: 'media/posters/arcade-city.png', label: 'ARCADE_CITY_07' }];

  const [clipIdx, setClipIdx] = React.useState(0);
  const [muted, setMuted] = React.useState(true);
  const heroVideoRef = React.useRef(null);
  React.useEffect(() => {
    if (heroVideoRef.current) heroVideoRef.current.muted = muted;
  }, [muted, clipIdx]);

  return (
    <section style={{ position: 'relative', padding: '72px 0 96px', overflow: 'hidden' }}>
      <div className="grid-bg" />
      <div className="scanlines" />
      <div className="wrap" style={{ position: 'relative' }}>
        <div style={{ display: 'grid', gridTemplateColumns: '1.05fr 1fr', gap: 56, alignItems: 'center' }}>
          {/* Left: copy */}
          <div>
            <HudTag>SYSTEM ONLINE · BUILD 0.5.1</HudTag>
            <h1 style={{
              fontSize: 'clamp(46px, 6vw, 78px)',
              lineHeight: 0.98, margin: '24px 0 24px',
              letterSpacing: '-0.035em', fontWeight: 600,
              textWrap: 'balance'
            }}>
              Generate entire <span style={{ color: 'var(--accent)', textShadow: '0 0 24px var(--accent-glow)' }}>3D worlds</span><br />
              from a single prompt.
            </h1>
            <p style={{
              fontSize: 19, color: 'var(--text-muted)', maxWidth: 580,
              margin: '0 0 36px', textWrap: 'pretty'
            }}>
              Graphyti is a 3D synthetic data sandbox. Build cities, forests,
              warehouses, harbours — labeled, lit, weather-controlled — to train
              robotics models and prototype scenes for the next generation of
              video AI like Veo&nbsp;3 and Seedance&nbsp;2.
            </p>
            <div style={{ display: 'flex', gap: 14, flexWrap: 'wrap' }}>
              <button className="btn btn-primary" onClick={onWaitlist}>
                Join the waitlist <span className="arrow">→</span>
              </button>
              <a className="btn btn-ghost" href="#scenes">
                Watch recovered footage
              </a>
            </div>

            <div style={{
              display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 24,
              marginTop: 52, paddingTop: 28, borderTop: '1px solid var(--border-soft)'
            }}>
              <HudReadout label="Scene Gen" value="< 5 MIN" />
              <HudReadout label="Cost Savings" value="~80%" />
              <HudReadout label="Worlds" value="∞" />
              <HudReadout label="Code Required" value="NONE" />
            </div>
          </div>

          {/* Right: 9:16 video panel */}
          <div style={{ position: 'relative', display: 'flex', justifyContent: 'center' }}>
            <div style={{
              position: 'relative', aspectRatio: '9/16', height: 'min(640px, 78vh)',
              background: 'oklch(10% 0.018 310)',
              border: '1px solid var(--border)',
              padding: 12
            }}>
              <HudCorners color="var(--accent)" />
              {/* Top bar */}
              <div style={{
                display: 'flex', justifyContent: 'space-between',
                alignItems: 'center', padding: '0 4px 10px',
                borderBottom: '1px solid var(--border-soft)'
              }}>
                <div className="mono" style={{ fontSize: 10, letterSpacing: '0.18em', color: 'var(--accent)' }}>
                  ● GRAPHYTI_ENGINE
                </div>
                <div className="mono" style={{ fontSize: 10, letterSpacing: '0.18em', color: 'var(--text-dim)' }}>
                  {ts}
                </div>
              </div>

              {/* Video */}
              <div style={{ marginTop: 10, position: 'relative', height: 'calc(100% - 36px)' }}>
                <video
                  key={clipIdx}
                  ref={heroVideoRef}
                  src={clips[clipIdx].src}
                  poster={clips[clipIdx].poster}
                  autoPlay muted loop playsInline preload="auto"
                  onEnded={() => setClipIdx((i) => (i + 1) % clips.length)}
                  style={{
                    width: '100%', height: '100%', objectFit: 'cover',
                    display: 'block', background: '#000'
                  }} />
                
                {/* Audio toggle */}
                <button
                  type="button"
                  onClick={() => setMuted((m) => !m)}
                  aria-label={muted ? 'Unmute hero' : 'Mute hero'}
                  style={{
                    position: 'absolute', top: 38, right: 10,
                    width: 32, height: 32, padding: 0, cursor: 'pointer',
                    border: '1px solid var(--accent)',
                    background: 'rgba(0,0,0,0.65)', color: 'var(--accent)',
                    display: 'grid', placeItems: 'center',
                    fontSize: 14,
                    boxShadow: '0 0 10px var(--accent-glow)'
                  }}>
                  {muted ? '🔇' : '🔊'}</button>
                {/* HUD overlay */}
                <div style={{ position: 'absolute', top: 10, left: 10, display: 'flex', gap: 12 }}>
                  <span className="mono" style={{ fontSize: 10, color: 'var(--accent)', letterSpacing: '0.15em', textShadow: '0 0 6px var(--accent-glow)' }}>● REC</span>
                  <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.15em', background: 'rgba(0,0,0,0.5)', padding: '1px 6px' }}>{clips[clipIdx].label}</span>
                </div>
                <div style={{ position: 'absolute', bottom: 10, left: 10, right: 10, display: 'flex', justifyContent: 'space-between' }}>
                  <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.15em', background: 'rgba(0,0,0,0.5)', padding: '1px 6px' }}>9:16 · 60FPS</span>
                  <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.15em', background: 'rgba(0,0,0,0.5)', padding: '1px 6px' }}>SEED 0x{(clipIdx * 1337 + 42).toString(16).toUpperCase()}</span>
                </div>

                {/* Clip selector dots */}
                <div style={{
                  position: 'absolute', top: '50%', right: -28, transform: 'translateY(-50%)',
                  display: 'flex', flexDirection: 'column', gap: 8
                }}>
                  {clips.map((_, i) =>
                  <button key={i} onClick={() => setClipIdx(i)} style={{
                    width: 8, height: 8, padding: 0, cursor: 'pointer',
                    border: '1px solid var(--accent)',
                    background: clipIdx === i ? 'var(--accent)' : 'transparent',
                    boxShadow: clipIdx === i ? '0 0 8px var(--accent-glow)' : 'none'
                  }} aria-label={`Clip ${i + 1}`} />
                  )}
                </div>
              </div>
            </div>

            <div className="mono" style={{
              position: 'absolute', top: -8, right: 14,
              background: 'var(--accent)', color: 'var(--bg)',
              fontSize: 10, letterSpacing: '0.18em', padding: '4px 8px',
              fontWeight: 600
            }}>LIVE FEED</div>
          </div>
        </div>
      </div>
    </section>);

};

// =============== INDUSTRY MARQUEE ===============
const Marquee = () => {
  const items = [
  'AI FILM PRODUCTION', 'VIDEO MODEL PROTOTYPING', 'AUTONOMOUS VEHICLES',
  'WORLD MODELS', 'GAME DEVELOPMENT', 'COMPUTER VISION RESEARCH',
  'PATROL DRONES', 'URBAN CLEANING ROBOTS', 'MARITIME SURVEILLANCE',
  'COMMERCIALS & ADVERTISING'];

  const row = [...items, ...items];
  return (
    <div style={{
      borderTop: '1px solid var(--border-soft)',
      borderBottom: '1px solid var(--border-soft)',
      background: 'oklch(10% 0.018 310 / 0.7)', overflow: 'hidden', padding: '16px 0',
      backdropFilter: 'blur(4px)'
    }}>
      <div style={{ display: 'flex', gap: 56, animation: 'scroll 60s linear infinite', whiteSpace: 'nowrap' }}>
        {row.map((it, i) =>
        <span key={i} className="mono" style={{
          fontSize: 12, letterSpacing: '0.3em', color: 'var(--text-dim)',
          display: 'inline-flex', alignItems: 'center', gap: 16
        }}>
            <span style={{ color: 'var(--accent)' }}>◇</span> {it}
          </span>
        )}
      </div>
      <style>{`@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }`}</style>
    </div>);

};

// =============== RECOVERED FOOTAGE GALLERY ===============
const RecoveredFootage = () => {
  const scenes = [
  {
    src: 'media/warehouse-liminal.mp4',
    poster: 'media/posters/warehouse-liminal.png',
    label: 'WAREHOUSE_LIMINAL_14',
    caption: 'INCIDENT 0247 · LOC UNKNOWN',
    coord: 'LAT —— · LON ——',
    style: 'LIMINAL SPACE',
    style2: 'INTERIOR'
  },
  {
    src: 'media/city-scenes.mp4',
    poster: 'media/posters/city-scenes.png',
    label: 'CITY_NIGHT_FF_03',
    caption: 'TRANSMISSION 0419',
    coord: 'LAT 1.290° · LON 103.851°',
    style: 'URBAN NIGHT',
    style2: 'NEON'
  },
  {
    src: 'media/horror-forest.mp4',
    poster: 'media/posters/horror-forest.png',
    label: 'FOREST_FF_09',
    caption: '⚠ JUMPSCARES · MAY 03 2002',
    coord: 'AM 02:17:36',
    style: 'FOUND FOOTAGE',
    style2: 'HORROR',
    warn: true
  },
  {
    src: 'media/arcade-city.mp4',
    poster: 'media/posters/arcade-city.png',
    label: 'ARCADE_CITY_22',
    caption: 'SIM TIMELINE B-7',
    coord: 'LAT 35.681° · LON 139.760°',
    style: 'ARCADE',
    style2: 'TOON SHADER'
  }];


  return (
    <section id="scenes" style={{ padding: '120px 0', position: 'relative' }}>
      <div className="wrap">
        <div className="sec-head">
          <div className="meta">
            <span className="num">01 / SCENES</span>
            <span className="line" />
            <span>RECOVERED FOOTAGE · BUILT IN GRAPHYTI</span>
          </div>
          <h2>Every clip below was generated, lit, and rendered inside Graphyti.</h2>
          <p>From liminal warehouses to rain-slick neon streets to a haunted forest path —
            one platform, one prompt at a time. Each scene is a true 3D world you can walk,
            re-light, and re-shoot from any angle.</p>
        </div>

        <div style={{
          display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 14
        }}>
          {scenes.map((s, i) =>
          <SceneCard key={i} scene={s} index={i} />
          )}
        </div>

        <div style={{
          marginTop: 18, padding: '14px 18px',
          border: '1px dashed var(--accent-line)', background: 'var(--accent-soft)',
          display: 'flex', alignItems: 'center', gap: 14
        }}>
          <span className="mono" style={{ fontSize: 10, letterSpacing: '0.22em', color: 'var(--accent)' }}>⚠ ADVISORY</span>
          <span style={{ fontSize: 13, color: 'var(--text-muted)' }}>
            Clip <span className="mono" style={{ color: 'var(--accent)' }}>FOREST_FF_09</span> contains intentional jumpscares — a feature, not a bug. Volume up.
          </span>
        </div>
      </div>
    </section>);

};

const SceneCard = ({ scene, index }) => {
  const videoRef = React.useRef(null);
  const [playing, setPlaying] = React.useState(false);
  const [muted, setMuted] = React.useState(false);

  const togglePlay = () => setPlaying((p) => !p);
  const toggleMute = (e) => {
    e.stopPropagation();
    setMuted((m) => !m);
  };

  React.useEffect(() => {
    const v = videoRef.current;
    if (!v) return;
    v.muted = muted;
    if (playing) v.play().catch(() => {});else
    v.pause();
  }, [playing, muted]);

  return (
    <div
      className="card scene-card"
      onClick={togglePlay}
      style={{ padding: 0, overflow: 'hidden', cursor: 'pointer', transition: 'transform 0.25s, border-color 0.2s' }}>
      
      <div style={{
        position: 'relative', aspectRatio: '9/16',
        background: `#000 url(${scene.poster}) center/cover no-repeat`
      }}>
        {playing &&
        <video
          ref={videoRef}
          src={scene.src}
          loop playsInline preload="auto"
          poster={scene.poster}
          style={{
            position: 'absolute', inset: 0,
            width: '100%', height: '100%', objectFit: 'cover', display: 'block'
          }} />

        }
        <HudCorners color="var(--accent)" />
        <div style={{
          position: 'absolute', top: 8, left: 8, right: 8,
          display: 'flex', justifyContent: 'space-between'
        }}>
          <span className="mono" style={{
            fontSize: 9, letterSpacing: '0.18em',
            color: scene.warn ? 'oklch(78% 0.22 30)' : 'var(--accent)',
            background: 'rgba(0,0,0,0.55)', padding: '2px 6px'
          }}>{playing ? '● REC' : scene.warn ? '⚠ WARN' : '○ STBY'}</span>
          <span className="mono" style={{
            fontSize: 9, letterSpacing: '0.18em', color: 'var(--text)',
            background: 'rgba(0,0,0,0.55)', padding: '2px 6px'
          }}>{scene.coord}</span>
        </div>
        {/* Audio toggle (only while playing) */}
        {playing &&
        <button
          type="button"
          onClick={toggleMute}
          aria-label={muted ? 'Unmute' : 'Mute'}
          style={{
            position: 'absolute', top: 38, right: 8,
            width: 30, height: 30, padding: 0, cursor: 'pointer',
            border: '1px solid var(--accent)',
            background: 'rgba(0,0,0,0.65)', color: 'var(--accent)',
            display: 'grid', placeItems: 'center',
            fontSize: 13, fontFamily: 'JetBrains Mono, monospace',
            boxShadow: '0 0 10px var(--accent-glow)'
          }}>
          {muted ? '🔇' : '🔊'}</button>
        }
        <div style={{
          position: 'absolute', bottom: 0, left: 0, right: 0,
          padding: '24px 12px 10px',
          background: 'linear-gradient(180deg, transparent, rgba(0,0,0,0.85))'
        }}>
          <div className="mono" style={{ fontSize: 10, color: 'var(--accent)', letterSpacing: '0.2em', marginBottom: 4 }}>
            {scene.label}
          </div>
          <div className="mono" style={{ fontSize: 10, color: 'var(--text-muted)', letterSpacing: '0.15em' }}>
            {scene.caption}
          </div>
        </div>
        {!playing &&
        <div style={{
          position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)',
          border: '1px solid var(--accent)', background: 'rgba(0,0,0,0.55)',
          backdropFilter: 'blur(4px)',
          padding: '10px 16px',
          color: 'var(--accent)', fontFamily: 'JetBrains Mono, monospace',
          fontSize: 11, letterSpacing: '0.22em',
          pointerEvents: 'none',
          display: 'flex', alignItems: 'center', gap: 8,
          boxShadow: '0 0 16px var(--accent-glow)'
        }}>▶ PLAY</div>
        }
      </div>
      <div style={{ padding: '12px 14px', borderTop: '1px solid var(--border-soft)', background: 'var(--surface-2)', display: 'flex', justifyContent: 'space-between' }}>
        <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.18em' }}>{scene.style}</span>
        <span className="mono" style={{ fontSize: 10, color: 'var(--text-dim)', letterSpacing: '0.18em' }}>{scene.style2}</span>
      </div>
      <style>{`
        .scene-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
      `}</style>
    </div>);

};

// =============== FEATURED REEL (16:9) ===============
const FeaturedReel = () => {
  const [playing, setPlaying] = React.useState(false);
  const [muted, setMuted] = React.useState(false);
  const videoRef = React.useRef(null);

  React.useEffect(() => {
    const v = videoRef.current;
    if (!v) return;
    v.muted = muted;
    if (playing) v.play().catch(() => {});else
    v.pause();
  }, [playing, muted]);

  return (
    <section id="featured" style={{ padding: '40px 0 100px', position: 'relative' }}>
      <div className="wrap">
        <div style={{
          display: 'flex', alignItems: 'center', justifyContent: 'space-between',
          marginBottom: 24, flexWrap: 'wrap', gap: 14
        }}>
          <div className="mono" style={{ fontSize: 11, letterSpacing: '0.28em', color: 'var(--accent)' }}>
            ◇ FEATURED REEL · 16:9 · EXTENDED CUT
          </div>
          <div className="mono" style={{ fontSize: 11, letterSpacing: '0.22em', color: 'var(--text-dim)' }}>
            CLIP_ID · FOREST_FF_09_WIDE
          </div>
        </div>

        <div
          onClick={() => setPlaying((p) => !p)}
          style={{
            position: 'relative', cursor: 'pointer',
            border: '1px solid var(--accent-line)',
            background: 'oklch(8% 0.014 305)',
            padding: 14
          }}>
          
          <HudCorners color="var(--accent)" />
          <div style={{
            display: 'flex', justifyContent: 'space-between', alignItems: 'center',
            padding: '0 6px 12px', borderBottom: '1px solid var(--border-soft)', marginBottom: 12
          }}>
            <div style={{ display: 'flex', gap: 16, alignItems: 'center' }}>
              <span className="mono" style={{ fontSize: 11, letterSpacing: '0.2em', color: 'var(--accent)' }}>
                {playing ? '● PLAYING' : '○ STANDBY'}
              </span>
              <span className="mono" style={{ fontSize: 11, letterSpacing: '0.2em', color: 'oklch(78% 0.22 30)' }}>
                ⚠ CONTAINS JUMPSCARES
              </span>
            </div>
            <div className="mono" style={{ fontSize: 11, letterSpacing: '0.18em', color: 'var(--text-dim)' }}>
              16:9 · RENDERED IN GRAPHYTI
            </div>
          </div>

          <div style={{
            position: 'relative', aspectRatio: '16/9',
            background: `#000 url(media/posters/horror-wide.png) center/cover no-repeat`
          }}>
            {playing &&
            <video
              ref={videoRef}
              src="media/horror-wide.mp4"
              poster="media/posters/horror-wide.png"
              loop playsInline preload="auto"
              style={{
                position: 'absolute', inset: 0, width: '100%', height: '100%',
                objectFit: 'cover', display: 'block'
              }} />

            }
            {/* Top HUD */}
            <div style={{
              position: 'absolute', top: 14, left: 14, right: 14,
              display: 'flex', justifyContent: 'space-between'
            }}>
              <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.18em', background: 'rgba(0,0,0,0.6)', padding: '3px 8px' }}>
                PLAY ▶
              </span>
              <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.18em', background: 'rgba(0,0,0,0.6)', padding: '3px 8px' }}>
                {playing ? 'REC ●' : 'STBY ○'}
              </span>
            </div>
            {/* Bottom HUD */}
            <div style={{
              position: 'absolute', bottom: 14, left: 14, display: 'flex', gap: 16
            }}>
              <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.18em', background: 'rgba(0,0,0,0.6)', padding: '3px 8px' }}>AM 02:17:36</span>
              <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.18em', background: 'rgba(0,0,0,0.6)', padding: '3px 8px' }}>MAY. 03 2002</span>
            </div>
            {/* Audio toggle */}
            {playing &&
            <button
              type="button"
              onClick={(e) => {e.stopPropagation();setMuted((m) => !m);}}
              aria-label={muted ? 'Unmute reel' : 'Mute reel'}
              style={{
                position: 'absolute', bottom: 14, right: 14,
                width: 36, height: 36, padding: 0, cursor: 'pointer',
                border: '1px solid var(--accent)',
                background: 'rgba(0,0,0,0.65)', color: 'var(--accent)',
                display: 'grid', placeItems: 'center', fontSize: 16,
                boxShadow: '0 0 12px var(--accent-glow)'
              }}>
              {muted ? '🔇' : '🔊'}</button>
            }
            {/* Center play */}
            {!playing &&
            <div style={{
              position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)',
              display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 14,
              pointerEvents: 'none'
            }}>
                <div style={{
                width: 96, height: 96, border: '1.5px solid var(--accent)',
                background: 'rgba(0,0,0,0.55)', backdropFilter: 'blur(4px)',
                display: 'grid', placeItems: 'center',
                boxShadow: '0 0 32px var(--accent-glow)'
              }}>
                  <div style={{
                  width: 0, height: 0,
                  borderTop: '14px solid transparent',
                  borderBottom: '14px solid transparent',
                  borderLeft: '22px solid var(--accent)',
                  marginLeft: 6
                }} />
                </div>
                <div className="mono" style={{ fontSize: 11, letterSpacing: '0.3em', color: 'var(--accent)' }}>▶ PLAY REEL</div>
              </div>
            }
          </div>
        </div>
      </div>
    </section>);

};

// =============== TWO VERTICALS ===============
const TwoVerticals = () => {
  const verticals = [
  {
    tag: 'VERTICAL_01 / AI FILM + VIDEO',
    title: 'Prototype scenes for video models in minutes.',
    body: 'Drop in a prompt, walk a real 3D world, capture clean 9:16 reference clips. Hand them to Veo 3, Seedance 2, or Runway as a directorial proxy — control camera, lighting, weather, time of day, even shader style. No re-rolls, no luck.',
    bullets: [
    'Pre-viz for video model outputs',
    'Cinematic 9:16, 16:9, anything',
    'Controllable lighting + weather',
    'Toon / painterly / photoreal shaders'],

    tags: ['Veo 3', 'Seedance 2', 'Runway', 'Sora', 'Kling']
  },
  {
    tag: 'VERTICAL_02 / ROBOTICS + AV',
    title: 'Train robots on edge cases that don\'t exist yet.',
    body: 'Generate the rare, expensive, dangerous scenarios — fallen trees, cluttered alleys, harbour patrols — at city scale. Export RGB, depth, segmentation masks and 2D/3D bounding boxes. Drop straight into any vision pipeline.',
    bullets: [
    'Auto-labeled datasets (masks + bbox)',
    'Any POV — aerial, vehicular, first-person',
    'Infinite seeds per scenario',
    '~80% cheaper than field capture'],

    tags: ['AVs', 'Cleaning Robots', 'Drones', 'Maritime', 'Smart City']
  }];

  return (
    <section id="verticals" style={{ padding: '120px 0', position: 'relative', background: 'linear-gradient(180deg, transparent, oklch(10% 0.02 310 / 0.5) 30%, oklch(10% 0.02 310 / 0.5) 70%, transparent)' }}>
      <div className="wrap">
        <div className="sec-head">
          <div className="meta">
            <span className="num">02 / WHO IT'S FOR</span>
            <span className="line" />
            <span>TWO INDUSTRIES · ONE ENGINE</span>
          </div>
          <h2>One sandbox. Whatever your visual AI needs to learn.</h2>
          <p>The same procedural core that builds training data for autonomous fleets builds
            cinematic worlds for the next wave of generative video. Different outputs, same
            magic underneath.</p>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 20 }}>
          {verticals.map((v, i) =>
          <div key={i} className="card" style={{ padding: '36px 32px', position: 'relative' }}>
              <HudCorners color="var(--accent)" />
              <div className="mono" style={{ fontSize: 11, letterSpacing: '0.22em', color: 'var(--accent)', marginBottom: 18 }}>
                {v.tag}
              </div>
              <h3 style={{ fontSize: 26, margin: '0 0 16px', fontWeight: 600, letterSpacing: '-0.015em', lineHeight: 1.15 }}>{v.title}</h3>
              <p style={{ color: 'var(--text-muted)', fontSize: 15, margin: '0 0 24px' }}>{v.body}</p>

              <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8, marginBottom: 24 }}>
                {v.bullets.map((b, j) =>
              <div key={j} style={{ display: 'flex', alignItems: 'flex-start', gap: 8, fontSize: 13, color: 'var(--text)' }}>
                    <span style={{ color: 'var(--accent)', fontFamily: 'JetBrains Mono, monospace' }}>+</span>
                    {b}
                  </div>
              )}
              </div>

              <div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, paddingTop: 18, borderTop: '1px solid var(--border-soft)' }}>
                {v.tags.map((tag, j) =>
              <span key={j} className="mono" style={{
                fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase',
                padding: '4px 8px', border: '1px solid var(--border)',
                color: 'var(--text-muted)'
              }}>{tag}</span>
              )}
              </div>
            </div>
          )}
        </div>
      </div>
    </section>);

};

// =============== APP PREVIEW ===============
const AppPreview = () => {
  return (
    <section id="app" style={{ padding: '120px 0', position: 'relative' }}>
      <div className="grid-bg" />
      <div className="wrap" style={{ position: 'relative' }}>
        <div className="sec-head">
          <div className="meta">
            <span className="num">03 / SANDBOX</span>
            <span className="line" />
            <span>INSIDE THE APP</span>
          </div>
          <h2>A no-code 3D sandbox with an AI co-pilot built in.</h2>
          <p>Prompt the world into existence, then refine it like a director. Capture the
            viewport, ask for a re-style, approve, generate a video — all in one place.</p>
        </div>

        <div style={{
          position: 'relative', border: '1px solid var(--accent-line)',
          padding: 14, background: 'oklch(10% 0.018 310)'
        }}>
          <HudCorners color="var(--accent)" />
          <div style={{
            display: 'flex', justifyContent: 'space-between', alignItems: 'center',
            padding: '4px 8px 12px', borderBottom: '1px solid var(--border-soft)', marginBottom: 12
          }}>
            <div style={{ display: 'flex', gap: 18, alignItems: 'center' }}>
              <span className="mono" style={{ fontSize: 11, letterSpacing: '0.2em', color: 'var(--accent)' }}>● GRAPHYTI.APP</span>
              <span className="mono" style={{ fontSize: 11, letterSpacing: '0.2em', color: 'var(--text-dim)' }}>VIEW · AI ASSISTANT</span>
            </div>
            <span className="mono" style={{ fontSize: 11, letterSpacing: '0.18em', color: 'var(--text-dim)' }}>2050 × 1108</span>
          </div>

          <div style={{ position: 'relative', background: '#000', border: '1px solid var(--border)' }}>
            <img
              src="media/app-screenshot.jpg"
              alt="Graphyti app screenshot"
              loading="lazy"
              style={{ width: '100%', display: 'block' }} />
            
            {/* Annotation pins */}
            <Annotation top="6%" left="2%" label="01" tip="Prompt-to-scene workflow" align="right" />
            <Annotation top="44%" left="42%" label="02" tip="Walk the world live · 60FPS" align="right" />
            <Annotation top="14%" left="74%" label="03" tip="AI co-pilot: re-style any viewport" align="left" />
          </div>
        </div>
      </div>
    </section>);

};

const Annotation = ({ top, left, label, tip, align = 'right' }) =>
<div style={{ position: 'absolute', top, left, display: 'flex', alignItems: 'center', gap: 10, flexDirection: align === 'left' ? 'row-reverse' : 'row' }}>
    <div style={{
    width: 22, height: 22, border: '1px solid var(--accent)',
    background: 'rgba(0,0,0,0.7)', color: 'var(--accent)',
    display: 'grid', placeItems: 'center',
    fontFamily: 'JetBrains Mono, monospace', fontSize: 10, fontWeight: 600,
    boxShadow: '0 0 12px var(--accent-glow)'
  }}>{label}</div>
    <div className="mono" style={{
    fontSize: 11, letterSpacing: '0.14em',
    padding: '4px 10px',
    border: '1px solid var(--accent-line)', color: "rgb(255, 255, 255)", background: "rgb(0, 0, 0)", borderColor: "rgb(254, 28, 166)"
  }}>{tip}</div>
  </div>;


// =============== YOUTUBE DEMO ===============
const Demo = () => {
  const [playing, setPlaying] = React.useState(false);
  const videoId = 'JAhphnwPNBY';
  return (
    <section id="demo" style={{ padding: '120px 0', position: 'relative' }}>
      <div className="wrap">
        <div className="sec-head">
          <div className="meta">
            <span className="num">04 / WALKTHROUGH</span>
            <span className="line" />
            <span>SEE IT RUNNING</span>
          </div>
          <h2>A guided walkthrough of the engine.</h2>
          <p>From empty viewport to dataset export, narrated end-to-end.</p>
        </div>

        <div style={{
          position: 'relative', border: '1px solid var(--accent-line)',
          padding: 14, background: 'oklch(10% 0.018 310)'
        }}>
          <HudCorners color="var(--accent)" />
          <div style={{
            display: 'flex', justifyContent: 'space-between', alignItems: 'center',
            padding: '4px 8px 12px', borderBottom: '1px solid var(--border-soft)', marginBottom: 12
          }}>
            <div style={{ display: 'flex', gap: 18, alignItems: 'center' }}>
              <span className="mono" style={{ fontSize: 11, letterSpacing: '0.2em', color: 'var(--accent)' }}>● PLAYBACK</span>
              <span className="mono" style={{ fontSize: 11, letterSpacing: '0.2em', color: 'var(--text-dim)' }}>GRAPHYTI_DEMO_REEL.MP4</span>
            </div>
            <div style={{ display: 'flex', gap: 18 }}>
              <span className="mono" style={{ fontSize: 11, color: 'var(--text-dim)', letterSpacing: '0.18em' }}>CH.01</span>
              <span className="mono" style={{ fontSize: 11, color: 'var(--accent)', letterSpacing: '0.18em' }}>HD</span>
            </div>
          </div>

          <div style={{ position: 'relative', aspectRatio: '16/9', background: '#000' }}>
            {playing ?
            <iframe
              src={`https://www.youtube-nocookie.com/embed/${videoId}?autoplay=1&rel=0&modestbranding=1&playsinline=1`}
              title="Graphyti Demo"
              allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
              allowFullScreen
              referrerPolicy="strict-origin-when-cross-origin"
              style={{ width: '100%', height: '100%', border: 0, display: 'block' }} /> :


            <button
              type="button"
              onClick={() => setPlaying(true)}
              style={{
                position: 'absolute', inset: 0, width: '100%', height: '100%',
                padding: 0, border: 0, cursor: 'pointer', display: 'block',
                background: `url(https://i.ytimg.com/vi/${videoId}/hqdefault.jpg) center/cover no-repeat, #000`
              }}
              aria-label="Play Graphyti demo">
              
                {/* Dark scrim */}
                <div style={{
                position: 'absolute', inset: 0,
                background: 'linear-gradient(180deg, rgba(0,0,0,0.25), rgba(0,0,0,0.65))'
              }} />
                {/* Big play button */}
                <div style={{
                position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)',
                display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 16
              }}>
                  <div style={{
                  width: 92, height: 92, border: '1.5px solid var(--accent)',
                  background: 'rgba(0,0,0,0.55)', backdropFilter: 'blur(4px)',
                  display: 'grid', placeItems: 'center',
                  boxShadow: '0 0 32px var(--accent-glow)',
                  transition: 'transform 0.2s'
                }} className="play-btn">
                    <div style={{
                    width: 0, height: 0,
                    borderTop: '14px solid transparent',
                    borderBottom: '14px solid transparent',
                    borderLeft: '22px solid var(--accent)',
                    marginLeft: 6
                  }} />
                  </div>
                  <div className="mono" style={{ fontSize: 11, letterSpacing: '0.3em', color: 'var(--accent)' }}>▶ PLAY DEMO</div>
                </div>
                {/* HUD overlay */}
                <div style={{ position: 'absolute', top: 12, left: 12, display: 'flex', gap: 12 }}>
                  <span className="mono" style={{ fontSize: 10, color: 'var(--accent)', letterSpacing: '0.18em', background: 'rgba(0,0,0,0.55)', padding: '2px 8px' }}>● STANDBY</span>
                </div>
                <div style={{ position: 'absolute', bottom: 12, left: 12 }}>
                  <span className="mono" style={{ fontSize: 10, color: 'var(--text)', letterSpacing: '0.18em', background: 'rgba(0,0,0,0.55)', padding: '2px 8px' }}>SOURCE: YOUTUBE · 1080P</span>
                </div>
              </button>
            }
          </div>
        </div>
        <style>{`
          .play-btn:hover { transform: scale(1.06); }
        `}</style>
      </div>
    </section>);

};

// =============== PROCEDURAL FEATURES (May update) ===============
const Features = () => {
  const features = [
  {
    n: '01',
    title: 'Urban scene generator',
    body: 'Multi-plot city generator that places, connects, and road-seals several tiles into one coherent urban footprint. Each tile gets zoned — Residential, Commercial, Landmark, Park — each zone with its own style.',
    label: 'URBAN.GEN'
  },
  {
    n: '02',
    title: 'Forest, terrain & rivers',
    body: 'Perlin-noise terrain for realistic uneven ground. Edge-to-edge meandering rivers carved into the mesh. Main, branch, and dead-end path networks. Build wilderness as easily as you build streets.',
    label: 'FOREST.GEN'
  },
  {
    n: '03',
    title: 'Day–night cycle',
    body: 'Automated lighting over a full day. Sun and moon arc across the sky. Realistic sunset and sunrise hues. Run as simulation or scrub manually — integrated with the AI assistant for one-line directorial control.',
    label: 'LIGHT.SIM'
  },
  {
    n: '04',
    title: 'Full weather system',
    body: 'Animated noise particles and depth-faded fog. Rain, snow, seasons, and a growing roster of environmental factors. Set the mood with one prompt.',
    label: 'WEATHER.SYS'
  },
  {
    n: '05',
    title: 'Material & shader play',
    body: 'Toggle a scene into toon-shaded anime, painterly oil paint, or photoreal. Experimenting with more styles every sprint.',
    label: 'SHADER.LAB'
  },
  {
    n: '06',
    title: 'Dataset capture',
    body: 'Render RGB video, segmentation masks, 2D and 3D bounding boxes for any POV — aerial, vehicular, first-person. Drop into any AI training pipeline.',
    label: 'DATA.OUT'
  }];

  return (
    <section id="features" style={{ padding: '120px 0', position: 'relative' }}>
      <div className="wrap">
        <div className="sec-head">
          <div className="meta">
            <span className="num">05 / ENGINE</span>
            <span className="line" />
            <span>PROCEDURAL ALGORITHM SUITE</span>
          </div>
          <h2>The largest suite of procedural generation algorithms — usable from a prompt.</h2>
          <p>True 3D geometry. Layouts and assets controlled by algorithms. Reproducible.
            Controllable. No black-box image hallucinations. The LLM is a co-pilot, not the creator.</p>
        </div>

        <div style={{
          display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 0,
          border: '1px solid var(--border-soft)'
        }}>
          {features.map((f, i) =>
          <div key={i} style={{
            padding: '32px 28px',
            borderRight: i % 3 < 2 ? '1px solid var(--border-soft)' : 'none',
            borderBottom: i < 3 ? '1px solid var(--border-soft)' : 'none',
            background: 'var(--surface)',
            position: 'relative',
            transition: 'background 0.2s'
          }}
          onMouseEnter={(e) => e.currentTarget.style.background = 'var(--surface-2)'}
          onMouseLeave={(e) => e.currentTarget.style.background = 'var(--surface)'}>
            
              <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 24 }}>
                <span className="mono" style={{
                fontSize: 32, color: 'var(--accent)', fontWeight: 600,
                textShadow: '0 0 18px var(--accent-glow)'
              }}>{f.n}</span>
                <span className="mono" style={{ fontSize: 10, letterSpacing: '0.22em', color: 'var(--text-dim)' }}>{f.label}</span>
              </div>
              <h3 style={{ fontSize: 20, margin: '0 0 10px', fontWeight: 600 }}>{f.title}</h3>
              <p style={{ color: 'var(--text-muted)', fontSize: 14, margin: 0, lineHeight: 1.65 }}>{f.body}</p>
            </div>
          )}
        </div>
      </div>
    </section>);

};

// =============== FOUNDERS ===============
const Founders = () => {
  const team = [
  {
    name: 'Howell Chan',
    title: 'CEO',
    role: 'Co-founder · AI & Unity Engineering',
    bio: 'Builds the AI co-pilot and full-stack engine. Former NTU researcher in computer graphics. B.Eng CS + M.Sc. Tech Management @ NTU.',
    photo: 'media/howell.jpg',
    initials: 'HC',
    tag: 'CEO'
  },
  {
    name: 'Eunice Lee',
    title: 'CTO',
    role: 'Co-founder · Graphics & Unity Engineering',
    bio: 'Architects the procedural graphics core. Former NTU researcher in computer graphics. B.Eng CS + M.Sc. Tech Management @ NTU.',
    photo: 'media/eunice.jpg',
    initials: 'EL',
    tag: 'CTO'
  }];

  const wins = [
  { tag: 'WINNER', label: 'Deep Tech Pioneers · Hello Tomorrow' },
  { tag: 'CHAMPIONS', label: 'Port63 Challenge' },
  { tag: '2ND R/U', label: 'Algorand Global Hackathon' },
  { tag: 'BACKED BY', label: 'Microsoft for Startups Founders Hub' }];

  return (
    <section id="founders" style={{ padding: '120px 0', position: 'relative' }}>
      <div className="wrap">
        <div className="sec-head">
          <div className="meta">
            <span className="num">06 / TEAM</span>
            <span className="line" />
            <span>BUILT BY GRAPHICS RESEARCHERS</span>
          </div>
          <h2>Two engineers from NTU. Going full-time at the end of 2026.</h2>
          <p>We've been shipping Graphyti as a side project while winning competitions
            and onboarding pilot conversations. We're now ready to build it as our life's work.</p>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 20 }}>
          {team.map((m, i) =>
          <div key={i} className="card" style={{ padding: '32px 32px 28px', position: 'relative' }}>
              <HudCorners color="var(--accent)" />
              <div style={{ display: 'flex', alignItems: 'flex-start', gap: 24, marginBottom: 20 }}>
                <div style={{
                position: 'relative', width: 160, height: 160, flexShrink: 0,
                border: '1px solid var(--accent-line)', padding: 4,
                background: 'var(--bg-2)'
              }}>
                  <img
                  src={m.photo}
                  alt={m.name}
                  loading="lazy"
                  style={{
                    width: '100%', height: '100%', objectFit: 'cover',
                    display: 'block', filter: 'saturate(0.92) contrast(1.02)'
                  }} />
                
                  <span className="mono" style={{
                  position: 'absolute', top: -1, right: -1,
                  background: 'var(--accent)', color: 'var(--bg)',
                  fontSize: 10, letterSpacing: '0.18em', padding: '3px 8px',
                  fontWeight: 700
                }}>{m.tag}</span>
                  <span className="mono" style={{
                  position: 'absolute', bottom: 8, left: 8,
                  fontSize: 9, letterSpacing: '0.18em', color: 'var(--accent)',
                  background: 'rgba(0,0,0,0.6)', padding: '2px 6px'
                }}>{m.initials}_0{i + 1}</span>
                </div>
                <div style={{ minWidth: 0, flex: 1, paddingTop: 6 }}>
                  <div className="mono" style={{ fontSize: 11, letterSpacing: '0.22em', color: 'var(--accent)', marginBottom: 10 }}>
                    ● {m.title} · CO-FOUNDER
                  </div>
                  <h3 style={{ fontSize: 30, margin: '0 0 6px', fontWeight: 600, letterSpacing: '-0.02em', lineHeight: 1.05 }}>{m.name}</h3>
                  <div style={{ color: 'var(--text-muted)', fontSize: 13, lineHeight: 1.5 }}>{m.role}</div>
                </div>
              </div>
              <p style={{
              color: 'var(--text-muted)', fontSize: 14.5, margin: 0, lineHeight: 1.65,
              paddingTop: 20, borderTop: '1px solid var(--border-soft)'
            }}>{m.bio}</p>
            </div>
          )}
        </div>

        {/* Achievements strip */}
        <div style={{
          marginTop: 28,
          border: '1px solid var(--border)',
          background: 'var(--surface)',
          padding: '24px 28px'
        }}>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 18, flexWrap: 'wrap', gap: 10 }}>
            <div className="mono" style={{ fontSize: 11, letterSpacing: '0.22em', color: 'var(--accent)' }}>
              ◇ RECOGNITION_LOG
            </div>
            <div className="mono" style={{ fontSize: 11, letterSpacing: '0.18em', color: 'var(--text-dim)' }}>
              SHIPPING SINCE 2025 · GRADUATING NTU · END 2026
            </div>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 14 }}>
            {wins.map((w, i) =>
            <div key={i} style={{
              padding: '14px 16px',
              border: '1px solid var(--border-soft)',
              background: 'var(--bg-2)'
            }}>
                <div className="mono" style={{
                fontSize: 10, letterSpacing: '0.22em', color: 'var(--accent)',
                marginBottom: 8
              }}>{w.tag}</div>
                <div style={{ fontSize: 13, color: 'var(--text)', lineHeight: 1.4, fontWeight: 500 }}>{w.label}</div>
              </div>
            )}
          </div>
        </div>
      </div>
    </section>);

};

// =============== WAITLIST ===============
const USE_CASE_LABELS = {
  AI_FILM: 'AI film & video production',
  VIDEO_MODEL: 'Video model pre-viz (Veo / Seedance / Runway)',
  GAME_DEV: 'Game development',
  AUTONOMOUS_VEHICLES: 'Autonomous vehicles',
  DRONES: 'Patrol & surveillance drones',
  CLEANING: 'Urban cleaning robots',
  RESEARCH: 'AI / computer vision research',
  OTHER: 'Other',
};

const Waitlist = ({ formRef }) => {
  const [email, setEmail] = React.useState('');
  const [company, setCompany] = React.useState('');
  const [useCase, setUseCase] = React.useState('AI_FILM');
  const [submitted, setSubmitted] = React.useState(false);
  const [alreadyOnList, setAlreadyOnList] = React.useState(false);
  const [submitting, setSubmitting] = React.useState(false);
  const [error, setError] = React.useState('');

  const submit = async (e) => {
    e.preventDefault();
    if (!email || submitting) return;

    const cfg = (window.ENV && window.ENV.supabase) || window.SUPABASE_CONFIG || {};
    const { url, anonKey } = cfg;
    if (!url || !anonKey) {
      setError('Waitlist is not configured. Fill PUBLIC_SUPABASE_* in .env, then run: npm run env');
      return;
    }

    const base = url.replace(/\/$/, '');
    const record = {
      email: email.trim().toLowerCase(),
      company: company.trim() || null,
      use_case: USE_CASE_LABELS[useCase] || useCase,
    };

    setSubmitting(true);
    setError('');
    try {
      const res = await fetch(`${base}/rest/v1/waitlist_signups`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          apikey: anonKey,
          Authorization: `Bearer ${anonKey}`,
          Prefer: 'return=minimal',
        },
        body: JSON.stringify(record),
      });

      if (res.status === 409) {
        setAlreadyOnList(true);
        setSubmitted(true);
        return;
      }
      if (!res.ok) {
        const detail = await res.text();
        console.error('Waitlist insert failed:', res.status, detail);
        throw new Error('Insert failed');
      }

      setSubmitted(true);
    } catch {
      setError('Could not save your signup. Try again or email hello@graphyti.io.');
    } finally {
      setSubmitting(false);
    }
  };

  return (
    <section ref={formRef} id="waitlist" style={{ padding: '140px 0 120px', position: 'relative', overflow: 'hidden' }}>
      <div className="grid-bg" />
      <div style={{
        position: 'absolute', top: '20%', left: '50%', transform: 'translateX(-50%)',
        width: 800, height: 400,
        background: 'radial-gradient(ellipse, var(--accent-glow), transparent 70%)',
        filter: 'blur(60px)', opacity: 0.7, pointerEvents: 'none'
      }} />
      <div className="wrap" style={{ position: 'relative', maxWidth: 880 }}>
        <div style={{
          background: 'var(--surface)', border: '1px solid var(--accent-line)',
          padding: '56px 56px 48px', position: 'relative'
        }}>
          <HudCorners color="var(--accent)" />
          <div style={{ textAlign: 'center' }}>
            <HudTag>EARLY ACCESS · COHORT 01</HudTag>
            <h2 style={{
              fontSize: 'clamp(36px, 4.5vw, 56px)', lineHeight: 1.05,
              margin: '24px 0 16px', letterSpacing: '-0.025em', fontWeight: 600,
              textWrap: 'balance'
            }}>
              Build a world. Train an intelligence.
            </h2>
            <p style={{ color: 'var(--text-muted)', fontSize: 17, maxWidth: 560, margin: '0 auto 36px' }}>
              Join the waitlist for early access. We're onboarding pilot teams in AI film,
              robotics, and computer vision research through 2026.
            </p>
          </div>

          {submitted ?
          <div style={{
            textAlign: 'center', padding: '32px 24px',
            border: '1px solid var(--accent)', background: 'var(--accent-soft)'
          }}>
              <div className="mono" style={{ fontSize: 11, letterSpacing: '0.22em', color: 'var(--accent)', marginBottom: 12 }}>
                ● {alreadyOnList ? 'ALREADY REGISTERED' : 'SIGNAL ACQUIRED'}
              </div>
              <div style={{ fontSize: 22, marginBottom: 8, fontWeight: 600 }}>
                {alreadyOnList ? 'You\'re already on the list.' : 'You\'re on the list.'}
              </div>
              <div style={{ color: 'var(--text-muted)', fontSize: 14 }}>
                {alreadyOnList
                  ? <>We already have <span className="mono" style={{ color: 'var(--accent)' }}>{email}</span> — no need to sign up again.</>
                  : <>We'll reach out at <span className="mono" style={{ color: 'var(--accent)' }}>{email}</span> when your cohort opens.</>}
              </div>
            </div> :

          <form onSubmit={submit} style={{ display: 'grid', gap: 14 }}>
              <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 14 }}>
                <Field label="EMAIL" required>
                  <input type="email" required value={email} onChange={(e) => setEmail(e.target.value)} placeholder="you@studio.com" />
                </Field>
                <Field label="COMPANY / STUDIO">
                  <input type="text" value={company} onChange={(e) => setCompany(e.target.value)} placeholder="Atlas Pictures" />
                </Field>
              </div>
              <Field label="PRIMARY USE CASE">
                <select value={useCase} onChange={(e) => setUseCase(e.target.value)}>
                  <option value="AI_FILM">AI film &amp; video production</option>
                  <option value="VIDEO_MODEL">Video model pre-viz (Veo / Seedance / Runway)</option>
                  <option value="GAME_DEV">Game development</option>
                  <option value="AUTONOMOUS_VEHICLES">Autonomous vehicles</option>
                  <option value="DRONES">Patrol &amp; surveillance drones</option>
                  <option value="CLEANING">Urban cleaning robots</option>
                  <option value="RESEARCH">AI / computer vision research</option>
                  <option value="OTHER">Other</option>
                </select>
              </Field>
              {error &&
              <div className="mono" style={{ fontSize: 11, letterSpacing: '0.08em', color: 'oklch(78% 0.22 30)', textAlign: 'center', lineHeight: 1.5 }}>
                {error}
              </div>
              }
              <button type="submit" className="btn btn-primary" style={{ marginTop: 8, justifyContent: 'center' }} disabled={submitting}>
                {submitting ? 'Sending…' : <>Request access <span className="arrow">→</span></>}
              </button>
              <div className="mono" style={{ fontSize: 10, letterSpacing: '0.2em', color: 'var(--text-dim)', textAlign: 'center', marginTop: 4 }}>
                NO SPAM · UNSUBSCRIBE ANY TIME · GRAPHYTI.IO
              </div>
            </form>
          }
        </div>
      </div>
      <style>{`
        .field { display: flex; flex-direction: column; gap: 6px; }
        .field label { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.22em; color: var(--text-dim); }
        .field input, .field select {
          width: 100%;
          background: var(--bg-2); border: 1px solid var(--border);
          color: var(--text); padding: 14px 16px; font-size: 15px;
          font-family: 'Space Grotesk', sans-serif; outline: none;
          transition: border-color 0.15s;
          border-radius: 0;
          appearance: none;
        }
        .field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-line); }
        .field input::placeholder { color: var(--text-dim); }
      `}</style>
    </section>);

};

const Field = ({ label, required, children }) =>
<div className="field">
    <label>{label}{required && <span style={{ color: 'var(--accent)', marginLeft: 6 }}>*</span>}</label>
    {children}
  </div>;


// =============== FOOTER ===============
const Footer = () =>
<footer style={{
  borderTop: '1px solid var(--border-soft)', padding: '40px 0 32px',
  background: 'oklch(10% 0.018 310 / 0.6)',
  backdropFilter: 'blur(6px)'
}}>
    <div className="wrap" style={{
    display: 'flex', alignItems: 'center', justifyContent: 'space-between',
    flexWrap: 'wrap', gap: 16
  }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
        <div className="brand-mark" />
        <div>
          <div className="mono" style={{ fontSize: 12, letterSpacing: '0.18em', color: 'var(--text)' }}>GRAPHYTI</div>
          <div className="mono" style={{ fontSize: 10, color: 'var(--text-dim)', letterSpacing: '0.22em', marginTop: 2 }}>3D SYNTHETIC DATA SANDBOX · BUILT IN SINGAPORE</div>
        </div>
      </div>
      <div className="mono" style={{ fontSize: 11, letterSpacing: '0.18em', color: 'var(--text-dim)', display: 'flex', gap: 24 }}>
        <a href="#waitlist" style={{ color: 'inherit', textDecoration: 'none' }}>WAITLIST</a>
        <a href="#scenes" style={{ color: 'inherit', textDecoration: 'none' }}>SCENES</a>
        <a href="mailto:hello@graphyti.io" style={{ color: 'inherit', textDecoration: 'none' }}>HELLO@GRAPHYTI.IO</a>
      </div>
      <div className="mono" style={{ fontSize: 10, letterSpacing: '0.2em', color: 'var(--text-dim)' }}>
        © 2026 GRAPHYTI · ALL SYSTEMS NOMINAL
      </div>
    </div>
  </footer>;


Object.assign(window, {
  Hero, Marquee, RecoveredFootage, FeaturedReel, TwoVerticals, AppPreview, Demo,
  Features, Founders, Waitlist, Footer, Field
});