/* Dulius Web — Learn More content + modal (makes every footer link real) */

const LEARN = {
  // Product
  "Funding score": { tag: "Product", title: "Your Dulius Score", body: ["A funding score built specifically for alternative lending — not a recycled FICO. It reads your real business cash flow, payment history, time in business, and utilization to show what funders actually see.", "Ranging 300–850, it updates daily as your accounts sync, and a soft pull never lowers it. The higher it climbs, the bigger the amounts, lower the factors, and longer the terms you unlock."] },
  "Live offers": { tag: "Product", title: "Live offers, ranked for you", body: ["See pre-qualified offers from 100+ funders plus our own programs, ranked by how well they fit your profile.", "Apply once with a single profile — no repeat paperwork. You compare, you choose, you fund, all in one transparent place."] },
  "Score path": { tag: "Product", title: "Your Score Path", body: ["The exact, personalized moves that raise your score the fastest — with the projected point gain for each one.", "Stay on time, trim utilization, keep accounts synced, avoid NSFs. Most members see meaningful gains within 60–90 days and graduate into better programs."] },
  // Company
  "About": { tag: "Company", title: "About Dulius", body: ["Dulius is the Alternative Lending Engine — built for the business owners the traditional system overlooks.", "Our mission is simple: give every owner a score they understand, a clear path to grow it, and honest access to capital that helps them build — not bury — their business."] },
  "Careers": { tag: "Company", title: "Careers at Dulius", body: ["We're a small team rethinking how small businesses access capital. If you care about doing right by owners who've been underserved, we'd love to meet you.", "Roles across engineering, underwriting, and partner success open regularly. Send your résumé and a note to hello@dulius.com."], cta: { label: "Email hello@dulius.com", href: "mailto:hello@dulius.com?subject=Careers%20at%20Dulius" } },
  "Press": { tag: "Company", title: "Press & media", body: ["For media inquiries, interviews, or brand assets, reach our team at hello@dulius.com.", "We're always glad to talk about the future of fair, transparent business funding."] },
  "Contact": { tag: "Company", title: "Get in touch", body: ["Questions about your score, an offer, or your account? Our team is here.", "Email hello@dulius.com or start a chat from your dashboard — real people, quick answers."], cta: { label: "Email hello@dulius.com", href: "mailto:hello@dulius.com?subject=Dulius%20%E2%80%94%20Question" } },
  // Lenders (discreet)
  "Partner with Dulius": { tag: "Lenders", title: "Partner with Dulius", body: ["Interested in partnering with Dulius?"], inquiry: true },
  "Lender login": { tag: "Lenders", title: "Lender login", body: ["Already an approved Dulius partner? Sign in to your funder portal to review matched applicants, manage your portfolio, and update your criteria.", "New here? Accounts are created by our team after an approved partnership inquiry — reach out and we'll get you set up."], cta: { label: "Go to lender portal", href: "../funder/index.html" } },
  "Why partners choose us": { tag: "Lenders", title: "Partner with Dulius", body: ["Interested in partnering with Dulius?"], inquiry: true },
  // Legal
  "Privacy": { tag: "Legal", title: "Privacy Policy", body: ["Your data is yours. We use bank-grade encryption, never sell your personal information, and only share what's needed to match you with funding you've asked for.", "This summary is a plain-language overview; the full policy is available on request."] },
  "Terms": { tag: "Legal", title: "Terms of Service", body: ["Dulius is a financial technology company, not a bank or lender. Scores are estimates and not a guarantee of funding.", "By using Dulius you agree to our standard terms; the complete document is available on request."] },
  "Disclosures": { tag: "Legal", title: "Disclosures", body: ["Funding products are offered through our funding partners and are subject to approval. Rates, factors, and terms vary by offer and are disclosed in full before you sign.", "Checking your score is a soft inquiry and does not affect your credit."] },
  "Security": { tag: "Legal", title: "Security", body: ["Your information is protected with strong encryption — both while it's being sent and while it's stored.", "We use trusted, industry-standard services to verify identity and handle financial data, and any documents you share are stored securely. We never sell your personal information."] },
};

function LearnMoreModal({ topic, onClose, onAuth }) {
  const c = LEARN[topic];
  if (!c) return null;
  return (
    <div className="wmodal" onClick={(e) => { if (e.target.classList.contains("wmodal")) onClose(); }}>
      <div className="wlearn" onClick={(e) => e.stopPropagation()}>
        <button className="wlearn-close" onClick={onClose}><WIcon name="x" size={20} /></button>
        <div className="wlearn-tag">{c.tag}</div>
        <h2 className="wlearn-title">{c.title}</h2>
        {c.body.map((p, i) => <p key={i} className="wlearn-p">{p}</p>)}
        {c.inquiry && (
          <div className="wlearn-email"><WIcon name="mail" size={16} /> <a href="mailto:hello@dulius.com?subject=Partner%20with%20Dulius">hello@dulius.com</a></div>
        )}
        <div className="wlearn-actions">
          {c.inquiry
            ? <a className="wbtn wbtn-primary wbtn-lg" href="mailto:hello@dulius.com?subject=Partner%20with%20Dulius">Email us <WIcon name="arrow-right" size={18} /></a>
            : c.cta
            ? <a className="wbtn wbtn-primary wbtn-lg" href={c.cta.href}>{c.cta.label} <WIcon name="arrow-right" size={18} /></a>
            : <WButton variant="primary" size="lg" iconRight="arrow-right" onClick={() => { onClose(); onAuth && onAuth("signup"); }}>Get my free score</WButton>}
          <button className="wlearn-back" onClick={onClose}>Close</button>
        </div>
      </div>
    </div>
  );
}

Object.assign(window, { LEARN, LearnMoreModal });
