import type { ReactNode } from "react";
import Image from "next/image";
import {
  ArrowRight,
  X,
  Check,
  Factory,
  Link2,
  Zap,
  LayoutGrid,
  Factory as FactoryIcon,
  Package as PackageIcon,
  ShoppingCart as CartIcon,
  Truck as TruckIcon,
  IndianRupee as RupeeIcon,
  Clock as ClockIcon,
  Users as UsersIcon,
  TrendingUp as TrendIcon,
  type LucideIcon,
} from "lucide-react";
import { SectionTitle, SectionHeader, PrimaryCta, GhostCta } from "./ui";
import { cn } from "@/lib/cn";

/* ---------- Value strip overlapping the hero ---------- */

const STRIP_ICONS: LucideIcon[] = [Factory, Link2, Zap, LayoutGrid];

export function ValueStrip({ items }: { items: { title: string; text: string }[] }) {
  return (
    <div className="mx-container relative z-[3] -mt-14">
      <div className="grid grid-cols-1 gap-px overflow-hidden rounded-[14px] border border-line bg-line shadow-card sm:grid-cols-2 lg:grid-cols-4">
        {items.map((it, i) => {
          const Icon = STRIP_ICONS[i % STRIP_ICONS.length];
          return (
            <div key={it.title} className="flex gap-3.5 bg-white p-[24px_22px]">
              <Icon size={38} className="shrink-0 rounded-[10px] bg-brand-tint p-[9px] text-brand" aria-hidden="true" />
              <span>
                <b className="block text-sm leading-snug text-ink">{it.title}</b>
                <small className="mt-1 block text-xs leading-snug text-muted">{it.text}</small>
              </span>
            </div>
          );
        })}
      </div>
    </div>
  );
}

/* ---------- Page hero (navy, reference style) ---------- */

export function PageHero({
  eyebrow,
  title,
  accent,
  para,
  para2,
  crumbs,
  primary,
  secondary,
  checks,
  mock,
  overlay,
  compact,
  pill = "default",
  accentColor = "brand",
  id,
}: {
  eyebrow: string;
  title: string;
  accent?: string;
  para: string;
  para2?: string;
  crumbs?: { label: string; href?: string }[];
  primary: { label: string; href: string };
  secondary?: { label: string; href: string };
  checks?: string[];
  mock?: ReactNode;
  overlay?: ReactNode;
  compact?: boolean;
  pill?: "default" | "amber" | "blue";
  accentColor?: "brand" | "amber";
  id?: string;
}) {
  return (
    <section id={id} className="bg-navy pb-[110px] pt-14 text-white md:pt-[72px] max-md:pb-[88px]">
      <div
        className={cn(
          "mx-container grid items-center gap-12",
          mock ? "lg:grid-cols-[1fr_1.05fr]" : "max-w-3xl"
        )}
      >
        <div className="min-w-0">
          {crumbs && (
            <nav aria-label="Breadcrumb" className="mb-4 flex items-center gap-2 font-mono text-xs text-faint">
              {crumbs.map((c, i) => (
                <span key={c.label} className="flex items-center gap-2">
                  {i > 0 && <span aria-hidden="true">/</span>}
                  {c.href ? (
                    <a href={c.href} className="hover:text-white">{c.label}</a>
                  ) : (
                    <span className="text-white">{c.label}</span>
                  )}
                </span>
              ))}
            </nav>
          )}
          {pill === "amber" ? (
            <span className="inline-flex items-center gap-2 self-start rounded-full border border-line bg-white px-3.5 py-1.5 font-mono text-[10.5px] font-semibold tracking-[0.12em] text-[#F59E13]">
              <span className="size-[7px] rounded-full bg-brand" aria-hidden="true" />
              {eyebrow}
            </span>
          ) : pill === "blue" ? (
            <span className="inline-flex items-center gap-2 self-start rounded-full border border-brand/25 bg-brand-tint px-3.5 py-1.5 font-mono text-[10.5px] font-semibold tracking-[0.12em] text-brand">
              <span className="size-[7px] rounded-full bg-accent" aria-hidden="true" />
              {eyebrow}
            </span>
          ) : (
            <span className="inline-flex items-center gap-2.5 self-start rounded-full border border-white/20 px-3.5 py-1.5 font-mono text-[10.5px] font-medium tracking-[0.12em] text-herosub">
              <span className="size-[7px] rounded-full bg-accent" aria-hidden="true" />
              {eyebrow}
            </span>
          )}
          <h1
            className={cn(
              "my-[22px] font-display font-bold leading-[1.08] text-white",
              compact
                ? "text-[clamp(30px,3.6vw,44px)]"
                : "text-[clamp(36px,4.6vw,56px)]"
            )}
          >
            {title}{" "}
            {accent && (
              <span className={accentColor === "amber" ? "text-[#F59E13]" : "text-brand-light"}>
                {accent}
              </span>
            )}
          </h1>
          <p className="max-w-[560px] text-[17px] leading-relaxed text-herosub">{para}</p>
          {/* {para2 && (
            <p className="mt-4 max-w-[560px] text-[15px] leading-relaxed text-faint">{para2}</p>
          )} */}
          <div className="my-7 flex flex-wrap gap-3.5">
            <PrimaryCta href={primary.href}>{primary.label}</PrimaryCta>
            {secondary && (
              <GhostCta href={secondary.href} dark>
                {secondary.label}
              </GhostCta>
            )}
          </div>
          {checks && (
            <div className="grid gap-3 border-t border-white/10 pt-6 sm:grid-cols-2">
              {checks.map((t) => (
                <span key={t} className="inline-flex items-center gap-2 text-[13px] font-medium text-herosub">
                  <Check size={15} className="text-accent" /> {t}
                </span>
              ))}
            </div>
          )}
        </div>
        {mock && (
          <div className="relative min-w-0" aria-hidden="true">
            {mock}
            {overlay}
          </div>
        )}
      </div>
    </section>
  );
}

/* ---------- Platform stack visual (platform hero, reference style) ---------- */

export function PlatformStack() {
  return (
    <div className="w-full max-w-[560px] space-y-3 max-lg:mx-auto">
      <div className="rounded-[14px] border border-white/10 bg-white/[0.05] p-4 shadow-hero">
        <p className="font-mono text-[10px] font-medium tracking-[0.14em] text-footsub">
          INDUSTRY SOLUTIONS
        </p>
        <div className="mt-3 grid grid-cols-2 gap-2.5">
          <span className="inline-flex min-h-[44px] items-center justify-center rounded-lg bg-accent px-4 text-center text-[13px] font-semibold text-navy">
            Manufacturing ERP
          </span>
          <span className="inline-flex min-h-[44px] items-center justify-center rounded-lg bg-brand px-4 text-center text-[13px] font-semibold text-white">
            Construction ERP
          </span>
        </div>
      </div>
      <div className="rounded-[14px] border border-white/10 bg-white/[0.05] p-4">
        <p className="font-mono text-[10px] font-medium tracking-[0.14em] text-footsub">
          SHARED MODULES
        </p>
        <div className="mt-3 grid grid-cols-2 gap-2.5 sm:grid-cols-4">
          {["Purchase", "Inventory", "Finance", "HR & Payroll"].map((t) => (
            <span
              key={t}
              className="inline-flex min-h-[40px] items-center justify-center rounded-lg bg-white/10 px-3 text-center text-[13px] font-medium text-herosub"
            >
              {t}
            </span>
          ))}
        </div>
      </div>
      <div className="rounded-[14px] border border-white/10 bg-white/[0.05] p-4">
        <p className="font-mono text-[10px] font-medium tracking-[0.14em] text-footsub">
          PLATFORM SERVICES
        </p>
        <div className="mt-3 grid grid-cols-2 gap-2.5 sm:grid-cols-4">
          {["Workflows", "Dashboards", "Access & audit", "Integrations"].map((t) => (
            <span
              key={t}
              className="inline-flex min-h-[40px] items-center justify-center rounded-lg bg-white/10 px-3 text-center text-[13px] font-medium text-herosub"
            >
              {t}
            </span>
          ))}
        </div>
      </div>
      <div className="rounded-[14px] border border-dashed border-white/20 bg-transparent p-4">
        <p className="font-mono text-[10px] font-medium tracking-[0.14em] text-footsub">
          DEPLOYMENT
        </p>
        <div className="mt-3 grid grid-cols-3 gap-2.5">
          {["Cloud", "On-premise", "Web & mobile"].map((t) => (
            <span
              key={t}
              className="inline-flex min-h-[40px] items-center justify-center rounded-lg border border-white/25 px-3 text-center text-[13px] font-medium text-white"
            >
              {t}
            </span>
          ))}
        </div>
      </div>
    </div>
  );
}

/* ---------- Split intro + capabilities card ---------- */

export function SplitIntro({
  label,
  title,
  paras,
  cardLabel,
  columns,
  tone = "amber",
}: {
  label: string;
  title: string;
  paras: string[];
  cardLabel: string;
  columns: string[][];
  tone?: "amber" | "blue";
}) {
  const blue = tone === "blue";
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container grid items-start gap-12 lg:grid-cols-[1fr_1.1fr]">
        <div>
          <span
            className={
              blue
                ? "inline-flex items-center rounded-full border border-brand/25 bg-brand-tint px-4 py-2 font-mono text-[11px] font-semibold tracking-[0.14em] text-brand"
                : "inline-flex items-center rounded-full border border-[#fde68a] bg-[#fffbeb] px-4 py-2 font-mono text-[11px] font-semibold tracking-[0.14em] text-accent-dark"
            }
          >
            {label}
          </span>
          <h2 className="mt-2.5 font-display text-[clamp(30px,3.4vw,42px)] font-bold">
            {title}
          </h2>
          {paras.map((p, i) => (
            <p
              key={i}
              className={i === 0 ? "mt-6 text-[15px] leading-relaxed text-body" : "mt-4 text-[15px] leading-relaxed text-muted"}
            >
              {p}
            </p>
          ))}
        </div>
        <div
          className={
            blue
              ? "rounded-2xl border border-[#bfdbfe] bg-[#f8faff] p-7 max-sm:p-6"
              : "rounded-2xl border border-[#fde68a] bg-[#fffbeb] p-7 max-sm:p-6"
          }
        >
          <p
            className={
              blue
                ? "font-mono text-[11px] font-medium tracking-[0.14em] text-muted"
                : "font-mono text-[11px] font-medium tracking-[0.14em] text-accent-dark"
            }
          >
            {cardLabel}
          </p>
          <div className="mt-5 grid gap-x-8 gap-y-3.5 sm:grid-cols-2">
            {columns.map((col, ci) => (
              <ul key={ci} className="space-y-3.5">
                {col.map((item) => (
                  <li key={item} className="flex items-start gap-2 text-[13.5px] font-medium leading-snug text-body">
                    <Check size={15} className={blue ? "mt-0.5 shrink-0 text-brand" : "mt-0.5 shrink-0 text-accent"} aria-hidden="true" />
                    {item}
                  </li>
                ))}
              </ul>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Dashboard strip (navy band + tiles) ---------- */

const DASH_TILES = [
  { icon: FactoryIcon, label: "Production" },
  { icon: PackageIcon, label: "Inventory" },
  { icon: CartIcon, label: "Purchase" },
  { icon: TruckIcon, label: "Sales" },
  { icon: RupeeIcon, label: "Finance" },
  { icon: ClockIcon, label: "HR" },
  { icon: UsersIcon, label: "Customers" },
];

export function DashStrip({
  label,
  title,
  para,
}: {
  label: string;
  title: string;
  para: string;
}) {
  return (
    <section className="bg-navy py-20 max-md:py-14">
      <div className="mx-container grid items-center gap-12 lg:grid-cols-[460px_minmax(0,1fr)] lg:gap-16">
        <div>
          <span className="inline-flex items-center rounded-full border border-[#fde68a] bg-[#fffbeb] px-4 py-2 font-mono text-[11px] font-semibold tracking-[0.14em] text-accent-dark">
            {label}
          </span>
          <h2 className="mt-2.5 font-display text-[clamp(30px,3.4vw,42px)] font-bold">
            {title}
          </h2>
          <p className="mt-4 text-[16px] leading-relaxed text-herosub">{para}</p>
        </div>
        <div className="grid grid-cols-2 gap-3 sm:grid-cols-4">
          {DASH_TILES.map((t) => (
            <div
              key={t.label}
              className="flex flex-col gap-2.5 rounded-xl border border-white/10 bg-navy2 p-[18px]"
            >
              <t.icon size={22} className="text-[#fcd34d]" aria-hidden="true" />
              <span className="text-sm font-semibold text-white">{t.label}</span>
            </div>
          ))}
          <div className="flex flex-col gap-2.5 rounded-xl bg-accent p-[18px]">
            <TrendIcon size={22} className="text-[#1c1405]" aria-hidden="true" />
            <span className="text-sm font-semibold text-[#1c1405]">One connected view</span>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Challenge → solution table ---------- */

export function SolvesTable({
  eyebrow,
  title,
  intro,
  rows,
  head = ["Manufacturing challenge", "MxERP solution"],
  headStyle = "navy",
  strong,
  tone = "blue",
  action,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  rows: { challenge: string; solution: string }[];
  head?: [string, string];
  headStyle?: "navy" | "mono";
  strong?: "left" | "right";
  tone?: "blue" | "amber";
  action?: { label: string; href: string };
}) {
  const emphasis = strong ?? (headStyle === "navy" ? "right" : "left");
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container grid items-start gap-12 lg:grid-cols-[400px_minmax(0,1fr)] lg:gap-16">
        <div>
          <SectionHeader align="left" eyebrow={eyebrow} title={title} intro={intro} tone={tone} />
          {action && (
            <a href={action.href} className="-mt-6 inline-flex items-center gap-2 text-[13.5px] font-semibold text-brand">
              {action.label} <ArrowRight size={16} />
            </a>
          )}
        </div>
        <div className="overflow-hidden rounded-2xl border border-line bg-white shadow-soft">
          <table className="w-full border-collapse text-left text-sm">
            <thead>
              {headStyle === "navy" ? (
                <tr className="bg-navy font-display text-[13.5px] text-white">
                  <th className="w-[38%] px-6 py-4 font-semibold">{head[0]}</th>
                  <th className="w-[62%] px-6 py-4 font-semibold">{head[1]}</th>
                </tr>
              ) : (
                <tr className="font-mono text-[11px] tracking-[0.14em] text-muted">
                  <th className="w-[38%] border-b border-line px-6 py-3.5 font-medium">{head[0]}</th>
                  <th className="w-[62%] border-b border-line px-6 py-3.5 font-medium">{head[1]}</th>
                </tr>
              )}
            </thead>
            <tbody>
              {rows.map((r, i) => (
                <tr key={r.challenge} className={i % 2 === 1 ? "bg-canvas/60" : "bg-white"}>
                  <td className={emphasis === "right" ? "border-t border-line px-6 py-4 text-sm text-muted" : "border-t border-line px-6 py-4 text-sm font-semibold text-ink"}>{r.challenge}</td>
                  <td className={emphasis === "right" ? "border-t border-line px-6 py-4 text-sm font-semibold text-ink" : "border-t border-line px-6 py-4 text-sm text-muted"}>{r.solution}</td>
                </tr>
              ))}
            </tbody>
          </table>
        </div>
      </div>
    </section>
  );
}

/* ---------- Challenge cards + blue CTA tile (reference format) ---------- */

export function ChallengeCards({
  eyebrow,
  title,
  intro,
  items,
  cta,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  items: { icon: LucideIcon; title: string; text: string }[];
  cta: { title: string; label: string; href: string };
}) {
  return (
    <section className="bg-canvas py-24 max-md:py-[72px]">
      <div className="mx-container">
        <div className="mb-12 flex items-end justify-between gap-10 max-md:flex-col max-md:items-start max-md:gap-4">
          <div className="max-w-[640px]">
            <SectionHeader align="left" eyebrow={eyebrow} title={title} noMargin />
          </div>
          <p className="max-w-[540px] shrink-0 leading-relaxed text-muted max-md:max-w-none">
            {intro}
          </p>
        </div>
        <div className="grid gap-[18px] sm:grid-cols-2 lg:grid-cols-4">
          {items.map((it) => (
            <div key={it.title} className="flex flex-col gap-3.5 rounded-2xl border border-line bg-white p-[26px] shadow-soft">
              <span className="grid size-11 place-items-center rounded-xl bg-[#fef3c7] text-[#b45309]" aria-hidden="true">
                <it.icon size={22} />
              </span>
              <h3 className="font-display text-[18px] font-bold text-ink">{it.title}</h3>
              <p className="text-sm leading-relaxed text-muted">{it.text}</p>
            </div>
          ))}
          <div className="flex flex-col justify-between gap-3.5 rounded-2xl bg-brand p-[26px]">
            <h3 className="font-display text-[20px] font-bold leading-snug text-white">
              {cta.title}
            </h3>
            <a href={cta.href} className="inline-flex items-center gap-2 text-sm font-semibold text-white">
              {cta.label} <ArrowRight size={16} />
            </a>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Dashboard views (navy band + cards + chips) ---------- */

export function DashViews({
  eyebrow,
  title,
  intro,
  cards,
  chips,
  closing,
  closingPara,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  cards: { icon: LucideIcon; title: string; points: string[] }[];
  chips: string[];
  closing: string;
  closingPara: string;
}) {
  return (
    <section className="bg-navy py-24 text-white max-md:py-[72px]">
      <div className="mx-container">
        <div className="mb-11 flex items-end justify-between gap-10 max-md:flex-col max-md:items-start max-md:gap-4">
          <div className="max-w-[640px]">
            <p className="font-mono text-[11px] font-medium tracking-[0.14em] text-accent">
              {eyebrow}
            </p>
            <h2 className="mt-4 font-display text-[clamp(28px,3.4vw,40px)] font-bold text-white">
              {title}
            </h2>
          </div>
          <p className="max-w-[520px] shrink-0 text-[17px] leading-relaxed text-herosub max-md:max-w-none">
            {intro}
          </p>
        </div>
        <div className="grid gap-[18px] sm:grid-cols-2 lg:grid-cols-3">
          {cards.map((c) => (
            <div key={c.title} className="flex flex-col gap-4 rounded-2xl border border-white/10 bg-navy2 p-[26px]">
              <div className="flex items-center gap-3">
                <span className="grid size-[38px] shrink-0 place-items-center rounded-[10px] bg-white/[0.07] text-[#fcd34d]" aria-hidden="true">
                  <c.icon size={20} />
                </span>
                <h3 className="font-display text-[18px] font-bold text-white">{c.title}</h3>
              </div>
              <ul className="space-y-2.5">
                {c.points.map((p) => (
                  <li key={p} className="flex items-start gap-2 text-[13.5px] text-footsub">
                    <Check size={14} className="mt-1 shrink-0 text-[#fcd34d]" aria-hidden="true" />
                    {p}
                  </li>
                ))}
              </ul>
            </div>
          ))}
        </div>
        <div className="mt-11 grid items-center gap-8 border-t border-white/10 pt-10 lg:grid-cols-[420px_minmax(0,1fr)] lg:gap-12">
          <div>
            <h3 className="font-display text-[26px] font-bold leading-snug text-white">{closing}</h3>
            <p className="mt-3 text-[15px] leading-relaxed text-faint">{closingPara}</p>
          </div>
          <div className="flex flex-wrap gap-2.5">
            {chips.map((chip) => (
              <span key={chip} className="rounded-full bg-brand-light/15 px-4 py-2 text-[13px] font-medium text-[#dbeafe]">
                {chip}
              </span>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Icon cards with split header ---------- */

export function IconCardsWithIcons({
  eyebrow,
  title,
  intro,
  items,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  items: { icon: LucideIcon; title: string; text: string }[];
}) {
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container">
        <div className="mb-11 flex items-end justify-between gap-10 max-md:flex-col max-md:items-start max-md:gap-4">
          <div className="max-w-[680px]">
            <SectionHeader align="left" eyebrow={eyebrow} title={title} noMargin />
          </div>
          <p className="max-w-[480px] shrink-0 leading-relaxed text-muted max-md:max-w-none">
            {intro}
          </p>
        </div>
        <div className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
          {items.map((it) => (
            <div key={it.title} className="flex flex-col gap-4 rounded-2xl border border-line bg-white p-[30px] shadow-soft max-sm:p-6">
              <span className="grid size-11 place-items-center rounded-xl bg-brand-tint text-brand" aria-hidden="true">
                <it.icon size={22} />
              </span>
              <h3 className="font-display text-[20px] font-bold text-ink">{it.title}</h3>
              <p className="text-[15px] leading-relaxed text-muted">{it.text}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ---------- Duo rich cards on navy ---------- */

export function DuoCards({
  cards,
}: {
  cards: {
    eyebrow: string;
    title: string;
    text: string;
    checks: string[];
    cols?: 1 | 2;
  }[];
}) {
  return (
    <section className="bg-navy py-24 text-white max-md:py-[72px]">
      <div className="mx-container grid gap-7 md:grid-cols-2">
        {cards.map((c) => (
          <div key={c.title} className="flex flex-col gap-5 rounded-2xl bg-white p-10 max-sm:p-7">
            <div>
              <p className="font-mono text-xs font-bold tracking-[0.12em] text-brand-dark">
                {c.eyebrow}
              </p>
              <h2 className="mt-3 font-display text-[32px] font-bold leading-[1.2] text-ink max-sm:text-[26px]">
                {c.title}
              </h2>
              <p className="mt-4 text-[16px] leading-relaxed text-[#475569]">{c.text}</p>
            </div>
            <ul className={c.cols === 2 ? "grid gap-3 sm:grid-cols-2" : "flex flex-col gap-3"}>
              {c.checks.map((chk) => (
                <li key={chk} className="flex items-start gap-2 text-sm font-medium text-body">
                  <Check size={16} className="mt-0.5 shrink-0 text-brand" aria-hidden="true" />
                  {chk}
                </li>
              ))}
            </ul>
          </div>
        ))}
      </div>
    </section>
  );
}

/* ---------- Split copy + workflow steps card ---------- */

export function SplitSteps({
  eyebrow,
  title,
  intro,
  checks,
  cardLabel,
  steps,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  checks: string[];
  cardLabel: string;
  steps: string[];
}) {
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container grid items-center gap-12 lg:grid-cols-[minmax(0,1fr)_520px] lg:gap-[72px]">
        <div>
          <SectionHeader align="left" eyebrow={eyebrow} title={title} intro={intro} noMargin />
          <ul className="mt-8 grid gap-3 sm:grid-cols-2">
            {checks.map((c) => (
              <li key={c} className="flex items-start gap-2 text-sm font-medium text-body">
                <Check size={16} className="mt-0.5 shrink-0 text-brand" aria-hidden="true" />
                {c}
              </li>
            ))}
          </ul>
        </div>
        <div className="rounded-2xl border border-[#dbeafe] bg-[#f8faff] p-8 max-sm:p-6">
          <p className="mb-3 font-mono text-xs tracking-[0.14em] text-muted">{cardLabel}</p>
          <ol>
            {steps.map((s, i) => {
              const last = i === steps.length - 1;
              return (
                <li key={s}>
                  <div className="flex items-center gap-3.5">
                    <span
                      className={`grid size-9 shrink-0 place-items-center rounded-full text-[11px] font-bold text-white ${last ? "bg-navy" : "bg-brand"}`}
                      aria-hidden="true"
                    >
                      {String(i + 1).padStart(2, "0")}
                    </span>
                    <span className="font-semibold text-ink">{s}</span>
                  </div>
                  {!last && (
                    <span className="ml-[17px] block h-[14px] w-[2px] bg-[#bfdbfe]" aria-hidden="true" />
                  )}
                </li>
              );
            })}
          </ol>
        </div>
      </div>
    </section>
  );
}

/* ---------- EPC band (navy, letter cards + lifecycle rail) ---------- */

export function EpcBand({
  eyebrow,
  title,
  intro,
  cards,
  railTitle,
  railLabel,
  steps,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  cards: { mark: string; amber?: boolean; title: string; text: string }[];
  railTitle: string;
  railLabel: string;
  steps: string[];
}) {
  return (
    <section className="bg-navy py-24 text-white max-md:py-[72px]">
      <div className="mx-container">
        <div className="mb-11 flex items-end justify-between gap-10 max-md:flex-col max-md:items-start max-md:gap-4">
          <div className="max-w-[680px]">
            <p className="font-mono text-[11px] font-medium tracking-[0.14em] text-brand-light">
              {eyebrow}
            </p>
            <h2 className="mt-4 font-display text-[clamp(28px,3.4vw,40px)] font-bold text-white">
              {title}
            </h2>
          </div>
          <p className="max-w-[520px] shrink-0 text-[17px] leading-relaxed text-herosub max-md:max-w-none">
            {intro}
          </p>
        </div>
        <div className="grid gap-[18px] sm:grid-cols-2 lg:grid-cols-4">
          {cards.map((c) => (
            <div key={c.title} className="flex flex-col gap-3 rounded-2xl border border-white/10 bg-navy2 p-7">
              <span className={c.amber ? "font-display text-[40px] font-bold leading-none text-[#fcd34d]" : "font-display text-[40px] font-bold leading-none text-brand-light"} aria-hidden="true">
                {c.mark}
              </span>
              <h3 className="font-display text-[19px] font-bold text-white">{c.title}</h3>
              <p className="text-sm leading-relaxed text-[#94a3b8]">{c.text}</p>
            </div>
          ))}
        </div>
        <div className="mt-7 rounded-2xl border border-white/10 p-8 max-sm:p-6">
          <div className="mb-6 flex items-center justify-between gap-4 max-sm:flex-col max-sm:items-start max-sm:gap-1">
            <h3 className="font-display text-[20px] font-bold text-white">{railTitle}</h3>
            <span className="shrink-0 font-mono text-xs text-[#94a3b8]">{railLabel}</span>
          </div>
          <ol className="grid grid-cols-2 gap-x-3 gap-y-6 sm:grid-cols-4 lg:grid-cols-8">
            {steps.map((s, i) => {
              const last = i === steps.length - 1;
              return (
                <li key={s} className="relative flex flex-col gap-2.5">
                  <span className="relative z-[1] grid size-9 shrink-0 place-items-center rounded-full text-[11px] font-bold text-white" style={{ background: last ? "#f59e0b" : "#1d4ed8", color: last ? "#1c1405" : "#fff" }} aria-hidden="true">
                    {String(i + 1).padStart(2, "0")}
                  </span>
                  {i < steps.length - 1 && (
                    <span className="absolute top-[18px] hidden h-[2px] bg-brand-light/35 lg:block" style={{ left: "44px", right: "-4px" }} aria-hidden="true" />
                  )}
                  <span className="block text-sm font-semibold leading-snug text-white">{s}</span>
                </li>
              );
            })}
          </ol>
        </div>
      </div>
    </section>
  );
}

/* ---------- Problem → solution rows ---------- */

export function Challenges({
  eyebrow,
  title,
  intro,
  items,
}: {
  eyebrow: string;
  title: string;
  intro?: string;
  items: { problem: string; problemDesc?: string; solution: string; solutionDesc?: string }[];
}) {
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container">
        <SectionHeader eyebrow={eyebrow} title={title} intro={intro} wide />
        <div className="mx-auto max-w-6xl px-2 sm:px-6">
          <div className="mb-3 hidden grid-cols-[1fr_auto_1.2fr] items-center gap-4 px-6 md:grid" aria-hidden="true">
            <p className="font-mono text-[11px] font-semibold tracking-[0.14em] text-muted">THE CHALLENGE</p>
            <span />
            <p className="font-mono text-[11px] font-semibold tracking-[0.14em] text-brand">HOW MXERP SOLVES IT</p>
          </div>
          <div className="space-y-4">
          {items.map((it) => (
            <div
              key={it.problem}
              className="grid items-center gap-4 rounded-2xl border border-line bg-white p-6 shadow-soft md:grid-cols-[1fr_auto_1.2fr] max-md:gap-2"
            >
              <div className="flex items-start gap-3">
                <span className="grid size-8 shrink-0 place-items-center rounded-full bg-red-50 text-red-500">
                  <X size={16} />
                </span>
                <span>
                  <p className="pt-1 font-display text-[17px] font-semibold text-ink">
                    {it.problem}
                  </p>
                  {it.problemDesc && (
                    <p className="mt-1 text-sm leading-relaxed text-muted">{it.problemDesc}</p>
                  )}
                </span>
              </div>
              <ArrowRight size={18} className="mx-auto shrink-0 text-faint max-md:rotate-90" aria-hidden="true" />
              <div className="rounded-xl bg-brand-tint p-4">
                <p className="flex items-start gap-2 font-semibold text-brand-dark">
                  <Check size={16} className="mt-1 shrink-0" /> {it.solution}
                </p>
                {it.solutionDesc && (
                  <p className="mt-1.5 pl-6 text-sm text-body">{it.solutionDesc}</p>
                )}
              </div>
            </div>
          ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Steps flow (flexible wrap) ---------- */

export function StepsFlow({
  kicker,
  title,
  intro,
  groups,
  tone = "blue",
}: {
  kicker: string;
  title: string;
  intro?: string;
  groups: { label: string; sub: string; steps: string[]; accent: "blue" | "amber" }[];
  tone?: "blue" | "amber";
}) {
  return (
    <section className="bg-canvas py-24 max-md:py-[72px]">
      <div className="mx-container text-center">
        <SectionHeader eyebrow={kicker} title={title} intro={intro} tone={tone} wide />
        <div className="mt-11 space-y-6 text-left">
          {groups.map((g) => (
            <div key={g.label} className="rounded-[14px] border border-line bg-white p-7 shadow-soft md:px-8 max-sm:p-[22px_18px]">
              <p className="mb-5 font-display text-lg font-bold text-ink">
                <span className="mb-1 block font-mono text-[10px] font-medium tracking-[0.14em] text-muted">
                  {g.sub}
                </span>
                {g.label}
              </p>
              <ol className="flex flex-col gap-6 md:flex-row md:gap-1">
                {g.steps.map((s, i) => (
                  <li
                    key={s}
                    className="relative flex gap-4 md:flex-1 md:flex-col md:items-center md:gap-0 md:px-1 md:text-center"
                  >
                    <span
                      className={cn(
                        "relative z-[1] grid size-8 shrink-0 place-items-center rounded-full text-[11px] font-bold",
                        i === g.steps.length - 1
                          ? "bg-navy text-white"
                          : g.accent === "amber"
                            ? "bg-accent text-ink"
                            : "bg-brand text-white"
                      )}
                      aria-hidden="true"
                    >
                      {String(i + 1).padStart(2, "0")}
                    </span>
                    {/* vertical connector (mobile) */}
                    {i < g.steps.length - 1 && (
                      <span
                        className="absolute bottom-[-26px] left-4 top-9 w-[2px] bg-line md:hidden"
                        aria-hidden="true"
                      />
                    )}
                    {/* horizontal connector (desktop): circle edge to next circle */}
                    {i < g.steps.length - 1 && (
                      <span
                        className="absolute top-4 hidden h-[2px] bg-line md:block"
                        style={{ left: "calc(50% + 24px)", right: "calc(-50% + 24px)" }}
                        aria-hidden="true"
                      />
                    )}
                    <span className="block pt-1.5 text-[12.5px] font-semibold leading-snug text-ink md:mt-2.5 md:pt-0 md:text-[11.5px]">
                      {s}
                    </span>
                  </li>
                ))}
              </ol>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ---------- Before / After (reference format) ---------- */

export function BeforeAfter({
  eyebrow,
  title,
  intro,
  before,
  after,
}: {
  eyebrow: string;
  title: string;
  intro?: string;
  before: { stages: { stage: string; oldWay: string }[]; result: string };
  after: { steps: string[]; result: string };
}) {
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container">
        <div className="mx-auto mb-11 flex max-w-[860px] flex-col items-center gap-4 text-center">
          <SectionHeader eyebrow={eyebrow} title={title} intro={intro} noMargin />
        </div>
        <div className="grid gap-7 md:grid-cols-2">
          <div className="rounded-2xl border border-line bg-[#fafaf9] p-9 max-sm:p-6">
            <div className="mb-1.5 flex items-center justify-between gap-3">
              <h3 className="font-display text-[22px] font-bold text-ink">Before MxERP</h3>
              <span className="rounded-md bg-[#ffedd5] px-2.5 py-[5px] font-mono text-[11px] tracking-[0.12em] text-[#9a3412]">
                DISCONNECTED
              </span>
            </div>
            <div>
              {before.stages.map((s, i) => (
                <div
                  key={s.stage}
                  className={`grid grid-cols-[150px_24px_1fr] items-center gap-2.5 py-2.5 text-[15px] max-sm:grid-cols-[120px_24px_1fr] ${
                    i < before.stages.length - 1 ? "border-b border-dashed border-[#d6d3d1]" : ""
                  }`}
                >
                  <span className="font-semibold text-ink">{s.stage}</span>
                  <ArrowRight size={15} className="text-[#a8a29e]" aria-hidden="true" />
                  <span className="text-[#57534e]">{s.oldWay}</span>
                </div>
              ))}
            </div>
            <div className="mt-2.5 rounded-[10px] bg-[#ffedd5] px-[18px] py-4 text-[15px] leading-relaxed text-[#7c2d12]">
              <b>Result:</b> {before.result}
            </div>
          </div>
          <div className="rounded-2xl border border-[#bfdbfe] bg-[#f8faff] p-9 max-sm:p-6">
            <div className="mb-2.5 flex items-center justify-between gap-3">
              <h3 className="font-display text-[22px] font-bold text-ink">With MxERP</h3>
              <span className="rounded-md bg-[#dbeafe] px-2.5 py-[5px] font-mono text-[11px] tracking-[0.12em] text-brand">
                CONNECTED
              </span>
            </div>
            <div className="space-y-2.5">
              {after.steps.map((s, i) => (
                <div
                  key={s}
                  className="flex items-center gap-3.5 rounded-[10px] border border-[#dbeafe] bg-white px-4 py-3 font-semibold text-ink"
                >
                  <span className="grid size-7 shrink-0 place-items-center rounded-full bg-brand text-[11px] font-bold text-white" aria-hidden="true">
                    {String(i + 1).padStart(2, "0")}
                  </span>
                  {s}
                </div>
              ))}
            </div>
            <div className="mt-2.5 rounded-[10px] bg-brand px-[18px] py-4 text-[15px] leading-relaxed text-white">
              <b>Result:</b> {after.result}
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Industry icon grid (split header) ---------- */

export function IndustryGrid({
  eyebrow,
  title,
  intro,
  items,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  items: { icon: LucideIcon; label: string }[];
}) {
  return (
    <section className="bg-canvas py-24 max-md:py-[72px]">
      <div className="mx-container grid items-center gap-12 lg:grid-cols-[440px_minmax(0,1fr)] lg:gap-16">
        <div>
          <SectionHeader align="left" eyebrow={eyebrow} title={title} intro={intro} />
        </div>
        <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
          {items.map((it) => (
            <div key={it.label} className="flex flex-col gap-3.5 rounded-2xl border border-line bg-white p-6 shadow-soft">
              <span className="grid size-11 place-items-center rounded-xl bg-brand-tint text-brand" aria-hidden="true">
                <it.icon size={22} />
              </span>
              <span className="text-[16px] font-semibold leading-snug text-ink">{it.label}</span>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ---------- Benefits grid ---------- */

/* ---------- Trio detail cards (icon + kicker + checks) ---------- */

export function TrioDetail({
  eyebrow,
  title,
  intro,
  items,
}: {
  eyebrow: string;
  title: string;
  intro?: string;
  items: { icon: LucideIcon; kicker: string; title: string; text: string; checks: string[] }[];
}) {
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container">
        <SectionHeader eyebrow={eyebrow} title={title} intro={intro} />
        <div className="grid gap-5 md:grid-cols-3">
          {items.map((it) => (
            <div key={it.title} className="flex flex-col gap-4 rounded-2xl border border-line bg-white p-8 shadow-soft max-sm:p-6">
              <span className="grid size-11 place-items-center rounded-xl bg-brand-tint text-brand" aria-hidden="true">
                <it.icon size={22} />
              </span>
              <p className="font-mono text-[11px] tracking-[0.14em] text-muted">{it.kicker}</p>
              <h3 className="font-display text-[21px] font-bold leading-snug text-ink">{it.title}</h3>
              <p className="text-[15px] leading-relaxed text-muted">{it.text}</p>
              <ul className="space-y-2.5 pt-1">
                {it.checks.map((c) => (
                  <li key={c} className="flex items-start gap-2 text-sm font-medium text-body">
                    <Check size={16} className="mt-0.5 shrink-0 text-brand" aria-hidden="true" />
                    {c}
                  </li>
                ))}
              </ul>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ---------- Numbered step cards (5-col grid, dark last) ---------- */

export function StepCards({
  eyebrow,
  title,
  intro,
  steps,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  steps: { title: string; text: string }[];
}) {
  return (
    <section className="bg-canvas py-24 max-md:py-[72px]">
      <div className="mx-container">
        <div className="mx-auto mb-11 flex max-w-2xl flex-col items-center gap-4 text-center">
          <SectionHeader eyebrow={eyebrow} title={title} intro={intro} noMargin />
        </div>
        <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-5">
          {steps.map((s, i) => {
            const last = i === steps.length - 1;
            return (
              <div
                key={s.title}
                className={last ? "rounded-2xl border border-navy bg-navy p-6" : "rounded-2xl border border-line bg-white p-6 shadow-soft"}
              >
                <span
                  className={last ? "grid size-9 place-items-center rounded-full bg-accent text-[11px] font-bold text-ink" : "grid size-9 place-items-center rounded-full bg-brand text-[12px] font-semibold text-white"}
                  aria-hidden="true"
                >
                  {String(i + 1).padStart(2, "0")}
                </span>
                <h3 className={last ? "mt-4 font-display text-[17px] font-bold text-white" : "mt-4 font-display text-[17px] font-bold text-ink"}>{s.title}</h3>
                <p className={last ? "mt-1.5 text-sm leading-relaxed text-herosub" : "mt-1.5 text-sm leading-relaxed text-muted"}>{s.text}</p>
              </div>
            );
          })}
        </div>
      </div>
    </section>
  );
}

export function Benefits({
  eyebrow,
  title,
  intro,
  items,
  split = false,
  icons,
  tone = "blue",
}: {
  eyebrow?: string;
  title: string;
  intro?: string;
  items: { title: string; text: string }[];
  split?: boolean;
  icons?: LucideIcon[];
  tone?: "blue" | "amber";
}) {
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container">
        {split ? (
          <div className="mb-11 flex items-end justify-between gap-10 max-md:flex-col max-md:items-start max-md:gap-4">
            <div className="max-w-[640px]">
              <SectionHeader align="left" eyebrow={eyebrow} title={title} tone={tone} noMargin />
            </div>
            {intro && (
              <p className="max-w-[480px] shrink-0 leading-relaxed text-muted max-md:max-w-none">
                {intro}
              </p>
            )}
          </div>
        ) : (
          <SectionHeader eyebrow={eyebrow} title={title} intro={intro} tone={tone} />
        )}
        <div className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
          {items.map((it, i) => {
            const Icon = icons?.[i % icons.length];
            return (
              <div key={it.title} className="rounded-2xl border border-line bg-white p-7 shadow-soft">
                {Icon ? (
                  <span className="mb-4 grid size-10 place-items-center rounded-xl bg-[#fef3c7] text-[#b45309]" aria-hidden="true">
                    <Icon size={20} />
                  </span>
                ) : (
                  <span className="mb-4 grid size-10 place-items-center rounded-xl bg-brand-tint font-display text-sm font-bold text-brand" aria-hidden="true">
                    {String(i + 1).padStart(2, "0")}
                  </span>
                )}
                <h3 className="font-display text-lg font-bold text-ink">{it.title}</h3>
                <p className="mt-2 text-sm leading-relaxed text-muted">{it.text}</p>
              </div>
            );
          })}
        </div>
      </div>
    </section>
  );
}

/* ---------- FAQ (native accordion, no JS) ---------- */

export function Faq({ title, items }: { title: string; items: { q: string; a: string }[] }) {
  return (
    <section className="bg-canvas py-24 max-md:py-[72px]">
      <div className="mx-container">
        <div className="mx-auto max-w-3xl">
          <div className="mb-10 text-center">
            <SectionTitle>{title}</SectionTitle>
          </div>
          <div className="space-y-3">
            {items.map((f) => (
              <details key={f.q} className="group rounded-xl border border-line bg-white px-6 py-4">
                <summary className="cursor-pointer list-none font-display text-[16px] font-semibold text-ink [&::-webkit-details-marker]:hidden">
                  <span className="flex items-center justify-between gap-4">
                    {f.q}
                    <span className="grid size-7 shrink-0 place-items-center rounded-full bg-brand-tint text-brand transition-transform group-open:rotate-45" aria-hidden="true">
                      +
                    </span>
                  </span>
                </summary>
                <p className="pt-3 text-sm leading-relaxed text-muted">{f.a}</p>
              </details>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Comparison table (two industry solutions) ---------- */

export function CompareTable({
  eyebrow,
  title,
  mfg,
  con,
}: {
  eyebrow: string;
  title: string;
  mfg: { icon: LucideIcon; title: string; rows: string[]; cta: string; href: string };
  con: { icon: LucideIcon; title: string; rows: string[]; cta: string; href: string };
}) {
  return (
    <section className="bg-canvas py-24 max-md:py-[72px]">
      <div className="mx-container">
        <div className="mx-auto mb-11 flex max-w-2xl flex-col items-center gap-4 text-center">
          <SectionHeader eyebrow={eyebrow} title={title} noMargin />
        </div>
        <div className="mx-auto max-w-[1040px] overflow-hidden rounded-2xl border border-line bg-white shadow-soft">
          <div className="grid md:grid-cols-2">
            {/* Manufacturing column — header, rows and CTA stay together on mobile */}
            <div className="flex flex-col border-b border-line md:border-b-0">
              <div className="flex items-center gap-3 border-b-2 border-accent bg-[#fffbeb] px-8 py-[22px] max-sm:px-5">
                <span className="grid size-9 shrink-0 place-items-center rounded-[10px] bg-[#fef3c7] text-[#b45309]" aria-hidden="true">
                  <mfg.icon size={20} />
                </span>
                <h3 className="font-display text-[19px] font-bold text-ink max-sm:text-[17px]">{mfg.title}</h3>
              </div>
              <div className="text-[16px] text-ink max-sm:text-[15px]">
                {mfg.rows.map((r, i) => (
                  <p key={r} className={i < mfg.rows.length - 1 ? "border-b border-[#eef2f7] px-8 py-4 max-sm:px-5" : "px-8 py-4 max-sm:px-5"}>{r}</p>
                ))}
              </div>
              <div className="mt-auto border-t border-line px-8 py-5 max-sm:px-5">
                <a href={mfg.href} className="inline-flex min-h-[44px] items-center gap-1.5 text-[15px] font-semibold text-accent-dark">
                  {mfg.cta} <ArrowRight size={16} />
                </a>
              </div>
            </div>
            {/* Construction column */}
            <div className="flex flex-col md:border-l md:border-line">
              <div className="flex items-center gap-3 border-b-2 border-brand bg-brand-tint px-8 py-[22px] max-sm:px-5">
                <span className="grid size-9 shrink-0 place-items-center rounded-[10px] bg-[#dbeafe] text-brand" aria-hidden="true">
                  <con.icon size={20} />
                </span>
                <h3 className="font-display text-[19px] font-bold text-ink max-sm:text-[17px]">{con.title}</h3>
              </div>
              <div className="text-[16px] text-ink max-sm:text-[15px]">
                {con.rows.map((r, i) => (
                  <p key={r} className={i < con.rows.length - 1 ? "border-b border-[#eef2f7] px-8 py-4 max-sm:px-5" : "px-8 py-4 max-sm:px-5"}>{r}</p>
                ))}
              </div>
              <div className="mt-auto border-t border-line px-8 py-5 max-sm:px-5">
                <a href={con.href} className="inline-flex min-h-[44px] items-center gap-1.5 text-[15px] font-semibold text-brand">
                  {con.cta} <ArrowRight size={16} />
                </a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Reporting split + monitor panel ---------- */

export function ReportingSplit({
  eyebrow,
  title,
  intro,
  chips,
  panelTitle,
  steps,
}: {
  eyebrow: string;
  title: string;
  intro: string;
  chips: string[];
  panelTitle: string;
  steps: { title: string; sub: string }[];
}) {
  return (
    <section className="py-24 max-md:py-[72px]">
      <div className="mx-container grid items-center gap-12 lg:grid-cols-2 lg:gap-20">
        <div>
          <SectionHeader align="left" eyebrow={eyebrow} title={title} intro={intro} noMargin />
          <div className="mt-6 flex flex-wrap gap-2.5">
            {chips.map((c) => (
              <span key={c} className="inline-flex h-9 items-center whitespace-nowrap rounded-full bg-canvas px-4 text-sm font-medium text-ink">
                {c}
              </span>
            ))}
          </div>
        </div>
        <div className="rounded-2xl border border-[#dbeafe] bg-[#f8faff] p-10 max-sm:p-6">
          <h3 className="font-display text-[28px] font-bold text-ink max-sm:text-2xl">{panelTitle}</h3>
          <div className="mt-6 flex flex-col gap-2.5">
            {steps.map((s, i) => {
              const last = i === steps.length - 1;
              return (
                <div
                  key={s.title}
                  className={last ? "flex items-center gap-4 rounded-xl bg-brand p-4 text-white" : "flex items-center gap-4 rounded-xl border border-line bg-white p-4"}
                >
                  <span
                    className={last ? "grid size-8 shrink-0 place-items-center rounded-lg bg-white/15 font-mono text-xs text-white" : "grid size-8 shrink-0 place-items-center rounded-lg bg-brand-tint font-mono text-xs text-brand"}
                    aria-hidden="true"
                  >
                    {String(i + 1).padStart(2, "0")}
                  </span>
                  <span className={last ? "font-semibold text-white" : "font-semibold text-ink"}>{s.title}</span>
                  <span className={last ? "ml-auto text-right text-[13px] text-[#dbeafe]" : "ml-auto text-right text-[13px] text-muted"}>{s.sub}</span>
                </div>
              );
            })}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Trusted-by logo marquee ---------- */

export function TrustBar({
  label,
  logos,
}: {
  label: string;
  logos: { src: string; name: string }[];
}) {
  const row = (hidden: boolean) => (
    <div className="flex shrink-0 items-center gap-4 pr-4" aria-hidden={hidden || undefined}>
      {logos.map((logo) => (
        <div
          key={logo.src}
          className="grid h-16 w-40 shrink-0 place-items-center overflow-hidden rounded-[10px] border border-line bg-white px-4"
        >
          <Image
            src={logo.src}
            alt={hidden ? "" : `${logo.name} logo`}
            width={160}
            height={64}
            className="h-9 w-auto max-w-full object-contain"
            loading="lazy"
          />
        </div>
      ))}
    </div>
  );
  return (
    <section className="pb-24 max-sm:pb-16" aria-label={label}>
      <div className="mx-container">
        <p className="text-center font-mono text-sm font-bold tracking-[0.1em] text-body">{label}</p>
        <div className="mx-marquee mt-6 overflow-hidden">
          <div className="mx-marquee-track flex w-max">
            {row(false)}
            {row(true)}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Dual industry CTA ---------- */

export function DualIndustry({
  title,
  intro,
  cards,
}: {
  title: string;
  intro?: string;
  cards: { tag: string; title: string; text: string; cta: string; href: string }[];
}) {
  return (
    <section className="bg-navy py-24 text-white max-md:py-[72px]">
      <div className="mx-container">
        <div className="mx-auto mb-12 max-w-2xl text-center">
          <h2 className="mt-2.5 font-display text-[clamp(28px,3.4vw,40px)] font-bold text-white">
            {title}
          </h2>
          {intro && <p className="mt-4 text-footsub">{intro}</p>}
        </div>
        <div className="mx-auto grid max-w-4xl gap-6 md:grid-cols-2">
          {cards.map((c) => (
            <div key={c.title} className="rounded-2xl border border-white/10 bg-navy2 p-8">
              <span className="font-mono text-[10px] font-medium tracking-[0.14em] text-accent">
                {c.tag}
              </span>
              <h3 className="mt-2 font-display text-2xl font-bold text-white">{c.title}</h3>
              <p className="mt-3 text-sm leading-relaxed text-footsub">{c.text}</p>
              <a
                href={c.href}
                className="mt-6 inline-flex min-h-[44px] items-center gap-2 rounded-lg bg-brand px-5 text-sm font-semibold text-white hover:bg-brand-dark"
              >
                {c.cta} <ArrowRight size={16} />
              </a>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}
