// Inline SVG icons (lucide-style stroke icons, drawn fresh to avoid heavy deps)
const Icon = ({ children, size = 20, stroke = 1.6, className = "" }) => (
  <svg
    width={size}
    height={size}
    viewBox="0 0 24 24"
    fill="none"
    stroke="currentColor"
    strokeWidth={stroke}
    strokeLinecap="round"
    strokeLinejoin="round"
    className={className}
    aria-hidden="true"
  >
    {children}
  </svg>
);

const ArrowRight = (p) => <Icon {...p}><path d="M5 12h14"/><path d="M13 5l7 7-7 7"/></Icon>;
const ArrowUpRight = (p) => <Icon {...p}><path d="M7 17L17 7"/><path d="M7 7h10v10"/></Icon>;
const ChevronDown = (p) => <Icon {...p}><path d="M6 9l6 6 6-6"/></Icon>;
const Search = (p) => <Icon {...p}><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></Icon>;
const Lock = (p) => <Icon {...p}><rect x="4" y="11" width="16" height="9" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></Icon>;
const Database = (p) => <Icon {...p}><ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"/><path d="M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"/></Icon>;
const Sparkles = (p) => <Icon {...p}><path d="M12 3v4"/><path d="M12 17v4"/><path d="M3 12h4"/><path d="M17 12h4"/><path d="M5.6 5.6l2.8 2.8"/><path d="M15.6 15.6l2.8 2.8"/><path d="M18.4 5.6l-2.8 2.8"/><path d="M8.4 15.6l-2.8 2.8"/></Icon>;
const Send = (p) => <Icon {...p}><path d="M22 2L11 13"/><path d="M22 2l-7 20-4-9-9-4 20-7z"/></Icon>;
const Check = (p) => <Icon {...p}><path d="M5 12l4 4 10-10"/></Icon>;
const Plus = (p) => <Icon {...p}><path d="M12 5v14"/><path d="M5 12h14"/></Icon>;
const MapPin = (p) => <Icon {...p}><path d="M12 22s7-7 7-12a7 7 0 1 0-14 0c0 5 7 12 7 12z"/><circle cx="12" cy="10" r="2.5"/></Icon>;
const Building = (p) => <Icon {...p}><rect x="4" y="3" width="16" height="18" rx="1.5"/><path d="M9 8h2"/><path d="M9 12h2"/><path d="M13 8h2"/><path d="M13 12h2"/><path d="M9 16h6"/></Icon>;
const Truck = (p) => <Icon {...p}><path d="M3 7h11v10H3z"/><path d="M14 10h4l3 3v4h-7"/><circle cx="7" cy="18" r="2"/><circle cx="17" cy="18" r="2"/></Icon>;
const Stethoscope = (p) => <Icon {...p}><path d="M6 3v6a4 4 0 0 0 8 0V3"/><path d="M10 15v3a4 4 0 0 0 8 0v-2"/><circle cx="18" cy="11" r="2"/></Icon>;
const Wrench = (p) => <Icon {...p}><path d="M14 7a4 4 0 1 1 5 5l-9 9-3-3 9-9z"/></Icon>;
const Coffee = (p) => <Icon {...p}><path d="M4 9h12v6a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4V9z"/><path d="M16 11h2a2 2 0 1 1 0 4h-2"/><path d="M7 4v2"/><path d="M11 4v2"/></Icon>;
const CreditCard = (p) => <Icon {...p}><rect x="3" y="6" width="18" height="13" rx="2"/><path d="M3 10h18"/></Icon>;
const Shield = (p) => <Icon {...p}><path d="M12 3l8 3v6c0 5-3.5 8.5-8 9-4.5-.5-8-4-8-9V6l8-3z"/></Icon>;
const Webhook = (p) => <Icon {...p}><circle cx="6" cy="18" r="3"/><circle cx="18" cy="18" r="3"/><circle cx="12" cy="6" r="3"/><path d="M9 9l-3 6"/><path d="M15 9l3 6"/><path d="M9 18h6"/></Icon>;
const Calendar = (p) => <Icon {...p}><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18"/><path d="M8 3v4"/><path d="M16 3v4"/></Icon>;
const Filter = (p) => <Icon {...p}><path d="M3 5h18l-7 9v5l-4 2v-7L3 5z"/></Icon>;
const Menu = (p) => <Icon {...p}><path d="M4 7h16"/><path d="M4 12h16"/><path d="M4 17h16"/></Icon>;
const X = (p) => <Icon {...p}><path d="M6 6l12 12"/><path d="M18 6L6 18"/></Icon>;
const Dot = ({ className = "" }) => <span className={"inline-block w-1.5 h-1.5 rounded-full " + className} />;
const Cpu = (p) => <Icon {...p}><rect x="5" y="5" width="14" height="14" rx="2"/><rect x="9" y="9" width="6" height="6"/><path d="M9 2v3"/><path d="M15 2v3"/><path d="M9 19v3"/><path d="M15 19v3"/><path d="M2 9h3"/><path d="M2 15h3"/><path d="M19 9h3"/><path d="M19 15h3"/></Icon>;
const Briefcase = (p) => <Icon {...p}><rect x="3" y="7" width="18" height="13" rx="2"/><path d="M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/></Icon>;
const Banknote = (p) => <Icon {...p}><rect x="3" y="6" width="18" height="12" rx="2"/><circle cx="12" cy="12" r="2.5"/><path d="M6 9v.01"/><path d="M18 15v.01"/></Icon>;
const HardHat = (p) => <Icon {...p}><path d="M3 18h18v-2a8 8 0 0 0-16 0v2z"/><path d="M9 16V8a3 3 0 0 1 6 0v8"/></Icon>;

window.Icons = {
  ArrowRight, ArrowUpRight, ChevronDown, Search, Lock, Database, Sparkles, Send,
  Check, Plus, MapPin, Building, Truck, Stethoscope, Wrench, Coffee, CreditCard,
  Shield, Webhook, Calendar, Filter, Menu, X, Dot, Cpu, Briefcase, Banknote, HardHat,
};

// ─── Reveal-on-scroll wrapper ──────────────────────────────────────────────
function Reveal({ children, delay = 0, as: Tag = "div", className = "", ...rest }) {
  const ref = React.useRef(null);
  const [shown, setShown] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (typeof IntersectionObserver === "undefined") { setShown(true); return; }
    const io = new IntersectionObserver((entries) => {
      entries.forEach((e) => {
        if (e.isIntersecting) { setShown(true); io.unobserve(e.target); }
      });
    }, { rootMargin: "0px 0px -8% 0px", threshold: 0.08 });
    io.observe(el);
    return () => io.disconnect();
  }, []);
  return (
    <Tag
      ref={ref}
      data-delay={delay}
      className={`reveal ${shown ? "in" : ""} ${className}`}
      {...rest}
    >
      {children}
    </Tag>
  );
}
window.Reveal = Reveal;

// ─── Custom vertical-themed icons for "Who it's for" ───────────────────────
// Designed to feel hand-crafted, not lucide-stock. Each is a small composition
// — an outlined glyph with one accent dot/shape to give it personality.
function IconRestaurant({ size = 28, accent = "#F97316" }) {
  return (
    <svg width={size} height={size} viewBox="0 0 32 32" fill="none">
      <rect x="4" y="6" width="24" height="20" rx="3" stroke="currentColor" strokeWidth="1.5"/>
      <path d="M4 11h24" stroke="currentColor" strokeWidth="1.5"/>
      <circle cx="7" cy="8.5" r="0.7" fill="currentColor"/>
      <circle cx="9.5" cy="8.5" r="0.7" fill="currentColor"/>
      <path d="M11 17h6M11 20h10M11 23h7" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/>
      <circle cx="22.5" cy="17.5" r="2.2" fill={accent}/>
    </svg>
  );
}

function IconHomeServices({ size = 28, accent = "#F97316" }) {
  return (
    <svg width={size} height={size} viewBox="0 0 32 32" fill="none">
      <path d="M5 15 L16 6 L27 15" stroke="currentColor" strokeWidth="1.5" strokeLinejoin="round"/>
      <path d="M8 14v12h16V14" stroke="currentColor" strokeWidth="1.5" strokeLinejoin="round"/>
      <path d="M14 26v-6h4v6" stroke="currentColor" strokeWidth="1.5" strokeLinejoin="round"/>
      {/* wrench accent */}
      <path d="M19.5 10.5l3-3a2.2 2.2 0 1 1 2 2l-3 3" stroke={accent} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
      <circle cx="21.5" cy="11.5" r="0.9" fill={accent}/>
    </svg>
  );
}

function IconInsurance({ size = 28, accent = "#F97316" }) {
  return (
    <svg width={size} height={size} viewBox="0 0 32 32" fill="none">
      <path d="M16 4 L26 8 V15 C26 21 21.5 25.5 16 27.5 C10.5 25.5 6 21 6 15 V8 L16 4 Z"
            stroke="currentColor" strokeWidth="1.5" strokeLinejoin="round"/>
      <path d="M11.5 16 L15 19.5 L21 13" stroke={accent} strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/>
    </svg>
  );
}

function IconFintech({ size = 28, accent = "#F97316" }) {
  return (
    <svg width={size} height={size} viewBox="0 0 32 32" fill="none">
      <rect x="4" y="9" width="24" height="15" rx="2.5" stroke="currentColor" strokeWidth="1.5"/>
      <path d="M4 14h24" stroke="currentColor" strokeWidth="1.5"/>
      <rect x="7" y="17.5" width="6" height="2.5" rx="1" fill="currentColor" opacity=".25"/>
      <circle cx="22" cy="19" r="2.2" stroke={accent} strokeWidth="1.5"/>
      <circle cx="24.4" cy="19" r="2.2" stroke={accent} strokeWidth="1.5"/>
    </svg>
  );
}

window.VerticalIcons = { IconRestaurant, IconHomeServices, IconInsurance, IconFintech };
