const { motion } = window.Motion || window;
const BRAND = "#FD765E";
const LIME = "#E2FFAB";
// Theme-aware tokens (resolved via CSS custom properties; see <ThemeStyles />).
// We keep JS constants pointing to var(...) so existing inline styles flip with the theme.
const BG = "var(--bg)";
const TEXT = "var(--fg)";
const MUTED = "var(--fg-2)";
const TERTIARY = "var(--fg-3)";
const SOFT = "var(--brand-soft)";
const RING = "var(--brand-ring)";
const FONT = "Aeonik, 'Helvetica Neue', Helvetica, Arial, sans-serif";

// Theme hook — persists in localStorage, applies data-theme on <html>.
function useTheme() {
  const [theme, setTheme] = React.useState(() => {
    if (typeof window === "undefined") return "dark";
    try {window.localStorage.removeItem("zc-theme");} catch (e) {}
    return "dark";
  });
  React.useEffect(() => {
    document.documentElement.setAttribute("data-theme", theme);
    try {window.localStorage.setItem("zc-theme", theme);} catch (e) {}
  }, [theme]);
  return [theme, setTheme];
}

function ThemeStyles() {
  return (
    <style>{`
      /* Default = dark mode tokens (Zerocap brand spec) */
      :root, [data-theme="dark"] {
        --bg: #060606;             /* bg-primary-dark   neutral-black */
        --bg-2: #171717;           /* bg-secondary-dark neutral-900 */
        --bg-3: #2B2B2B;           /* bg-tertiary-dark  neutral-800 */
        --fg: #F8F8F8;             /* fg-primary-dark   neutral-50 */
        --fg-2: #C3C3C3;           /* fg-secondary-dark neutral-200 */
        --fg-3: #979797;           /* fg-tertiary-dark  neutral-400 */
        --border-1: #171717;       /* neutral-900 */
        --border-2: #2B2B2B;       /* neutral-800 */
        --border-3: #3D3D3D;       /* neutral-700 */
        --surface-1: rgba(255,255,255,0.04);
        --surface-2: rgba(255,255,255,0.02);
        --surface-3: rgba(255,255,255,0.06);
        --surface-strong: rgba(255,255,255,0.10);
        --brand-soft: rgba(253,118,94,0.12);
        --brand-ring: rgba(253,118,94,0.28);
        --hairline: rgba(255,255,255,0.10);
        --hairline-strong: rgba(255,255,255,0.18);
        --shadow-card: 0 30px 80px rgba(0,0,0,0.55);
        --on-brand: #171717;
      }
      /* Light mode — Zerocap brand spec */
      [data-theme="light"] {
        --bg: #FFFFFF;             /* bg-primary-light   neutral-white */
        --bg-2: #F8F8F8;           /* bg-secondary-light neutral-50 */
        --bg-3: #EFEFEF;           /* bg-tertiary-light  neutral-100 */
        --fg: #171717;             /* fg-primary-light   neutral-900 */
        --fg-2: #404040;           /* fg-secondary-light neutral-700 */
        --fg-3: #797979;           /* fg-tertiary-light  neutral-500 */
        --border-1: #F8F8F8;       /* neutral-50 */
        --border-2: #EFEFEF;       /* neutral-100 */
        --border-3: #C3C3C3;       /* neutral-200 */
        --surface-1: #F8F8F8;
        --surface-2: #FFFFFF;
        --surface-3: #EFEFEF;
        --surface-strong: #EFEFEF;
        --brand-soft: rgba(253,118,94,0.10);
        --brand-ring: rgba(253,118,94,0.30);
        --hairline: rgba(0,0,0,0.10);
        --hairline-strong: rgba(0,0,0,0.18);
        --shadow-card: 0 22px 60px rgba(20,20,30,0.10);
        --on-brand: #FFFFFF;
      }

      html, body, #root { background: var(--bg); color: var(--fg); }

      /* === Light-mode overrides for Tailwind utility classes that hardcode dark colours === */
      [data-theme="light"] .text-white { color: var(--fg) !important; }
      [data-theme="light"] .text-zinc-500 { color: var(--fg-3) !important; }
      [data-theme="light"] .text-zinc-600 { color: var(--fg-3) !important; }

      /* Translucent white surfaces -> light neutral surfaces */
      [data-theme="light"] .bg-white\\/\\[0\\.02\\] { background-color: var(--bg-2) !important; }
      [data-theme="light"] .bg-white\\/\\[0\\.03\\] { background-color: var(--bg-2) !important; }
      [data-theme="light"] .bg-white\\/\\[0\\.04\\] { background-color: var(--bg-2) !important; }
      [data-theme="light"] .bg-white\\/\\[0\\.06\\] { background-color: var(--bg-3) !important; }
      [data-theme="light"] .bg-white\\/\\[0\\.07\\] { background-color: var(--bg-3) !important; }
      [data-theme="light"] .hover\\:bg-white\\/\\[0\\.07\\]:hover { background-color: var(--bg-3) !important; }
      [data-theme="light"] .bg-black\\/20 { background-color: var(--bg-2) !important; }
      [data-theme="light"] .bg-black\\/25 { background-color: var(--bg-2) !important; }
      [data-theme="light"] .bg-black\\/30 { background-color: var(--bg-2) !important; }
      [data-theme="light"] .bg-black\\/35 { background-color: var(--bg-2) !important; }
      [data-theme="light"] .bg-black\\/40 { background-color: rgba(255,255,255,0.7) !important; }

      /* Hairlines -> neutral-100/200 borders */
      [data-theme="light"] .border-white\\/10 { border-color: var(--border-2) !important; }
      [data-theme="light"] .border-white\\/15 { border-color: var(--border-3) !important; }
      [data-theme="light"] .border-white\\/40 { border-color: var(--border-3) !important; }

      /* Dividers between rows */
      [data-theme="light"] .divide-white\\/10 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border-2) !important; }

      /* hover:bg-white/10 -> tinted brand soft */
      [data-theme="light"] .hover\\:bg-white\\/10:hover { background-color: var(--brand-soft) !important; }
      [data-theme="light"] .hover\\:text-white:hover { color: var(--fg) !important; }

      /* Header backdrop sample dark -> white */
      [data-theme="light"] header.bg-black\\/40 { background-color: rgba(255,255,255,0.85) !important; }

      /* Marquee fade gradients (hardcoded to #060606 in JSX) */
      [data-theme="light"] .from-\\[\\#060606\\] { --tw-gradient-from: var(--bg) var(--tw-gradient-from-position) !important; --tw-gradient-to: rgba(255,255,255,0) var(--tw-gradient-to-position) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
      [data-theme="light"] .to-\\[\\#060606\\] { --tw-gradient-to: var(--bg) var(--tw-gradient-to-position) !important; }

      /* Marquee logos: light mode wants dark logos on white */
      [data-theme="light"] .logo-marquee img { filter: grayscale(100%) brightness(0.4) contrast(1.2) !important; opacity: 0.8 !important; }

      /* Theme toggle */
      .theme-toggle {
        height: 40px; width: 40px; display: inline-flex; align-items: center; justify-content: center;
        border-radius: 999px; border: 1px solid var(--hairline);
        background: var(--surface-1); color: var(--fg);
        cursor: pointer; transition: background 0.2s, border-color 0.2s, transform 0.2s;
      }
      .theme-toggle:hover { background: var(--surface-3); border-color: var(--hairline-strong); }
      .theme-toggle:active { transform: scale(0.94); }
      .theme-toggle svg { width: 18px; height: 18px; }
    `}</style>);
}

function ThemeToggle({ theme, onToggle }) {
  const isDark = theme === "dark";
  return (
    <button
      type="button"
      className="theme-toggle"
      aria-label={isDark ? "Switch to light mode" : "Switch to dark mode"}
      title={isDark ? "Light mode" : "Dark mode"}
      onClick={onToggle}>
      {isDark ?
      // Sun (currently dark -> click to go light)
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <circle cx="12" cy="12" r="4" />
          <path d="M12 2v2" /><path d="M12 20v2" />
          <path d="m4.93 4.93 1.41 1.41" /><path d="m17.66 17.66 1.41 1.41" />
          <path d="M2 12h2" /><path d="M20 12h2" />
          <path d="m6.34 17.66-1.41 1.41" /><path d="m19.07 4.93-1.41 1.41" />
        </svg> :

      // Moon
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z" />
        </svg>
      }
    </button>);
}

function Button({ children, className = "", variant = "default", style = {}, ...props }) {
  const variantClass = variant === "ghost" ? "bg-transparent" : variant === "outline" ? "border bg-transparent" : "";
  return (
    <button className={`inline-flex items-center justify-center transition ${variantClass} ${className}`} style={style} {...props}>
      {children}
    </button>);

}

function Card({ children, className = "", style = {} }) {
  return (
    <div className={`rounded-2xl border ${className}`} style={style}>
      {children}
    </div>);

}

function CardContent({ children, className = "" }) {
  return <div className={className}>{children}</div>;
}

const fadeUp = {
  hidden: { opacity: 0, y: 24 },
  visible: { opacity: 1, y: 0 }
};

function Icon({ name = "check", size = 22, className = "", style = {} }) {
  const common = {
    width: size,
    height: size,
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    strokeWidth: 2,
    strokeLinecap: "round",
    strokeLinejoin: "round",
    className,
    style,
    "aria-hidden": true
  };

  const icons = {
    arrow: <svg {...common}><path d="M5 12h14" /><path d="m13 5 7 7-7 7" /></svg>,
    shield: <svg {...common}><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z" /><path d="m9 12 2 2 4-5" /></svg>,
    bolt: <svg {...common}><path d="M13 2 4 14h7l-1 8 10-13h-7V2Z" /></svg>,
    wallet: <svg {...common}><path d="M20 7H5a3 3 0 0 0 0 6h15v7H5a4 4 0 0 1-4-4V7a4 4 0 0 1 4-4h13a2 2 0 0 1 2 2v2Z" /><path d="M16 13h4" /><path d="M17 16h.01" /></svg>,
    lock: <svg {...common}><rect x="4" y="10" width="16" height="11" rx="2" /><path d="M8 10V7a4 4 0 0 1 8 0v3" /></svg>,
    dollar: <svg {...common}><circle cx="12" cy="12" r="10" /><path d="M12 6v12" /><path d="M16 8.5c-.8-1-2.1-1.5-4-1.5-2.2 0-3.5 1-3.5 2.6 0 1.7 1.6 2.2 3.9 2.7 2.4.5 3.6 1.1 3.6 2.8 0 1.7-1.5 2.9-4 2.9-1.9 0-3.4-.6-4.3-1.8" /></svg>,
    link: <svg {...common}><path d="M10 13a5 5 0 0 0 7.1 0l2-2a5 5 0 0 0-7.1-7.1l-1.1 1.1" /><path d="M14 11a5 5 0 0 0-7.1 0l-2 2A5 5 0 0 0 12 20.1l1.1-1.1" /></svg>,
    chart: <svg {...common}><path d="M4 19V5" /><path d="M4 19h16" /><rect x="7" y="12" width="3" height="4" rx="1" /><rect x="12" y="8" width="3" height="8" rx="1" /><rect x="17" y="5" width="3" height="11" rx="1" /></svg>,
    refresh: <svg {...common}><path d="M20 12a8 8 0 0 1-14.9 4" /><path d="M4 16v5h5" /><path d="M4 12A8 8 0 0 1 18.9 8" /><path d="M20 8V3h-5" /></svg>,
    building: <svg {...common}><rect x="4" y="3" width="16" height="18" rx="2" /><path d="M8 7h.01" /><path d="M12 7h.01" /><path d="M16 7h.01" /><path d="M9 21v-5h6v5" /></svg>,
    support: <svg {...common}><path d="M4 13a8 8 0 0 1 16 0" /><path d="M4 13v3a2 2 0 0 0 2 2h1v-7H6a2 2 0 0 0-2 2Z" /><path d="M20 13v3a2 2 0 0 1-2 2h-1v-7h1a2 2 0 0 1 2 2Z" /><path d="M16 18c0 1.7-1.3 3-3 3h-2" /></svg>,
    check: <svg {...common}><circle cx="12" cy="12" r="10" /><path d="m8 12 3 3 5-6" /></svg>,
    menu: <svg {...common}><path d="M4 7h16" /><path d="M4 12h16" /><path d="M4 17h16" /></svg>
  };

  return icons[name] || icons.check;
}

function ZerocapLogoMark({ className = "", style = {} }) {
  return (
    <svg className={className} style={style} width="56" height="65" viewBox="0 0 56 65" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Zerocap icon mark" role="img">
      <polygon points="48.1 20.4 48.1 43.8 27.9 55.5 7.6 43.8 7.6 20.4 0 16 0 48.2 27.9 64.3 55.7 48.2 55.7 16" fill="#F16152" />
      <polygon points="27.9 8.7 48.1 20.4 55.7 16 27.9 0 0 16 7.6 20.4" fill="#A83031" />
    </svg>);

}

function Logo() {
  return (
    <div className="flex items-center gap-3">
      <ZerocapLogoMark className="h-10 w-auto" />
      <div>
        <div className="text-lg font-semibold tracking-tight text-white">Zerocap Connect</div>
        <div className="text-xs uppercase tracking-[0.25em] text-zinc-500">by Zerocap</div>
      </div>
    </div>);

}

function PrimaryButton({ children, className = "" }) {
  return (
    <Button className={`h-12 rounded-full px-7 text-base font-semibold text-[#171717] hover:opacity-90 ${className}`} style={{ background: LIME, boxShadow: "0 18px 44px rgba(226,255,171,0.30)" }}>
      {children}
    </Button>);

}

const trustBadges = [
{ icon: "shield", label: "Institutional-grade compliance" },
{ icon: "bolt", label: "Fast crypto processing" },
{ icon: "wallet", label: "Simple checkout experience" },
{ icon: "support", label: "Dedicated coverage" }];


const features = [
{ icon: "wallet", title: "Crypto deposits and withdrawals", body: "Zerocap Connect lets financial service providers offer crypto deposit and withdrawal functionality to their clients — without the operational headache." },
{ icon: "link", title: "Lightweight API and branded widget", body: "Embedded via a lightweight API and self-branded funding widget, Zerocap Connect abstracts away the full complexity of crypto rails while preserving your existing client experience." },
{ icon: "shield", title: "Custody, liquidity, trading and settlement", body: "Custody, liquidity, trading, and settlement are handled behind the scenes, so your operations team never has to manage wallets, keys, or on-chain risk." },
{ icon: "building", title: "Per-account wallet structure", body: "Your firm receives a structured wallet hierarchy that lets you allocate, attribute, and reconcile deposits at the account level — under your own onboarding and labelling. No pooled wallets, no reconciliation headaches." },
{ icon: "refresh", title: "Streaming pricing and real-time conversion", body: "Streaming pricing and real-time conversion ensure clean execution on every deposit, with complete transaction auditability across all flows." },
{ icon: "check", title: "No duplicate onboarding for your clients", body: "Your clients are onboarded by your firm under your licences. They do not onboard with Zerocap, never see the Zerocap brand, and never interact with Zerocap directly." }];


const keyFeatures = [
["Plug-and-Play Integration", "Deployable widget with configurable branding (including white-label mode)"],
["Supported Assets", "BTC, ETH, USDT (ERC20/TRC20), USDC"],
["Supported Fiat Currencies", "USD, EUR, GBP, AUD, JPY"],
["Streaming Conversion Rates", "Real-time indicative quotes for 12 symbols, refreshed every 30 seconds"],
["Conversion Model", "Choose between spread-based pricing or midpoint + fixed monthly fee"],
["Institutional Limits", "Agreed per client integration"],
["Compliance Layer", "AML/CTF-aligned settlement routing via Zerocap Treasury infrastructure"],
["Custody Architecture", "Dedicated Fireblocks workspace and Zerocap Gas Station for ERC20/TRC20 fees"],
["Admin Portal", "Real-time visibility into customer deposits, withdrawals, and transaction history"]];


const provenExcellenceStats = [
{ value: 25, decimals: 0, prefix: "US$", suffix: "B+", label: "cumulative institutional spot volume" },
{ value: 12, decimals: 0, prefix: "", suffix: "+", label: "institutional counterparties globally" },
{ value: 50, decimals: 0, prefix: "", suffix: "+", label: "jurisdictions of institutional clients" },
{ value: 5, decimals: 0, prefix: "", suffix: "+ yrs", label: "regulated operations in Australia", sub: "AFSL CAR · AUSTRAC DCE" }];

function CountUp({ value, decimals = 0, prefix = "", suffix = "", duration = 1400 }) {
  const ref = React.useRef(null);
  const [display, setDisplay] = React.useState(0);
  const startedRef = React.useRef(false);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
    if (reduce) {setDisplay(value);return;}
    const io = new IntersectionObserver((entries) => {
      entries.forEach((entry) => {
        if (entry.isIntersecting && !startedRef.current) {
          startedRef.current = true;
          const start = performance.now();
          const tick = (t) => {
            const p = Math.min(1, (t - start) / duration);
            const eased = 1 - Math.pow(1 - p, 3);
            setDisplay(value * eased);
            if (p < 1) requestAnimationFrame(tick);else
            setDisplay(value);
          };
          requestAnimationFrame(tick);
        }
      });
    }, { threshold: 0.3 });
    io.observe(el);
    return () => io.disconnect();
  }, [value, duration]);
  const formatted = display.toLocaleString(undefined, { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
  return <span ref={ref}>{prefix}{formatted}{suffix}</span>;
}


const vendorItems = ["Wallet infrastructure for your firm and your accounts", "Principal-to-principal crypto conversion at institutional rates", "Fiat settlement to your firm’s operating account", "Institutional custody via dedicated Fireblocks workspace"];
const customerItems = ["Pay in crypto", "Convert into preferred asset", "Receive stablecoin payouts", "Simple checkout flow"];
const footerServices = ["OTC Crypto Trading", "Crypto Market Making & Liquidity", "Digital Asset Custody", "Treasury & Lending"];
const footerInsights = ["Articles", "Snippets", "Weekly Crypto Market Wrap"];
const footerCompany = ["About", "Letter of Authorization", "Privacy Policy", "Wholesale Client Notice", "Wholesale Investor Certificate", "Glossary"];

function BitGoLogo({ className = "" }) {
  return (
    <svg className={className} viewBox="0 0 807 256" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="BitGo logo" role="img">
      <path fillRule="evenodd" clipRule="evenodd" d="M205.331 94.9394C205.331 193.236 126.666 220 126.666 220C126.666 220 48 193.236 48 94.9394V59.5566C48 55.6784 51.0164 52.5662 54.7989 52.2789C69.0669 51.6086 102.965 48.7359 126.666 36C150.414 48.7359 184.264 51.6086 198.532 52.3268C202.315 52.5662 205.331 55.6784 205.331 59.5566V94.9394Z" fill="white" />
      <text x="250" y="170" fill="white" fontSize="118" fontWeight="900" fontFamily={FONT}>BitGo</text>
    </svg>);

}

function FireblocksLogo({ className = "" }) {
  return (
    <div className={`flex items-center gap-3 ${className}`} aria-label="Fireblocks logo" role="img">
      <svg className="h-9 w-9 shrink-0" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
        <rect width="22" height="22" rx="3" fill="white" />
        <rect x="28" width="22" height="22" rx="3" fill="white" opacity="0.82" />
        <rect y="28" width="22" height="22" rx="3" fill="white" opacity="0.82" />
        <rect x="28" y="28" width="22" height="22" rx="3" fill="white" />
      </svg>
      <span className="text-2xl font-semibold tracking-tight text-white">Fireblocks</span>
    </div>);

}

function ChainalysisLogo({ className = "" }) {
  return (
    <svg className={className} viewBox="0 0 617 100" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Chainalysis logo" role="img">
      <path fill="#ff5300" d="M50 0c27.6 0 50 22.4 50 50s-22.4 50-50 50S0 77.6 0 50 22.4 0 50 0Z" />
      <text x="130" y="72" fill="#ff5300" fontSize="58" fontWeight="800" fontFamily={FONT}>Chainalysis</text>
    </svg>);

}

function FPMarketsLogo({ className = "" }) {
  return (
    <svg className={className} viewBox="0 0 720 150" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="FP Markets logo" role="img">
      <text x="0" y="98" fill="white" fontSize="94" fontWeight="900" fontStyle="italic" fontFamily={FONT} letterSpacing="-7" textLength="575" lengthAdjust="spacingAndGlyphs">fpmarkets</text>
      <path d="M598 103C628 78 653 42 668 11C667 65 645 106 607 133C589 117 578 97 574 73C581 89 588 98 598 103Z" fill="white" />
      <path d="M616 136C656 116 682 69 690 16C704 74 677 125 616 136Z" fill="white" opacity="0.92" />
    </svg>);

}

function ICMarketsLogo({ className = "" }) {
  return (
    <svg className={className} viewBox="0 0 1041 203" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="IC Markets Global logo" role="img">
      <rect x="94" y="102" width="24" height="36" fill="white" />
      <rect x="132" y="76" width="24" height="62" fill="white" />
      <rect x="170" y="48" width="24" height="90" fill="white" />
      <rect x="208" y="10" width="31" height="128" fill="#30F034" />
      <text x="262" y="126" fill="#30F034" fontSize="126" fontWeight="900" fontFamily={FONT} letterSpacing="-8">IC</text>
      <text x="407" y="126" fill="white" fontSize="126" fontWeight="900" fontFamily={FONT} letterSpacing="-8">Markets</text>
      <text x="614" y="194" fill="#30F034" fontSize="82" fontWeight="900" fontFamily={FONT}>Global</text>
    </svg>);

}

const infrastructurePartners = [
{ name: "BitGo", Logo: BitGoLogo, className: "h-10 w-auto max-w-[190px]" },
{ name: "Fireblocks", Logo: FireblocksLogo, className: "h-10 w-auto max-w-[230px]" },
{ name: "Chainalysis", Logo: ChainalysisLogo, className: "h-10 w-auto max-w-[220px]" },
{ name: "FP Markets", Logo: FPMarketsLogo, className: "h-12 w-auto max-w-[260px]" },
{ name: "IC Markets Global", Logo: ICMarketsLogo, className: "h-16 w-auto max-w-[320px]" }];


const fiatOptions = [
{ code: "EUR", symbol: "€" },
{ code: "USD", symbol: "$" },
{ code: "AUD", symbol: "A$" }];


const cryptoOptions = [
{ code: "BTC", icon: "₿", mockPriceEUR: 66858.43 },
{ code: "ETH", icon: "Ξ", mockPriceEUR: 3100.25 },
{ code: "USDC", icon: "$", mockPriceEUR: 0.92 },
{ code: "USDT", icon: "₮", mockPriceEUR: 0.92 }];


const paymentMethods = [
{ id: "card", label: "Card Payment", time: "1–3 minutes", fee: 0.025 },
{ id: "bank", label: "Bank Transfer", time: "5–30 minutes", fee: 0.005 },
{ id: "wallet", label: "Wallet Balance", time: "Instant", fee: 0.001 }];


const flows = {
  deposits: {
    eyebrow: "Deposits",
    title: "Crypto in, fiat settled to your firm.",
    intro: "Your client deposits crypto into a wallet your firm controls. Zerocap converts on a principal-to-principal basis and settles fiat to your firm’s operating account.",
    steps: [
    { number: "1", title: "Your client deposits crypto with your firm", body: "Your client sends BTC, ETH, USDT or USDC into a wallet your firm controls, hosted on Zerocap Connect infrastructure and attributed at the account level. Your firm onboards and KYCs the client; we host the infrastructure." },
    { number: "2", title: "Conversion runs principal-to-principal", body: "Your firm transacts with Zerocap on a principal-to-principal basis to convert crypto to AUD or USD at streaming institutional rates." },
    { number: "3", title: "Settlement to your firm", body: "Fiat settles to your firm’s operating account. Any onward payment to your client is made by your firm under your own licences." }],

    widgetSteps: [
    { label: "Step 1", title: "Firm-controlled wallet", detail: "BTC / ETH / USDT / USDC · attributed at account level" },
    { label: "Step 2", title: "Principal-to-principal conversion", detail: "Crypto → AUD / USD · streaming institutional rates" },
    { label: "Step 3", title: "Your firm’s operating account", detail: "Fiat settled to your firm · onward payment under your licences" }]

  },
  withdrawals: {
    eyebrow: "Withdrawals",
    title: "Crypto out, on your firm’s instruction.",
    intro: "Where your client requests a crypto withdrawal, the movement runs between wallets in your firm’s account hierarchy on Zerocap Connect, on your firm’s instruction routed via your API integration.",
    steps: [
    { number: "1", title: "Your client requests withdrawal", body: "Your client raises a withdrawal request with your firm, under your KYC, transaction monitoring, and client-money framework." },
    { number: "2", title: "Your firm instructs via API", body: "Your firm sends the withdrawal instruction to Zerocap Connect through your API integration, referencing the originating wallet in your firm’s account hierarchy." },
    { number: "3", title: "Movement between your firm’s wallets", body: "The movement runs between wallets in your firm’s account hierarchy on Zerocap Connect, with a full audit trail back to your client account." }],

    widgetSteps: [
    { label: "Step 1", title: "Client request to your firm", detail: "Raised under your KYC & client-money framework" },
    { label: "Step 2", title: "API instruction to Zerocap Connect", detail: "Routed via your API integration" },
    { label: "Step 3", title: "Firm-hierarchy wallet movement", detail: "Between wallets in your firm’s account hierarchy" }]

  }
};

function BackgroundSystem() {
  return (
    <div className="pointer-events-none fixed inset-0 overflow-hidden opacity-90">
      <div className="absolute inset-0" style={{ background: "radial-gradient(circle at 24% 18%, rgba(253,118,94,0.16), transparent 34%), radial-gradient(circle at 78% 22%, rgba(226,255,171,0.06), transparent 28%), radial-gradient(circle at 50% 64%, rgba(255,255,255,0.035), transparent 34%), #060606" }} />
      <div className="absolute left-[-18rem] top-[-16rem] h-[44rem] w-[44rem] rounded-full blur-3xl" style={{ background: "rgba(253,118,94,0.14)" }} />
      <div className="absolute right-[-16rem] top-[12rem] h-[38rem] w-[38rem] rounded-full blur-3xl" style={{ background: "rgba(226,255,171,0.055)" }} />
      <div className="absolute inset-0 opacity-[0.10]" style={{ backgroundImage: "linear-gradient(rgba(248,248,248,0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(248,248,248,0.16) 1px, transparent 1px)", backgroundSize: "72px 72px", maskImage: "radial-gradient(circle at 50% 18%, black, transparent 72%)", WebkitMaskImage: "radial-gradient(circle at 50% 18%, black, transparent 72%)" }} />
      <div className="absolute inset-0 bg-[radial-gradient(circle_at_center,transparent_0%,rgba(0,0,0,0.18)_55%,rgba(0,0,0,0.58)_100%)]" />
    </div>);

}

function FeaturePixelIcon({ type }) {
  const r = 3,s = 9;
  const grids = {
    // Crypto deposits/withdrawals — coin circle with currency symbol inside
    wallet: [
    [3, 0], [4, 0], [5, 0],
    [2, 1], [6, 1],
    [1, 2], [7, 2],
    [1, 3], [7, 3],
    [1, 4], [7, 4],
    [2, 5], [6, 5],
    [3, 6], [4, 6], [5, 6],
    // inner stem + top/bottom bars (₿-like)
    [4, 2], [4, 3], [4, 4],
    [3, 2], [5, 2],
    [3, 4], [5, 4]],

    // Lightweight API / widget — hub-and-spoke network node
    link: [
    [4, 4],
    [4, 1], [4, 2], [4, 3],
    [4, 5], [4, 6], [4, 7],
    [1, 4], [2, 4], [3, 4],
    [5, 4], [6, 4], [7, 4],
    [3, 0], [4, 0], [5, 0],
    [3, 8], [4, 8], [5, 8],
    [0, 3], [0, 4], [0, 5],
    [8, 3], [8, 4], [8, 5]],

    // Custody / liquidity / settlement — shield with lock inside
    shield: [
    [3, 0], [4, 0], [5, 0],
    [2, 1], [6, 1],
    [1, 2], [7, 2],
    [1, 3], [7, 3],
    [1, 4], [7, 4],
    [2, 5], [6, 5],
    [3, 6], [5, 6],
    [4, 7],
    // lock shackle arch
    [3, 2], [5, 2],
    [3, 3], [5, 3],
    // lock body
    [3, 4], [4, 4], [5, 4],
    [3, 5], [4, 5], [5, 5]],

    // Unique wallet UUID attribution — key icon
    building: [
    // Key head (circle)
    [3, 0], [4, 0],
    [2, 1], [5, 1],
    [2, 2], [5, 2],
    [3, 3], [4, 3],
    // keyhole
    [3, 1], [4, 1],
    // shaft
    [5, 2], [6, 2], [7, 2], [8, 2],
    // teeth
    [6, 3], [8, 3]],

    // Streaming pricing / real-time conversion — circular arrows
    refresh: [
    // top arc (left→right)
    [2, 0], [3, 0], [4, 0], [5, 0], [6, 0],
    [1, 1], [7, 1],
    [1, 2],
    // arrowhead top-right (pointing down)
    [7, 0], [8, 1], [7, 2],
    // bottom arc (right→left)
    [2, 7], [3, 7], [4, 7], [5, 7], [6, 7],
    [1, 6], [7, 6],
    [7, 5],
    // arrowhead bottom-left (pointing up)
    [1, 7], [0, 6], [2, 5]],

    // Reliance KYC / compliance — badge circle with checkmark
    check: [
    [3, 0], [4, 0], [5, 0],
    [2, 1], [6, 1],
    [1, 2], [7, 2],
    [1, 3], [7, 3],
    [1, 4], [7, 4],
    [2, 5], [6, 5],
    [3, 6], [4, 6], [5, 6],
    // checkmark ✓ inside
    [2, 4], [3, 5], [4, 4], [5, 3], [6, 2]]

  };
  const pts = grids[type] || grids.check;
  return (
    <svg width="160" height="160" viewBox="0 0 90 90" fill="none" aria-hidden="true">
      {pts.map(([col, row], i) =>
      <circle key={i} cx={col * s + s} cy={row * s + s} r={r} fill={BRAND} opacity={0.55 + i % 4 * 0.1} />
      )}
    </svg>);

}

function FeatureCard({ feature, idx = 0 }) {
  return (
    <Card className="fc-card group relative overflow-hidden border-white/10 bg-white/[0.04] text-white shadow-2xl shadow-black/20 backdrop-blur transition hover:-translate-y-1 hover:bg-white/[0.07]">
      <div className="fc-icon pointer-events-none absolute -right-6 -top-6" style={{ animationDelay: `-${idx * 1.2}s, -${idx * 0.6}s` }} aria-hidden="true">
        <FeaturePixelIcon type={feature.icon} />
      </div>
      <CardContent className="relative p-6">
        <div className="mb-6 flex h-12 w-12 items-center justify-center rounded-2xl" style={{ background: SOFT, color: BRAND, boxShadow: `inset 0 0 0 1px ${RING}` }}>
          <Icon name={feature.icon} size={22} />
        </div>
        <h3 className="mb-3 text-xl font-semibold tracking-tight">{feature.title}</h3>
        <p className="text-sm leading-7" style={{ color: MUTED }}>{feature.body}</p>
      </CardContent>
    </Card>);

}

const GROUP_ICONS = [
// Integration — plug / link
<svg width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
    <path d="M13 3l4 4-8.5 8.5a2.828 2.828 0 01-4-4L13 3z" />
    <path d="M7.5 12.5l-3.5 3.5" /><path d="M15 5l2-2" />
  </svg>,
// Coverage — globe
<svg width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
    <circle cx="10" cy="10" r="7.5" />
    <path d="M2.5 10h15" /><path d="M10 2.5c-2.5 2-4 4.5-4 7.5s1.5 5.5 4 7.5M10 2.5c2.5 2 4 4.5 4 7.5s-1.5 5.5-4 7.5" />
  </svg>,
// Pricing & limits — tag
<svg width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
    <path d="M3 3h6l8 8a2 2 0 010 2.83l-3.17 3.17a2 2 0 01-2.83 0L3 9V3z" />
    <circle cx="7" cy="7" r="1.1" fill="currentColor" stroke="none" />
  </svg>,
// Operations — sliders
<svg width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
    <line x1="3" y1="5" x2="17" y2="5" /><circle cx="7" cy="5" r="2" fill="currentColor" stroke="none" />
    <line x1="3" y1="10" x2="17" y2="10" /><circle cx="13" cy="10" r="2" fill="currentColor" stroke="none" />
    <line x1="3" y1="15" x2="17" y2="15" /><circle cx="9" cy="15" r="2" fill="currentColor" stroke="none" />
  </svg>];


const ASSET_CHIPS = {
  "Supported Assets": [
  { ticker: "BTC", label: "Bitcoin", bg: "#F7931A", fg: "#fff",
    icon: <svg viewBox="0 0 24 24" fill="currentColor" width="14" height="14" aria-hidden="true"><path d="M23.638 14.904c-1.602 6.43-8.113 10.34-14.542 8.736C2.67 22.05-1.244 15.525.362 9.105 1.962 2.67 8.475-1.243 14.9.358c6.43 1.605 10.342 8.115 8.738 14.548v-.002zm-6.35-4.613c.24-1.59-.974-2.45-2.64-3.03l.54-2.153-1.315-.33-.525 2.107c-.345-.087-.705-.167-1.064-.25l.526-2.127-1.32-.33-.54 2.165c-.285-.067-.565-.132-.84-.2l-1.815-.45-.35 1.407s.974.225.955.236c.535.136.63.486.615.766l-1.477 5.92c-.075.166-.24.406-.614.314.015.02-.96-.24-.96-.24l-.66 1.51 1.71.426.93.242-.54 2.19 1.32.327.54-2.17c.36.1.705.19 1.05.273l-.51 2.154 1.32.33.545-2.19c2.24.427 3.93.257 4.64-1.774.57-1.637-.03-2.58-1.217-3.196.854-.193 1.5-.76 1.68-1.93h.01zm-3.01 4.22c-.404 1.64-3.157.75-4.05.53l.72-2.9c.896.23 3.757.67 3.33 2.37zm.41-4.24c-.37 1.49-2.662.735-3.405.55l.654-2.64c.744.18 3.137.524 2.75 2.084v.006z" /></svg> },
  { ticker: "ETH", label: "Ethereum", bg: "#627EEA", fg: "#fff",
    icon: <svg viewBox="0 0 24 24" fill="currentColor" width="14" height="14" aria-hidden="true"><path d="M11.944 17.97L4.58 13.62 11.943 24l7.37-10.38-7.372 4.35h.003zM12.056 0L4.69 12.223l7.365 4.354 7.365-4.35L12.056 0z" /></svg> },
  { ticker: "USDT", label: "Tether", bg: "#26A17B", fg: "#fff",
    icon: <svg viewBox="0 0 24 24" fill="currentColor" width="14" height="14" aria-hidden="true"><path d="M13.5 8.182V6.545h3.818V4H6.682v2.545H10.5v1.637C6.295 8.413 3.136 9.392 3.136 10.59c0 1.2 3.159 2.177 7.364 2.408v8.638h2.5v-8.638c4.206-.23 7.364-1.208 7.364-2.408 0-1.198-3.158-2.177-6.864-2.408zM12 12.273c-3.863 0-6.999-.79-6.999-1.682 0-.894 3.136-1.682 6.999-1.682 3.864 0 7 .788 7 1.682 0 .892-3.136 1.682-7 1.682z" /></svg> },
  { ticker: "USDC", label: "USD Coin", bg: "#2775CA", fg: "#fff",
    icon: <svg viewBox="0 0 24 24" fill="currentColor" width="14" height="14" aria-hidden="true"><path d="M12 0C5.374 0 0 5.373 0 12c0 6.628 5.374 12 12 12s12-5.372 12-12c0-6.627-5.374-12-12-12zm-.613 18.545v-.873c-1.578-.16-2.89-.824-3.773-1.882l1.25-1.25c.713.814 1.66 1.312 2.523 1.47v-2.942c-2.062-.47-3.207-1.357-3.207-2.932 0-1.573 1.227-2.636 3.207-2.795v-.818h1.226v.818c1.44.145 2.633.73 3.495 1.715l-1.234 1.234c-.643-.728-1.485-1.175-2.261-1.33v2.781c2.119.49 3.303 1.4 3.303 3.047 0 1.658-1.265 2.759-3.303 2.933v.879h-1.226v-.055zm0-8.273c-.96.13-1.463.634-1.463 1.25 0 .617.503 1.02 1.463 1.272V10.272zm1.226 4.42c1.01-.144 1.543-.668 1.543-1.352 0-.68-.533-1.11-1.543-1.352v2.704z" /></svg> }],

  "Supported Fiat Currencies": [
  { ticker: "USD", label: "US Dollar", bg: "#1a3a6c", fg: "#fff",
    icon: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" aria-hidden="true"><line x1="12" y1="1" x2="12" y2="23" /><path d="M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6" /></svg> },
  { ticker: "EUR", label: "Euro", bg: "#003399", fg: "#FFD700",
    icon: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" aria-hidden="true"><path d="M18 4a9 9 0 100 16M4 9h10M4 15h10" /></svg> },
  { ticker: "GBP", label: "British Pound", bg: "#CF142B", fg: "#fff",
    icon: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" aria-hidden="true"><path d="M17 20H7m2.5-8h5M7 12h2.5m-3 8l1.5-12a4 4 0 018 1.5" /></svg> },
  { ticker: "AUD", label: "Australian Dollar", bg: "#00843D", fg: "#fff",
    icon: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" aria-hidden="true"><line x1="12" y1="1" x2="12" y2="23" /><path d="M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6" /></svg> },
  { ticker: "JPY", label: "Japanese Yen", bg: "#BC002D", fg: "#fff",
    icon: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" aria-hidden="true"><path d="M12 21V11m0 0L5 3m7 8l7-8M5 11h14M5 16h14" /></svg> }]

};

function AssetChips({ chips }) {
  return (
    <div style={{ display: "flex", flexWrap: "wrap", gap: "8px", marginTop: "10px" }}>
      {chips.map(({ ticker, label, bg, fg, icon }) =>
      <div key={ticker} title={label} style={{
        display: "flex", alignItems: "center", gap: "6px",
        padding: "4px 10px 4px 6px",
        borderRadius: "999px",
        background: bg + "22",
        border: "1px solid " + bg + "55",
        fontSize: "11px", fontWeight: 600, letterSpacing: "0.04em",
        color: fg === "#FFD700" ? "#FFD700" : "#fff",
        fontFamily: "ui-monospace, 'JetBrains Mono', Menlo, monospace"
      }}>
          <span style={{
          display: "flex", alignItems: "center", justifyContent: "center",
          width: "20px", height: "20px", borderRadius: "50%",
          background: bg, color: fg, flexShrink: 0
        }}>
            {icon}
          </span>
          {ticker}
        </div>
      )}
    </div>);

}

function KeyFeaturesSection() {
  const groupedFeatures = [
  { group: "Integration", items: keyFeatures.slice(0, 1) },
  { group: "Coverage", items: keyFeatures.slice(1, 3) },
  { group: "Pricing & limits", items: keyFeatures.slice(3, 7) },
  { group: "Operations", items: keyFeatures.slice(7, 10) }];

  const [openIdx, setOpenIdx] = React.useState(0);

  return (
    <section id="key-features" className="relative z-10 mx-auto max-w-7xl px-5 py-24 md:px-8">
      <style>{`
        @keyframes kf-border-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
        @keyframes kf-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
        @keyframes kf-pulse-dot { 0%, 100% { opacity: 0.35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.4); } }
        @keyframes kf-row-shine { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }
        .kf-shell { isolation: isolate; }
        .kf-shell::before {
          content: ""; position: absolute; inset: -1px; border-radius: 2.05rem; padding: 1.5px;
          background: conic-gradient(from 0deg, transparent 0deg, rgba(253,118,94,0.55) 60deg, rgba(226,255,171,0.4) 120deg, transparent 200deg, transparent 360deg);
          -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          -webkit-mask-composite: xor; mask-composite: exclude;
          animation: kf-border-spin 14s linear infinite;
          pointer-events: none; opacity: 0.75; z-index: 0;
        }
        .kf-shell-inner { position: relative; z-index: 1; }
        .kf-title-shimmer {
          background: linear-gradient(90deg, #ffffff 0%, #ffffff 35%, #FD765E 50%, #ffffff 65%, #ffffff 100%);
          background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
          animation: kf-shimmer 6s linear infinite;
        }
        .kf-dot { animation: kf-pulse-dot 2.4s ease-in-out infinite; }
        .kf-accordion-trigger {
          width: 100%; display: flex; align-items: center; gap: 16px;
          padding: 20px 24px; background: transparent; border: none; cursor: pointer;
          text-align: left; transition: background 0.2s;
        }
        .kf-accordion-trigger:hover { background: rgba(253,118,94,0.04); }
        .kf-accordion-trigger[data-open="true"] { background: rgba(253,118,94,0.06); }
        .kf-chevron { transition: transform 0.35s cubic-bezier(0.4,0,0.2,1); color: rgba(255,255,255,0.4); flex-shrink: 0; }
        .kf-chevron[data-open="true"] { transform: rotate(180deg); color: #FD765E; }
        .kf-panel { overflow: hidden; transition: max-height 0.42s cubic-bezier(0.4,0,0.2,1), opacity 0.35s ease; }
        .kf-panel[data-open="false"] { max-height: 0; opacity: 0; }
        .kf-panel[data-open="true"] { max-height: 900px; opacity: 1; }
        .kf-row { position: relative; overflow: hidden; transition: background 0.2s; }
        .kf-row:hover { background: rgba(253,118,94,0.04); }
        .kf-row::before {
          content: ""; position: absolute; inset: 0;
          background: linear-gradient(90deg, transparent, rgba(253,118,94,0.08), transparent);
          transform: translateX(-100%); pointer-events: none;
        }
        .kf-row:hover::before { animation: kf-row-shine 0.8s ease forwards; }
        @media (prefers-reduced-motion: reduce) {
          .kf-shell::before, .kf-title-shimmer, .kf-dot, .kf-row::before, .kf-panel, .kf-chevron { animation: none !important; transition: none !important; }
        }
      `}</style>
      <div className="kf-shell relative overflow-hidden rounded-[2rem] border border-white/10 bg-white/[0.04] p-6 shadow-2xl shadow-black/20 backdrop-blur md:p-8">
        <div className="pointer-events-none absolute -right-24 -top-24 h-72 w-72 rounded-full blur-3xl" style={{ background: "rgba(253,118,94,0.14)" }} />
        <div className="pointer-events-none absolute -left-24 bottom-10 h-64 w-64 rounded-full blur-3xl" style={{ background: "rgba(226,255,171,0.055)" }} />
        <div className="kf-shell-inner">
          <motion.div
            className="relative mb-10 grid gap-5 md:grid-cols-[0.9fr_1.1fr] md:items-end"
            initial={{ opacity: 0, y: 18 }}
            whileInView={{ opacity: 1, y: 0 }}
            viewport={{ once: true, amount: 0.4 }}
            transition={{ duration: 0.6, ease: "easeOut" }}>
            {/* Dot-pixel watermark — matches the FeaturePixelIcon / IndustryIcon grid style */}
            <svg className="pointer-events-none absolute right-0 top-0 opacity-[0.07]" width="96" height="72" viewBox="0 0 96 72" fill="none" aria-hidden="true">
              {Array.from({ length: 6 }, (_, row) =>
              Array.from({ length: 8 }, (_, col) =>
              <circle key={`${row}-${col}`} cx={col * 12 + 6} cy={row * 12 + 6} r={3} fill={BRAND} opacity={0.4 + (row + col) % 4 * 0.15} />
              )
              )}
            </svg>
            <div>
              <div className="mb-4 inline-flex items-center gap-2">
                {/* 3×2 pixel cluster replacing the single dot */}
                <svg className="kf-dot shrink-0" width="20" height="14" viewBox="0 0 20 14" fill="none" aria-hidden="true">
                  {[[2, 2], [8, 2], [14, 2], [2, 8], [8, 8], [14, 8]].map(([x, y], i) =>
                  <circle key={i} cx={x} cy={y} r={2.2} fill={BRAND} opacity={0.42 + i % 3 * 0.2} />
                  )}
                </svg>
                <p className="text-sm font-semibold uppercase tracking-[0.3em]" style={{ color: BRAND }}>Key features</p>
              </div>
              <h2 className="kf-title-shimmer text-4xl font-semibold tracking-[-0.04em] md:text-5xl" style={{ fontFamily: FONT }}>Zerocap Connect product specifications</h2>
            </div>
            <p className="max-w-2xl text-base leading-7 md:justify-self-end md:text-right" style={{ color: MUTED }}>Core integration, asset, conversion, compliance, custody, and reporting capabilities for financial service providers.</p>
          </motion.div>

          <div className="divide-y divide-white/[0.07] rounded-2xl border border-white/10 overflow-hidden">
            {groupedFeatures.map((section, gIdx) => {
              const isOpen = openIdx === gIdx;
              return (
                <motion.div
                  key={section.group}
                  initial={{ opacity: 0, y: 12 }}
                  whileInView={{ opacity: 1, y: 0 }}
                  viewport={{ once: true, amount: 0.15 }}
                  transition={{ duration: 0.45, delay: gIdx * 0.07, ease: "easeOut" }}>
                  <button
                    type="button"
                    className="kf-accordion-trigger"
                    data-open={isOpen}
                    onClick={() => setOpenIdx(isOpen ? -1 : gIdx)}
                    aria-expanded={isOpen}>
                    <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl" style={{ background: isOpen ? SOFT : "rgba(255,255,255,0.05)", color: isOpen ? BRAND : TERTIARY, boxShadow: isOpen ? "inset 0 0 0 1px " + RING : "none", transition: "all 0.3s" }}>
                      {GROUP_ICONS[gIdx]}
                    </span>
                    <span className="flex-1 text-sm font-semibold uppercase tracking-[0.22em]" style={{ color: isOpen ? BRAND : TEXT, transition: "color 0.3s" }}>{section.group}</span>
                    <span className="font-mono text-[11px] tabular-nums" style={{ color: TERTIARY }}>{section.items.length} item{section.items.length !== 1 ? "s" : ""}</span>
                    <svg className="kf-chevron" data-open={isOpen} width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
                      <polyline points="4 6 8 10 12 6" />
                    </svg>
                  </button>

                  <div className="kf-panel" data-open={isOpen} aria-hidden={!isOpen}>
                    <div className="divide-y divide-white/[0.06] border-t border-white/[0.07]">
                      {section.items.map(([label, value], rIdx) =>
                      <div key={label} className="kf-row grid gap-2 px-6 py-4 md:grid-cols-[2.5rem_0.38fr_0.62fr] md:gap-6">
                          <div className="hidden font-mono text-xs tabular-nums md:flex md:items-start md:pt-0.5" style={{ color: TERTIARY }}>{String(rIdx + 1).padStart(2, "0")}</div>
                          <div className="text-sm font-semibold leading-snug" style={{ color: TEXT }}>{label}</div>
                          <div className="text-sm leading-6" style={{ color: MUTED }}>
                            {value}
                            {ASSET_CHIPS[label] && <AssetChips chips={ASSET_CHIPS[label]} />}
                          </div>
                        </div>
                      )}
                    </div>
                  </div>
                </motion.div>);

            })}
          </div>
        </div>
      </div>
    </section>);
}

function FlowOfFundsSection() {
  const [activeTab, setActiveTab] = React.useState("deposits");
  const [activeStep, setActiveStep] = React.useState(0);
  const current = flows[activeTab];
  const total = current.steps.length;

  const handleTab = (key) => {setActiveTab(key);setActiveStep(0);};
  const goPrev = () => setActiveStep((s) => Math.max(0, s - 1));
  const goNext = () => setActiveStep((s) => Math.min(total - 1, s + 1));

  return (
    <section id="flow-of-funds" className="relative z-10 border-y border-white/10 bg-white/[0.02] py-24">
      <style>{`
        @keyframes fof-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(253,118,94,0.5); } 50% { box-shadow: 0 0 0 14px rgba(253,118,94,0); } }
        .fof-step { transition: all 0.45s cubic-bezier(0.2,0.7,0.2,1); cursor: pointer; }
        .fof-step[data-state="upcoming"] { opacity: 0.32; }
        .fof-step[data-state="active"] { opacity: 1; }
        .fof-step[data-state="done"] { opacity: 0.55; }
        .fof-step:hover[data-state="upcoming"], .fof-step:hover[data-state="done"] { opacity: 0.8; }
        .fof-step .fof-num { transition: all 0.45s cubic-bezier(0.2,0.7,0.2,1); }
        .fof-step[data-state="active"] .fof-num { background: #FD765E; color: #111; animation: fof-pulse 2.2s ease-out infinite; }
        .fof-step[data-state="done"] .fof-num { background: rgba(253,118,94,0.22); color: #FD765E; }
        .fof-vstep { transition: all 0.5s cubic-bezier(0.2,0.7,0.2,1); }
        .fof-vstep[data-state="upcoming"] { opacity: 0.35; filter: saturate(0.5); }
        .fof-vstep[data-state="active"] { opacity: 1; transform: scale(1.02); border-color: rgba(253,118,94,0.6) !important; box-shadow: 0 12px 40px rgba(253,118,94,0.18); }
        .fof-vstep[data-state="done"] { opacity: 0.7; }
        .fof-arrow { transition: color 0.4s, transform 0.4s; }
        .fof-arrow[data-active="true"] { color: #FD765E !important; transform: translateY(2px) scale(1.15); }
        .fof-progress { transition: height 0.5s cubic-bezier(0.2,0.7,0.2,1); }
        .fof-nav-btn { transition: all 0.2s ease; }
        .fof-nav-btn:hover:not(:disabled) { background: rgba(253,118,94,0.15); border-color: rgba(253,118,94,0.5); color: #FD765E; }
        .fof-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
        @media (prefers-reduced-motion: reduce) {
          .fof-step, .fof-vstep, .fof-arrow, .fof-progress, .fof-step .fof-num { transition: none !important; animation: none !important; }
        }
      `}</style>
      <div className="mx-auto max-w-7xl px-5 md:px-8">
        <div className="mb-10 grid gap-8 lg:grid-cols-[0.88fr_1.12fr] lg:items-end">
          <div>
            <p className="mb-4 text-sm font-semibold uppercase tracking-[0.3em]" style={{ color: BRAND }}>Flow of funds</p>
            <h2 className="max-w-xl text-4xl font-semibold tracking-[-0.04em] text-white md:text-5xl">How the integration works.</h2>
          </div>
          <div>
            <p className="max-w-2xl text-base leading-7 md:text-lg md:leading-8" style={{ color: MUTED }}>Your firm uses Zerocap Connect to offer crypto deposits, withdrawals, and conversion to your clients under your own licences and KYC framework.</p>
            <div className="mt-5 inline-flex rounded-full border border-white/10 bg-black/30 p-1">
              {[["deposits", "Deposits"], ["withdrawals", "Withdrawals"]].map(([key, label]) =>
              <button key={key} type="button" onClick={() => handleTab(key)} className="rounded-full px-5 py-2 text-sm font-semibold transition" style={{ background: activeTab === key ? BRAND : "transparent", color: activeTab === key ? "#111111" : TEXT }}>
                  {label}
                </button>
              )}
            </div>
          </div>
        </div>

        <div className="grid gap-6 lg:grid-cols-[1.02fr_0.98fr]">
          <div className="relative rounded-[2rem] border border-white/10 bg-white/[0.04] p-6 shadow-2xl shadow-black/20 backdrop-blur md:p-8">
            <p className="mb-3 text-xs font-semibold uppercase tracking-[0.26em]" style={{ color: BRAND }}>{current.eyebrow}</p>
            <h3 className="text-2xl font-semibold tracking-[-0.03em] text-white md:text-3xl">{current.title}</h3>
            <p className="mt-3 max-w-2xl text-sm leading-6 md:text-base md:leading-7" style={{ color: MUTED }}>{current.intro}</p>
            <div className="relative mt-6">
              <div className="absolute left-[19px] top-2 bottom-2 w-px bg-white/10" />
              <div className="fof-progress absolute left-[19px] top-2 w-px" style={{ background: BRAND, height: "calc(" + (activeStep + 1) / total * 100 + "% - 16px)" }} />
              <div className="space-y-3">
                {current.steps.map((step, idx) => {
                  const state = idx < activeStep ? "done" : idx === activeStep ? "active" : "upcoming";
                  return (
                    <div key={step.number} className="fof-step relative" data-state={state} onClick={() => setActiveStep(idx)}>
                      <div className="flex items-start gap-4 rounded-2xl border border-white/10 bg-black/25 p-4">
                        <div className="fof-num relative z-10 flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-sm font-semibold" style={{ background: SOFT, color: BRAND }}>{step.number}</div>
                        <div>
                          <h4 className="text-base font-semibold text-white md:text-lg">{step.title}</h4>
                          <p className="mt-1.5 text-sm leading-6" style={{ color: MUTED }}>{step.body}</p>
                        </div>
                      </div>
                    </div>);

                })}
              </div>
            </div>
            <div className="mt-6 flex items-center justify-between gap-4">
              <button type="button" onClick={goPrev} disabled={activeStep === 0} className="fof-nav-btn flex items-center gap-2 rounded-full border border-white/15 bg-black/30 px-4 py-2 text-sm font-semibold text-white/90">
                <span aria-hidden="true">←</span> Prev
              </button>
              <div className="flex items-center gap-2">
                {current.steps.map((_, idx) =>
                <button key={idx} type="button" onClick={() => setActiveStep(idx)} aria-label={"Go to step " + (idx + 1)} className="rounded-full transition-all duration-300" style={{ width: idx === activeStep ? 24 : 8, height: 8, background: idx <= activeStep ? BRAND : "rgba(255,255,255,0.2)" }} />
                )}
              </div>
              <button type="button" onClick={goNext} disabled={activeStep === total - 1} className="fof-nav-btn flex items-center gap-2 rounded-full border border-white/15 bg-black/30 px-4 py-2 text-sm font-semibold text-white/90">
                Next <span aria-hidden="true">→</span>
              </button>
            </div>
          </div>

          <div className="rounded-[2rem] border border-white/10 bg-black/35 p-6 shadow-2xl shadow-black/20 backdrop-blur md:p-8">
            <div className="mb-5 flex items-center justify-between gap-4">
              <div>
                <p className="text-xs font-semibold uppercase tracking-[0.26em]" style={{ color: BRAND }}>Flow visualiser</p>
                <h3 className="mt-1.5 text-xl font-semibold tracking-tight text-white md:text-2xl">Zerocap swap engine</h3>
              </div>
              <div className="rounded-full px-3 py-1 text-xs font-semibold" style={{ background: SOFT, color: BRAND }}>{activeTab === "deposits" ? "Deposit flow" : "Withdrawal flow"}</div>
            </div>
            <div className="space-y-3">
              {current.widgetSteps.map((step, index) => {
                const state = index < activeStep ? "done" : index === activeStep ? "active" : "upcoming";
                return (
                  <React.Fragment key={step.label}>
                    <div className="fof-vstep rounded-2xl border border-white/10 bg-white/[0.04] p-4" data-state={state}>
                      <p className="text-xs font-semibold uppercase tracking-[0.2em]" style={{ color: BRAND }}>{step.label}</p>
                      <h4 className="mt-1.5 text-base font-semibold text-white md:text-lg">{step.title}</h4>
                      <p className="mt-1 text-sm leading-6" style={{ color: MUTED }}>{step.detail}</p>
                    </div>
                    {index < current.widgetSteps.length - 1 &&
                    <div className="flex justify-center">
                        <div className="fof-arrow flex h-8 w-8 items-center justify-center rounded-full border border-white/10 bg-white/[0.03] text-base" style={{ color: "rgba(255,255,255,0.4)" }} data-active={index < activeStep ? "true" : "false"}>↓</div>
                      </div>
                    }
                  </React.Fragment>);

              })}
            </div>
            <div className="mt-5 rounded-2xl border p-4" style={{ borderColor: RING, background: "linear-gradient(135deg, rgba(253,118,94,0.10), rgba(255,255,255,0.03))" }}>
              <p className="text-xs font-semibold uppercase tracking-[0.24em]" style={{ color: BRAND }}>Note</p>
              <p className="mt-2 text-sm leading-6 text-white/85">Throughout this flow, the end-client relationship is your firm’s — including KYC, transaction monitoring, client communications, and client money obligations.</p>
            </div>
          </div>
        </div>
      </div>
    </section>);

}

function TrustBadgeMarquee() {
  const marqueeItems = [...trustBadges, ...trustBadges, ...trustBadges, ...trustBadges];
  return (
    <div className="relative overflow-hidden py-2">
      <div className="pointer-events-none absolute inset-y-0 left-0 z-10 w-6 bg-gradient-to-r from-[#060606] to-transparent" />
      <div className="pointer-events-none absolute inset-y-0 right-0 z-10 w-6 bg-gradient-to-l from-[#060606] to-transparent" />
      <motion.div className="flex w-max items-center gap-10" animate={{ x: [0, -760] }} transition={{ duration: 24, repeat: Infinity, ease: "linear" }}>
        {marqueeItems.map((badge, index) =>
        <div key={`${badge.label}-${index}`} className="flex min-w-max shrink-0 items-center gap-3 text-[15px] font-semibold leading-snug text-white md:text-base">
            <span className="flex h-5 w-5 shrink-0 items-center justify-center" style={{ color: BRAND }}><Icon name={badge.icon} size={20} /></span>
            <span>{badge.label}</span>
          </div>
        )}
      </motion.div>
    </div>);

}

const partnerSlides = [
{ name: "Zerocap", src: "https://zerocap.com/wp-content/uploads/2026/05/Full-Logo_Dark-scaled.png" },
{ name: "Lockup White", src: "https://zerocap.com/wp-content/uploads/2026/05/Lockup_White_785px-scaled.png" },
{ name: "Chainalysis", src: "https://zerocap.com/wp-content/uploads/2026/05/Chainalysis_idaup1d4Il_1.png" },
{ name: "FP Markets", src: "https://zerocap.com/wp-content/uploads/2026/05/FP_Markets_idsTf7GgKr_0.png" },
{ name: "IC Markets", src: "https://zerocap.com/wp-content/uploads/2026/05/IC_Markets_idGyGc4Msn_0.png" }];


function LogoMarquee() {
  const items = [...partnerSlides, ...partnerSlides, ...partnerSlides, ...partnerSlides, ...partnerSlides, ...partnerSlides];
  return (
    <div className="relative w-full overflow-hidden bg-transparent py-10">
      <div className="pointer-events-none absolute inset-y-0 left-0 z-10 w-24 bg-gradient-to-r from-[#060606] to-transparent" />
      <div className="pointer-events-none absolute inset-y-0 right-0 z-10 w-24 bg-gradient-to-l from-[#060606] to-transparent" />
      <motion.div className="flex w-max items-center gap-16" animate={{ x: [0, -1920] }} transition={{ duration: 28, repeat: Infinity, ease: "linear" }}>
        {items.map((slide, i) =>
        <div key={`${slide.name}-${i}`} className="flex h-20 w-[320px] shrink-0 items-center justify-center px-6">
            <img
            src={slide.src}
            alt={slide.name}
            className="max-h-full max-w-full object-contain transition-opacity duration-300 hover:opacity-80"
            style={{ filter: "grayscale(100%) brightness(1.6) contrast(0.9)", opacity: 0.55 }} />
          
          </div>
        )}
      </motion.div>
    </div>);

}

function SwapWidget() {
  return (
    <motion.div className="relative mx-auto w-full max-w-[500px]" initial={{ opacity: 0, y: 18, scale: 0.98 }} animate={{ opacity: 1, y: 0, scale: 1 }} transition={{ duration: 0.65, ease: "easeOut" }}>
      <div className="absolute inset-0 -z-10 rounded-[2.5rem] blur-3xl" style={{ background: "radial-gradient(circle at 50% 45%, rgba(253,118,94,0.22), rgba(253,118,94,0.08) 42%, transparent 70%)", transform: "scale(1.06)" }} />

      {/* Fictitious broker-branded application chrome */}
      <div style={brokerWidgetStyles.window} aria-hidden="true">
        <div style={brokerWidgetStyles.titleBar}>
          <div style={brokerWidgetStyles.brokerBrand}>
            <span style={brokerWidgetStyles.brokerMark}>FX</span>
            <span style={brokerWidgetStyles.brokerName}>FX Broker XYZ</span>
          </div>
          <div style={brokerWidgetStyles.titleNav}>
            <span>Markets</span><span>Portfolio</span><span style={brokerWidgetStyles.titleNavActive}>Wallet</span>
          </div>
        </div>

        <div style={brokerWidgetStyles.body}>
          <div style={brokerWidgetStyles.panelHead}>
            <p style={brokerWidgetStyles.panelTitle}>Digital Assets</p>
            <div style={brokerWidgetStyles.tabs}>
              <span style={brokerWidgetStyles.activeTab}>Deposit</span>
              <span style={brokerWidgetStyles.tab}>Withdraw</span>
            </div>
          </div>

          <div style={brokerWidgetStyles.field}>
            <div style={brokerWidgetStyles.fieldRow}>
              <span style={brokerWidgetStyles.fieldLabel}>Asset</span>
              <span style={brokerWidgetStyles.assetPill}><span style={brokerWidgetStyles.assetDot}><svg viewBox="0 0 24 24" fill="#fff" width="12" height="12" aria-hidden="true"><path d="M12 0C5.374 0 0 5.373 0 12c0 6.628 5.374 12 12 12s12-5.372 12-12c0-6.627-5.374-12-12-12zm-.613 18.545v-.873c-1.578-.16-2.89-.824-3.773-1.882l1.25-1.25c.713.814 1.66 1.312 2.523 1.47v-2.942c-2.062-.47-3.207-1.357-3.207-2.932 0-1.573 1.227-2.636 3.207-2.795v-.818h1.226v.818c1.44.145 2.633.73 3.495 1.715l-1.234 1.234c-.643-.728-1.485-1.175-2.261-1.33v2.781c2.119.49 3.303 1.4 3.303 3.047 0 1.658-1.265 2.759-3.303 2.933v.879h-1.226v-.055zm0-8.273c-.96.13-1.463.634-1.463 1.25 0 .617.503 1.02 1.463 1.272V10.272zm1.226 4.42c1.01-.144 1.543-.668 1.543-1.352 0-.68-.533-1.11-1.543-1.352v2.704z" /></svg></span>USDC</span>
            </div>
            <div style={brokerWidgetStyles.fieldRow}>
              <span style={brokerWidgetStyles.fieldLabel}>Network</span>
              <span style={brokerWidgetStyles.fieldValue}>Ethereum Mainnet</span>
            </div>
          </div>

          <div style={brokerWidgetStyles.addressBox}>
            <span style={brokerWidgetStyles.fieldLabel}>Your deposit address</span>
            <div style={brokerWidgetStyles.addressRow}>
              <code style={brokerWidgetStyles.address}>0x7a3F…d9C2e</code>
              <span style={brokerWidgetStyles.copyBtn}>Copy</span>
            </div>
            <p style={brokerWidgetStyles.addressNote}>Wallet-to-wallet transfer · credited to your FX Broker XYZ account</p>
          </div>

          <div style={brokerWidgetStyles.flowRow}>
            <span style={brokerWidgetStyles.flowNode}>Client wallet</span>
            <span style={brokerWidgetStyles.flowArrow}>→</span>
            <span style={brokerWidgetStyles.flowNode}>Firm account</span>
            <span style={brokerWidgetStyles.flowArrow}>→</span>
            <span style={brokerWidgetStyles.flowNode}>Convert / settle</span>
          </div>

          <p style={brokerWidgetStyles.poweredBy}>Infrastructure by Zerocap Connect</p>
        </div>
      </div>

      <p style={brokerWidgetStyles.caption}>Illustrative — shown inside a broker-branded integration.</p>
    </motion.div>);

}

const brokerWidgetStyles = {
  window: { width: "100%", maxWidth: "470px", margin: "0 auto", background: "linear-gradient(145deg, rgba(34,34,34,0.94) 0%, rgba(18,18,18,0.96) 55%, rgba(26,26,26,0.94) 100%)", color: "#ffffff", borderRadius: "20px", fontFamily: FONT, boxShadow: "0 30px 80px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -1px 0 rgba(0,0,0,0.4)", border: "1px solid rgba(255,255,255,0.10)", backdropFilter: "blur(18px) saturate(140%)", WebkitBackdropFilter: "blur(18px) saturate(140%)", overflow: "hidden" },
  titleBar: { display: "flex", justifyContent: "space-between", alignItems: "center", padding: "14px 18px", borderBottom: "1px solid rgba(255,255,255,0.08)", background: "rgba(255,255,255,0.02)" },
  brokerBrand: { display: "flex", alignItems: "center", gap: "9px" },
  brokerMark: { display: "inline-flex", alignItems: "center", justifyContent: "center", width: "26px", height: "26px", borderRadius: "7px", background: "linear-gradient(135deg,#3b82f6,#1e3a8a)", color: "#fff", fontSize: "12px", fontWeight: 800, letterSpacing: "0.02em" },
  brokerName: { fontSize: "14px", fontWeight: 700, color: "#e8e8e8" },
  titleNav: { display: "flex", gap: "14px", fontSize: "12px", color: "#7d7d7d" },
  titleNavActive: { color: "#ffffff", fontWeight: 600 },
  body: { padding: "20px" },
  panelHead: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "18px" },
  panelTitle: { margin: 0, fontSize: "16px", fontWeight: 700 },
  tabs: { display: "flex", gap: "6px", background: "rgba(255,255,255,0.05)", borderRadius: "10px", padding: "3px" },
  activeTab: { background: "#2a2a2a", color: BRAND, padding: "7px 14px", borderRadius: "8px", fontSize: "13px", fontWeight: 600 },
  tab: { color: "#8f8f8f", padding: "7px 14px", borderRadius: "8px", fontSize: "13px" },
  field: { border: "1px solid rgba(255,255,255,0.08)", borderRadius: "12px", padding: "4px 16px", marginBottom: "12px" },
  fieldRow: { display: "flex", justifyContent: "space-between", alignItems: "center", padding: "14px 0", borderBottom: "1px solid rgba(255,255,255,0.06)" },
  fieldLabel: { color: "#9a9a9a", fontSize: "13px" },
  fieldValue: { fontSize: "14px", fontWeight: 600, color: "#ededed" },
  assetPill: { display: "inline-flex", alignItems: "center", gap: "8px", background: "#262626", border: "1px solid rgba(255,255,255,0.06)", borderRadius: "9px", padding: "7px 13px", fontSize: "14px", fontWeight: 700 },
  assetDot: { width: "22px", height: "22px", borderRadius: "50%", background: "#2775CA", display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0 },
  addressBox: { background: "rgba(255,255,255,0.03)", border: "1px solid rgba(255,255,255,0.08)", borderRadius: "12px", padding: "16px", marginBottom: "16px" },
  addressRow: { display: "flex", justifyContent: "space-between", alignItems: "center", marginTop: "10px" },
  address: { fontFamily: "'SF Mono', ui-monospace, Menlo, monospace", fontSize: "15px", letterSpacing: "0.04em", color: "#ffffff" },
  copyBtn: { fontSize: "12px", fontWeight: 600, color: BRAND, border: `1px solid ${BRAND}`, borderRadius: "7px", padding: "5px 11px" },
  addressNote: { margin: "12px 0 0", fontSize: "11px", color: "#8f8f8f" },
  flowRow: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "6px", background: "rgba(255,255,255,0.02)", border: "1px solid rgba(255,255,255,0.06)", borderRadius: "10px", padding: "12px 10px", marginBottom: "16px" },
  flowNode: { flex: 1, textAlign: "center", fontSize: "11px", fontWeight: 600, color: "#cfcfcf" },
  flowArrow: { color: BRAND, fontSize: "13px" },
  poweredBy: { textAlign: "center", color: "#8f8f8f", fontSize: "11px", margin: 0 },
  caption: { textAlign: "center", color: "#7d7d7d", fontSize: "12px", fontStyle: "italic", marginTop: "14px", marginBottom: 0 }
};

const swapWidgetStyles = {
  wrapper: { width: "100%", maxWidth: "460px", background: "linear-gradient(145deg, rgba(40,40,40,0.92) 0%, rgba(20,20,20,0.95) 50%, rgba(28,28,28,0.92) 100%)", color: "#ffffff", borderRadius: "22px", padding: "18px", fontFamily: FONT, boxShadow: "0 30px 80px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -1px 0 rgba(0,0,0,0.4)", border: "1px solid rgba(255,255,255,0.10)", backdropFilter: "blur(18px) saturate(140%)", WebkitBackdropFilter: "blur(18px) saturate(140%)", position: "relative", overflow: "hidden" },
  header: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "22px" },
  tabs: { display: "flex", gap: "8px" },
  tab: { background: "transparent", color: "#8f8f8f", border: "none", padding: "10px 14px", borderRadius: "10px", cursor: "pointer", fontSize: "15px" },
  activeTab: { background: "#242424", color: BRAND, border: "none", padding: "10px 14px", borderRadius: "10px", cursor: "pointer", fontSize: "15px" },
  settingsButton: { background: "transparent", color: "#8f8f8f", border: "none", fontSize: "18px", cursor: "pointer" },
  quoteBox: { border: "1px solid rgba(255,255,255,0.08)", borderRadius: "10px", overflow: "hidden", marginBottom: "10px" },
  row: { minHeight: "76px", padding: "20px", display: "flex", justifyContent: "space-between", alignItems: "center", gap: "16px" },
  divider: { height: "1px", background: "rgba(255,255,255,0.08)" },
  label: { margin: 0, color: "#9a9a9a", fontSize: "14px" },
  amountInput: { marginTop: "6px", width: "150px", background: "transparent", border: "none", outline: "none", color: "#ffffff", fontSize: "24px", fontWeight: 700 },
  receiveAmount: { margin: "6px 0 0", fontSize: "24px", fontWeight: 700, color: "#a6a6a6" },
  assetSelect: { background: "#262626", color: "#ffffff", border: "1px solid rgba(255,255,255,0.05)", borderRadius: "10px", padding: "14px 16px", fontSize: "16px", fontWeight: 700, cursor: "pointer" },
  rateRow: { display: "flex", justifyContent: "space-between", color: "#8f8f8f", fontSize: "12px", padding: "0 18px 24px" },
  section: { marginBottom: "22px" },
  sectionTitle: { color: "#9a9a9a", fontSize: "14px", marginBottom: "10px" },
  paymentSelect: { width: "100%", background: "#262626", color: "#ffffff", border: "1px solid rgba(255,255,255,0.05)", borderRadius: "10px", padding: "18px", fontSize: "16px", cursor: "pointer" },
  feeRow: { borderTop: "1px solid rgba(255,255,255,0.08)", paddingTop: "18px", marginBottom: "22px", display: "flex", justifyContent: "space-between", color: "#ffffff", fontSize: "14px" },
  buyButton: { width: "100%", background: BRAND, color: "#000000", border: "none", borderRadius: "9px", padding: "16px", fontSize: "16px", fontWeight: 600, cursor: "pointer" },
  poweredBy: { textAlign: "center", color: "#8f8f8f", fontSize: "10px", marginTop: "12px", marginBottom: 0 }
};

const industries = [
{ id: "cfd", name: "CFD Platforms", desc: "Execute crypto-backed CFD positions with institutional settlement infrastructure and real-time streaming liquidity.", icon: "cfd" },
{ id: "gaming", name: "Gaming Platforms", desc: "Move player funds quickly and compliantly across borders and around the clock.", icon: "gaming" },
{ id: "marketplace", name: "Marketplaces & Platforms", desc: "Power global payments, payouts, and creator earnings with infrastructure built for scale, speed, and compliance.", icon: "marketplace" },
{ id: "fintech", name: "FinTechs", desc: "Add new financial capabilities as your roadmap evolves, with infrastructure designed for speed, compliance, and scale.", icon: "fintech" },
{ id: "brokerage", name: "Brokerages & Trading Platforms", desc: "Launch digital asset trading without rebuilding your platform.", icon: "brokerage" },
{ id: "bank", name: "Banks & Institutions", desc: "Digital money infrastructure banks can trust.", icon: "bank" },
{ id: "payments", name: "Payments & PSPs", desc: "Real-time global payments and settlement, built into your existing stack.", icon: "payments" }];


function IndustryIcon({ type }) {
  const r = 3,s = 9;
  const grids = {
    cfd: [
    [1, 1], [1, 2], [1, 3], [1, 4], [1, 5],
    [3, 0], [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6],
    [5, 2], [5, 3], [5, 4], [5, 5], [5, 6],
    [7, 0], [7, 1], [7, 2], [7, 3], [7, 4], [7, 5],
    // wick tops
    [1, 0], [3, 7], [5, 1], [7, 6]],

    gaming: [
    [3, 0], [4, 0], [5, 0],
    [2, 1], [3, 1], [4, 1], [5, 1], [6, 1],
    [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2],
    [0, 3], [1, 3], [3, 3], [4, 3], [5, 3], [7, 3], [8, 3],
    [1, 4], [2, 4], [3, 4], [5, 4], [6, 4], [7, 4],
    [2, 5], [3, 5], [5, 5], [6, 5],
    [4, 1], [4, 3] // d-pad centre
    ],
    marketplace: [
    [1, 0], [2, 0], [3, 0], [5, 0], [6, 0], [7, 0],
    [1, 1], [3, 1], [5, 1], [7, 1],
    [1, 2], [2, 2], [3, 2], [5, 2], [6, 2], [7, 2],
    [1, 4], [2, 4], [3, 4], [5, 4], [6, 4], [7, 4],
    [1, 5], [3, 5], [5, 5], [7, 5],
    [1, 6], [2, 6], [3, 6], [5, 6], [6, 6], [7, 6]],

    fintech: [
    [4, 0],
    [3, 1], [4, 1], [5, 1], [6, 1],
    [2, 2], [4, 2],
    [2, 3], [4, 3],
    [3, 4], [4, 4], [5, 4], [6, 4],
    [4, 5], [7, 5],
    [4, 6], [7, 6],
    [3, 7], [4, 7], [5, 7], [6, 7],
    [4, 8]],

    brokerage: [
    [0, 7], [1, 7], [0, 6], [1, 6],
    [3, 7], [4, 7], [3, 6], [4, 6], [3, 5], [4, 5],
    [6, 7], [7, 7], [6, 6], [7, 6], [6, 5], [7, 5], [6, 4], [7, 4], [6, 3], [7, 3],
    [0, 5], [2, 4], [5, 2], [8, 1]],

    bank: [
    [4, 0],
    [3, 1], [4, 1], [5, 1],
    [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2],
    [2, 3], [4, 3], [6, 3],
    [2, 4], [4, 4], [6, 4],
    [2, 5], [4, 5], [6, 5],
    [2, 6], [4, 6], [6, 6],
    [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7]],

    payments: [
    [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1],
    [1, 2], [7, 2],
    [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [7, 3],
    [1, 4], [7, 4],
    [1, 5], [2, 5], [3, 5], [7, 5],
    [1, 6], [7, 6],
    [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7]]

  };
  const pts = grids[type] || grids.fintech;
  return (
    <svg width="90" height="90" viewBox="0 0 90 90" fill="none" aria-hidden="true">
      {pts.map(([col, row], i) =>
      <circle key={i} cx={col * s + s} cy={row * s + s} r={r} fill={BRAND} opacity={0.55 + i % 4 * 0.1} />
      )}
    </svg>);

}

function IndustrySlider() {
  const trackRef = React.useRef(null);
  const [activeIdx, setActiveIdx] = React.useState(0);
  const cardW = 320;
  const gap = 20;

  function scrollTo(idx) {
    const clamped = Math.max(0, Math.min(idx, industries.length - 1));
    setActiveIdx(clamped);
    if (trackRef.current) {
      trackRef.current.scrollTo({ left: clamped * (cardW + gap), behavior: "smooth" });
    }
  }

  React.useEffect(() => {
    const el = trackRef.current;
    if (!el) return;
    function onScroll() {
      const idx = Math.round(el.scrollLeft / (cardW + gap));
      setActiveIdx(Math.max(0, Math.min(idx, industries.length - 1)));
    }
    el.addEventListener("scroll", onScroll, { passive: true });
    return () => el.removeEventListener("scroll", onScroll);
  }, []);

  return (
    <section className="relative z-10 py-24 overflow-hidden" style={{ borderTop: "1px solid rgba(255,255,255,0.08)" }}>
      <div className="mx-auto max-w-7xl px-5 md:px-8">
        {/* Header row */}
        <div className="flex items-end justify-between mb-10">
          <div>
            <p className="mb-3 text-sm font-semibold uppercase tracking-[0.3em]" style={{ color: BRAND }}>Industries</p>
            <h2 className="text-4xl font-semibold tracking-[-0.04em] text-white md:text-5xl" style={{ maxWidth: "520px" }}>
              The operating system<br />for digital money
            </h2>
          </div>
          <div className="hidden md:flex items-center gap-3 flex-shrink-0 mb-1">
            <button
              onClick={() => scrollTo(activeIdx - 1)}
              disabled={activeIdx === 0}
              aria-label="Previous industry"
              style={{
                width: 44, height: 44, borderRadius: "50%",
                border: "1px solid rgba(255,255,255,0.12)",
                background: activeIdx === 0 ? "rgba(255,255,255,0.03)" : "rgba(255,255,255,0.06)",
                color: activeIdx === 0 ? "rgba(255,255,255,0.25)" : "#F8F8F8",
                display: "flex", alignItems: "center", justifyContent: "center",
                cursor: activeIdx === 0 ? "not-allowed" : "pointer",
                transition: "background 0.2s, color 0.2s"
              }}>
              <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M15 18l-6-6 6-6" /></svg>
            </button>
            <button
              onClick={() => scrollTo(activeIdx + 1)}
              disabled={activeIdx === industries.length - 1}
              aria-label="Next industry"
              style={{
                width: 44, height: 44, borderRadius: "50%",
                border: "1px solid rgba(255,255,255,0.12)",
                background: activeIdx === industries.length - 1 ? "rgba(255,255,255,0.03)" : "rgba(255,255,255,0.06)",
                color: activeIdx === industries.length - 1 ? "rgba(255,255,255,0.25)" : "#F8F8F8",
                display: "flex", alignItems: "center", justifyContent: "center",
                cursor: activeIdx === industries.length - 1 ? "not-allowed" : "pointer",
                transition: "background 0.2s, color 0.2s"
              }}>
              <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M9 18l6-6-6-6" /></svg>
            </button>
          </div>
        </div>
      </div>

      {/* Card track — bleeds past container edge */}
      <div
        ref={trackRef}
        style={{
          display: "flex",
          gap: gap,
          overflowX: "auto",
          paddingLeft: "calc((100vw - min(100%, 80rem)) / 2 + 2rem)",
          paddingRight: "5vw",
          paddingBottom: "8px",
          scrollSnapType: "x mandatory",
          scrollbarWidth: "none",
          msOverflowStyle: "none"
        }}>
        <style>{`.ind-track::-webkit-scrollbar{display:none}`}</style>
        {industries.map((ind, i) =>
        <div
          key={ind.id}
          onClick={() => setActiveIdx(i)}
          style={{
            flexShrink: 0,
            width: cardW,
            scrollSnapAlign: "start",
            borderRadius: "20px",
            border: `1px solid ${activeIdx === i ? "rgba(253,118,94,0.35)" : "rgba(255,255,255,0.08)"}`,
            background: activeIdx === i ? "rgba(253,118,94,0.06)" : "rgba(255,255,255,0.03)",
            padding: "28px",
            cursor: "pointer",
            transition: "border-color 0.25s, background 0.25s"
          }}>
            <div style={{ marginBottom: 24 }}>
              <IndustryIcon type={ind.icon} />
            </div>
            <div style={{ fontWeight: 600, fontSize: 17, color: "#F8F8F8", marginBottom: 10, lineHeight: 1.3 }}>{ind.name}</div>
            <div style={{ fontSize: 14, color: MUTED, lineHeight: 1.65 }}>{ind.desc}</div>
          </div>
        )}
      </div>

      {/* Dot pagination */}
      <div className="mx-auto max-w-7xl px-5 md:px-8 mt-8 flex items-center gap-2">
        {industries.map((_, i) =>
        <button
          key={i}
          onClick={() => scrollTo(i)}
          aria-label={`Go to industry ${i + 1}`}
          style={{
            width: activeIdx === i ? 20 : 6,
            height: 6,
            borderRadius: 3,
            background: activeIdx === i ? BRAND : "rgba(255,255,255,0.2)",
            border: "none",
            padding: 0,
            cursor: "pointer",
            transition: "width 0.25s, background 0.25s"
          }} />

        )}
      </div>
    </section>);

}

function LinkedInIcon({ className = "" }) {
  return <svg className={className} viewBox="0 0 24 24" fill="currentColor" aria-label="LinkedIn" role="img"><path d="M4.98 3.5C4.98 4.88 3.86 6 2.5 6S0 4.88 0 3.5 1.12 1 2.5 1s2.48 1.12 2.48 2.5ZM.3 8.1h4.4V23H.3V8.1ZM8.1 8.1h4.2v2.04h.06c.58-1.1 2.02-2.26 4.16-2.26 4.45 0 5.27 2.93 5.27 6.74V23h-4.4v-7.43c0-1.77-.03-4.04-2.46-4.04-2.46 0-2.84 1.92-2.84 3.91V23h-4.4V8.1h.41Z" /></svg>;
}

function XIcon({ className = "" }) {
  return <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" aria-label="X" role="img"><path d="M4 4l16 16" /><path d="M20 4L4 20" /></svg>;
}

function validatePageData() {
  return {
    hasBrandColour: BRAND === "#FD765E",
    hasGuidelineLime: LIME === "#E2FFAB",
    hasTertiaryColour: TERTIARY === "#979797",
    hasFourTrustBadges: trustBadges.length === 4,
    hasSixFeatures: features.length === 6,
    hasTenKeyFeatures: keyFeatures.length === 10,
    hasKeyFeaturesSection: typeof KeyFeaturesSection === "function",
    hasFlowOfFundsSection: typeof FlowOfFundsSection === "function",
    hasGroupedKeyFeatures: keyFeatures.length === 10,
    hasGatewayFeatureTitles: ["Crypto deposits and withdrawals", "Lightweight API and branded widget", "Custody, liquidity, trading and settlement", "Per-account wallet structure", "Streaming pricing and real-time conversion", "No duplicate onboarding for your clients"].every((title) => features.some((feature) => feature.title === title)),
    hasFourProvenExcellenceStats: provenExcellenceStats.length === 4 && typeof CountUp === "function",
    hasFiveInfrastructurePartners: Array.isArray(partnerSlides) && partnerSlides.length === 2,
    hasInfrastructurePartnerLogos: partnerSlides.every((p) => p.name && p.src),
    hasSwapWidget: typeof SwapWidget === "function",
    hasTrustBadgeMarquee: typeof TrustBadgeMarquee === "function",
    hasLogoMarquee: typeof LogoMarquee === "function",
    hasDarkProvenExcellence: true,
    hasDarkFooter: true,
    hasGatewayName: true,
    noExternalUiImportsRequired: typeof Button === "function" && typeof Card === "function" && typeof CardContent === "function"
  };
}

const pageDataTests = validatePageData();
if (typeof console !== "undefined") {
  Object.entries(pageDataTests).forEach(([testName, passed]) => console.assert(passed, `Gateway landing page data test failed: ${testName}`));
}

function GatewayLandingPage() {
  return (
    <>
    <ThemeStyles />
    <main className="min-h-screen overflow-hidden text-white" style={{ background: "#060606", color: "#F8F8F8", fontFamily: FONT, padding: "0px" }}>
      <BackgroundSystem />

      <header className="relative z-10 border-b border-white/10 bg-black/40 backdrop-blur-xl">
        <div className="mx-auto flex max-w-7xl items-center justify-between px-5 py-5 md:px-8">
          <Logo />
          <nav className="hidden items-center gap-8 text-sm md:flex" style={{ color: MUTED }}>
            <a href="/documentation" className="hover:text-white">Documentation</a>
            <a href="/supported-currencies" className="hover:text-white">Supported currencies</a>
          </nav>
          <div className="hidden items-center gap-3 md:flex">
            <Button variant="ghost" className="hover:bg-white/10 hover:text-white" style={{ color: MUTED }}>Dashboard</Button>
            <PrimaryButton className="px-6">Get started</PrimaryButton>
          </div>
          <button className="rounded-xl border border-white/10 p-2 md:hidden" style={{ color: MUTED }} aria-label="Open navigation menu"><Icon name="menu" size={22} /></button>
        </div>
      </header>

      <div className="relative overflow-hidden">
        <section className="relative z-10 mx-auto grid max-w-7xl items-center gap-14 px-5 pb-20 pt-20 md:grid-cols-[1.08fr_0.92fr] md:px-8 md:pb-28 md:pt-28">
          <motion.div initial="hidden" animate="visible" variants={fadeUp} transition={{ duration: 0.6 }}>
            <h1 className="max-w-4xl text-4xl font-semibold leading-[1.08] tracking-[-0.035em] text-white md:text-[3.4rem]">Institutional <span style={{ color: "rgb(253, 118, 94)" }}>crypto</span> custody, conversion, and settlement infrastructure for licensed financial firms.</h1>
            <p className="mt-6 max-w-xl text-base leading-7 md:text-lg md:leading-8" style={{ color: MUTED }}>Zerocap Connect provides the wallet, conversion, and settlement infrastructure that lets regulated brokers and financial services firms offer crypto to their clients — under their own licences, their own KYC, and their own client relationships. We are the institutional layer underneath your platform.</p>
            <div className="mt-9 flex flex-col gap-3 sm:flex-row">
              <PrimaryButton>Talk to Sales <Icon name="arrow" size={18} className="ml-2" /></PrimaryButton>
              <Button variant="ghost" className="group h-12 px-0 text-base font-semibold text-white hover:text-white">See Product Overview <Icon name="arrow" size={18} className="ml-2 transition group-hover:translate-x-1" /></Button>
            </div>
          </motion.div>
          <motion.div initial={{ opacity: 0, y: 18, scale: 0.98 }} animate={{ opacity: 1, y: 0, scale: 1 }} transition={{ duration: 0.7, delay: 0.1 }} className="relative flex justify-center md:justify-end">
            <SwapWidget />
          </motion.div>
        </section>
      </div>

      <section className="relative z-10 w-full pb-20"><TrustBadgeMarquee /></section>

      <IndustrySlider />

      <section id="gateway" className="relative z-10 border-y border-white/10 bg-white/[0.02] py-24">
        <div className="mx-auto max-w-7xl px-5 md:px-8">
          <div className="mx-auto mb-14 max-w-3xl text-center">
            <p className="mb-4 text-sm font-semibold uppercase tracking-[0.3em]" style={{ color: BRAND }}>Zerocap Connect</p>
            <h2 className="text-4xl font-semibold tracking-[-0.04em] text-white md:text-5xl">Everything needed to collect, convert, and settle crypto flows.</h2>
            <p className="mt-5 text-lg leading-8" style={{ color: MUTED }}>Designed for firms that need wallet infrastructure, conversion, treasury visibility, and institutional execution under one roof.</p>
          </div>
          <div className="grid gap-5 md:grid-cols-2 lg:grid-cols-3">
            {features.map((feature, i) => <FeatureCard key={feature.title} feature={feature} idx={i} />)}
          </div>
        </div>
      </section>

      <KeyFeaturesSection />
      <FlowOfFundsSection />

      <section className="relative z-10 mx-auto max-w-7xl px-5 py-24 md:px-8">
        <div className="mb-12 text-center"><h2 className="text-4xl font-semibold tracking-[-0.04em] text-white md:text-6xl">Backed by Zerocap.</h2></div>
        <div className="overflow-hidden rounded-[2rem] border border-white/10 bg-white/[0.04] shadow-2xl shadow-black/20">
          <div className="grid md:grid-cols-4">
            {provenExcellenceStats.map((stat, index) =>
              <div key={stat.label} className="px-8 py-12 text-center" style={{ borderRight: index < provenExcellenceStats.length - 1 ? "1px solid rgba(255,255,255,0.08)" : "0", borderBottom: "1px solid rgba(255,255,255,0.08)" }}>
                <div className="text-4xl font-semibold tracking-[-0.03em] text-white md:text-5xl tabular-nums"><CountUp value={stat.value} decimals={stat.decimals} prefix={stat.prefix} suffix={stat.suffix} /></div>
                <div className="mt-3 text-base font-normal" style={{ color: MUTED }}>{stat.label}</div>
                {stat.sub && <div className="mt-1.5 text-xs font-medium uppercase tracking-[0.18em]" style={{ color: BRAND }}>{stat.sub}</div>}
              </div>
              )}
          </div>
        </div>
      </section>

      <section id="use-cases" className="relative z-10 mx-auto max-w-7xl px-5 pb-24 md:px-8">
        <div className="mx-auto max-w-3xl">
          <Card className="overflow-hidden border-white/10 bg-white/[0.04] text-white">
            <CardContent className="p-8">
              <div className="mb-10 flex items-start justify-between gap-6">
                <div><p className="text-sm font-semibold uppercase tracking-[0.3em]" style={{ color: TERTIARY }}>Who it’s for</p><h3 className="mt-2 text-3xl font-semibold tracking-tight">Built for licensed brokers and financial services firms.</h3></div>
                <Icon name="building" size={38} style={{ color: BRAND }} />
              </div>
              <div className="space-y-4">
                {vendorItems.map((item) =>
                  <div key={item} className="flex items-center gap-3 rounded-2xl border border-white/10 bg-black/30 p-4"><span style={{ color: BRAND }}><Icon name="check" size={20} /></span><span>{item}</span></div>
                  )}
              </div>
            </CardContent>
          </Card>
        </div>
      </section>

      <section id="partners" className="relative z-10 border-y border-white/10 bg-white/[0.02] py-20">
        <div className="mx-auto max-w-7xl px-5 md:px-8">
          <div className="mb-10 flex flex-col justify-between gap-4 md:flex-row md:items-end">
            <div><p className="mb-3 text-sm font-semibold uppercase tracking-[0.3em]" style={{ color: BRAND }}>Infrastructure</p><h2 className="text-4xl font-semibold tracking-[-0.04em]">Built on institutional infrastructure</h2></div>
            <p className="max-w-xl" style={{ color: MUTED }}>Integrated with trusted institutional infrastructure providers across crypto and traditional finance.</p>
          </div>
        </div>
      </section>

      <section className="relative z-10 mx-auto max-w-7xl px-5 py-24 md:px-8">
        <div className="rounded-[2.25rem] overflow-hidden text-white flex flex-col" style={{ background: `linear-gradient(150deg, #c94c32 0%, ${BRAND} 35%, #ff9a88 80%, #ffbdad 100%)`, border: `1px solid ${RING}` }}>
          {/* text + CTAs */}
          <div className="px-8 pt-12 pb-10 md:px-14 md:pt-16 flex flex-col md:flex-row md:items-end md:justify-between gap-8">
            <div>
              <h2 className="text-4xl font-semibold tracking-[-0.035em] md:text-5xl md:leading-[1.08] max-w-lg">Ready to integrate?</h2>
              <p className="mt-4 max-w-md text-base md:text-lg" style={{ color: 'rgba(255,255,255,0.72)' }}>Speak with Zerocap about custody, conversion, and settlement infrastructure for your firm.</p>
            </div>
            <div className="flex flex-wrap gap-3 md:pb-1 shrink-0">
              <Button className="h-12 rounded-full bg-black px-7 text-base text-white hover:bg-[#171717]">Contact sales <Icon name="arrow" size={18} className="ml-2" /></Button>
              <Button className="h-12 rounded-full px-7 text-base" style={{ background: 'rgba(255,255,255,0.12)', border: '1px solid rgba(255,255,255,0.25)', color: '#fff' }}>View docs <Icon name="arrow" size={18} className="ml-2" /></Button>
            </div>
          </div>

        </div>
      </section>

      <footer id="contact" className="relative z-10 overflow-hidden border-t border-white/10 py-16 text-white" style={{ background: BG }}>
        <div className="pointer-events-none absolute inset-0 opacity-80"><div className="absolute -right-32 top-10 h-80 w-80 rounded-full blur-3xl" style={{ background: SOFT }} /><div className="absolute -bottom-40 left-10 h-96 w-96 rounded-full blur-3xl" style={{ background: "rgba(253,118,94,0.18)" }} /></div>
        <div className="relative mx-auto max-w-7xl px-5 md:px-8">
          <div className="mb-10 flex flex-col justify-between gap-6 rounded-[2rem] border border-white/10 bg-white/[0.04] p-6 backdrop-blur md:flex-row md:items-center md:p-8"><Logo /><div className="max-w-xl text-sm leading-6 md:text-right" style={{ color: MUTED }}>Institutional crypto custody, conversion, and settlement infrastructure for licensed financial services firms.</div></div>
          <div className="grid gap-5 md:grid-cols-[1.15fr_1fr_1fr_1.15fr]">
            <div className="rounded-[1.5rem] border border-white/10 bg-white/[0.03] p-6"><h4 className="mb-5 text-xs font-semibold uppercase tracking-[0.26em]" style={{ color: BRAND }}>Locations</h4><div className="space-y-5 text-sm" style={{ color: MUTED }}><div><p className="font-medium text-white">Australia</p><p className="mt-1">ACN 164 874 597</p></div><div><p className="font-medium text-white">Melbourne</p><p className="mt-1">Melbourne, VIC 3004</p></div><div><p className="font-medium text-white">Sydney</p><p className="mt-1">Sydney, NSW 2000</p></div></div></div>
            <div className="rounded-[1.5rem] border border-white/10 bg-white/[0.03] p-6"><h4 className="mb-5 text-xs font-semibold uppercase tracking-[0.26em]" style={{ color: BRAND }}>Services</h4><div className="space-y-4 text-sm" style={{ color: MUTED }}>{footerServices.map((item) => <p key={item}>{item}</p>)}</div><h4 className="mb-5 mt-8 text-xs font-semibold uppercase tracking-[0.26em]" style={{ color: BRAND }}>Insights</h4><div className="space-y-4 text-sm" style={{ color: MUTED }}>{footerInsights.map((item) => <p key={item}>{item}</p>)}</div></div>
            <div className="rounded-[1.5rem] border border-white/10 bg-white/[0.03] p-6"><h4 className="mb-5 text-xs font-semibold uppercase tracking-[0.26em]" style={{ color: BRAND }}>Company</h4><div className="space-y-4 text-sm" style={{ color: MUTED }}>{footerCompany.map((item) => <p key={item}>{item}</p>)}</div></div>
            <div className="rounded-[1.5rem] border border-white/10 p-6" style={{ background: `linear-gradient(135deg, ${SOFT}, rgba(255,255,255,0.03))` }}><h3 className="mb-6 text-2xl font-semibold tracking-tight text-white">Have a question?</h3><div className="space-y-6 text-sm" style={{ color: MUTED }}><div><p>Contact us:</p><a href="mailto:hello@zerocap.com" className="font-medium" style={{ color: BRAND }}>hello@zerocap.com</a></div><div><p>Media enquiries:</p><a href="mailto:media@zerocap.com" className="font-medium" style={{ color: BRAND }}>media@zerocap.com</a></div><div><p>Compliance enquiries:</p><a href="mailto:compliance@zerocap.com" className="font-medium" style={{ color: BRAND }}>compliance@zerocap.com</a></div></div><div className="mt-9 flex items-center gap-3"><div className="flex h-9 w-9 items-center justify-center rounded-full border border-white/10 bg-black/30 text-white"><LinkedInIcon className="h-4 w-4" /></div><div className="flex h-9 w-9 items-center justify-center rounded-full border border-white/10 bg-black/30" style={{ color: MUTED }}><XIcon className="h-4 w-4" /></div></div></div>
          </div>
          <div className="my-10 h-px w-full bg-gradient-to-r from-transparent via-white/20 to-transparent" />
          <div className="grid gap-6 text-xs leading-5 md:grid-cols-[1.35fr_1fr_0.7fr]" style={{ color: TERTIARY }}>
            <div className="rounded-[1.5rem] border border-white/10 bg-black/25 p-6"><div className="space-y-5"><p><span style={{ color: MUTED }} className="font-semibold">About this product:</span> Zerocap Connect is offered by Zerocap Pty Ltd exclusively to financial services firms operating under their own regulatory licences. It is not available to retail customers, and is not intended to facilitate third-party payments or remittance services on behalf of any firm. Firms using this product are responsible for their own client onboarding, KYC, AML/CTF program, transaction monitoring, and client money obligations.</p><p>Zerocap Pty Ltd carries out regulated and unregulated activities.</p><p>Zerocap Gamma Ltd carries out unregulated activities.</p><p>Spot crypto-asset services and products offered by Zerocap are not regulated by ASIC. Zerocap Pty Ltd is registered with AUSTRAC as a DCE service provider.</p><p>Regulated services and products include structured products and funds available to Wholesale Clients only. Zerocap Pty Ltd is a Corporate Authorised Representative of AFSL 340799.</p></div></div>
            <div className="rounded-[1.5rem] border border-white/10 bg-black/25 p-6"><p>All material in this website is intended for illustrative purposes and general information only. It does not constitute financial advice nor does it take into account your investment objectives, financial situation or particular needs. Investments in digital assets can be risky and you may lose your investment.</p></div>
            <div className="rounded-[1.5rem] border border-white/10 bg-black/25 p-6 text-left md:text-right"><p style={{ color: MUTED }}>© 2026 ZEROCAP.</p><p>ALL RIGHTS RESERVED.</p></div>
          </div>
          <p className="mt-8 text-center text-xs text-zinc-600">This site is protected by reCAPTCHA and the Google <span className="underline decoration-white/20">Privacy Policy</span> and <span className="underline decoration-white/20">Terms of Service</span> apply.</p>
        </div>
      </footer>
    </main>
    </>);

}

// ── Dot-matrix Globe (removed) ──────────────────────────────────────────────
// GlobeCanvas removed per design update
function GlobeCanvas({ mode = "hero" }) {
  const canvasRef = React.useRef(null);
  const rafRef = React.useRef(null);
  const angleRef = React.useRef(0);
  const modeRef = React.useRef(mode);

  React.useEffect(() => {
    const canvas = canvasRef.current;
    if (!canvas) return;
    const ctx = canvas.getContext('2d');
    const isHero = modeRef.current === "hero";

    const RADIUS = 520;
    const DOT_R = isHero ? 1.9 : 2.3;
    const SPACING = isHero ? 8 : 14; // hero: ~3× more dots
    const BRAND_R = 253,BRAND_G = 118,BRAND_B = 94;

    const dots = [];
    for (let lat = -90; lat <= 90; lat += SPACING) {
      const latRad = lat * Math.PI / 180;
      const cosLat = Math.cos(latRad);
      const sinLat = Math.sin(latRad);
      const count = Math.max(1, Math.round(cosLat * (360 / SPACING)));
      for (let i = 0; i < count; i++) {
        const lon = i / count * 2 * Math.PI;
        dots.push({ x0: cosLat * Math.cos(lon), y0: sinLat, z0: cosLat * Math.sin(lon) });
      }
    }

    function resize() {
      if (isHero) {
        canvas.width = canvas.parentElement.offsetWidth;
        canvas.height = canvas.parentElement.offsetHeight;
      } else {
        const w = canvas.parentElement.offsetWidth;
        canvas.width = w;
        canvas.height = Math.round(w * 0.55);
      }
    }

    resize();
    const ro = new ResizeObserver(resize);
    ro.observe(canvas.parentElement);

    function draw() {
      const W = canvas.width;
      const H = canvas.height;
      ctx.clearRect(0, 0, W, H);

      // Hero: globe centered on the right third, vertically centered
      // Footer: cropped rising-from-bottom
      const cx = isHero ? W * 0.72 : W / 2;
      const cy = isHero ? H * 0.52 : H + RADIUS * 0.28;
      const scale = isHero ? Math.min(W * 0.55, H * 0.9) / RADIUS : W * 0.46 / RADIUS;

      const a = angleRef.current;
      const cosA = Math.cos(a),sinA = Math.sin(a);

      const projected = dots.map(({ x0, y0, z0 }) => {
        const x = x0 * cosA + z0 * sinA;
        const y = y0;
        const z = -x0 * sinA + z0 * cosA;
        const depth = (z + 1) / 2;
        return { sx: cx + x * RADIUS * scale, sy: cy - y * RADIUS * scale, depth };
      });
      projected.sort((a, b) => a.depth - b.depth);

      const minA = isHero ? 0.03 : 0.06;
      const maxA = isHero ? 0.36 : 0.55;

      for (const { sx, sy, depth } of projected) {
        if (!isHero && sy > H + DOT_R) continue;
        const alpha = minA + depth * (maxA - minA);
        ctx.beginPath();
        ctx.arc(sx, sy, DOT_R * (0.7 + depth * 0.5), 0, Math.PI * 2);
        ctx.fillStyle = `rgba(${BRAND_R},${BRAND_G},${BRAND_B},${alpha.toFixed(3)})`;
        ctx.fill();
      }

      // Soft radial glow at globe center
      const glowR = RADIUS * scale * 1.1;
      const grad = ctx.createRadialGradient(cx, cy, 0, cx, cy, glowR);
      const gi = isHero ? 0.06 : 0.10;
      grad.addColorStop(0, `rgba(${BRAND_R},${BRAND_G},${BRAND_B},${gi})`);
      grad.addColorStop(0.5, `rgba(${BRAND_R},${BRAND_G},${BRAND_B},${(gi * 0.4).toFixed(3)})`);
      grad.addColorStop(1, `rgba(${BRAND_R},${BRAND_G},${BRAND_B},0.00)`);
      ctx.globalCompositeOperation = 'screen';
      ctx.beginPath();
      ctx.ellipse(cx, cy, glowR, glowR, 0, 0, Math.PI * 2);
      ctx.fillStyle = grad;
      ctx.fill();
      ctx.globalCompositeOperation = 'source-over';

      angleRef.current += 0.0016;
      rafRef.current = requestAnimationFrame(draw);
    }

    rafRef.current = requestAnimationFrame(draw);
    return () => {cancelAnimationFrame(rafRef.current);ro.disconnect();};
  }, []);

  if (mode === "hero") {
    return (
      <canvas
        ref={canvasRef}
        style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', pointerEvents: 'none', zIndex: 0 }} />);


  }

  // Footer fallback (kept for reference, no longer rendered)
  return (
    <div style={{ position: 'relative', width: '100%', overflow: 'hidden', marginTop: 48 }}>
      <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 120, zIndex: 2, background: 'linear-gradient(to bottom, #060606 0%, transparent 100%)', pointerEvents: 'none' }} />
      <canvas ref={canvasRef} style={{ display: 'block', width: '100%' }} />
    </div>);

}

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