/* global React, Icon, Footer, SiteHeader */

const CHECKS = [
  { sev: "block", label: "Blocked", text: "Mug set: no HS code. Carriers reject international parcels without one." },
  { sev: "warn",  label: "Check",   text: "No IOSS number on a parcel of €150 or less. The buyer would pay VAT at the door." },
  { sev: "warn",  label: "Check",   text: "No recipient phone number. Most carriers need it for customs contact." },
  { sev: "note",  label: "Note",    text: "Country of origin not set. It will default to United Kingdom." },
];
const SEV = {
  block: "bg-red-500/15 text-red-300 ring-red-400/30",
  warn:  "bg-amber-500/15 text-amber-300 ring-amber-400/30",
  note:  "bg-stone-500/20 text-stone-300 ring-stone-400/30",
};

function IntlHero() {
  return (
    <section className="relative pt-10 pb-24 lg:pt-14 lg:pb-28 bg-stone-950 text-stone-100 overflow-hidden" data-screen-label="01 Hero">
      <div className="absolute inset-0 pilot-grid opacity-60 pointer-events-none"></div>
      <div className="absolute inset-0 pointer-events-none">
        <div className="absolute -top-1/3 left-0 w-2/3 h-2/3 bg-gradient-to-br from-orange-600/25 via-orange-500/8 to-transparent blur-3xl"></div>
      </div>
      <div className="relative max-w-7xl mx-auto px-6 grid grid-cols-12 gap-10 items-center">
        <div className="col-span-12 lg:col-span-6">
          <div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-orange-500/15 border border-orange-400/30 text-orange-300 text-[11px] font-medium mb-6">
            <span className="w-1.5 h-1.5 rounded-full bg-orange-400" style={{ animation: "pulse-dot 1.6s ease-in-out infinite" }}></span>
            International shipping · customs
          </div>
          <h1 className="font-bold tracking-tight text-white" style={{ fontSize: "clamp(38px, 5.2vw, 70px)", lineHeight: 1.03, letterSpacing: "-0.028em" }}>
            Customs paperwork<br /><span className="text-orange-400">without the afternoon.</span>
          </h1>
          <p className="text-stone-300 text-lg mt-6 max-w-xl leading-relaxed">
            Sell to the world and keep parcels moving. Unified Orders checks every international order before you book a label, fills the commercial invoice from your own data, and tells you what the buyer is likely to be charged at the border.
          </p>
          <div className="flex flex-col sm:flex-row gap-3 mt-8">
            <a href="contact.html#demo" className="px-6 py-3.5 rounded-lg bg-orange-500 text-white font-semibold hover:bg-orange-600 inline-flex items-center justify-center gap-2 transition-colors">Book a walkthrough <Icon name="arrow" size={16} /></a>
            <a href="#how" className="px-6 py-3.5 rounded-lg bg-white/10 text-white font-semibold border border-white/20 hover:bg-white/15 transition-colors text-center">See how it works</a>
          </div>
        </div>

        <div className="col-span-12 lg:col-span-6">
          <div className="bg-stone-900/95 border border-stone-700/60 rounded-2xl overflow-hidden shadow-2xl shadow-black/40">
            <div className="px-4 h-11 border-b border-stone-800 flex items-center justify-between bg-stone-900/60">
              <span className="text-[11px] uppercase tracking-[0.16em] font-semibold text-stone-300">Customs declaration · Germany · DDU</span>
              <span className="font-mono text-[10px] text-stone-500">ORD-10931</span>
            </div>
            <div className="p-4 space-y-2.5">
              {CHECKS.map((c, i) => (
                <div key={i} className="flex items-start gap-2.5 text-[12.5px]">
                  <span className={"flex-none px-2 py-0.5 rounded-full text-[10px] font-semibold ring-1 " + SEV[c.sev]}>{c.label}</span>
                  <span className="text-stone-300 leading-snug">{c.text}</span>
                </div>
              ))}
              <div className="mt-3 rounded-xl border border-stone-700/60 bg-stone-800/50 px-3.5 py-3 text-[12.5px] text-stone-300">
                Estimated at the border: <span className="font-semibold text-white">£12.40</span> import VAT
                <span className="text-stone-500"> · duty-free with UK origin statement · indicative</span>
              </div>
              <div className="flex gap-2 pt-1">
                <span className="px-3 py-1.5 rounded-md bg-orange-500 text-white text-[12px] font-semibold inline-flex items-center gap-1.5"><Icon name="printer" size={12} /> Print commercial invoice</span>
                <span className="px-3 py-1.5 rounded-md bg-stone-800 text-stone-200 text-[12px] border border-stone-700">Suggest HS codes with AI</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

function Problems() {
  const items = [
    { icon: "x",       title: "Wrong commercial invoice",  desc: "Typed by hand, so a missing HS code or a wrong value holds the parcel at the border." },
    { icon: "bell",    title: "Surprise charges at the door", desc: "No IOSS or VOEC number means the buyer pays VAT plus a courier fee, and refuses the parcel." },
    { icon: "layers",  title: "Rules in someone's head",   desc: "Which country needs EORI, which one is fully dutiable, which one you cannot ship to at all." },
  ];
  return (
    <section className="py-20 bg-white border-b border-stone-200/70" data-screen-label="02 Problems">
      <div className="max-w-7xl mx-auto px-6">
        <div className="max-w-2xl mb-10">
          <span className="text-[11px] uppercase tracking-[0.18em] font-semibold text-orange-700">When 30% of orders cross a border</span>
          <h2 className="font-bold tracking-tight text-stone-900 mt-2" style={{ fontSize: "clamp(28px, 3.4vw, 44px)", lineHeight: 1.1, letterSpacing: "-0.02em" }}>
            The paperwork becomes a second job.
          </h2>
        </div>
        <div className="grid md:grid-cols-3 gap-4">
          {items.map((p) => (
            <div key={p.title} className="bg-stone-50/70 border border-stone-200 rounded-2xl p-6">
              <div className="w-10 h-10 rounded-xl bg-orange-100 text-orange-700 flex items-center justify-center mb-4"><Icon name={p.icon} size={18} /></div>
              <h3 className="font-semibold text-stone-900 text-[17px] mb-1.5">{p.title}</h3>
              <p className="text-stone-600 text-[14px] leading-relaxed">{p.desc}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function IntlFeatures() {
  const items = [
    { icon: "check",   title: "Readiness check before you book", desc: "Missing or short HS codes, zero values, sanctioned destinations, missing EORI, IOSS or VOEC: flagged as blocked, check or note, on the order, before the label exists." },
    { icon: "printer", title: "Commercial invoice from a template", desc: "Exporter, consignee, HS codes, origin, incoterm and tax numbers, filled from the order. It is a normal document template, so you change the layout in the Template Designer and it prints and saves like every other document." },
    { icon: "bot",     title: "AI HS-code suggestions",         desc: "Ranked candidate commodity codes for every item in one call. Pick one, apply it to all, and save it back to the product so it sticks." },
    { icon: "bar",     title: "Duty and VAT estimate",           desc: "An indicative import VAT/GST figure for the destination, with duty included when you give it a rate. Good enough to decide between DDU and DDP." },
    { icon: "shield",  title: "IOSS, EORI, VOEC, VAT",           desc: "Store your registrations, and your marketplaces', once. The right number is picked per destination, channel and order value, and a marketplace's IOSS wins on that marketplace's orders." },
    { icon: "truck",   title: "Compare carriers on international", desc: "Live quotes from your connected carriers sit next to your own contracted rate cards in the ship dialog, so the cheap lane is obvious." },
  ];
  return (
    <section className="py-24" data-screen-label="03 Features">
      <div className="max-w-7xl mx-auto px-6">
        <div className="max-w-2xl mb-12">
          <span className="text-[11px] uppercase tracking-[0.18em] font-semibold text-orange-700">What you get</span>
          <h2 className="font-bold tracking-tight text-stone-900 mt-2" style={{ fontSize: "clamp(28px, 3.4vw, 44px)", lineHeight: 1.1, letterSpacing: "-0.02em" }}>
            Built into the order, not bolted on.
          </h2>
        </div>
        <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-4">
          {items.map((f) => (
            <div key={f.title} className="bg-white border border-stone-200 rounded-2xl p-6 hover:shadow-md hover:border-stone-300 hover:-translate-y-0.5 transition-all">
              <div className="w-10 h-10 rounded-xl bg-orange-100 text-orange-700 flex items-center justify-center mb-4"><Icon name={f.icon} size={18} /></div>
              <h3 className="font-semibold text-stone-900 text-[17px] mb-1.5">{f.title}</h3>
              <p className="text-stone-600 text-[14px] leading-relaxed">{f.desc}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function IntlHow() {
  const steps = [
    { n: "01", title: "Set it up once", desc: "Add your EORI, VAT and any IOSS or VOEC numbers to the shipping account, plus a default origin and incoterm." },
    { n: "02", title: "Open the order", desc: "The customs panel resolves each item's HS code from the item, then the product, then your account default, and lists anything missing." },
    { n: "03", title: "Fix and print", desc: "Accept AI suggestions, save codes back to the product, then print the commercial invoice. Next time the same product needs nothing." },
    { n: "04", title: "Book the label", desc: "The customs data goes to the carrier with the booking, for carriers that accept it electronically." },
  ];
  return (
    <section id="how" className="py-24 bg-stone-50/60 border-y border-stone-200/70" data-screen-label="04 How">
      <div className="max-w-5xl mx-auto px-6">
        <div className="text-center mb-12 max-w-2xl mx-auto">
          <span className="text-[11px] uppercase tracking-[0.18em] font-semibold text-orange-700">How it works</span>
          <h2 className="font-bold tracking-tight text-stone-900 mt-2" style={{ fontSize: "clamp(28px, 3.4vw, 44px)", lineHeight: 1.1, letterSpacing: "-0.02em" }}>Fill it in once. Reuse it forever.</h2>
        </div>
        <div className="space-y-3">
          {steps.map((s) => (
            <div key={s.n} className="grid grid-cols-12 gap-6 items-center bg-white border border-stone-200 rounded-2xl p-6">
              <div className="col-span-2 lg:col-span-1 font-mono text-2xl font-bold text-orange-500">{s.n}</div>
              <div className="col-span-10 lg:col-span-3"><h3 className="font-semibold text-stone-900 text-xl">{s.title}</h3></div>
              <div className="col-span-12 lg:col-span-8 text-stone-600 leading-relaxed text-[15px]">{s.desc}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function IntlCoverage() {
  const rows = [
    ["United Kingdom", "VAT at sale up to £135, importer pays above"],
    ["European Union", "Import VAT on every parcel; IOSS up to €150; EORI; UK-origin duty relief with an origin statement"],
    ["United States", "No de-minimis: every parcel dutiable, 10-digit codes"],
    ["Canada · Australia · New Zealand", "Low-value thresholds and GST on import"],
    ["Norway · Switzerland · Japan", "VOEC, EORI and local thresholds"],
  ];
  return (
    <section className="py-24" data-screen-label="05 Coverage">
      <div className="max-w-5xl mx-auto px-6">
        <div className="max-w-2xl mb-8">
          <span className="text-[11px] uppercase tracking-[0.18em] font-semibold text-orange-700">Country rules</span>
          <h2 className="font-bold tracking-tight text-stone-900 mt-2" style={{ fontSize: "clamp(26px, 3vw, 38px)", lineHeight: 1.1, letterSpacing: "-0.02em" }}>The big lanes are covered. The obscure ones are flagged.</h2>
          <p className="text-stone-600 mt-4 leading-relaxed">Built-in rules for the destinations most sellers ship to, and a block list for sanctioned countries. For a country without built-in rules, the panel says so plainly instead of guessing. Thresholds change, so estimates are labelled indicative.</p>
        </div>
        <div className="bg-white border border-stone-200 rounded-2xl divide-y divide-stone-100">
          {rows.map(([k, v]) => (
            <div key={k} className="px-6 py-4 grid md:grid-cols-3 gap-2"><div className="font-semibold text-stone-900">{k}</div><div className="md:col-span-2 text-stone-600 text-[14px]">{v}</div></div>
          ))}
        </div>
      </div>
    </section>
  );
}

function IntlCta() {
  return (
    <section className="py-24" data-screen-label="06 CTA">
      <div className="max-w-5xl mx-auto px-6">
        <div className="bg-stone-900 rounded-3xl p-10 lg:p-16 text-center relative overflow-hidden">
          <div className="absolute inset-0 opacity-50 pointer-events-none"><div className="absolute top-0 right-0 w-2/3 h-full bg-gradient-to-l from-orange-600/30 via-orange-400/10 to-transparent blur-3xl"></div></div>
          <div className="relative">
            <h2 className="font-bold tracking-tight text-white" style={{ fontSize: "clamp(30px, 4vw, 50px)", lineHeight: 1.05, letterSpacing: "-0.025em" }}>Stop filling in customs forms<br />by hand.</h2>
            <p className="text-stone-300 text-lg mt-5 max-w-xl mx-auto">Part of the same order screen you already ship from. No separate customs tool to subscribe to.</p>
            <div className="flex flex-col sm:flex-row gap-3 justify-center mt-9">
              <a href="contact.html#demo" className="px-6 py-3.5 rounded-lg bg-orange-500 text-white font-semibold hover:bg-orange-600 inline-flex items-center justify-center gap-2 transition-colors">Book a 20-min walkthrough <Icon name="arrow" size={16} /></a>
              <a href="pricing.html" className="px-6 py-3.5 rounded-lg bg-white/10 text-white font-semibold border border-white/20 hover:bg-white/15 transition-colors">See pricing</a>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

function InternationalPage() {
  return (
    <>
      <SiteHeader theme="dark" active="international" breadcrumb={[{ label: "Product", href: "index.html" }, { label: "Features", href: "index.html#features" }, { label: "International shipping" }]} />
      <IntlHero />
      <Problems />
      <IntlFeatures />
      <IntlHow />
      <IntlCoverage />
      <IntlCta />
      <Footer />
    </>
  );
}

window.InternationalPage = InternationalPage;
