const dl = { fontFamily: "var(--font-mono)", fontSize: 10, letterSpacing: ".12em", textTransform: "uppercase", color: "#8D97B5" };

function FFunnel() {
  const rows = [["200,000+ investors", "200,000+", 100, "#3B82F6"], ["Match sector", "12,400", 48, "#60A5FA"], ["Match all filters", "3,847", 22, "#E5A600"]];
  return <div style={{ width: "100%", display: "flex", flexDirection: "column", gap: 12 }}>{rows.map(([l, n, w, c], i) => <div key={l}><div style={{ display: "flex", justifyContent: "space-between", fontSize: 12, color: "#B8C1D9", marginBottom: 6 }}><span>{l}</span><span className="mono" style={{ color: "#fff" }}>{n}</span></div><div style={{ height: 10, borderRadius: 6, background: "rgba(255,255,255,.07)" }}><div className="rv" style={{ "--d": i * 150 + "ms", width: w + "%", height: "100%", borderRadius: 6, background: c, boxShadow: `0 0 16px ${c}66` }}></div></div></div>)}</div>;
}
function FScore() {
  const l = [2, 4, 9].map(i => CH.investors[i]);
  return <div style={{ width: "100%", display: "flex", flexDirection: "column", gap: 8 }}>{l.map(v => <div key={v.name} className="glass" style={{ display: "flex", alignItems: "center", gap: 10, padding: 10 }}><LogoAvatar dom={v.dom} name={v.firm} size={28} /><span className="trunc" style={{ fontSize: 12.5, color: "#fff", flex: 1 }}>{v.name}</span><MatchScore value={v.match} variant="bar" style={{ minWidth: 90 }} /></div>)}<p style={{ fontSize: 11.5, color: "#8D97B5", display: "flex", gap: 6, alignItems: "center", marginTop: 2 }}><Icon name="Sparkles" size={12} color="var(--accent-gold)" />Scored on stage, sector, cheque and recency</p></div>;
}
function FConsent() {
  const l = [3, 6, 16].map(i => CH.investors[i]);
  return <div style={{ width: "100%" }}><div className="glass" style={{ padding: 14, display: "flex", alignItems: "center", justifyContent: "space-between" }}><div><p style={{ fontSize: 13, fontWeight: 700, color: "#fff" }}>Accepting pitches</p><p style={{ fontSize: 11.5, color: "#8D97B5" }}>SaaS · Seed · UK</p></div><span style={{ width: 40, height: 22, borderRadius: 22, background: "var(--status-live)", position: "relative", boxShadow: "0 0 14px rgba(16,185,129,.5)" }}><span style={{ position: "absolute", right: 3, top: 3, width: 16, height: 16, borderRadius: 16, background: "#fff" }}></span></span></div><div style={{ display: "flex", flexDirection: "column", gap: 6, marginTop: 10 }}>{l.map(v => <div key={v.name} style={{ display: "flex", alignItems: "center", gap: 8, fontSize: 12, color: "#DDE3F3" }}><LogoAvatar dom={v.dom} name={v.firm} size={22} /><span style={{ flex: 1 }}>{v.name}</span><span style={{ color: "#34D399", display: "flex", alignItems: "center", gap: 4, fontWeight: 600 }}><Icon name="Check" size={12} strokeWidth={3} />Opted in</span></div>)}</div></div>;
}
function FFeed() {
  const [k, setK] = React.useState(0);
  React.useEffect(() => { const t = setInterval(() => setK(x => x + 1), 2400); return () => clearInterval(t); }, []);
  const items = [0, 1, 2, 3].map(i => CH.feed[(k + i) % CH.feed.length]);
  return <div style={{ width: "100%", display: "flex", flexDirection: "column", gap: 8 }}>{items.map((f, i) => <div key={f.label + k} className={i === 0 ? "rowin" : ""} style={{ display: "flex", alignItems: "center", gap: 10, padding: "8px 10px", borderRadius: 10, background: i === 0 ? "rgba(96,165,250,.12)" : "rgba(255,255,255,.04)", border: "1px solid " + (i === 0 ? "rgba(96,165,250,.3)" : "rgba(255,255,255,.07)"), opacity: 1 - i * .18 }}><FirmLogo dom={f.dom} size={20} /><span className="trunc" style={{ fontSize: 12, color: "#E6E9F2", flex: 1 }}>{f.label}</span><span className="mono" style={{ fontSize: 10, color: "#8D97B5", flexShrink: 0 }}>{i === 0 ? "Just now" : f.time}</span></div>)}</div>;
}
function FChart() {
  return (
    <div style={{ width: "100%" }}>
      <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline" }}><p style={dl}>ARR forecast</p><span className="mono" style={{ fontSize: 13, color: "#F2C14E", fontWeight: 700 }}>+217%</span></div>
      <svg viewBox="0 0 260 130" style={{ width: "100%", marginTop: 8 }}>
        <defs><linearGradient id="fa" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stopColor="#E5A600" stopOpacity=".35" /><stop offset="1" stopColor="#E5A600" stopOpacity="0" /></linearGradient></defs>
        {[20, 50, 80, 110].map(y => <line key={y} x1="0" x2="260" y1={y} y2={y} stroke="rgba(255,255,255,.07)" />)}
        <path d="M0 110 L30 104 L90 80 L160 46 L240 14 L260 10 L260 130 L0 130Z" fill="url(#fa)" />
        <path d="M0 110 L30 104 L90 80 L160 46 L240 14 L260 10" fill="none" stroke="#E5A600" strokeWidth="2.5" strokeLinecap="round" className="draw" />
        {[[30, 104, "$1.2M"], [90, 80, "$1.8M"], [160, 46, "$2.9M"], [240, 14, "$3.8M"]].map(([x, y, l]) => <g key={l}><circle cx={x} cy={y} r="4" fill="#0F172A" stroke="#F2C14E" strokeWidth="2" /><text x={x} y={y - 9} textAnchor="middle" fill="#DDE3F3" fontSize="9" fontFamily="JetBrains Mono">{l}</text></g>)}
      </svg>
    </div>
  );
}
function FCompare() {
  const m = [["Annual Recurring Revenue", 72, 68], ["Team Size", 85, 78], ["Total Addressable Market", 60, 65], ["Revenue Growth", 90, 82], ["Funding Raised", 55, 70]];
  return <div style={{ width: "100%" }}><div style={{ display: "flex", gap: 14, fontSize: 11, color: "#B8C1D9", marginBottom: 10 }}><span style={{ display: "flex", alignItems: "center", gap: 5 }}><i style={{ width: 8, height: 8, borderRadius: 2, background: "#3B82F6" }}></i>You</span><span style={{ display: "flex", alignItems: "center", gap: 5 }}><i style={{ width: 8, height: 8, borderRadius: 2, background: "#E5A600" }}></i>Look-alike</span></div>{m.map(([l, a, b]) => <div key={l} style={{ marginBottom: 8 }}><p className="trunc" style={{ fontSize: 11, color: "#8D97B5", marginBottom: 4 }}>{l}</p><div style={{ display: "flex", flexDirection: "column", gap: 3 }}><div style={{ height: 5, width: a + "%", borderRadius: 4, background: "#3B82F6" }}></div><div style={{ height: 5, width: b + "%", borderRadius: 4, background: "#E5A600" }}></div></div></div>)}</div>;
}
function FExport() {
  const t = [["CSV", "FileText", null], ["XLS", "Sheet", null], ["HubSpot", null, "hubspot.com"], ["Salesforce", null, "salesforce.com"]];
  return <div style={{ width: "100%" }}><div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }}>{t.map(([l, ic, dom]) => <div key={l} className="glass" style={{ display: "flex", alignItems: "center", gap: 8, padding: "10px 12px" }}>{dom ? <FirmLogo dom={dom} size={18} /> : <Icon name={ic} size={18} color="#60A5FA" />}<span style={{ fontSize: 12.5, color: "#fff", fontWeight: 600 }}>{l}</span></div>)}</div><div className="glass" style={{ marginTop: 10, padding: 12 }}><div style={{ display: "flex", justifyContent: "space-between", fontSize: 11.5, color: "#B8C1D9" }}><span>Exporting 3,847 rows</span><span className="mono" style={{ color: "#34D399" }}>Done</span></div><div style={{ height: 6, borderRadius: 6, background: "rgba(255,255,255,.08)", marginTop: 8, overflow: "hidden" }}><div className="loadbar" style={{ height: "100%", background: "linear-gradient(90deg,#3B82F6,#34D399)", borderRadius: 6 }}></div></div></div></div>;
}
function FFields() {
  const f = ["Email", "Phone", "LinkedIn", "Thesis", "Cheque size", "Stages", "Sectors", "Geography", "Portfolio", "Last deal", "AUM", "Fund size", "Co-investors", "Twitter / X", "Board seats", "Lead / follow"];
  const [k, setK] = React.useState(0);
  React.useEffect(() => { const t = setInterval(() => setK(x => (x + 1) % f.length), 450); return () => clearInterval(t); }, []);
  return <div style={{ width: "100%", display: "flex", flexWrap: "wrap", gap: 6 }}>{f.map((x, i) => { const on = (i - k + f.length) % f.length < 5; return <span key={x} style={{ fontSize: 11.5, padding: "5px 9px", borderRadius: 8, transition: "all .4s", border: "1px solid " + (on ? "rgba(242,193,78,.5)" : "rgba(255,255,255,.1)"), color: on ? "#F7D36B" : "#8D97B5", background: on ? "rgba(229,166,0,.1)" : "transparent" }}>{x}</span>; })}<span className="mono" style={{ fontSize: 11.5, padding: "5px 9px", color: "#fff" }}>+17 more</span></div>;
}

const FEATURE_ART = [FFunnel, FScore, FConsent, FFeed, FChart, FCompare, FExport, FFields];
Object.assign(window, { FEATURE_ART, FFunnel });
