// v3-site.jsx, App composition, nav, waitlist, trust strip, footer, tweaks.

const {
  BRAND, SAT, SF, MONO,
  useReducedMotion, useInView, useViewport,
  Cortex, Wordmark, Eyebrow,
  SCENES_DATA, HERO_HEADLINES,
  CinematicScene, HeroScene, StatementStrip, PromiseLines, ImagineLine, ComparisonSection, MindModel, HowItWorks, PaysForItself, FAQSection, FounderNote,
  useTweaks, TweaksPanel, TweakSection, TweakRadio, TweakToggle, TweakSelect
} = window;

const { useState, useRef, useEffect, useMemo } = React;

// Keyframes used by the generic-AI / Lantic comparison.
if (typeof document !== 'undefined' && !document.getElementById('nc-kf')) {
  const s = document.createElement('style'); s.id = 'nc-kf';
  s.textContent = `
    @keyframes nc-blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }
    @keyframes nc-eq { 0%,100%{ transform: scaleY(0.32); } 50%{ transform: scaleY(1); } }
    @keyframes nc-ring { 0%{ transform: scale(0.78); opacity:.55; } 100%{ transform: scale(1.9); opacity:0; } }
    @keyframes nc-swipe { 0%{ opacity:0; transform: translateY(14px); } 100%{ opacity:1; transform: none; } }
  `;
  document.head.appendChild(s);
}

const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
  "heroVariant": "default",
  "motion": "active",
  "voice": "mate",
  "heroPersona": "v1",
  "showOverlayOrb": true
}/*EDITMODE-END*/;

// ─────────────────────────────────────────────────────────────────
// Top nav, minimal, sticky. Wordmark left, waitlist CTA right.
// ─────────────────────────────────────────────────────────────────
function Nav({ onCTA }) {
  const [scrolled, setScrolled] = useState(false);
  const vw = useViewport();
  const compact = vw < 720;
  useEffect(() => {
    const on = () => setScrolled(window.scrollY > 40);
    window.addEventListener('scroll', on, { passive: true }); on();
    return () => window.removeEventListener('scroll', on);
  }, []);
  return (
    <nav style={{
      position: 'fixed', top: 0, left: 0, right: 0, zIndex: 60,
      padding: compact ? '14px 20px' : '18px 36px',
      display: 'flex', alignItems: 'center', justifyContent: 'space-between',
      background: scrolled ? 'rgba(5,11,23,.72)' : 'transparent',
      backdropFilter: scrolled ? 'blur(22px) saturate(160%)' : 'none',
      WebkitBackdropFilter: scrolled ? 'blur(22px) saturate(160%)' : 'none',
      borderBottom: `1px solid ${scrolled ? BRAND.hair : 'transparent'}`,
      transition: 'background 280ms ease, border-color 280ms ease, padding 280ms ease'
    }}>
      <a href="#hero" onClick={(e) => { e.preventDefault(); window.scrollTo({ top: 0, behavior: 'smooth' }); }}
        style={{ display: 'inline-flex', alignItems: 'center', gap: 12, cursor: 'pointer' }}>
        <Wordmark size={compact ? 26 : 28}/>
      </a>
      <div style={{ display: 'flex', alignItems: 'center', gap: compact ? 10 : 20 }}>
        {!compact && (
          <div style={{
            display: 'inline-flex', alignItems: 'center', gap: 8,
            fontFamily: MONO, fontSize: 10.5, color: BRAND.skyMist,
            letterSpacing: '0.24em', fontWeight: 600, textTransform: 'uppercase',
            padding: '6px 11px', borderRadius: 14,
            background: 'rgba(56,189,248,.08)', border: '1px solid rgba(56,189,248,.20)'
          }}>
            <span style={{
              width: 6, height: 6, borderRadius: 4, background: BRAND.skyLight,
              boxShadow: `0 0 8px ${BRAND.skyLight}`, animation: 'v3-tick-dot 1.8s ease-in-out infinite'
            }}/>
            Private waitlist · launching soon
          </div>
        )}
        <button onClick={onCTA} style={{
          height: compact ? 36 : 40, padding: compact ? '0 14px' : '0 20px',
          borderRadius: 22,
          background: `linear-gradient(135deg, ${BRAND.skyLight} 0%, ${BRAND.skyDeep} 100%)`,
          color: '#FFFFFF', border: '1px solid rgba(255,255,255,.18)',
          fontSize: compact ? 13 : 14, fontWeight: 600, letterSpacing: -0.1,
          cursor: 'pointer',
          boxShadow: `0 8px 24px ${BRAND.skyDark}66, inset 0 1px 0 rgba(255,255,255,.18)`
        }}>{compact ? 'Waitlist' : 'Join the waitlist'}</button>
      </div>
    </nav>
  );
}

// ─────────────────────────────────────────────────────────────────
// NotChat, Generic AI vs. Lantic.
// ─────────────────────────────────────────────────────────────────
function NotChat() {
  const ref = useRef(null);
  const inView = useInView(ref, 0.28);
  const reduced = useReducedMotion();
  const vw = useViewport();
  const phone = vw < 640;

  // What Lantic surfaces on its own — colour-keyed to the lobe system from S6.
  const nudges = [
    { k: 'MONEY',  col: '#10B981', t: 'Morrison was 8 days over. I chased it, it’s in.' },
    { k: 'FAMILY', col: '#FB923C', t: 'Sophie’s game is Friday 4pm. Don’t miss this one.' },
    { k: 'TEAM',   col: '#7DD3FC', t: 'Friday’s cover is sorted with Jordan’s Lantic. No call needed.' },
  ];
  const [ni, setNi] = useState(0);
  useEffect(() => {
    if (!inView || reduced) return;
    const t = setInterval(() => setNi(p => (p + 1) % nudges.length), 3000);
    return () => clearInterval(t);
  }, [inView, reduced]);
  const active = nudges[ni];

  return (
    <section ref={ref} style={{
      position: 'relative', padding: phone ? '104px 20px 116px' : '160px 32px 180px',
      background: BRAND.canvasDeep, overflow: 'hidden'
    }}>
      <div style={{
        position: 'absolute', inset: 0,
        background: `radial-gradient(ellipse 55% 50% at 75% 38%, ${BRAND.skyDark}28 0%, transparent 60%)`
      }}/>
      <div style={{
        maxWidth: 1180, margin: '0 auto', display: 'grid',
        gridTemplateColumns: phone ? '1fr' : 'repeat(auto-fit, minmax(min(360px, 100%), 1fr))',
        gap: phone ? 44 : 72,
        alignItems: 'start', position: 'relative'
      }}>
        {/* LEFT — generic AI: a frozen, empty box that waits */}
        <div style={{ filter: 'grayscale(0.7)', opacity: 0.92 }}>
          <div style={{
            fontFamily: MONO, fontSize: 10.5, color: BRAND.dim,
            letterSpacing: '0.24em', fontWeight: 600, textTransform: 'uppercase',
            marginBottom: 14
          }}>Generic AI assistants</div>
          <div style={{
            fontFamily: SAT, fontWeight: 600, fontSize: 'clamp(28px, 3.4vw, 42px)',
            letterSpacing: -1.4, lineHeight: 1.1, color: BRAND.sub, marginBottom: 18
          }}>
            A blank box that waits<br/>for you to type.
          </div>

          <div style={{
            fontFamily: SF, fontSize: 16.5, lineHeight: 1.55, color: BRAND.dim,
            maxWidth: 460, textWrap: 'pretty', marginBottom: 26
          }}>
            Helpful when you ask. Blind to everything else.
          </div>

          {/* what a tool-you-call can't do on its own */}
          <div style={{ marginBottom: 28 }}>
            <div style={{
              fontFamily: MONO, fontSize: 10, color: BRAND.dim,
              letterSpacing: '0.2em', fontWeight: 600, textTransform: 'uppercase',
              marginBottom: 16
            }}>What it can’t do for you</div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 13 }}>
              {[
                'You have to ask first. It only knows what you type.',
                'It can’t connect to your world.',
                'It doesn’t remember your world.',
                'It can’t reach your team.',
              ].map(t => (
                <div key={t} style={{ display: 'flex', alignItems: 'flex-start', gap: 12 }}>
                  <span style={{
                    width: 18, height: 18, borderRadius: '50%', flex: '0 0 auto', marginTop: 1,
                    border: '1.5px solid rgba(255,255,255,.18)',
                    display: 'flex', alignItems: 'center', justifyContent: 'center'
                  }}>
                    <svg width="9" height="9" viewBox="0 0 24 24" fill="none">
                      <path d="M6 6l12 12M18 6L6 18" stroke="rgba(248,250,252,.4)" strokeWidth="2.4" strokeLinecap="round"/>
                    </svg>
                  </span>
                  <span style={{
                    fontFamily: SF, fontSize: 15, color: BRAND.sub, letterSpacing: -0.1, lineHeight: 1.4
                  }}>{t}</span>
                </div>
              ))}
            </div>
          </div>

          {/* an empty chat surface — nothing happens until you act */}
          <div style={{
            borderRadius: 16, overflow: 'hidden',
            background: 'rgba(255,255,255,.022)', border: '1px solid rgba(255,255,255,.07)'
          }}>
            <div style={{
              display: 'flex', alignItems: 'center', gap: 9, padding: '13px 16px',
              borderBottom: '1px solid rgba(255,255,255,.06)'
            }}>
              <span style={{ width: 8, height: 8, borderRadius: 4, background: 'rgba(255,255,255,.16)' }}/>
              <span style={{ fontFamily: SF, fontSize: 12.5, color: BRAND.faint }}>New chat</span>
            </div>
            <div style={{
              minHeight: phone ? 132 : 178, display: 'flex', alignItems: 'center', justifyContent: 'center',
              padding: 22
            }}>
              <span style={{
                fontFamily: SF, fontSize: 13.5, lineHeight: 1.55, textAlign: 'center',
                color: 'rgba(255,255,255,.20)'
              }}>Empty until you ask.<br/>It knows nothing about your day.</span>
            </div>
            <div style={{
              margin: '0 14px 14px', height: 44, borderRadius: 12,
              background: 'rgba(255,255,255,.04)', border: '1px solid rgba(255,255,255,.09)',
              display: 'flex', alignItems: 'center', padding: '0 14px'
            }}>
              <span style={{ fontFamily: SF, fontSize: 13.5, color: BRAND.faint }}>Ask anything…</span>
              <span style={{
                width: 1.5, height: 17, background: BRAND.sub, marginLeft: 2,
                animation: reduced ? 'none' : 'nc-blink 1.1s step-end infinite'
              }}/>
            </div>
          </div>

          <div style={{
            marginTop: 16, fontFamily: SF, fontSize: 14.5, color: BRAND.dim,
            lineHeight: 1.55, fontStyle: 'italic'
          }}>You have to know the question. Every time.</div>
        </div>

        {/* RIGHT — Lantic: proactive, alive, comes to you (no input box) */}
        <div>
          <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 16 }}>
            <span style={{
              fontFamily: MONO, fontSize: 10.5, color: BRAND.skyMist,
              letterSpacing: '0.24em', fontWeight: 600, textTransform: 'uppercase'
            }}>Lantic</span>
            <span style={{
              display: 'inline-flex', alignItems: 'center', gap: 7, marginLeft: 2,
              padding: '4px 10px', borderRadius: 12,
              background: 'rgba(56,189,248,.12)', border: '1px solid rgba(56,189,248,.26)',
              fontFamily: MONO, fontSize: 9.5, color: BRAND.skyMist, letterSpacing: '0.18em', fontWeight: 600
            }}>
              <span style={{ width: 6, height: 6, borderRadius: 3, background: BRAND.skyLight,
                boxShadow: `0 0 8px ${BRAND.skyLight}`, animation: reduced ? 'none' : 'v3-tick-dot 1.6s ease-in-out infinite' }}/>
              WORKING NOW
            </span>
          </div>

          <div style={{
            fontFamily: SAT, fontWeight: 600, fontSize: 'clamp(28px, 3.4vw, 42px)',
            letterSpacing: -1.6, lineHeight: 1.1, color: BRAND.ink, marginBottom: 18,
            textWrap: 'balance'
          }}>
            A human personal assistant.<br/>
            <span style={{
              background: `linear-gradient(110deg, ${BRAND.skyMist} 0%, ${BRAND.skyLight} 60%, ${BRAND.skyMist} 100%)`,
              WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent',
              fontStyle: 'italic', fontWeight: 500
            }}>Who happens to be AI.</span>
          </div>
          <div style={{
            fontFamily: SF, fontSize: 16.5, lineHeight: 1.55, color: BRAND.sub,
            maxWidth: 540, textWrap: 'pretty', marginBottom: 28
          }}>
            You never opened it. It speaks first, surfacing the things you didn’t
            know to ask about.
          </div>

          {/* the orb, talking — with one nudge auto-swiping beneath it */}
          <div style={{
            borderRadius: 20, padding: phone ? '30px 22px 24px' : '38px 32px 28px',
            background: `linear-gradient(168deg, ${active.col}14 0%, rgba(255,255,255,.022) 70%)`,
            border: '1px solid rgba(255,255,255,.08)',
            transition: 'background 600ms ease',
            display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center'
          }}>
            {/* speaking orb */}
            <div style={{ position: 'relative', width: 104, height: 104,
              display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
              {!reduced && [0, 1].map(r => (
                <span key={r} aria-hidden style={{
                  position: 'absolute', inset: 0, borderRadius: '50%',
                  border: `1.5px solid ${active.col}`,
                  animation: `nc-ring 2.4s ease-out ${r * 1.2}s infinite`
                }}/>
              ))}
              <Cortex size={92} animate={!reduced} glowLobe={active.col} glowAlpha={0.85}/>
            </div>

            {/* waveform — Lantic is speaking */}
            <div style={{ display: 'flex', alignItems: 'flex-end', gap: 4, height: 22, marginTop: 18 }}>
              {[0, 1, 2, 3, 4, 5, 6].map(b => (
                <span key={b} style={{
                  width: 3, height: 22, borderRadius: 2, background: active.col,
                  transformOrigin: 'center bottom', opacity: 0.85,
                  animation: reduced ? 'none' : `nc-eq ${0.9 + (b % 3) * 0.18}s ease-in-out ${b * 0.09}s infinite`
                }}/>
              ))}
            </div>

            {/* the spoken nudge — re-keyed so each one swipes in */}
            <div key={ni} style={{ marginTop: 20, minHeight: phone ? 76 : 70, animation: reduced ? 'none' : 'nc-swipe 480ms cubic-bezier(.22,1,.36,1)' }}>
              <div style={{ fontFamily: MONO, fontSize: 9.5, color: active.col,
                letterSpacing: '0.22em', fontWeight: 700, marginBottom: 9 }}>{active.k}</div>
              <div style={{ fontFamily: SAT, fontWeight: 500, fontSize: phone ? 18 : 20,
                lineHeight: 1.32, letterSpacing: -0.5, color: BRAND.ink, textWrap: 'balance',
                maxWidth: 360 }}>“{active.t}”</div>
            </div>

            {/* progress dots */}
            <div style={{ display: 'flex', gap: 7, marginTop: 18 }}>
              {nudges.map((n, i) => (
                <button key={n.k} onClick={() => setNi(i)} aria-label={n.k} style={{
                  width: i === ni ? 22 : 7, height: 7, borderRadius: 5, padding: 0, border: 'none', cursor: 'pointer',
                  background: i === ni ? n.col : 'rgba(255,255,255,.2)',
                  boxShadow: i === ni ? `0 0 9px ${n.col}` : 'none',
                  transition: 'all 360ms cubic-bezier(.22,1,.36,1)'
                }}/>
              ))}
            </div>
          </div>

          <div style={{
            marginTop: 18, fontFamily: SF, fontSize: 14.5, color: BRAND.sub,
            lineHeight: 1.55, fontStyle: 'italic'
          }}>
            Lantic already knew to{' '}
            <span style={{ fontStyle: 'normal', fontWeight: 600, color: BRAND.ink }}>tell you.</span>
          </div>
        </div>
      </div>
    </section>
  );
}

// ─────────────────────────────────────────────────────────────────
// TrustStrip, the data promise. Tight, confident, no marketing.
// ─────────────────────────────────────────────────────────────────
function TrustStrip() {
  const ref = useRef(null);
  const inView = useInView(ref, 0.3);
  const vw = useViewport();
  const phone = vw < 640;
  const items = [
    { k: 'Encrypted', v: 'Your data never leaves Lantic. End-to-end.' },
    { k: 'Forgettable', v: 'Ask Lantic to forget anything, or everything, forever.' },
    { k: 'Yours', v: 'Never sold. Never used to train other people’s models.' },
  ];
  return (
    <section ref={ref} style={{
      position: 'relative', padding: phone ? '84px 20px' : '120px 32px',
      background: BRAND.canvasDeep,
      borderTop: `1px solid ${BRAND.hair}`, borderBottom: `1px solid ${BRAND.hair}`
    }}>
      <div style={{ maxWidth: 1080, margin: '0 auto' }}>
        <div style={{
          fontFamily: MONO, fontSize: 11, color: BRAND.skyMist,
          letterSpacing: '0.28em', fontWeight: 600, textTransform: 'uppercase',
          marginBottom: 28
        }}>A promise, in three lines</div>
        <div style={{
          fontFamily: SAT, fontWeight: 500, fontSize: 'clamp(28px, 3.6vw, 48px)',
          letterSpacing: -1.6, lineHeight: 1.18, color: BRAND.ink,
          maxWidth: 880, marginBottom: phone ? 40 : 56, textWrap: 'balance'
        }}>
          Lantic learns more about you than any tool you’ve used.
          That trust runs one way, from us to you.
        </div>
        <div style={{
          display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(240px, 100%), 1fr))', gap: phone ? 26 : 36
        }}>
          {items.map((it, i) => (
            <div key={i} style={{
              transition: `opacity 800ms ease ${i * 140}ms, transform 800ms ease ${i * 140}ms`,
              borderTop: `1px solid ${BRAND.skyDark}66`, paddingTop: 22
            }}>
              <div style={{
                fontFamily: MONO, fontSize: 11, color: BRAND.skyLight,
                letterSpacing: '0.2em', fontWeight: 600, textTransform: 'uppercase',
                marginBottom: 12
              }}>{it.k}</div>
              <div style={{
                fontFamily: SF, fontSize: 19, lineHeight: 1.45, color: BRAND.ink,
                fontWeight: 500, letterSpacing: -0.2, textWrap: 'pretty'
              }}>{it.v}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

// ─────────────────────────────────────────────────────────────────
// WaitlistSection, email + role + optional excitement.
// ─────────────────────────────────────────────────────────────────
function WaitlistSection() {
  const ref = useRef(null);
  const inView = useInView(ref, 0.2);
  const vw = useViewport();
  const phone = vw < 640;
  const [email, setEmail] = useState('');
  const [role, setRole] = useState(null);
  const [excited, setExcited] = useState('');
  const [submitted, setSubmitted] = useState(false);
  const [submitting, setSubmitting] = useState(false);
  const roles = ['Builder', 'SMB Owner', 'Corporate', 'Clinic / Practice', 'Other'];

  // Posts to Netlify Forms. The hidden static <form name="waitlist"> in index.html
  // is detected at deploy time; this fetch routes here via form-name. Submissions
  // are emailed to lantic.admin@gmail.com (configured in Netlify dashboard).
  const onSubmit = async (e) => {
    e.preventDefault();
    if (!email || !role || submitting) return;
    setSubmitting(true);

    const body = new URLSearchParams({
      'form-name': 'waitlist',
      'bot-field': '',
      email: email,
      role: role,
      hand_over_first: excited || '',
      page_url: typeof window !== 'undefined' ? window.location.href : '',
      submitted_at: new Date().toISOString(),
    }).toString();

    try {
      await fetch('/', {
        method: 'POST',
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
        body: body,
      });
    } catch (err) {
      // Soft-fail: still show the thank-you state so the visitor isn't stuck.
      // Netlify queues most submissions even when fetch reports an error.
      console.error('Waitlist submission error:', err);
    } finally {
      setSubmitted(true);
      setSubmitting(false);
      // Fire Clarity custom event so we can see conversions in heatmaps.
      if (typeof window !== 'undefined' && window.clarity) {
        try { window.clarity('event', 'waitlist_submitted'); } catch (_) {}
      }
    }
  };

  return (
    <section ref={ref} id="waitlist" style={{
      position: 'relative', padding: phone ? '110px 20px 92px' : '160px 32px 120px',
      background: BRAND.canvasDeep, overflow: 'hidden'
    }}>
      <div style={{
        position: 'absolute', inset: 0,
        background: `radial-gradient(ellipse 60% 60% at 50% 30%, ${BRAND.skyDark}33 0%, transparent 65%)`
      }}/>
      <div style={{
        maxWidth: 720, margin: '0 auto', position: 'relative',
        textAlign: 'center'
      }}>
        <div style={{ display: 'flex', justifyContent: 'center', marginBottom: 28 }}>
          <Cortex size={92}/>
        </div>
        <div style={{
          fontFamily: MONO, fontSize: 11, color: BRAND.skyMist,
          letterSpacing: '0.28em', fontWeight: 600, textTransform: 'uppercase',
          marginBottom: 24
        }}>Private rollout</div>
        <h2 style={{
          fontFamily: SAT, fontWeight: 600, fontSize: 'clamp(40px, 5.4vw, 68px)',
          letterSpacing: -2.4, lineHeight: 1.04, color: BRAND.ink,
          margin: '0 0 22px', textWrap: 'balance'
        }}>
          Lantic is rolling out to a small group first.<br/>
          <span style={{
            background: `linear-gradient(110deg, ${BRAND.skyMist} 0%, ${BRAND.skyLight} 50%, ${BRAND.skyMist} 100%)`,
            WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent',
            fontStyle: 'italic', fontWeight: 500
          }}>Be one of them.</span>
        </h2>
        <div style={{
          fontFamily: SF, fontSize: 17, lineHeight: 1.55, color: BRAND.sub,
          maxWidth: 540, margin: '0 auto 48px', textWrap: 'pretty'
        }}>
          We’re onboarding founders, clinic owners, builders, and operators by hand.
          Tell us about you, we’ll write back when there’s something real to say.
        </div>

        {!submitted ? (
          <form name="waitlist" method="POST" onSubmit={onSubmit}
            data-netlify="true" data-netlify-honeypot="bot-field" style={{
            display: 'flex', flexDirection: 'column', gap: 16,
            maxWidth: 480, margin: '0 auto', textAlign: 'left'
          }}>
            {/* Netlify form identifier + honeypot — handled by index.html schema */}
            <input type="hidden" name="form-name" value="waitlist"/>
            <p style={{ display: 'none' }}>
              <label>Don't fill this out: <input name="bot-field"/></label>
            </p>

            <label style={{ display: 'block' }}>
              <div style={fieldLabel}>Email</div>
              <input type="email" name="email" required value={email} onChange={(e) => setEmail(e.target.value)}
                placeholder="you@yourcompany.com" style={fieldInput}/>
            </label>

            <div>
              <div style={fieldLabel}>You’re a…</div>
              <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
                {roles.map(r => (
                  <button type="button" key={r} onClick={() => setRole(r)} style={{
                    height: 38, padding: '0 14px', borderRadius: 19,
                    fontFamily: SF, fontSize: 13.5, fontWeight: 500, letterSpacing: -0.1, cursor: 'pointer',
                    background: role === r ? `linear-gradient(135deg, ${BRAND.skyLight}33 0%, ${BRAND.skyDeep}22 100%)` : 'rgba(255,255,255,.04)',
                    color: role === r ? BRAND.ink : BRAND.sub,
                    border: `1px solid ${role === r ? 'rgba(56,189,248,.55)' : 'rgba(255,255,255,.08)'}`,
                    boxShadow: role === r ? `0 0 24px ${BRAND.skyDark}55` : 'none',
                    transition: 'all 240ms ease'
                  }}>{r}</button>
                ))}
              </div>
            </div>

            <label style={{ display: 'block' }}>
              <div style={fieldLabel}>What’s the one thing you’d hand over first?  <span style={{ color: BRAND.faint, textTransform: 'none', letterSpacing: 'normal', fontSize: 11 }}>optional</span></div>
              <input type="text" name="hand_over_first" value={excited} onChange={(e) => setExcited(e.target.value)}
                placeholder="Email triage, my calendar, supplier negotiations…" style={fieldInput}/>
            </label>
            {/* Hidden field passes the chosen role into Netlify form submission */}
            <input type="hidden" name="role" value={role || ''}/>

            <button type="submit" disabled={!email || !role || submitting} style={{
              height: 54, marginTop: 12, borderRadius: 28,
              background: (!email || !role || submitting)
                ? 'rgba(255,255,255,.06)'
                : `linear-gradient(135deg, ${BRAND.skyLight} 0%, ${BRAND.skyDeep} 100%)`,
              color: '#FFFFFF', border: '1px solid rgba(255,255,255,.18)',
              fontSize: 16, fontWeight: 600, letterSpacing: -0.15,
              cursor: (!email || !role || submitting) ? 'not-allowed' : 'pointer',
              boxShadow: (!email || !role || submitting) ? 'none' : `0 12px 40px ${BRAND.skyDark}88, inset 0 1px 0 rgba(255,255,255,.2)`,
              opacity: (!email || !role || submitting) ? 0.6 : 1,
              transition: 'all 240ms ease'
            }}>{submitting ? 'Reserving…' : 'Reserve your place'}</button>

            <div style={{
              fontSize: 12, color: BRAND.dim, textAlign: 'center', marginTop: 8, lineHeight: 1.5
            }}>
              By joining, you agree to be contacted about Lantic.
              See our <a href="/privacy.html" style={{ color: BRAND.skyMist, textDecoration: 'underline', textDecorationColor: 'rgba(186,230,253,.4)' }}>privacy notice</a>.
            </div>
          </form>
        ) : (
          <div style={{
            maxWidth: 480, margin: '0 auto', padding: 32, borderRadius: 18,
            background: `linear-gradient(135deg, rgba(56,189,248,.12) 0%, rgba(8,145,178,.06) 100%)`,
            border: '1px solid rgba(56,189,248,.28)',
            textAlign: 'center'
          }}>
            <div style={{
              fontFamily: SAT, fontWeight: 600, fontSize: 26, letterSpacing: -1, color: BRAND.ink,
              marginBottom: 10
            }}>You’re on the list.</div>
            <div style={{
              fontFamily: SF, fontSize: 15, color: BRAND.sub, lineHeight: 1.5
            }}>We’ll write when there’s something real to say. Promise.</div>
          </div>
        )}

        <div style={{
          marginTop: 56, fontFamily: MONO, fontSize: 11.5, color: BRAND.dim,
          letterSpacing: '0.16em', textTransform: 'uppercase', fontWeight: 500,
          lineHeight: 1.6, maxWidth: 580, marginLeft: 'auto', marginRight: 'auto'
        }}>
          Your data never leaves Lantic.<br/>
          Ask Lantic to forget anything, or everything, forever.
        </div>
      </div>
    </section>
  );
}

const fieldLabel = {
  fontFamily: MONO, fontSize: 10.5, color: BRAND.skyMist,
  letterSpacing: '0.22em', fontWeight: 600, textTransform: 'uppercase',
  marginBottom: 8, display: 'block'
};
const fieldInput = {
  width: '100%', height: 50, padding: '0 18px', borderRadius: 12,
  background: 'rgba(255,255,255,.04)', border: '1px solid rgba(255,255,255,.10)',
  color: BRAND.ink, fontSize: 15.5, letterSpacing: -0.15,
  outline: 'none', transition: 'all 200ms ease'
};

// ─────────────────────────────────────────────────────────────────
// Footer, quiet, single-line.
// ─────────────────────────────────────────────────────────────────
function Footer() {
  return (
    <footer style={{
      padding: '52px 22px', borderTop: `1px solid ${BRAND.hair}`,
      display: 'flex', flexWrap: 'wrap', gap: 18,
      justifyContent: 'space-between', alignItems: 'center'
    }}>
      <Wordmark size={20}/>
      <div style={{ display: 'flex', gap: 24, fontFamily: SF, fontSize: 13, color: BRAND.dim }}>
        <a href="/privacy.html">Privacy</a>
        <a href="mailto:hello@lantic.app">hello@lantic.app</a>
      </div>
      <div style={{ fontFamily: MONO, fontSize: 11, color: BRAND.faint, letterSpacing: '0.16em', textTransform: 'uppercase' }}>
        © Lantic, 2026
      </div>
    </footer>
  );
}

// ─────────────────────────────────────────────────────────────────
// App
// ─────────────────────────────────────────────────────────────────
function App() {
  const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);

  const goToWaitlist = () => {
    document.getElementById('waitlist')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
  };

  const headline = HERO_HEADLINES[t.heroVariant] || HERO_HEADLINES.default;
  const heroScene = SCENES_DATA[0];
  const otherScenes = SCENES_DATA.slice(1);

  return (
    <div>
      <Nav onCTA={goToWaitlist}/>

      <HeroScene scene={heroScene} headline={headline} onCTA={goToWaitlist}
        motionIntensity={t.motion} showOrb={t.showOverlayOrb}/>

      {/* H2 — pain point, moved up directly under the hero */}
      <StatementStrip
        eyebrow="The quiet cost of busy"
        sub="Most of it disappears into small, forgettable work. Lantic takes that off your hands and gives back your sharpest hours, the time worth spending on growing your business, and on your own health.">
        Your time is worth more<br/>
        than your money.
      </StatementStrip>

      {/* H3 — the comparison: one owner, two versions of the same day */}
      <ComparisonSection/>

      {/* H4 — statement: Lantic is not another generic AI (S2-style typographic moment) */}
      <StatementStrip
        eyebrow="Not another chatbot"
        sub="It doesn’t sit there waiting for a prompt. Lantic knows your world, watches what matters, and tells you first. You just react.">
        Lantic isn’t another<br/>
        generic AI.
      </StatementStrip>

      {/* H5 — generic-AI vs Lantic: a blank box, and a human */}
      <NotChat/>

      {/* H6 — the mental model: one mind for your whole world */}
      <MindModel/>

      {/* H7 — how it works + the real product + the control line (you approve, it acts) */}
      <HowItWorks/>

      {/* H8 — the money / nothing-slips value beat */}
      <PaysForItself/>

      {/* the proactive promise + the imagine beat, now the reflective close to the mind-model */}
      <PromiseLines/>

      <ImagineLine/>

      {/* Day-in-the-life cinematic scenes (Doctor, Shop Owner, Director, Team, Walk) — HIDDEN for now, kept in code.
      {otherScenes.map(scene => (
        <CinematicScene key={scene.id} scene={scene}
          motionIntensity={t.motion} showCortex={t.showOverlayOrb}/>
      ))}
      */}

      <TrustStrip/>

      <FAQSection/>

      {/* founder's note — HIDDEN for now, kept in code. Re-enable when copy + name are final.
      <FounderNote/>
      */}

      <WaitlistSection/>

      <Footer/>

      <TweaksPanel title="Tweaks">
        <TweakSection label="Hero"/>
        <TweakRadio label="Headline" value={t.heroVariant}
          options={['default', 'relief', 'cofounder']}
          onChange={(v) => setTweak('heroVariant', v)}/>
        <TweakRadio label="Hero persona" value={t.heroPersona}
          options={['v1', 'v2', 'v3']}
          onChange={(v) => setTweak('heroPersona', v)}/>

        <TweakSection label="Motion"/>
        <TweakRadio label="Intensity" value={t.motion}
          options={['calm', 'standard', 'active']}
          onChange={(v) => setTweak('motion', v)}/>
        <TweakToggle label="Cortex orb" value={t.showOverlayOrb}
          onChange={(v) => setTweak('showOverlayOrb', v)}/>

        <TweakSection label="Lantic"/>
        <TweakRadio label="Voice tone" value={t.voice}
          options={['mate', 'cofounder', 'professional']}
          onChange={(v) => setTweak('voice', v)}/>
      </TweaksPanel>
    </div>
  );
}

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