/* global React */
// YachtingStack — For Yachts page. Agents-first; cloud/local de-emphasized.
// Full-height snap sections (like home), each anchored for the For Yachts mega-menu.
const { Icon, Eyebrow, Btn, Reveal } = window;

// full-screen snap section
const Snap = ({ children, id, style = {} }) => (
  <section id={id} className="snap-sec" style={{ position: "relative", minHeight: "100vh", padding: "120px 32px",
    display: "flex", flexDirection: "column", justifyContent: "center", ...style }}>
    <div style={{ width: "100%", maxWidth: 1080, margin: "0 auto", position: "relative" }}>{children}</div>
  </section>
);

const Head = ({ children, style = {} }) => (
  <h2 style={{ fontFamily: "var(--font-head)", fontWeight: 400, fontSize: "clamp(28px,3.6vw,44px)", lineHeight: 1.12, color: "var(--ink)", margin: 0, maxWidth: 760, ...style }}>{children}</h2>
);

// compact cloud / local card
function ModeCard({ m }) {
  const tone = m.tone === "violet" ? "var(--violet)" : "var(--cyan-2)";
  const toneBg = m.tone === "violet" ? "rgba(167,139,250,.08)" : "rgba(250,204,21,.07)";
  const toneBd = m.tone === "violet" ? "rgba(167,139,250,.22)" : "rgba(250,204,21,.22)";
  return (
    <div style={{ padding: "26px 26px", borderRadius: 18, background: "var(--surface)", border: "1px solid var(--hairline)", height: "100%" }}>
      <div style={{ display: "flex", alignItems: "center", gap: 13, marginBottom: 14 }}>
        <span style={{ width: 44, height: 44, borderRadius: 12, background: toneBg, border: `1px solid ${toneBd}`,
          display: "flex", alignItems: "center", justifyContent: "center", color: tone }}><Icon name={m.icon} size={21} /></span>
        <div>
          <div style={{ fontFamily: "var(--font-head)", fontSize: 21, color: "var(--ink)", lineHeight: 1 }}>{m.name}</div>
          <div style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, color: tone, marginTop: 4 }}>{m.tagline}</div>
        </div>
      </div>
      <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 14, lineHeight: 1.6, color: "var(--ink-2)", margin: "0 0 16px" }}>{m.desc}</p>
      <div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
        {m.points.map(([ic, t]) => (
          <div key={t} style={{ display: "flex", gap: 10, alignItems: "center" }}>
            <Icon name={ic} size={15} color={tone} />
            <span style={{ fontFamily: "var(--font-ui)", fontSize: 13, color: "var(--ink-2)" }}>{t}</span>
          </div>
        ))}
      </div>
      <div style={{ display: "flex", gap: 9, alignItems: "flex-start", marginTop: 16, padding: "11px 13px", borderRadius: 11,
        background: "rgba(255,255,255,.02)", border: "1px solid var(--hairline)" }}>
        <Icon name="Info" size={13} color="var(--ink-4)" style={{ marginTop: 1, flexShrink: 0 }} />
        <span style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 12, lineHeight: 1.5, color: "var(--ink-3)" }}>{m.note}</span>
      </div>
    </div>
  );
}

// yacht-centric network — yacht ⇄ management (cloud), private connection,
// onboard departments/dashboards/devices/crew, powered by the platform.
function OnboardMap() {
  const [hov, setHov] = React.useState(null);
  const W = 860, Ht = 560, HUB = [430, 286];
  const px = (v, m) => (v / m * 100) + "%";
  const SPEED = 54;
  const segDur = (a, b) => Math.max(1.6, Math.hypot(b[0] - a[0], b[1] - a[1]) / SPEED);
  const primary = [
    { id: "yacht", t: "Yacht", badge: "On board", x: 232, y: 168, tip: "Your vessel — agents, modules and crew working on board, online or off." },
    { id: "mgmt", ic: "Building2", t: "Management", badge: "In the cloud", x: 628, y: 168, tip: "Your management office in the cloud — privately connected to the vessel." }];
  const onboard = [
    { id: "depts", ic: "Boxes", t: "Departments", x: 140, y: 248, tip: "Every onboard department — bridge, engineering, interior, deck — on the platform." },
    { id: "dash", ic: "LayoutDashboard", t: "Custom Dashboards", x: 64, y: 330, tip: "Purpose-built dashboards, fed by the departments." },
    { id: "devices", ic: "Smartphone", t: "Agents on devices", x: 216, y: 342, tip: "Department agents in the crew's hands — on phones and tablets." },
    { id: "crew", ic: "Users", t: "Crew", x: 138, y: 420, tip: "The crew — working through the dashboards and the agents on their devices." }];
  const supports = [
    { id: "interfaces", ic: "AppWindow", t: "Interfaces", x: 318, y: 472, tip: "The apps and surfaces your team works in — web, mobile and extensions." },
    { id: "intel", ic: "BrainCircuit", t: "Intelligence", x: 396, y: 498, tip: "Yachting market intelligence, fed to your agents." },
    { id: "sec", ic: "ShieldCheck", t: "Security", x: 474, y: 512, tip: "One verified identity, least-privilege access and enforced MFA." },
    { id: "models", ic: "Cpu", t: "AI Models", x: 552, y: 514, tip: "Private, yachting-tuned models — never pooled." },
    { id: "sim", ic: "Workflow", t: "Simulation", x: 630, y: 506, tip: "Test scenarios, generate SOPs and benchmark before anything goes live." },
    { id: "data", ic: "Database", t: "Data", x: 706, y: 488, tip: "A shared data ontology — one source of truth." },
    { id: "identity", ic: "Fingerprint", t: "Identity", x: 776, y: 458, tip: "One YachtingStack ID governing who and what can act, everywhere." },
    { id: "priv", ic: "ShieldAlert", t: "Privacy", x: 822, y: 414, tip: "Private by design — your data never leaves for external models." }];
  const nById = {}; [...primary, ...onboard].forEach((n) => { nById[n.id] = n; });
  const obLinks = [["yacht", "depts"], ["depts", "dash"], ["depts", "devices"], ["devices", "crew"], ["dash", "crew"]].map(([a, b]) => [nById[a], nById[b]]);
  const tips = {};
  [...primary, ...onboard, ...supports].forEach((n) => { tips[n.id] = n; });
  tips.hub = { t: "YachtingStack", x: HUB[0], y: HUB[1], tip: "The platform connecting vessel and management and running your agents — powered by shared capabilities." };

  const beam = (k, a, b) => {
    const d = segDur(a, b);
    return (
      <g key={k}>
        <line x1={a[0]} y1={a[1]} x2={b[0]} y2={b[1]} stroke="rgba(253,224,71,.12)" strokeWidth="1.1" />
        <circle r="1.8" fill="#FDE047" fillOpacity="0.55" filter="url(#obsoft)"><animateMotion dur={d.toFixed(2) + "s"} repeatCount="indefinite" path={`M ${a[0]},${a[1]} L ${b[0]},${b[1]}`} /></circle>
        <circle r="1.8" fill="#FDE047" fillOpacity="0.55" filter="url(#obsoft)"><animateMotion dur={d.toFixed(2) + "s"} begin={(-d / 2).toFixed(2) + "s"} repeatCount="indefinite" path={`M ${b[0]},${b[1]} L ${a[0]},${a[1]}`} /></circle>
      </g>
    );
  };
  const arc = `M ${primary[0].x},${primary[0].y} Q ${HUB[0]},86 ${primary[1].x},${primary[1].y}`;

  return (
    <Snap>
      <Reveal style={{ textAlign: "center", maxWidth: 760, margin: "0 auto" }}>
        <Eyebrow style={{ textAlign: "center" }}>Vessel to management</Eyebrow>
        <Head style={{ marginTop: 14, marginLeft: "auto", marginRight: "auto", textAlign: "center" }}>Your yacht and your office, <span style={{ color: "var(--cyan)" }}>privately connected</span>.</Head>
        <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 16, lineHeight: 1.7, color: "var(--ink-3)", margin: "16px auto 0", maxWidth: 600 }}>
          On board, every department, dashboard, device and crew member works through your agents. A single private connection links the vessel to management in the cloud — powered by the same platform of identity, models, simulation and data. Hover any node to see what it does.
        </p>
      </Reveal>

      <Reveal delay={120} style={{ marginTop: 16 }}>
        <div style={{ position: "relative", width: "100%", maxWidth: 780, aspectRatio: `${W} / ${Ht}`, margin: "0 auto" }}>
          <svg viewBox={`0 0 ${W} ${Ht}`} preserveAspectRatio="none" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", overflow: "visible" }}>
            <defs>
              <filter id="obsoft" x="-80%" y="-80%" width="260%" height="260%"><feGaussianBlur stdDeviation="1.1" result="b" /><feMerge><feMergeNode in="b" /><feMergeNode in="SourceGraphic" /></feMerge></filter>
              <radialGradient id="obhub" cx="50%" cy="50%" r="50%"><stop offset="0%" stopColor="rgba(250,204,21,.16)" /><stop offset="70%" stopColor="rgba(250,204,21,.04)" /><stop offset="100%" stopColor="rgba(250,204,21,0)" /></radialGradient>
            </defs>
            <circle cx={HUB[0]} cy={HUB[1]} r="150" fill="url(#obhub)" />
            <path d={arc} fill="none" stroke="rgba(253,224,71,.3)" strokeWidth="1.2" strokeDasharray="5 6" />
            <circle r="2.2" fill="#FEF3A0" filter="url(#obsoft)"><animateMotion dur="3.4s" repeatCount="indefinite" path={arc} /></circle>
            {primary.map((a, i) => beam("p" + i, [a.x, a.y], HUB))}
            {obLinks.map((l, i) => beam("o" + i, [l[0].x, l[0].y], [l[1].x, l[1].y]))}
            {supports.map((u, i) => beam("u" + i, [u.x, u.y], HUB))}
          </svg>

          {/* private-connection label on the arc */}
          <div style={{ position: "absolute", left: px(HUB[0], W), top: px(86, Ht), transform: "translate(-50%,-50%)", zIndex: 3,
            fontFamily: "var(--font-mono)", fontSize: 9.5, fontWeight: 700, letterSpacing: ".12em", textTransform: "uppercase", color: "var(--cyan-2)", whiteSpace: "nowrap",
            display: "inline-flex", alignItems: "center", gap: 6 }}><Icon name="Lock" size={11} color="var(--cyan-2)" />Private connection</div>

          {/* hub */}
          <div onMouseEnter={() => setHov("hub")} onMouseLeave={() => setHov(null)} style={{ position: "absolute", left: px(HUB[0], W), top: px(HUB[1], Ht), transform: "translate(-50%,-50%)", zIndex: 4, textAlign: "center", cursor: "default" }}>
            <div style={{ position: "relative", width: 96, height: 96, borderRadius: "50%", display: "flex", alignItems: "center", justifyContent: "center", background: "rgba(7,22,37,.92)", border: "1px solid rgba(250,204,21,.4)", boxShadow: "0 0 44px rgba(250,204,21,.32)" }}>
              <div className="ym-orbit" style={{ position: "absolute", inset: -7, borderRadius: "50%", background: "conic-gradient(from 0deg, transparent 0deg, rgba(253,224,71,.55) 70deg, transparent 150deg)", WebkitMaskImage: "radial-gradient(circle, transparent 58%, #000 60%)", maskImage: "radial-gradient(circle, transparent 58%, #000 60%)" }} />
              <div className="radar-core-ring" style={{ position: "absolute", left: "50%", top: "50%", marginLeft: -48, marginTop: -48, width: 96, height: 96, borderRadius: "50%", border: "1px solid rgba(253,224,71,.5)" }} />
              <img src="assets/logo/YachtingStack_Logo.svg" alt="YachtingStack" style={{ width: 48, height: 48, objectFit: "contain" }} />
            </div>
          </div>

          {/* primary nodes: yacht + management */}
          {primary.map((a) => (
            <div key={a.id} onMouseEnter={() => setHov(a.id)} onMouseLeave={() => setHov(null)} style={{ position: "absolute", left: px(a.x, W), top: px(a.y, Ht), transform: "translate(-50%,-50%)", zIndex: 4, width: 96, cursor: "default" }}>
              <div style={{ position: "relative", width: 96, height: 96, borderRadius: "50%", display: "flex", alignItems: "center", justifyContent: "center", background: "rgba(7,22,37,.92)", border: "1px solid rgba(250,204,21,.4)", boxShadow: "0 0 32px rgba(250,204,21,.26)" }}>
                <div className="radar-core-ring" style={{ position: "absolute", left: "50%", top: "50%", width: 96, height: 96, marginLeft: -48, marginTop: -48, borderRadius: "50%", border: "1px solid rgba(253,224,71,.5)" }} />
                {a.id === "yacht"
                  ? <img src="assets/images/yacht-cyan.png" alt="Yacht" style={{ position: "relative", width: 66, height: "auto", display: "block" }} />
                  : <Icon name={a.ic} size={34} color="var(--cyan-2)" />}
              </div>
              <div style={{ position: "absolute", top: "calc(100% + 10px)", left: "50%", transform: "translateX(-50%)", width: 150, textAlign: "center" }}>
                <div style={{ fontFamily: "var(--font-ui)", fontSize: 14, fontWeight: 600, color: "var(--ink)", lineHeight: 1.15 }}>{a.t}</div>
                <span style={{ display: "inline-flex", alignItems: "center", gap: 4, marginTop: 6, padding: "2px 8px", borderRadius: 999, background: "rgba(250,204,21,.12)", border: "1px solid rgba(250,204,21,.3)", fontFamily: "var(--font-mono)", fontSize: 8.5, fontWeight: 700, letterSpacing: ".07em", textTransform: "uppercase", color: "var(--cyan-2)" }}>{a.badge}</span>
              </div>
            </div>
          ))}

          {/* onboard cluster */}
          {onboard.map((o) => (
            <div key={o.id} onMouseEnter={() => setHov(o.id)} onMouseLeave={() => setHov(null)} style={{ position: "absolute", left: px(o.x, W), top: px(o.y, Ht), transform: "translate(-50%,-50%)", zIndex: 4, textAlign: "center", width: 104, cursor: "default" }}>
              <div style={{ width: 40, height: 40, margin: "0 auto 6px", borderRadius: 11, background: "rgba(10,27,44,.92)", border: "1px solid var(--hairline-2)", color: "var(--cyan-2)", display: "flex", alignItems: "center", justifyContent: "center" }}><Icon name={o.ic} size={17} /></div>
              <div style={{ fontFamily: "var(--font-mono)", fontSize: 9.5, color: "var(--ink-3)", lineHeight: 1.3 }}>{o.t}</div>
            </div>
          ))}

          {/* powering capabilities */}
          {supports.map((u) => (
            <div key={u.id} onMouseEnter={() => setHov(u.id)} onMouseLeave={() => setHov(null)} style={{ position: "absolute", left: px(u.x, W), top: px(u.y, Ht), transform: "translate(-50%,-50%)", zIndex: 4, textAlign: "center", width: 90, cursor: "default" }}>
              <div className="aura" style={{ width: 42, height: 42, margin: "0 auto", borderRadius: "50%", background: "rgba(10,27,44,.92)", border: "1px solid rgba(250,204,21,.28)", color: "var(--cyan-2)", display: "flex", alignItems: "center", justifyContent: "center", boxShadow: "0 0 16px rgba(250,204,21,.18)" }}><Icon name={u.ic} size={17} /></div>
              <div style={{ fontFamily: "var(--font-mono)", fontSize: 9.5, fontWeight: 600, letterSpacing: ".04em", textTransform: "uppercase", color: "var(--ink-3)", marginTop: 6 }}>{u.t}</div>
            </div>
          ))}

          {hov && tips[hov] && (
            <div style={{ position: "absolute", left: px(tips[hov].x, W), top: px(tips[hov].y, Ht), zIndex: 9, width: 210, pointerEvents: "none",
              transform: `translate(-50%, ${tips[hov].y < Ht * 0.5 ? "22px" : "calc(-100% - 22px)"})`,
              padding: "11px 13px", borderRadius: 12, background: "rgba(6,16,27,.98)", border: "1px solid var(--hairline-2)", boxShadow: "0 20px 50px -20px rgba(0,0,0,.85)" }}>
              <div style={{ fontFamily: "var(--font-mono)", fontSize: 10, fontWeight: 700, letterSpacing: ".1em", textTransform: "uppercase", color: "var(--cyan-2)", marginBottom: 5 }}>{tips[hov].t}</div>
              <div style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 12.5, lineHeight: 1.5, color: "var(--ink-2)" }}>{tips[hov].tip}</div>
            </div>
          )}
        </div>
      </Reveal>
    </Snap>
  );
}

function OnBoard({ go }) {
  const d = window.ONBOARD;
  const feeds = [
    ["Compass", "Navigation & AIS"], ["Gauge", "Engines & propulsion"], ["Droplet", "Tanks & bilge"],
    ["BellRing", "Alarms & safety"], ["Zap", "Power & electrical"], ["Thermometer", "HVAC & climate"]];
  return (
    <div style={{ background: "var(--bg)" }}>
      {/* hero — yacht line-art background */}
      <section className="snap-sec" style={{ position: "relative", overflow: "hidden", minHeight: "100vh", padding: "150px 32px 90px",
        display: "flex", flexDirection: "column", justifyContent: "center", background: "var(--bg-deep)" }}>
        <div aria-hidden="true" style={{ position: "absolute", inset: 0, backgroundImage: "url(assets/images/yacht-cyan.png)", backgroundSize: "min(900px, 92%)",
          backgroundRepeat: "no-repeat", backgroundPosition: "right -40px bottom -10px", opacity: 0.16, pointerEvents: "none" }} />
        <div style={{ position: "absolute", inset: 0, background: "radial-gradient(ellipse 70% 80% at 80% 0%, rgba(250,204,21,.10), transparent 60%)" }} />
        <div aria-hidden="true" style={{ position: "absolute", left: 0, right: 0, bottom: 0, height: "40%", pointerEvents: "none", background: "linear-gradient(to bottom, transparent, var(--bg))" }} />
        <div style={{ width: "100%", maxWidth: 1080, margin: "0 auto", position: "relative" }}>
          <button onClick={() => go("home")} style={{ all: "unset", cursor: "pointer", display: "inline-flex", alignItems: "center", gap: 7,
            fontFamily: "var(--font-ui)", fontSize: 13, color: "var(--ink-3)", marginBottom: 26 }}
            onMouseEnter={(e) => e.currentTarget.style.color = "var(--ink)"} onMouseLeave={(e) => e.currentTarget.style.color = "var(--ink-3)"}>
            <Icon name="ArrowLeft" size={15} /> Home
          </button>
          <div className="rise" style={{ animationDelay: ".05s" }}><Eyebrow>{d.eyebrow}</Eyebrow></div>
          <h1 className="rise" style={{ animationDelay: ".12s", fontFamily: "var(--font-head)", fontWeight: 400,
            fontSize: "clamp(36px,5vw,60px)", lineHeight: 1.06, letterSpacing: "-0.01em", color: "#fff", margin: "16px 0 0", maxWidth: 760 }}>
            {d.title}
          </h1>
          <p className="rise" style={{ animationDelay: ".22s", fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: "clamp(16px,1.7vw,19px)",
            lineHeight: 1.65, color: "var(--ink-2)", maxWidth: 620, margin: "22px 0 0" }}>{d.intro}</p>
          <div className="rise" style={{ animationDelay: ".32s", display: "flex", gap: 40, marginTop: 44, flexWrap: "wrap" }}>
            {d.stats.map(([n, l]) => (
              <div key={l}>
                <div style={{ fontFamily: "var(--font-head)", fontWeight: 700, fontSize: 38, color: "var(--cyan-2)", lineHeight: 1 }}>{n}</div>
                <div style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, color: "var(--ink-3)", marginTop: 7, letterSpacing: ".02em" }}>{l}</div>
              </div>
            ))}
          </div>
        </div>
      </section>

      {/* yacht ⇄ management network */}
      <OnboardMap />

      {/* agents + pillars */}
      <Snap id="agents">
        <Reveal>
          <Eyebrow>Yachting Agents</Eyebrow>
          <Head style={{ marginTop: 14 }}>One crew of agents, one structured-data backbone.</Head>
          <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 17, lineHeight: 1.7, color: "var(--ink-2)", margin: "20px 0 0", maxWidth: 720 }}>{d.agentsBody}</p>
        </Reveal>
        <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(210px, 1fr))", gap: 16, marginTop: 44 }}>
          {d.pillars.map(([ic, t, s], i) => (
            <Reveal key={t} delay={i * 70}>
              <div style={{ height: "100%", padding: "22px 20px", borderRadius: 18, background: "var(--surface)", border: "1px solid var(--hairline)" }}>
                <span style={{ width: 40, height: 40, borderRadius: 11, background: "rgba(250,204,21,.07)", border: "1px solid rgba(250,204,21,.18)",
                  display: "flex", alignItems: "center", justifyContent: "center", color: "var(--cyan-2)", marginBottom: 14 }}><Icon name={ic} size={19} /></span>
                <div style={{ fontFamily: "var(--font-ui)", fontSize: 15.5, fontWeight: 600, color: "var(--ink)" }}>{t}</div>
                <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 13, lineHeight: 1.55, color: "var(--ink-3)", margin: "8px 0 0" }}>{s}</p>
              </div>
            </Reveal>
          ))}
        </div>
      </Snap>

      {/* IoT */}
      <Snap id="iot">
        <Reveal style={{ maxWidth: 680 }}>
          <Eyebrow>IoT</Eyebrow>
          <Head style={{ marginTop: 14 }}>Connect to your vessel's data.</Head>
          <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 16.5, lineHeight: 1.7, color: "var(--ink-2)", margin: "20px 0 0" }}>
            Onboard sensors and systems stream straight to your agents — navigation, engines, tanks, power and alarms — so the AI works from live vessel data, not guesswork.
          </p>
        </Reveal>
        <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(230px, 1fr))", gap: 14, marginTop: 40 }}>
          {feeds.map(([ic, t], i) => (
            <Reveal key={t} delay={i * 60}>
              <div style={{ display: "flex", alignItems: "center", gap: 13, padding: "18px 20px", borderRadius: 14, background: "var(--surface)", border: "1px solid var(--hairline)" }}>
                <span style={{ width: 40, height: 40, borderRadius: 11, background: "rgba(250,204,21,.07)", border: "1px solid rgba(250,204,21,.18)",
                  display: "flex", alignItems: "center", justifyContent: "center", color: "var(--cyan-2)", flexShrink: 0 }}><Icon name={ic} size={18} /></span>
                <span style={{ fontFamily: "var(--font-ui)", fontSize: 14.5, fontWeight: 500, color: "var(--ink)" }}>{t}</span>
              </div>
            </Reveal>
          ))}
        </div>
      </Snap>

      {/* modules */}
      <Snap id="modules">
        <Reveal>
          <Eyebrow>Onboard modules</Eyebrow>
          <Head style={{ marginTop: 14 }}>A module for every department.</Head>
          <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 16, lineHeight: 1.65, color: "var(--ink-3)", margin: "16px 0 0", maxWidth: 640 }}>
            Each department runs on a dedicated module, wired to its specialist agent. Custom modules are built whenever your operation needs one.
          </p>
        </Reveal>
        <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(190px, 1fr))", gap: 12, marginTop: 36 }}>
          {d.modules.map(([ic, t], i) => (
            <Reveal key={t} delay={i * 35}>
              <div style={{ display: "flex", alignItems: "center", gap: 12, padding: "16px 18px", borderRadius: 14, background: "var(--surface)", border: "1px solid var(--hairline)" }}>
                <Icon name={ic} size={18} color="var(--cyan-2)" />
                <span style={{ fontFamily: "var(--font-ui)", fontSize: 14, fontWeight: 500, color: "var(--ink)" }}>{t}</span>
              </div>
            </Reveal>
          ))}
          <Reveal delay={d.modules.length * 35}>
            <div style={{ display: "flex", alignItems: "center", gap: 12, padding: "16px 18px", borderRadius: 14, background: "rgba(250,204,21,.05)", border: "1px dashed rgba(250,204,21,.3)" }}>
              <Icon name="Plus" size={18} color="var(--cyan-2)" />
              <span style={{ fontFamily: "var(--font-ui)", fontSize: 14, fontWeight: 500, color: "var(--cyan-2)" }}>Custom module</span>
            </div>
          </Reveal>
        </div>
      </Snap>

      {/* every deployment is custom — the spectrum */}
      <Snap>
        <Reveal style={{ maxWidth: 640 }}>
          <Eyebrow>Every deployment is a custom project</Eyebrow>
          <Head style={{ marginTop: 14 }}>Scaled to your vessel — new build or refit.</Head>
          <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 16, lineHeight: 1.65, color: "var(--ink-3)", margin: "16px 0 0" }}>
            From the lightest cloud setup to a full local installation, we scope and install around your vessel — whether it's a new build or a refit.
          </p>
        </Reveal>
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16, marginTop: 36 }}>
          {d.tiers.map((t, i) => (
            <Reveal key={t.tag} delay={i * 100}>
              <div style={{ position: "relative", height: "100%", padding: "26px 26px", borderRadius: 18, overflow: "hidden",
                background: i === 0 ? "var(--surface)" : "linear-gradient(150deg, rgba(167,139,250,.08), rgba(250,204,21,.04))",
                border: i === 0 ? "1px solid var(--hairline)" : "1px solid rgba(167,139,250,.25)" }}>
                <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start" }}>
                  <span style={{ width: 44, height: 44, borderRadius: 12, background: "rgba(250,204,21,.07)", border: "1px solid rgba(250,204,21,.2)",
                    display: "flex", alignItems: "center", justifyContent: "center", color: "var(--cyan-2)" }}><Icon name={t.icon} size={21} /></span>
                  <span style={{ fontFamily: "var(--font-mono)", fontSize: 10, fontWeight: 700, letterSpacing: ".12em", textTransform: "uppercase",
                    color: "var(--ink-4)", padding: "5px 10px", borderRadius: 999, border: "1px solid var(--hairline-2)" }}>{t.tag}</span>
                </div>
                <div style={{ display: "flex", gap: 16, marginTop: 18 }}>
                  <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, color: "var(--cyan-2)" }}>{t.vessel}</span>
                  <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, color: "var(--ink-3)" }}>{t.crew}</span>
                </div>
                <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 14.5, lineHeight: 1.65, color: "var(--ink-2)", margin: "12px 0 0" }}>{t.body}</p>
              </div>
            </Reveal>
          ))}
        </div>
      </Snap>

      {/* how it runs — cloud / local, de-emphasized */}
      <Snap id="runs">
        <Reveal>
          <Eyebrow>How it runs</Eyebrow>
          <Head style={{ marginTop: 14 }}>Cloud, local, or both.</Head>
          <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 15.5, lineHeight: 1.65, color: "var(--ink-3)", margin: "16px 0 0", maxWidth: 600 }}>
            The same agents run either way. Most fleets mix both — cloud where there's connectivity, local for sensitive or offshore work.
          </p>
        </Reveal>
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16, marginTop: 36 }}>
          {d.modes.map((m) => <Reveal key={m.id}><ModeCard m={m} /></Reveal>)}
        </div>
      </Snap>

      {/* CTA */}
      <section className="snap-sec" style={{ position: "relative", overflow: "hidden", minHeight: "100vh", padding: "120px 32px", textAlign: "center",
        display: "flex", flexDirection: "column", justifyContent: "center" }}>
        <div style={{ position: "absolute", inset: 0, background: "radial-gradient(ellipse 60% 70% at 50% 50%, rgba(250,204,21,.08), transparent 70%)" }} />
        <Reveal style={{ position: "relative", maxWidth: 600, margin: "0 auto" }}>
          <h2 style={{ fontFamily: "var(--font-head)", fontWeight: 400, fontSize: "clamp(28px,3.6vw,42px)", color: "var(--ink)", margin: 0 }}>
            Put a crew of agents aboard.
          </h2>
          <p style={{ fontFamily: "var(--font-ui)", fontWeight: 300, fontSize: 16, lineHeight: 1.7, color: "var(--ink-3)", margin: "18px auto 32px", maxWidth: 460 }}>
            Tell us about your vessel and we'll scope the deployment — agents, modules and the right mix of cloud and local.
          </p>
          <Btn size="lg" onClick={() => go("onboarding")} iconRight="ArrowRight">Begin Onboarding</Btn>
        </Reveal>
      </section>
    </div>
  );
}

Object.assign(window, { OnBoard });
