function Words({ text, base = 0, cls = "" }) {
  return text.split(" ").map((w, i) => <React.Fragment key={i}><span className="w"><span className={cls} style={{ "--d": base + i * 80 + "ms" }}>{w}</span></span>{" "}</React.Fragment>);
}

function Hero() {
  const tilt = React.useRef(null);
  React.useEffect(() => {
    let raf; const f = () => { cancelAnimationFrame(raf); raf = requestAnimationFrame(() => { const t = Math.max(0, Math.min(1, 1 - window.scrollY / 520)); tilt.current && tilt.current.style.setProperty("--t", t.toFixed(3)); }); };
    f(); window.addEventListener("scroll", f, { passive: true }); return () => window.removeEventListener("scroll", f);
  }, []);
  return (
    <section id="top" className="hero" data-screen-label="Hero">
      <div className="hero-lines"></div>
      <div className="wrap hero-c">
        <span className="badge fade" style={{ "--d": "0ms" }}><span className="pill"><Icon name="Rocket" size={12} />Launching 28th December 2026</span><span className="pad">500 spots open<Icon name="ArrowRight" size={13} /></span></span>
        <h1 className="h1"><span className="ln"><Words text="Find Your Next Investor" base={120} /></span><span className="ln"><Words text="in Minutes, Not Months." base={460} cls="hl" /></span></h1>
        <p className="hero-sub fade" style={{ "--d": "900ms" }}>Leverage our AI platform to find and connect with over <strong>200,000+ verified investors</strong> — spend less time researching and more time closing rounds.</p>
        <div className="ctas fade" style={{ "--d": "1050ms" }}>
          <Button variant="primary" size="lg" arrow href={CH.APP} target="_blank" style={{ height: 52 }}>Get Early Access</Button>
          <a className="btn-glass" href="#how-it-works"><Icon name="Play" size={16} />See How It Works</a>
        </div>
        <div className="nudge fade" style={{ "--d": "1200ms" }}>
          <div style={{ display: "flex" }}>{CH.founders.map((s, i) => <Photo key={i} src={s} name="F" size={30} style={{ marginLeft: i ? -9 : 0, boxShadow: "0 0 0 2px #fff" }} />)}</div>
          <div style={{ textAlign: "left" }}><div className="stars">{[0, 1, 2, 3, 4].map(i => <Icon key={i} name="Star" size={13} fill="currentColor" />)}</div><span>Join <b>2,000+ founders</b> already raising smarter</span></div>
        </div>
      </div>
      <div className="stage fade" style={{ "--d": "700ms" }}>
                <div ref={tilt} className="tilt" style={{ position: "relative" }}><HeroApp /><HeroFloats /></div>
      </div>
    </section>
  );
}

function ClientChip({ c }) {
  const hue = ["#1E3A8A", "#0F766E", "#A16207", "#6D28D9", "#C2410C", "#2563EB", "#047857", "#475569"][c.name.length % 8];
  return (
    <div className="logo-chip">
      {c.img ? <img src={c.img} alt="" style={{ height: c.only ? 22 : 26 }} /> : <span className="mono-mark" style={{ background: hue }}>{c.name[0]}</span>}
      {!c.only && <b>{c.name}</b>}
      <small>{c.d}</small>
    </div>
  );
}

function Proof() {
  return (
    <section className="sec" style={{ paddingTop: 96, paddingBottom: 72 }} aria-label="Founders who trust Capital Hunt" data-screen-label="Social proof">
      <div className="wrap" style={{ display: "flex", justifyContent: "center" }}>
        <div className="rv" style={{ display: "inline-flex", alignItems: "center", gap: 18, height: 64, padding: "0 28px 0 12px", borderRadius: 999, background: "#fff", border: "1px solid var(--border-subtle)", boxShadow: "0 10px 34px rgba(15,23,42,.06)" }}>
          <div style={{ display: "flex" }}>{CH.founders.map((s, i) => <Photo key={i} src={s} name="F" size={38} style={{ marginLeft: i ? -11 : 0, boxShadow: "0 0 0 2px #fff" }} />)}</div>
          <div style={{ textAlign: "left" }}>
            <div className="mono" style={{ fontSize: 24, fontWeight: 600, letterSpacing: "-.02em", color: "var(--accent-primary)", lineHeight: 1 }}>2,000+</div>
            <div style={{ fontSize: 14, color: "var(--text-secondary)", marginTop: 4 }}>founders pre-registered</div>
          </div>
        </div>
      </div>
    </section>
  );
}

const PLAT = [
  { name: "Capital Data", icon: "Database", desc: "The investor database. Search, filter and export verified investor profiles.", items: [["Search", "200,000+ verified investor profiles", "Angels, VCs and family offices across 170+ countries."], ["Brain", "AI filters and match scoring", "Shortlist by stage, sector, cheque, geo and more."], ["LayoutList", "62 structured data fields", "Verified contacts, exportable to CSV, XLS and your CRM."]] },
  { name: "Capital Connect", icon: "Users", desc: "On-platform outreach. Share your data room and speak with investors who opted in.", items: [["FolderOpen", "Connect your data room", "Keep your deck and key documents in one place."], ["ShieldCheck", "Reach opted-in investors", "Pitch investors who have agreed to hear from founders."], ["Radio", "Live investor signals", "See when investors open your deck or view your profile."]] }
];
function Platform() {
  return (
    <section id="platform" className="sec" data-screen-label="Capital Data">
      <div className="wrap">
        <SecHead eyebrow="Capital Data" title={<>The Investor Intelligence Platform Built for <span className="gx">Raising Capital</span></>} lead="Capital Hunt replaces the scattered spreadsheets, expensive databases, and guesswork with one platform purpose-built for fundraising." />
        <div className="plat rv">
          {PLAT.map(p => (
            <article key={p.name} id={p.name.toLowerCase().replace(" ", "-")} className="pcol">
              <header><IconBox icon={p.icon} /><div><h3>{p.name}</h3><p>{p.desc}</p></div></header>
              <ul>{p.items.map(([ic, t, g]) => <li key={t}><Icon name={ic} size={18} color="var(--accent-primary)" /><div><b>{t}</b><span>{g}</span></div></li>)}</ul>
            </article>
          ))}
        </div>
        <div className="rv" style={{ display: "flex", justifyContent: "center", marginTop: 40 }}><Button variant="primary" arrow href={CH.APP} target="_blank">Get Early Access</Button></div>
      </div>
    </section>
  );
}

function UseCases() {
  const u = CH.useCases;
  const cells = [
    { s: "s4", art: <ArtInvestorWall />, i: 0, cls: "tint" },
    { s: "s2", art: <ArtNetwork />, i: 1 },
    { s: "s3", art: <FFunnel />, i: 2, cls: "nv" },
    { s: "s3", art: <ArtSignals />, i: 3 }
  ];
  return (
    <section id="use-cases" className="sec" data-screen-label="Use cases">
      <div className="wrap">
        <SecHead eyebrow="Use Cases" title={<>How Founders Are Using Capital Hunt <br />To <span className="gx">Accelerate Funding Rounds</span></>} />
        <div className="bento">
          {cells.map((c, k) => (
            <article key={k} className={"bc rv " + c.s + " " + (c.cls || "")} style={{ "--d": (k % 3) * 90 + "ms", ...(c.row ? { flexDirection: "row", alignItems: "center", gap: 40 } : {}) }} onMouseMove={spot}>
              <h3 style={c.row ? { flex: "0 0 300px" } : {}}>{u[c.i].title}<span>{u[c.i].gray}</span></h3>
              <div className="art" style={c.row ? { minHeight: 180, minWidth: 0 } : {}}>{c.art}</div>
            </article>
          ))}
        </div>
      </div>
    </section>
  );
}

const STEP_G = [StepSignup, StepCredits, StepMatched];
function HowItWorks() {
  const icons = ["UserPlus", "Coins", "MessagesSquare"];
  return (
    <section id="how-it-works" className="sec" data-screen-label="How it works">
      <div className="wrap">
        <SecHead eyebrow="How It Works" title={<>How To <span className="gx">Get Started</span></>} lead="Three simple steps to start connecting with the right investors." />
        <ol className="hiw-steps">
          {CH.steps.map((s, i) => (
            <li key={s.n} className="hiw-step rv" style={{ "--d": i * 90 + "ms" }}>
              <div className="hiw-top" aria-hidden="true"><span className="hiw-ic"><Icon name={icons[i]} size={20} /></span><i></i></div>
              <span className="num">STEP 0{s.n}</span>
              <h3>{s.title}</h3>
              <p>{s.n === 2 ? <>{s.description.split("Pricing")[0]}<a href="#pricing" style={{ textDecoration: "underline", textUnderlineOffset: 3 }}>Pricing</a>{s.description.split("Pricing")[1]}</> : s.description}</p>
            </li>
          ))}
        </ol>
        <div className="hiw-cta rv"><Button variant="primary" arrow href={CH.APP} target="_blank">Get Early Access</Button></div>
      </div>
    </section>
  );
}

Object.assign(window, { Hero, Proof, Platform, UseCases, HowItWorks });
