// ============================================================================
// Principia White Paper — Section content (01–13)
// Faithful to Product_White_Paper source. PDF discipline: no invented tech.
// ============================================================================

// ── 01 · THE DEBANKING CRISIS ───────────────────────────────────────────
function Sec01() {
  return (
    <Section id="01">
      <WpOpener num="01" label="The Debanking Crisis"
        title="Licensed, regulated firms"
        italicTail="cannot get a bank account."
        lede="This is not anecdotal. It is structural, accelerating, and permanent — driven by economics that will not reverse." />

      <P>Correspondent banking is in retreat. Since 2011 the number of active relationships has fallen sharply, and the decline is steepest in exactly the corridors that need them most. Fewer banks carrying more volume concentrates systemic risk in a handful of survivors.</P>

      <Fig n="01" title="Correspondent banking is retreating from the corridors that need it most"
        sub="Decline in active correspondent relationships by region since 2011."
        source="Source · BIS CPMI Correspondent Banking Data 2025">
        <RegionalDeclineChart />
      </Fig>

      <P style={{ marginTop: 40 }}>The result is a bottleneck. In the UK, safeguarding for the entire licensed payment sector rests on a handful of institutions — and none of them settle to Africa via SWIFT. A single bank exit can shut down an entire payment firm overnight.</P>

      <Fig n="02" title="Five banks hold safeguarding for the entire UK payment sector"
        sub="Of 192 UK banks, only five will hold safeguarding accounts for licensed payment and e-money institutions."
        source="Source · FCA PS25/12 · EBA EUCLID Register 2024">
        <BankAccessUnitChart />
      </Fig>

      <P style={{ marginTop: 40 }}>When a safeguarding firm fails, customer money does not come back. Twelve UK e-money institutions went insolvent between 2018 and 2023; on average, customers recovered roughly 35p on the pound. There is no statutory trust protecting the funds.</P>

      <Fig n="03" title="When an EMI fails, customers recover about 35p on the pound"
        sub="Average customer-fund shortfall across 12 UK EMI insolvencies, 2018–2023."
        source="Source · FCA CP24/20 · FCA insolvency data 2018–2023">
        <ShortfallDonut />
      </Fig>

      <div style={{ marginTop: 48 }}>
        <h3 style={{ fontFamily: FONT_SANS, fontSize: 13, letterSpacing: '0.04em', textTransform: 'uppercase', color: C_MUTED, fontWeight: 700, marginBottom: 18 }}>The evidence, in five lines</h3>
        <SpecTable cols="44px 230px 1fr" head={['#', 'Problem', 'Evidence']} rows={[
          ['1', '−22% correspondent banking', 'Global decline since 2011 (BIS CPMI). Latin America −34%. Caribbean −41%. Africa mirrors the Caribbean. Fewer banks, more volume — systemic concentration risk.'],
          ['2', '45–80% of MTOs unbanked', '45% of MTO agents globally have lost banking access (FSB 2018); 70–80%+ for high-risk corridors including Sub-Saharan Africa.'],
          ['3', '5 banks out of 192 in the UK', 'ClearBank, Griffin, Banking Circle, LHV, Starling hold safeguarding for the entire UK payment sector. None settle to Africa via SWIFT.'],
          ['4', '65% shortfall on insolvency', '12 UK EMIs insolvent 2018–2023. Average customer-fund shortfall 65%; recovery ≈35p on the pound (FCA CP24/20).'],
          ['5', '$180.9B/yr compliance spend', 'Tier-1 banks refuse MSB corridors entirely. EMIs need a regulated third party for SWIFT wiring — another intermediary, another fee, another exit risk.'],
        ]} />
        <Source>Sources · BIS CPMI 2025 · FSB 2018 · FCA PS25/12 · LexisNexis 2023</Source>
      </div>

      <Pull>The exit is permanent. Banks are not returning to MSB corridors — the compliance cost exceeds the revenue. Every year the available correspondents shrink and the concentration risk in the survivors grows.</Pull>

      <h3 style={{ fontFamily: FONT_DISP, fontSize: 26, fontWeight: 400, letterSpacing: '-0.01em', color: C_INK, margin: '8px 0 24px' }}>
        The paradox: <em>regulation creates a dependency it cannot enforce.</em>
      </h3>
      <TrendCards items={[
        { tag: 'Licensed but homeless', t: 'A mandate without a counterparty', d: 'PSD2 / EMD2 require EMIs to hold 100% of customer funds at a credit institution. But credit institutions refuse high-risk corridors — the regulation creates a dependency on an unwilling counterparty.' },
        { tag: 'Dropped in 30 days', t: 'One exit ends the firm', d: 'Safeguarding banks exit on 30–90 days notice, with only 4–5 options to replace them. The FCA rates EMI safeguarding HIGH risk for 2025–2026. A single exit can shut a payment firm overnight.' },
        { tag: 'CASS 15 shock', t: 'Compliance they cannot afford', d: 'The new UK safeguarding regime (effective 7 May 2026) adds daily reconciliation, annual audit and a 48-hour resolution pack — with no statutory trust. Firms that survived de-risking now face costs they cannot carry.' },
      ]} />
      <Source>Sources · FCA PS25/12 · CASS 15 (May 2026) · FCA insolvency data 2018–2023</Source>
    </Section>
  );
}

// ── 02 · THE MERCHANT DESERT ────────────────────────────────────────────
function Sec02() {
  return (
    <Section id="02" style={{ background: C_PAPER }}>
      <WpOpener num="02" label="The Merchant Desert"
        title="The crisis cascades"
        italicTail="to their merchants."
        lede="Debanking does not stop at payment institutions. Thousands of MSB-adjacent merchants across the EU and UK operate cash-only — not by choice, but because no acquirer will onboard them." />
      <SpecTable cols="220px 1fr" rows={[
        ['No acquirer for MSB merchants', 'Major acquirers (Worldpay, Adyen, Stripe) refuse merchants categorised as money-service businesses. MCC 6051 / 6012 is blacklisted at most processors.'],
        ['Cash-only operations', 'Without card acceptance, remittance agents, forex bureaux and mobile-money agents run cash-only — raising AML risk, reducing transparency, and locking them out of digital commerce.'],
        ['No POS infrastructure', 'Even where a merchant has an account, POS terminal providers refuse onboarding. The merchant can bank, but cannot accept a card payment.'],
        ['Enormous latent demand', 'Thousands of licensed merchants across the EU/UK diaspora corridor need POS + card acceptance. Whoever provides it captures 1.15% MDR on every transaction — a market with zero competition.'],
      ]} />
    </Section>
  );
}

// ── 03 · THE MULTI-CURRENCY GAP ─────────────────────────────────────────
function Sec03() {
  return (
    <Section id="03">
      <WpOpener num="03" label="The Multi-Currency Gap"
        title="vIBAN providers are wrappers"
        italicTail="on other banks."
        lede="When the underlying bank exits, the vIBAN provider's entire customer base goes dark — every account, simultaneously." />
      <SpecTable cols="220px 1fr" rows={[
        ['vIBANs are not real accounts', 'Most providers route through a single banking partner. When that partner exits (Railsr / Paynetics, Modulr / Barclays), thousands of accounts freeze at once.'],
        ['Single-currency limitation', 'Partners need EUR + GBP + Nordics. Most providers offer one currency. Stitching 3–4 providers together multiplies reconciliation work and counterparty risk.'],
        ['No card programme attached', 'Account providers don\u2019t issue cards; card issuers don\u2019t provide accounts. Partners integrate 2–3 vendors for what should be one product: account + card + payments.'],
        ['FX as a profit centre', 'Most providers mark FX up 1.5–3% on top of settlement fees. Interbank-rate FX inside a flat settlement fee changes the economics entirely.'],
      ]} />
    </Section>
  );
}

// ── 04 · WHAT CHANGED ───────────────────────────────────────────────────
function Sec04() {
  return (
    <Section id="04" style={{ background: C_PAPER }}>
      <WpOpener num="04" label="What Changed"
        title="Three regulatory shifts"
        italicTail="opened a door."
        lede="An infrastructure opportunity that did not exist 18 months ago. In 2025, three changes made direct central-bank access possible for licensed firms." />
      <TrendCards items={[
        { tag: 'ECB · Oct 2025', t: 'EMIs can access TIPS directly', d: 'Electronic-money institutions can now connect to TARGET2 and TIPS as direct participants — removing intermediary-bank dependency for EUR settlement. €0.002/txn, under 10 seconds.' },
        { tag: 'Nordics · Apr 2025', t: 'Riksbanken + Nationalbanken open up', d: 'Both central banks opened direct access to EMIs and payment institutions: SEK and DKK clearing without a correspondent bank. The first-mover window is open.' },
        { tag: 'Lithuania', t: '€1M specialised bank licence', d: 'The only EU jurisdiction offering a full specialised banking licence at €1M capital — 8 banks hold it; Revolut (Dec 2018) is the precedent. EEA passporting to 29 countries from day one.' },
      ]} />
      <Source>Sources · ECB Decision 2025 · Riksbanken Payments Report 2025 · Nationalbanken 2025 · Bank of Lithuania</Source>

      <Fig n="04" title="One licence, five central banks, zero correspondents"
        sub="A single EU credit institution can now reach all five major European corridor currencies directly."
        source="Source · ECB · Bank of England · Riksbanken · Nationalbanken · Norges Bank"
        style={{ marginTop: 40 }}>
        <CentralBanksDiagram />
      </Fig>
    </Section>
  );
}

// ── 05 · FROM 5 INTERMEDIARIES TO ZERO (dark) ───────────────────────────
function Sec05() {
  return (
    <Section id="05" dark>
      <WpOpener num="05" label="From Five to Zero" dark
        title="Remove the layers"
        italicTail="and the economics change."
        lede="Every intermediary is a fee, a delay, and an exit risk. Our model collapses the chain from five-to-seven parties down to two." />

      <Fig n="05" title="The settlement chain, today versus our model"
        sub="Each hop adds $15–35 and a counterparty that can exit on notice."
        source="Source · Product architecture · BIS / World Bank RPW Q1 2025">
        <IntermediaryFlow />
      </Fig>

      <Fig n="06" title="Cost per transaction collapses by orders of magnitude"
        sub="Intermediary hops versus a direct central-bank rail, on a logarithmic scale."
        source="Source · ECB TIPS pricing · World Bank RPW Q1 2025"
        style={{ marginTop: 36 }}>
        <CostScaleChart />
      </Fig>

      <div style={{ marginTop: 44 }}>
        <CompareCols
          today={{ title: 'Today', rows: [
            '5–7 parties per transaction',
            '$15–35 per hop × 1–3 hops',
            'Any bank can exit at any time',
            '65% shortfall on insolvency',
            '8.78% cost to send $200 to SSA',
            '30–90 day exit notice',
          ] }}
          ours={{ title: 'Our model', rows: [
            '2 parties · direct settlement',
            '€0.002 per instant payment (TIPS rails)',
            'Own licence · cannot be de-risked',
            'Funds at ECB / BoE / Riksbanken / Nationalbanken / Norges Bank',
            'Under 3% total cost · meets SDG 10.c',
            'No exit risk — we are the bank',
          ] }}
        />
      </div>
    </Section>
  );
}

// ── 06 · HOW THE MODEL WORKS ────────────────────────────────────────────
function Sec06() {
  const strong = (t) => <strong style={{ color: C_INK, fontWeight: 700 }}>{t}</strong>;
  return (
    <Section id="06">
      <WpOpener num="06" label="How the Model Works"
        title="Own the rails —"
        italicTail="don't rent them."
        lede="Most providers are intermediaries themselves: EMIs or payment institutions that rely on a banking partner for settlement, safeguarding and scheme access. When that partner exits, the provider and all its clients go dark. Our model is structurally different." />
      <SpecTable cols="150px 158px 168px 1fr" head={['Capability', 'Via EMI/PI partner', 'Via our model', 'Why it matters to you']} rows={[
        ['Safeguarding', 'At a third-party bank', strong('At the ECB directly'), 'No intermediary bank can freeze or exit your safeguarded funds. Counterparty risk eliminated.'],
        ['SEPA settlement', 'Via partner bank', strong('Direct TIPS participant'), '€0.002/txn, under 10 seconds. No batch windows, no partner processing schedule.'],
        ['Card issuing', 'Via BIN sponsor', strong('Own BIN (principal)'), 'Full control over limits, branding, fees, lifecycle. No sponsor markup or restrictions.'],
        ['Merchant acquiring', 'Not available', strong('Own acquiring stack'), 'POS terminals + online gateway under our principal membership — for MSB merchants no acquirer will touch.'],
        ['Multi-currency', '1–2 currencies', strong('5 currencies, 5 central banks'), 'EUR, GBP, SEK, DKK, NOK — all direct. One integration, one provider, one reconciliation.'],
        ['Exit risk', '30–90 day notice', strong('Zero'), 'We are the credit institution. We cannot de-risk ourselves. Your account exists as long as you are compliant.'],
      ]} />
      <Pull>Think of it as the difference between renting server space and owning the data centre. Most providers rent banking access and pass it through. We hold the licence, the scheme membership and the central-bank accounts directly.</Pull>
      <div style={{ background: C_SURF2, border: `1px solid ${C_RULE}`, borderLeft: `3px solid ${C_ACCENT}`, borderRadius: 10, padding: '20px 24px', maxWidth: 860 }}>
        <div style={{ fontFamily: FONT_MONO, fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase', color: C_ACCENT, fontWeight: 600, marginBottom: 8 }}>What we are not</div>
        <P style={{ margin: 0, maxWidth: 'none' }}>We are wholesale B2B infrastructure. We do not offer retail accounts, consumer apps, or direct-to-customer products. We do not compete with our partners. Your customers are yours — we provide the regulated rails underneath.</P>
      </div>
    </Section>
  );
}

// ── 07 · PLATFORM: SIX SERVICE LINES ────────────────────────────────────
function Sec07() {
  return (
    <Section id="07" style={{ background: C_PAPER }}>
      <WpOpener num="07" label="The Platform"
        title="Six service lines,"
        italicTail="one licence."
        lede="All six operate under a single Lithuanian specialised bank licence (€1M capital, ECB-supervised) with Mastercard / Visa principal membership and direct central-bank access. Partners onboarded in 48 hours; revenue from the first transaction." />
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(min(340px, 100%), 1fr))', gap: 20 }}>
        <ServiceCard letter="A" title="Segregated Safeguarding" tag="PSD2 Art. 10 · EMD2 Art. 7 · CASS 15" rows={[
          ['Structure', 'Omnibus safeguarding account per partner, individual sub-ledgers per end-customer. T+0 automated reconciliation.'],
          ['Protection', 'ECB direct account. Lithuanian DGS €100K/depositor post specialised-bank upgrade.'],
          ['Reporting', 'Real-time balance API. Monthly statement. Annual Big-4 audit.'],
        ]} fee="Included" market="3,300+ firms" />
        <ServiceCard letter="B" title="Multi-Currency Accounts" tag="vIBAN · real IBAN, not a wrapper" rows={[
          ['IBAN', 'Unique Lithuanian IBAN (LTxx) per customer. API-issued, instant activation, at a credit institution.'],
          ['Rails', 'SEPA CT · SEPA Instant (<10s) · SWIFT MT103/MT202 · FPS · CHAPS.'],
          ['FX', 'Interbank rate, included in the 0.75% settlement fee. No additional markup.'],
        ]} fee="€2.99 / mo" market="EUR · GBP · SEK · DKK · NOK" />
        <ServiceCard letter="C" title="MC / Visa Card Issuing" tag="Mastercard + Visa principal" rows={[
          ['Types', 'Prepaid (e-money) + debit (post specialised bank). Physical EMV contactless + virtual (instant API).'],
          ['Tokenisation', 'MDES / VTS digital-wallet tokenisation. Contactless NFC. 3DS2 SCA-compliant.'],
          ['BIN', 'Own BIN range, co-branded (partner logo + bank issuer). Full lifecycle API.'],
        ]} fee="€0.50–8" market="Interchange + FX" />
        <ServiceCard letter="D" title="POS & Online Acquiring" tag="Own acquiring stack" rows={[
          ['MDR', '1.15% net. Stacked on settlement → combined 1.90%.'],
          ['Terminals', 'PAX A920 — contactless + chip + 4G/WiFi. €80–120/unit. Remote TMS.'],
          ['Scale', '500 → 1,000 → 5,000 → 10,000 terminals. T+1 standard, T+0 high-volume.'],
        ]} fee="1.15%" market="Debanked MSB merchants" />
        <ServiceCard letter="E" title="Payment Gateway" tag="Partner integration" rows={[
          ['Integration', 'Hosted iframe (zero PCI scope) · REST API (OpenAPI 3.0, OAuth 2.0) · mobile SDK (iOS/Android).'],
          ['Methods', 'MC/Visa · SEPA DD · SEPA CT · bank redirect (iDEAL, Bancontact planned). Built-in 3DS2.'],
          ['SLA', '99.95% uptime · <200ms response · 24/7 monitoring.'],
        ]} fee="Included" market="48-hour go-live" />
        <ServiceCard letter="F" title="Remittance Rails" tag="EU/Nordics → SSA · UK → SSA" rows={[
          ['Collection', 'SEPA CT/Instant · FPS (UK) · MC/Visa card funding.'],
          ['Payout', 'Mobile-money wallets · bank transfer (SWIFT MT103) · agent cash-out · card push (Visa Direct / MC Send).'],
          ['Rail cost', '€0.002 per instant payment on TIPS rails (EUR, SEK, DKK). CHAPS £0.49 (GBP).'],
        ]} fee="0.75%" market="Combined 1.90%" />
      </div>
    </Section>
  );
}

// ── 08 · SETTLEMENT RAILS ───────────────────────────────────────────────
function Sec08() {
  return (
    <Section id="08">
      <WpOpener num="08" label="Settlement Rails"
        title="Direct central-bank access,"
        italicTail="every currency."
        lede="All five major European corridor currencies settle directly. No correspondent bank required for EUR, GBP, SEK, DKK or NOK." />
      <Fig n="07" title="Five currencies, five rails, all direct"
        source="Source · ECB · Bank of England · Riksbanken · Nationalbanken · Norges Bank">
        <CurrencyRails />
      </Fig>
    </Section>
  );
}

// ── 09 · COMPETITIVE POSITION ───────────────────────────────────────────
function Sec09() {
  return (
    <Section id="09" style={{ background: C_PAPER }}>
      <WpOpener num="09" label="Competitive Position"
        title="No competitor holds"
        italicTail="the full stack."
        lede="ECB + BoE direct clearing, MC/Visa principal, own acquiring, and SSA distribution — combined. The nearest competitor scores 2 of 7." />
      <Fig n="08" title="Capability coverage across the market"
        sub="Banking Circle: Luxembourg bank, ECB + partial Nordics. ClearBank: UK bank, BoE only. Modulr: MC/Visa issuing member, no acquiring or direct clearing."
        source="Source · public regulatory registers · provider disclosures 2025">
        <CompetitiveMatrix />
      </Fig>
    </Section>
  );
}

// ── 10 · PARTNER ECONOMICS ──────────────────────────────────────────────
function Sec10() {
  return (
    <Section id="10">
      <WpOpener num="10" label="Partner Economics"
        title="What your firm makes —"
        italicTail="not what we charge."
        lede="Same price to the customer, same volume. The difference is infrastructure cost: we eliminated four layers of intermediaries." />
      <Fig n="09" title="Net margin per $200 transfer, today versus our rails"
        source="Source · Product economics · World Bank RPW remittance pricing Q1 2025">
        <MarginCompare />
      </Fig>
      <Pull>+105% net-margin improvement on the same transaction. The customer pays the same price; your firm keeps more than twice as much.</Pull>
    </Section>
  );
}

// ── 11 · PRICING ────────────────────────────────────────────────────────
function Sec11() {
  const b = (t) => <strong style={{ color: C_INK, fontWeight: 700 }}>{t}</strong>;
  return (
    <Section id="11" style={{ background: C_PAPER }}>
      <WpOpener num="11" label="Pricing"
        title="Transparent, stacked,"
        italicTail="no lock-in."
        lede="One settlement rate that includes FX at interbank. Acquiring stacks on top. Everything else is included or near-zero." />
      <SpecTable cols="200px 120px 1fr" head={['Service', 'Rate / Fee', 'Notes']} rows={[
        ['Settlement (all flows)', b('0.75%'), 'Includes FX at interbank rate.'],
        ['Card acquiring (POS + online)', b('1.15%'), 'Stacked on settlement. Combined: 1.90%.'],
        ['vIBAN account', '€2.99 / mo', 'SEPA in/out included.'],
        ['Card issuance', '€0.50–8', 'Virtual €0.50, physical €5–8.'],
        ['Segregated safeguarding', b('Included'), 'Core onboarding feature.'],
        ['Payment gateway', b('Included'), 'In the 1.15% acquiring rate.'],
      ]} />
      <div style={{ marginTop: 24, display: 'flex', gap: 28, flexWrap: 'wrap' }}>
        {['No setup fees', 'No monthly minimums', 'No lock-in'].map((t) => (
          <div key={t} style={{ display: 'flex', alignItems: 'center', gap: 10, fontFamily: FONT_SANS, fontSize: 15, fontWeight: 600, color: C_INK }}>
            <span style={{ color: C_SUCCESS, fontWeight: 700 }}>✓</span>{t}
          </div>
        ))}
      </div>
    </Section>
  );
}

// ── 12 · PARTNER ONBOARDING ─────────────────────────────────────────────
function Sec12() {
  return (
    <Section id="12">
      <WpOpener num="12" label="Partner Onboarding"
        title="Live in"
        italicTail="five to seven days."
        lede="From application to first live transaction in a week. Revenue begins with the first settlement cycle." />
      <Fig n="10" title="From application to first live transaction"
        source="Ongoing · dedicated partner manager · quarterly compliance review · 24/7 support">
        <OnboardingTimeline />
      </Fig>
    </Section>
  );
}

// ── 13 · PLATFORM ARCHITECTURE ──────────────────────────────────────────
function Sec13() {
  return (
    <Section id="13" style={{ background: C_PAPER }}>
      <WpOpener num="13" label="Platform Architecture"
        title="Three layers,"
        italicTail="end to end."
        lede="Regulatory reach, the infrastructure that runs on it, and the partner surface you integrate against." />
      <Fig n="11" title="The platform stack"
        source="Core banking · Mambu · SWIFT + TIPS · MC/Visa principal · Onfido / Sumsub · Dow Jones / Refinitiv">
        <ArchitectureStack />
      </Fig>
    </Section>
  );
}

Object.assign(window, {
  Sec01, Sec02, Sec03, Sec04, Sec05, Sec06, Sec07, Sec08, Sec09, Sec10, Sec11, Sec12, Sec13,
});
