/* BOFU page renderer */

const { useState, useEffect, useMemo } = React;

/* ---------------- Pathname router (clean URLs via Vercel rewrites) ---------------- */
// All 30 BOFU slugs are served at /<slug> by Vercel → bofu.html rewrite.
// /resources shows the Index. Direct URL access works correctly.
const getSlug = () => {
  const p = window.location.pathname.replace(/^\//, '').replace(/\/$/, '');
  if (!p || p === 'resources' || p === 'bofu.html') return '';
  return p;
};

/* ---------------- Icons ---------------- */
const IArrow = ({ size=16, stroke=1.75 }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={stroke} strokeLinecap="round" strokeLinejoin="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="13 6 19 12 13 18"/></svg>
);
const IChev = ({ size=14, stroke=1.75, dir='down' }) => {
  const r = { down:0, up:180, left:90, right:-90 }[dir] || 0;
  return <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={stroke} strokeLinecap="round" strokeLinejoin="round" style={{transform:`rotate(${r}deg)`}}><polyline points="6 9 12 15 18 9"/></svg>;
};

/* ---------------- Hero accent (placeholder image) ---------------- */
const HeroAccent = ({ kind='arch' }) => {
  // Lightweight editorial SVG placeholders, no stock photos
  const variants = {
    arch: (
      <svg viewBox="0 0 600 360" className="w-full h-full" preserveAspectRatio="xMidYMid slice">
        <defs>
          <linearGradient id="a1" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0" stopColor="#F5E9D8"/><stop offset="1" stopColor="#E8C8A0"/>
          </linearGradient>
        </defs>
        <rect width="600" height="360" fill="url(#a1)"/>
        <path d="M0 360 V200 Q120 160 240 200 T480 200 T600 200 V360 Z" fill="#D9A878" opacity=".6"/>
        <g fill="#FBF9F5" opacity=".9">
          <rect x="120" y="100" width="60" height="180"/>
          <rect x="200" y="80" width="60" height="200"/>
          <rect x="280" y="120" width="60" height="160"/>
          <rect x="360" y="60" width="60" height="220"/>
          <rect x="440" y="100" width="60" height="180"/>
        </g>
        <circle cx="500" cy="80" r="36" fill="#FBE4C8"/>
      </svg>
    ),
    cost: (
      <svg viewBox="0 0 600 360" className="w-full h-full" preserveAspectRatio="xMidYMid slice">
        <rect width="600" height="360" fill="#F5F0E8"/>
        <g transform="translate(80,90)">
          {[60,120,180,240,300,360].map((y,i)=>(<line key={i} x1="0" x2="440" y1={y/2} y2={y/2} stroke="#E8E0D2" strokeWidth="1"/>))}
          <rect x="40" y="40" width="60" height="140" fill="#1F4E4D"/>
          <rect x="140" y="80" width="60" height="100" fill="#7B9078"/>
          <rect x="240" y="20" width="60" height="160" fill="#E8745C"/>
          <rect x="340" y="100" width="60" height="80" fill="#8C8A6E"/>
        </g>
      </svg>
    ),
    coast: (
      <svg viewBox="0 0 600 360" className="w-full h-full" preserveAspectRatio="xMidYMid slice">
        <defs>
          <linearGradient id="sky" x1="0" x2="0" y1="0" y2="1">
            <stop offset="0" stopColor="#E8DCC4"/><stop offset="1" stopColor="#F5E9D8"/>
          </linearGradient>
        </defs>
        <rect width="600" height="360" fill="url(#sky)"/>
        <circle cx="450" cy="120" r="40" fill="#F5C896" opacity=".7"/>
        <path d="M0 240 Q200 200 400 240 T600 240 V360 H0 Z" fill="#7B9078" opacity=".8"/>
        <path d="M0 280 Q200 260 400 280 T600 280 V360 H0 Z" fill="#1F4E4D"/>
      </svg>
    ),
    compare: (
      <svg viewBox="0 0 600 360" className="w-full h-full" preserveAspectRatio="xMidYMid slice">
        <rect width="300" height="360" fill="#F5E9D8"/>
        <rect x="300" width="300" height="360" fill="#1F4E4D"/>
        <text x="150" y="190" textAnchor="middle" fill="#1F4E4D" fontFamily="EB Garamond, serif" fontSize="48" fontStyle="italic">Spain</text>
        <text x="450" y="190" textAnchor="middle" fill="#FBF9F5" fontFamily="EB Garamond, serif" fontSize="48" fontStyle="italic">vs</text>
      </svg>
    ),
    donor: (
      <svg viewBox="0 0 600 360" className="w-full h-full" preserveAspectRatio="xMidYMid slice">
        <rect width="600" height="360" fill="#F5F0E8"/>
        <g opacity=".9">
          <circle cx="180" cy="180" r="80" fill="#E8745C" opacity=".25"/>
          <circle cx="300" cy="180" r="80" fill="#7B9078" opacity=".3"/>
          <circle cx="420" cy="180" r="80" fill="#1F4E4D" opacity=".25"/>
        </g>
      </svg>
    ),
    madrid: (
      <svg viewBox="0 0 600 360" className="w-full h-full" preserveAspectRatio="xMidYMid slice">
        <rect width="600" height="360" fill="#E8C8A0"/>
        <g fill="#1F1D1A" opacity=".75">
          <rect x="40" y="180" width="40" height="160"/>
          <rect x="100" y="140" width="50" height="200"/>
          <rect x="170" y="100" width="60" height="240"/>
          <rect x="250" y="160" width="40" height="180"/>
          <rect x="310" y="120" width="55" height="220"/>
          <rect x="385" y="80" width="70" height="260"/>
          <rect x="475" y="150" width="45" height="190"/>
          <rect x="540" y="180" width="40" height="160"/>
        </g>
        <circle cx="500" cy="60" r="28" fill="#FBE4C8"/>
      </svg>
    ),
    barcelona: (
      <svg viewBox="0 0 600 360" className="w-full h-full" preserveAspectRatio="xMidYMid slice">
        <rect width="600" height="360" fill="#F5E9D8"/>
        <g transform="translate(0,80)" fill="#1F4E4D" opacity=".85">
          <path d="M280 0 L260 120 L300 120 Z"/>
          <path d="M310 -10 L290 130 L330 130 Z"/>
          <path d="M340 -5 L320 125 L360 125 Z"/>
        </g>
        <rect y="280" width="600" height="80" fill="#7B9078" opacity=".5"/>
      </svg>
    ),
    interior: (
      <svg viewBox="0 0 600 360" className="w-full h-full" preserveAspectRatio="xMidYMid slice">
        <rect width="600" height="360" fill="#F5E9D8"/>
        <rect x="80" y="60" width="200" height="240" fill="#FBF9F5" stroke="#E8E0D2"/>
        <rect x="100" y="80" width="160" height="200" fill="#F5C896" opacity=".4"/>
        <line x1="180" y1="80" x2="180" y2="280" stroke="#E8E0D2"/>
        <line x1="100" y1="180" x2="260" y2="180" stroke="#E8E0D2"/>
        <rect x="340" y="220" width="200" height="100" fill="#1F4E4D" opacity=".15"/>
        <circle cx="440" cy="270" r="20" fill="#7B9078" opacity=".6"/>
      </svg>
    ),
  };
  return variants[kind] || variants.arch;
};

const InlineImage = ({ kind }) => {
  return (
    <div className="rounded-2xl overflow-hidden bg-cream aspect-[4/3] border border-sand/60">
      <HeroAccent kind={kind} />
    </div>
  );
};

/* ---------------- Header / Footer ---------------- */
const Header = () => (
  <header className="fixed top-0 inset-x-0 z-40 bg-bone/92 backdrop-blur-md border-b border-sand/60">
    <div className="max-w-[1280px] mx-auto px-6 md:px-10 h-16 flex items-center justify-between">
      <a href="/" className="flex items-center gap-2.5 text-ink">
        <svg width="26" height="26" viewBox="0 0 56 56" aria-hidden="true">
          <circle cx="28" cy="28" r="24" fill="none" stroke="#1F4E4D" strokeWidth="2.2" opacity=".65"/>
          <path d="M28 4 A24 24 0 0 1 52 28" fill="none" stroke="#E8745C" strokeWidth="3" strokeLinecap="round"/>
          <circle cx="28" cy="28" r="3.4" fill="#1F1D1A"/>
        </svg>
        <span className="font-serif text-[22px] tracking-display font-medium">Conceive <em className="italic font-normal opacity-75">Iberia</em></span>
      </a>
      <nav className="hidden md:flex items-center gap-7 text-[13.5px] text-inksoft">
        <a href="/" className="hover:text-teal transition-colors">Home</a>
        <a href="/resources" className="hover:text-teal transition-colors">Resources</a>
        <a href="/#/quiz" className="hover:text-teal transition-colors">Take the quiz</a>
        <a href="/#/calculator" className="hover:text-teal transition-colors">Cost calculator</a>
      </nav>
      <a href="/#/quiz" className="hidden md:inline-flex items-center gap-1.5 rounded-full px-4 py-2 text-[13px] font-medium bg-ink text-bone hover:bg-teal transition-colors">
        Start matching <IArrow size={14}/>
      </a>
    </div>
  </header>
);

const Footer = () => (
  <footer className="border-t border-sand/60 mt-32 bg-cream/40">
    <div className="max-w-[1280px] mx-auto px-6 md:px-10 py-14 grid md:grid-cols-4 gap-10 text-[13.5px] text-inksoft">
      <div>
        <a href="/" className="flex items-center gap-2 text-ink">
          <svg width="20" height="20" viewBox="0 0 56 56" aria-hidden="true">
            <circle cx="28" cy="28" r="24" fill="none" stroke="#1F4E4D" strokeWidth="2.5" opacity=".65"/>
            <path d="M28 4 A24 24 0 0 1 52 28" fill="none" stroke="#E8745C" strokeWidth="3.4" strokeLinecap="round"/>
            <circle cx="28" cy="28" r="3.8" fill="#1F1D1A"/>
          </svg>
          <span className="font-serif text-[22px] tracking-display">Conceive <em className="italic font-normal opacity-70">Iberia</em></span>
        </a>
        <p className="mt-3 leading-relaxed">An independent marketplace for Spanish IVF. Standard commission across all clinics in our network.</p>
      </div>
      <div>
        <div className="text-ink font-medium mb-3">Get started</div>
        <ul className="space-y-2">
          <li><a className="hover:text-teal" href="/#/quiz">Take the matching quiz</a></li>
          <li><a className="hover:text-teal" href="/#/calculator">Cost calculator</a></li>
          <li><a className="hover:text-teal" href="/#/concierge">Concierge service</a></li>
        </ul>
      </div>
      <div>
        <div className="text-ink font-medium mb-3">Popular guides</div>
        <ul className="space-y-2">
          <li><a className="hover:text-teal" href="/best-ivf-clinics-spain">Best IVF clinics in Spain</a></li>
          <li><a className="hover:text-teal" href="/ivf-spain-cost">IVF Spain cost</a></li>
          <li><a className="hover:text-teal" href="/donor-egg-ivf-spain">Donor egg IVF</a></li>
          <li><a className="hover:text-teal" href="/ivf-spain-american-patients">For American patients</a></li>
        </ul>
      </div>
      <div>
        <div className="text-ink font-medium mb-3">Legal</div>
        <ul className="space-y-2">
          <li><a className="hover:text-teal" href="#">Privacy</a></li>
          <li><a className="hover:text-teal" href="#">Terms</a></li>
          <li><a className="hover:text-teal" href="#">Commission disclosure</a></li>
        </ul>
      </div>
    </div>
    <div className="border-t border-sand/60">
      <div className="max-w-[1280px] mx-auto px-6 md:px-10 py-5 text-[12px] text-inksoft/70 flex justify-between">
        <span>© 2026 Conceive Iberia</span>
        <span>Last updated · Q2 2026</span>
      </div>
    </div>
  </footer>
);

/* ---------------- Index page ---------------- */
const TIER_LABELS = {
  1: 'Tier 1 · Quick Wins',
  2: 'Tier 2 · High-Intent Profile & Process',
  3: 'Tier 3 · Comparison & Geographic',
  4: 'Tier 4 · Niche & Logistics',
};

const Index = () => {
  const byTier = useMemo(() => {
    const m = { 1:[], 2:[], 3:[], 4:[] };
    BOFU_PAGES.forEach(p => m[p.tier].push(p));
    return m;
  }, []);
  return (
    <div className="pt-24">
      {/* Hero */}
      <section className="max-w-[1280px] mx-auto px-6 md:px-10 pt-12 pb-16">
        <div className="text-[12px] uppercase tracking-[0.18em] text-teal font-medium mb-4">Resources</div>
        <h1 className="font-serif text-[56px] md:text-[80px] leading-[0.95] tracking-displaytight text-ink max-w-4xl">
          Honest answers for <span className="italic">every</span> question patients actually ask.
        </h1>
        <p className="mt-8 text-[18px] leading-relaxed text-inksoft max-w-2xl">
          Thirty in-depth guides covering the cost, geography, treatment, and decision-points of IVF in Spain — written for American patients evaluating real options. No publish dates. Refreshed quarterly.
        </p>
        <div className="mt-10 flex flex-wrap gap-3">
          <a href="/#/quiz" className="inline-flex items-center gap-2 rounded-full px-5 py-3 bg-ink text-bone font-medium hover:bg-teal transition-colors">
            Start the matching quiz <IArrow/>
          </a>
          <a href="/resources#tier1" className="inline-flex items-center gap-2 rounded-full px-5 py-3 border border-sand text-ink hover:border-teal hover:text-teal transition-colors">
            Browse all 30 guides <IChev/>
          </a>
        </div>
      </section>

      <div className="divider mx-6 md:mx-10 max-w-[1280px] md:mx-auto"/>

      {/* Index by tier */}
      <section className="max-w-[1280px] mx-auto px-6 md:px-10 py-16">
        {[1,2,3,4].map(t => (
          <div key={t} id={`tier${t}`} className="mb-16">
            <div className="flex items-baseline justify-between mb-6">
              <h2 className="font-serif text-[28px] md:text-[34px] tracking-display text-ink">{TIER_LABELS[t]}</h2>
              <span className="text-[12px] uppercase tracking-[0.16em] text-inksoft/70">{byTier[t].length} pages</span>
            </div>
            <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-px bg-sand/60 border border-sand/60 rounded-2xl overflow-hidden">
              {byTier[t].map(p => (
                <a key={p.slug} href={`/${p.slug}`} className="block bg-bone p-6 hover:bg-cream transition-colors group">
                  <div className="text-[11px] uppercase tracking-[0.16em] text-teal/80 mb-2">{p.intent}</div>
                  <div className="font-serif text-[22px] tracking-display text-ink leading-tight group-hover:text-teal transition-colors">{p.h1}</div>
                  <div className="mt-3 text-[13px] text-inksoft/80 font-mono">/{p.slug}</div>
                  <div className="mt-4 inline-flex items-center gap-1.5 text-[13px] text-teal font-medium">Read <IArrow size={13}/></div>
                </a>
              ))}
            </div>
          </div>
        ))}
      </section>
    </div>
  );
};

/* ---------------- BOFU Page ---------------- */
const Crumbs = ({ page }) => (
  <nav className="text-[12px] text-inksoft/70 flex items-center gap-2">
    <a href="/" className="hover:text-teal">Home</a>
    <span className="opacity-40">/</span>
    <a href="/resources" className="hover:text-teal">Resources</a>
    <span className="opacity-40">/</span>
    <span className="text-inksoft">{page.h1}</span>
  </nav>
);

const SectionBlock = ({ s }) => {
  const hasImg = !!s.image;
  if (!hasImg) {
    return (
      <section className="max-w-[720px] mx-auto px-6 py-10">
        <h2 className="font-serif text-[30px] md:text-[36px] tracking-display text-ink leading-[1.1] mb-5">{s.h2}</h2>
        <div className="prose-bofu">{s.body.map((p,i)=> <p key={i}>{p}</p>)}</div>
      </section>
    );
  }
  const right = s.imageSide !== 'left';
  return (
    <section className="max-w-[1080px] mx-auto px-6 py-12">
      <div className={`grid md:grid-cols-2 gap-10 md:gap-14 items-center ${right ? '' : 'md:[&>*:first-child]:order-2'}`}>
        <div>
          <h2 className="font-serif text-[30px] md:text-[36px] tracking-display text-ink leading-[1.1] mb-5">{s.h2}</h2>
          <div className="prose-bofu">{s.body.map((p,i)=> <p key={i}>{p}</p>)}</div>
        </div>
        <InlineImage kind={s.image}/>
      </div>
    </section>
  );
};

const FAQ = ({ items }) => {
  const [open, setOpen] = useState(0);
  return (
    <section className="max-w-[860px] mx-auto px-6 py-16">
      <h2 className="font-serif text-[30px] md:text-[36px] tracking-display text-ink leading-[1.1] mb-8">Frequently asked questions</h2>
      <div className="border-t border-sand/70" itemScope itemType="https://schema.org/FAQPage">
        {items.map((it,i) => {
          const isOpen = open === i;
          return (
            <div key={i} className="border-b border-sand/70" itemScope itemType="https://schema.org/Question" itemProp="mainEntity">
              <button onClick={()=>setOpen(isOpen ? -1 : i)} className="w-full flex items-center justify-between text-left py-5 group">
                <span className="text-[17px] text-ink font-medium pr-4" itemProp="name">{it.q}</span>
                <span className={`shrink-0 text-inksoft transition-transform ${isOpen ? 'rotate-45' : ''}`}>
                  <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
                </span>
              </button>
              {isOpen && (
                <div className="pb-6 pr-10 text-[16px] leading-[1.7] text-inksoft" itemScope itemType="https://schema.org/Answer" itemProp="acceptedAnswer">
                  <span itemProp="text">{it.a}</span>
                </div>
              )}
            </div>
          );
        })}
      </div>
    </section>
  );
};

const PullQuote = ({ q }) => (
  <section className="max-w-[860px] mx-auto px-6 py-12">
    <figure className="border-l-2 border-coral pl-8">
      <blockquote className="font-serif italic text-[28px] md:text-[32px] leading-[1.25] text-ink tracking-display">
        "{q.text}"
      </blockquote>
      <figcaption className="mt-5 text-[13px] uppercase tracking-[0.18em] text-inksoft/80">— {q.attribution}</figcaption>
    </figure>
  </section>
);

const TrustStrip = () => (
  <section className="max-w-[1080px] mx-auto px-6 py-10">
    <div className="grid grid-cols-1 md:grid-cols-3 gap-px bg-sand/60 border border-sand/60 rounded-2xl overflow-hidden">
      {[
        { v: '38', l: 'Vetted clinics in network' },
        { v: '5', l: 'Published vetting criteria' },
        { v: 'Flat', l: 'Commission across all clinics' },
      ].map((t,i)=>(
        <div key={i} className="bg-bone p-7">
          <div className="font-serif text-[44px] tracking-displaytight text-teal leading-none">{t.v}</div>
          <div className="mt-3 text-[13px] text-inksoft uppercase tracking-[0.14em]">{t.l}</div>
        </div>
      ))}
    </div>
  </section>
);

const InternalLinks = ({ slugs }) => {
  const pages = slugs.map(s => BOFU_PAGES.find(p => p.slug === s)).filter(Boolean);
  if (!pages.length) return null;
  return (
    <section className="max-w-[1080px] mx-auto px-6 py-12">
      <div className="text-[12px] uppercase tracking-[0.16em] text-inksoft/70 mb-5">Keep reading</div>
      <div className="grid md:grid-cols-3 gap-4">
        {pages.map(p => (
          <a key={p.slug} href={`/${p.slug}`} className="group block p-6 rounded-2xl border border-sand/60 bg-bone hover:bg-cream transition-colors">
            <div className="font-serif text-[20px] tracking-display text-ink leading-tight group-hover:text-teal transition-colors">{p.h1}</div>
            <div className="mt-3 inline-flex items-center gap-1.5 text-[13px] text-teal font-medium">Read <IArrow size={13}/></div>
          </a>
        ))}
      </div>
    </section>
  );
};

const FinalCTA = ({ secondary }) => (
  <section className="max-w-[1080px] mx-auto px-6 pt-12 pb-20">
    <div className="rounded-3xl bg-tealdeep text-bone p-10 md:p-16 relative overflow-hidden">
      <div className="absolute inset-0 opacity-[.06]" style={{backgroundImage:'radial-gradient(rgba(255,255,255,1) 1px, transparent 1px)', backgroundSize:'24px 24px'}}/>
      <div className="relative">
        <h2 className="font-serif text-[40px] md:text-[56px] tracking-displaytight leading-[0.98] max-w-2xl">
          Find your matched <span className="italic">clinics.</span>
        </h2>
        <p className="mt-5 text-[17px] text-bone/80 max-w-xl">Six minutes. Three matched clinics with profile-specific pricing in your inbox within 48 hours. Free.</p>
        <div className="mt-8 flex flex-wrap gap-3">
          <a href="/#/quiz" className="inline-flex items-center gap-2 rounded-full px-6 py-3.5 bg-bone text-ink font-medium hover:bg-coral hover:text-bone transition-colors">
            Find your matched clinics <IArrow/>
          </a>
          {secondary && (
            <a href={secondary.href.startsWith('#/') ? `/${secondary.href.slice(2)}` : secondary.href} className="inline-flex items-center gap-2 rounded-full px-6 py-3.5 border border-bone/30 text-bone hover:border-bone hover:bg-bone/10 transition-colors">
              {secondary.label} <IArrow/>
            </a>
          )}
        </div>
      </div>
    </div>
  </section>
);

const HeroBlock = ({ page }) => (
  <section className="max-w-[1280px] mx-auto px-6 md:px-10 pt-10 pb-12">
    <Crumbs page={page}/>
    <div className="grid lg:grid-cols-[1.15fr_1fr] gap-10 lg:gap-14 mt-7 items-center">
      <div>
        <div className="text-[11px] uppercase tracking-[0.18em] text-teal font-medium mb-4">{page.intent}</div>
        <h1 className="font-serif text-[44px] md:text-[68px] leading-[0.98] tracking-displaytight text-ink">{page.h1}</h1>
        <p className="mt-7 text-[18px] leading-[1.65] text-inksoft max-w-xl">{page.intro}</p>
        <div className="mt-9 flex flex-wrap gap-3">
          <a href="/#/quiz" className="inline-flex items-center gap-2 rounded-full px-5 py-3 bg-ink text-bone font-medium hover:bg-teal transition-colors">
            Start the matching quiz <IArrow/>
          </a>
          {page.secondaryCTA && (
            <a href={page.secondaryCTA.href.startsWith('#/') ? `/${page.secondaryCTA.href.slice(2)}` : page.secondaryCTA.href} className="inline-flex items-center gap-2 rounded-full px-5 py-3 border border-sand text-ink hover:border-teal hover:text-teal transition-colors">
              {page.secondaryCTA.label} <IArrow/>
            </a>
          )}
        </div>
      </div>
      <div className="rounded-3xl overflow-hidden border border-sand/60 aspect-[4/3] bg-cream">
        <HeroAccent kind={page.heroAccent}/>
      </div>
    </div>
  </section>
);

const BofuPage = ({ slug }) => {
  const page = BOFU_PAGES.find(p => p.slug === slug);
  useEffect(() => {
    if (page) document.title = `${page.h1} — Conceive Iberia`;
  }, [page]);
  if (!page) {
    return (
      <div className="pt-32 max-w-[720px] mx-auto px-6">
        <h1 className="font-serif text-[36px] tracking-display">Page not found</h1>
        <p className="mt-3 text-inksoft">Try the <a className="text-teal underline" href="/resources">resource index</a> or the <a className="text-teal underline" href="/">homepage</a>.</p>
      </div>
    );
  }
  return (
    <article className="pt-20">
      <HeroBlock page={page}/>
      <div className="divider max-w-[1080px] mx-6 md:mx-auto"/>
      {page.sections.map((s,i) => (
        <React.Fragment key={i}>
          <SectionBlock s={s}/>
          {i < page.sections.length - 1 && <div className="divider max-w-[600px] mx-auto opacity-50"/>}
        </React.Fragment>
      ))}
      <TrustStrip/>
      <FAQ items={page.faqs}/>
      {page.quote && <PullQuote q={page.quote}/>}
      <InternalLinks slugs={page.internalLinks}/>
      <FinalCTA secondary={page.secondaryCTA}/>
    </article>
  );
};

/* ---------------- Root ---------------- */
const App = () => {
  const slug = getSlug();
  return (
    <div className="min-h-screen bg-bone">
      <Header/>
      {slug ? <BofuPage slug={slug}/> : <Index/>}
      <Footer/>
    </div>
  );
};

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