// ── API helper ────────────────────────────────────────────────── const API = "https://api.herbimmortal.com/api"; async function apiFetch(path, options = {}) { const res = await fetch(`${API}${path}`, { ...options, headers: { "Content-Type": "application/json", ...options.headers }, }); const data = await res.json(); if (!res.ok) throw new Error(data.error || "Request failed"); return data; } // ── Contact / Invest Modal ─────────────────────────────────────── const Modal = ({ type, onClose }) => { const isInvestor = type === "invest"; const [form, setForm] = React.useState({ name: "", email: "", company: "", subject: "", message: "" }); const [status, setStatus] = React.useState("idle"); const [errMsg, setErrMsg] = React.useState(""); const set = (key) => (e) => setForm((f) => ({ ...f, [key]: e.target.value })); const submit = async (e) => { e.preventDefault(); setStatus("loading"); try { if (isInvestor) { await apiFetch("/invest/lead", { method: "POST", body: JSON.stringify({ name: form.name, email: form.email, company: form.company, message: form.message }) }); } else { await apiFetch("/contact", { method: "POST", body: JSON.stringify({ ...form, type: "collaborate" }) }); } setStatus("success"); } catch (err) { setErrMsg(err.message); setStatus("error"); } }; const overlayStyle = { position: "fixed", inset: 0, background: "rgba(14,26,18,0.7)", zIndex: 100, display: "flex", alignItems: "center", justifyContent: "center", padding: 24, backdropFilter: "blur(4px)", }; const boxStyle = { background: "var(--paper)", border: "1px solid var(--line)", borderRadius: 8, padding: "40px 36px", width: "100%", maxWidth: 520, position: "relative", maxHeight: "90vh", overflowY: "auto", }; const inputStyle = { width: "100%", padding: "10px 12px", border: "1px solid var(--line)", borderRadius: 4, fontFamily: "var(--sans)", fontSize: 14, background: "var(--bg)", color: "var(--ink)", boxSizing: "border-box", marginTop: 6, display: "block", }; const labelStyle = { fontSize: 11, fontFamily: "var(--mono)", letterSpacing: "0.12em", textTransform: "uppercase", color: "var(--ink-mute)", display: "block", marginTop: 16, }; return (
e.target === e.currentTarget && onClose()}>
{status === "success" ? (
🌿

Thank you!

{isInvestor ? "We've received your interest and will be in touch soon." : "We've received your message and will be in touch shortly."}

) : ( <>

{isInvestor ? "Investor Enquiry" : "Collaborate with us"}

{isInvestor ? "Tell us about yourself and we'll be in touch." : "Tell us about your idea and we'll get back to you."}

{status === "error" && (
{errMsg}
)}
{isInvestor && ( <> )} {!isInvestor && ( <> )}