/* global React, Arrow, SectionHead, Stat, Check, Plus */

// ============================================================
// Top Solutions, Our Expertise — 6 service tiles
// ============================================================
const Solutions = () => {
  const items = [
    { name: "Cloud", desc: "Strategy, migration & FinOps across Azure, AWS, GCP." },
    { name: "Server", desc: "Sizing, procurement & lifecycle for compute estates." },
    { name: "Datacenter", desc: "Colocation, on-prem modernization, DR planning." },
    { name: "Network", desc: "LAN, WAN, SD-WAN, segmentation & observability." },
    { name: "IoT & Automation", desc: "Edge devices, telemetry pipelines, control logic." },
    { name: "Security", desc: "Posture audits, DPDP readiness, SOC 2 & ISO 27001 prep." },
  ];
  return (
    <section id="solutions" style={{ position: "relative", overflow: "hidden", background: "#0C0908", color: "white" }}>
      {/* Deep warm gradient + orange glow */}
      <div aria-hidden style={{
        position: "absolute", inset: 0,
        background: "radial-gradient(ellipse 80% 60% at 80% 10%, rgba(239,106,31,0.35), transparent 55%), radial-gradient(ellipse 70% 50% at 10% 100%, rgba(239,106,31,0.18), transparent 50%), linear-gradient(180deg, #0F0A07 0%, #14100C 100%)",
      }} />
      {/* Fine grid */}
      <div aria-hidden style={{
        position: "absolute", inset: 0,
        backgroundImage:
          "linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px)",
        backgroundSize: "64px 64px",
        maskImage: "radial-gradient(ellipse 90% 80% at 50% 50%, #000 25%, transparent 80%)",
        WebkitMaskImage: "radial-gradient(ellipse 90% 80% at 50% 50%, #000 25%, transparent 80%)",
      }} />
      {/* Diagonal accent line */}
      <div aria-hidden style={{
        position: "absolute", top: "30%", right: "-10%", width: "60%", height: 1,
        background: "linear-gradient(90deg, transparent, var(--bel-orange), transparent)",
        transform: "rotate(-12deg)", opacity: 0.5,
      }} />

      <div className="wrap" style={{ position: "relative", display: "flex", flexDirection: "column", gap: 36 }}>
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 36, alignItems: "end" }}>
          <div className="reveal" style={{ display: "flex", flexDirection: "column", gap: 18 }}>
            <span className="eyebrow" style={{ color: "var(--bel-orange)" }}>SOLUTIONS — TOP SIX, OUR EXPERTISE</span>
            <h2 className="h2" style={{ margin: 0, color: "white" }}>
              Top Solutions,{" "}
              <span style={{ color: "#A1A1A8", fontWeight: 400 }}>Our Expertise.</span>
            </h2>
          </div>
          <p className="lead reveal" style={{ margin: 0, color: "#C7C7CE", justifySelf: "end", maxWidth: 460 }}>
            Six core technology disciplines we&apos;ve been refining since 2012. Pick one to start a conversation — or ask us to combine a few into a single program.
          </p>
        </div>

        <div className="swipe-grid swipe-grid--solutions" style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 18 }}>
          {items.map((it, i) => <SolutionCard key={i} index={i} {...it} />)}
        </div>
      </div>
    </section>
  );
};

const SolutionCard = ({ name, desc, index }) => (
  <a href="#contact" className="reveal sol-card" style={{
    position: "relative",
    background: "linear-gradient(180deg, #1A1410 0%, #14100C 100%)",
    border: "1px solid rgba(255,255,255,0.08)",
    borderRadius: 22,
    padding: 28,
    display: "flex", flexDirection: "column", gap: 18, minHeight: 280,
    transition: "transform .25s, border-color .25s, box-shadow .25s",
    color: "white",
    overflow: "hidden",
    textAlign: "center",
    alignItems: "center",
  }}>
    {/* Hover-only orange glow */}
    <span aria-hidden className="sol-glow" style={{
      position: "absolute", top: -60, right: -60,
      width: 180, height: 180, borderRadius: "50%",
      background: "radial-gradient(circle, rgba(239,106,31,0.45), transparent 70%)",
      opacity: 0, transition: "opacity .35s",
      pointerEvents: "none",
    }} />
    {/* Top accent line */}
    <span aria-hidden style={{
      position: "absolute", top: 0, left: "50%", transform: "translateX(-50%)",
      height: 3, width: 56,
      background: "var(--bel-orange)",
      borderRadius: 2,
    }} />

    <div style={{
      width: 88, height: 88, borderRadius: 18,
      background: "var(--bel-orange)",
      display: "grid", placeItems: "center",
      boxShadow: "0 16px 32px -10px rgba(239,106,31,0.55), inset 0 1px 0 rgba(255,255,255,0.25)",
      marginTop: 4,
    }}>
      <SolutionIcon kind={name} tone="onOrange" />
    </div>

    <span style={{ fontFamily: "var(--font-display)", fontSize: 26, fontWeight: 600, letterSpacing: "-0.02em", marginTop: 2 }}>{name}</span>

    <p style={{ margin: 0, fontSize: 14.5, color: "#A1A1A8", lineHeight: 1.55, maxWidth: 280 }}>{desc}</p>

    <div style={{ flex: 1 }} />
    <div style={{
      position: "relative", width: "100%",
      display: "flex", justifyContent: "space-between", alignItems: "center",
      paddingTop: 16, borderTop: "1px solid rgba(255,255,255,0.08)",
    }}>
      <span style={{ fontSize: 13.5, color: "#E5E5EA", fontWeight: 500 }}>Explore solution</span>
      <span className="sol-arrow" style={{
        width: 36, height: 36, borderRadius: "50%",
        background: "rgba(255,255,255,0.06)",
        border: "1px solid rgba(255,255,255,0.12)",
        color: "white",
        display: "grid", placeItems: "center",
        transition: "background .25s, color .25s, transform .25s, border-color .25s",
      }}>
        <Arrow size={13} />
      </span>
    </div>

    <style>{`
      .sol-card:hover { transform: translateY(-4px); border-color: rgba(239,106,31,0.4); box-shadow: 0 28px 60px -28px rgba(239,106,31,0.4); }
      .sol-card:hover .sol-glow { opacity: 1; }
      .sol-card:hover .sol-arrow { background: var(--bel-orange); border-color: var(--bel-orange); color: white; transform: rotate(-45deg) translate(2px, 0); }
    `}</style>
  </a>
);

const SolutionIcon = ({ kind, tone }) => {
  const c = tone === "onOrange" ? "white" : "#18181B";
  if (kind === "Cloud") return (
    <svg viewBox="0 0 64 64" width="60" height="60" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round">
      <path d="M16 38c-5 0-9-4-9-9s4-9 9-9c2-6 8-10 14-10s11 3 13 9c5 0 9 4 9 9s-4 9-9 9H16z"/>
      <circle cx="32" cy="34" r="4" fill={c} stroke="none"/>
      <path d="M16 50h8M28 50h12M44 50h4M12 56h6M22 56h14M40 56h10"/>
    </svg>
  );
  if (kind === "Server") return (
    <svg viewBox="0 0 64 64" width="60" height="60" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round">
      <rect x="10" y="10" width="44" height="14" rx="2"/>
      <rect x="10" y="26" width="44" height="14" rx="2"/>
      <rect x="10" y="42" width="44" height="14" rx="2"/>
      <circle cx="18" cy="17" r="1.5" fill={c} stroke="none"/>
      <circle cx="24" cy="17" r="1.5" fill={c} stroke="none"/>
      <circle cx="18" cy="33" r="1.5" fill={c} stroke="none"/>
      <circle cx="24" cy="33" r="1.5" fill={c} stroke="none"/>
      <circle cx="18" cy="49" r="1.5" fill={c} stroke="none"/>
      <circle cx="24" cy="49" r="1.5" fill={c} stroke="none"/>
      <path d="M44 17h4M44 33h4M44 49h4"/>
    </svg>
  );
  if (kind === "Datacenter") return (
    <svg viewBox="0 0 64 64" width="60" height="60" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round">
      <rect x="14" y="6" width="10" height="32"/>
      <rect x="27" y="6" width="10" height="32"/>
      <rect x="40" y="6" width="10" height="32"/>
      <path d="M19 11v0M19 17v0M19 23v0M19 29v0M32 11v0M32 17v0M32 23v0M32 29v0M45 11v0M45 17v0M45 23v0M45 29v0"/>
      <circle cx="19" cy="11" r="1" fill={c}/><circle cx="19" cy="17" r="1" fill={c}/><circle cx="19" cy="23" r="1" fill={c}/><circle cx="19" cy="29" r="1" fill={c}/>
      <circle cx="32" cy="11" r="1" fill={c}/><circle cx="32" cy="17" r="1" fill={c}/><circle cx="32" cy="23" r="1" fill={c}/><circle cx="32" cy="29" r="1" fill={c}/>
      <circle cx="45" cy="11" r="1" fill={c}/><circle cx="45" cy="17" r="1" fill={c}/><circle cx="45" cy="23" r="1" fill={c}/><circle cx="45" cy="29" r="1" fill={c}/>
      <path d="M32 38v8M19 46h26M19 46v6M32 46v6M45 46v6"/>
      <rect x="14" y="52" width="10" height="6"/>
      <rect x="27" y="52" width="10" height="6"/>
      <rect x="40" y="52" width="10" height="6"/>
    </svg>
  );
  if (kind === "Network") return (
    <svg viewBox="0 0 64 64" width="60" height="60" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round">
      <circle cx="32" cy="32" r="10"/>
      <path d="M32 32L14 14M32 32l18-18M32 32L14 50M32 32l18 18M32 32V10M32 32v22M32 32H10M32 32h22"/>
      <circle cx="32" cy="10" r="4" fill={c} stroke="none"/>
      <circle cx="32" cy="54" r="4" fill={c} stroke="none"/>
      <circle cx="10" cy="32" r="4" fill={c} stroke="none"/>
      <circle cx="54" cy="32" r="4" fill={c} stroke="none"/>
      <circle cx="14" cy="14" r="3.5" fill={c} stroke="none"/>
      <circle cx="50" cy="14" r="3.5" fill={c} stroke="none"/>
      <circle cx="14" cy="50" r="3.5" fill={c} stroke="none"/>
      <circle cx="50" cy="50" r="3.5" fill={c} stroke="none"/>
    </svg>
  );
  if (kind === "IoT & Automation") return (
    <svg viewBox="0 0 64 64" width="60" height="60" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round">
      <rect x="20" y="20" width="24" height="24" rx="3"/>
      <text x="32" y="36" textAnchor="middle" fontFamily="monospace" fontSize="8" fontWeight="700" fill={c} stroke="none">IoT</text>
      {[26,32,38].map(y => <path key={`l${y}`} d={`M20 ${y} h-8`}/>)}
      {[26,32,38].map(y => <path key={`r${y}`} d={`M44 ${y} h8`}/>)}
      {[26,32,38].map(x => <path key={`t${x}`} d={`M${x} 20 v-8`}/>)}
      {[26,32,38].map(x => <path key={`b${x}`} d={`M${x} 44 v8`}/>)}
      <circle cx="12" cy="26" r="2" fill={c} stroke="none"/>
      <circle cx="12" cy="38" r="2" fill={c} stroke="none"/>
      <circle cx="52" cy="32" r="2" fill={c} stroke="none"/>
      <circle cx="26" cy="12" r="2" fill={c} stroke="none"/>
      <circle cx="38" cy="52" r="2" fill={c} stroke="none"/>
    </svg>
  );
  if (kind === "Security") return (
    <svg viewBox="0 0 64 64" width="60" height="60" fill="none" stroke={c} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round">
      <path d="M32 6L52 14v14c0 12-8 22-20 26-12-4-20-14-20-26V14L32 6z"/>
      <path d="M22 32l7 7 14-14" strokeWidth="3"/>
    </svg>
  );
  return null;
};

Object.assign(window, { Solutions });

// ============================================================
// XSOL CLOUD — official brand mark
// Cloud outline that envelopes a stacked "XSOL / — / CLOUD" wordmark.
// Reused in the ecosystem hub (white on orange) and the WeDeliver
// laptop screen (orange on white).
// ============================================================
const XsolCloudMark = ({ size = 160 }) => (
  <img src="assets/xsol-cloud-logo.png" alt="XSOL Cloud" draggable="false"
       style={{ width: size, height: "auto", display: "block", userSelect: "none" }} />
);

// ============================================================
// XSOL Cloud Ecosystem — hub & spokes + benefits panel
// (Replaces the old "Three pillars" section)
// ============================================================
const Pillars = () => {
  // 6 partners arranged on a circle. Angles in degrees, 0° = top, clockwise.
  const partners = [
    { kind: "microsoft",  label: "Microsoft",     role: "Solutions Partner",   angle: 330 },
    { kind: "aws",        label: "AWS",           role: "Business Partner",    angle:  30 },
    { kind: "googleCloud",label: "Google Cloud",  role: "Partner",             angle:  90 },
    { kind: "fortinet",   label: "Fortinet",      role: "Authorized Partner",  angle: 150 },
    { kind: "hpeAruba",   label: "HPE Aruba",     role: "Networking",          angle: 210 },
    { kind: "kaspersky",  label: "kaspersky",     role: "Registered Partner",  angle: 270 },
  ];
  // 6 concept badges — small circular chips in an inner ring,
  // each sitting between the hub and a partner pill.
  const concepts = [
    { kind: "solutions",      label: "SOLUTIONS",       angle: 330 },
    { kind: "infrastructure", label: "INFRASTRUCTURE",  angle:  30 },
    { kind: "cloud",          label: "CLOUD",           angle:  90 },
    { kind: "protection",     label: "PROTECTION",      angle: 150 },
    { kind: "networking",     label: "NETWORKING",      angle: 210 },
    { kind: "security",       label: "SECURITY",        angle: 270 },
  ];

  const features = [
    { name: "Disaster Protection",  desc: "Geographic redundancy and hardware-failure isolation with recovery SLAs in writing.", tone: "var(--bel-orange)" },
    { name: "Hardened Security",    desc: "Nine layers of integrated controls and granular telemetry across every workload.",   tone: "var(--bel-blue)"   },
    { name: "Dedicated Provisioning", desc: "Reserved capacity per client — no noisy-neighbour multi-tenancy on critical paths.", tone: "var(--bel-orange)" },
    { name: "Zero Ops Overhead",    desc: "Fully managed — your team ships product while we run the floor 24×7.",                tone: "var(--bel-blue)"   },
    { name: "Cost-controlled",      desc: "Pay-as-you-go blended with reserved capacity and a monthly FinOps review.",            tone: "var(--bel-orange)" },
  ];

  return (
    <section id="services" style={{ background: "var(--cream)" }}>
      <div className="wrap" style={{ display: "flex", flexDirection: "column", gap: 40 }}>
        {/* Header */}
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 36, alignItems: "end" }}>
          <SectionHead
            eyebrow="ECOSYSTEM — CERTIFIED ACROSS THE STACK"
            title={<>One operating layer. <em style={{ fontStyle: "italic", color: "var(--bel-blue)", fontWeight: 500 }}>Every&nbsp;vendor</em> worth deploying.</>}
          />
          <p className="lead reveal" style={{ margin: 0, justifySelf: "end", maxWidth: 460 }}>
            We don&apos;t sell you a hyperscaler. We pick the right blend for the workload — and hold the certifications that prove we&apos;ve earned the right to.
          </p>
        </div>

        {/* Body — diagram + benefits */}
        <div className="cloud-eco-grid">
          {/* LEFT — hub & spokes */}
          <div className="reveal cloud-eco-hub">
            <CertChipRow />
            <HubDiagram partners={partners} />
          </div>

          {/* RIGHT — benefits panel */}
          <div className="reveal" style={{ display: "flex", flexDirection: "column", gap: 22 }}>
            <h3 className="h3" style={{ margin: 0, fontSize: "clamp(26px, 2.4vw, 34px)" }}>
              Cloud, security, network —{" "}
              <span style={{ color: "var(--ink-mute)", fontWeight: 400 }}>one accountable team.</span>
            </h3>
            <p style={{ margin: 0, color: "var(--ink-soft)", fontSize: 15.5, lineHeight: 1.6, maxWidth: 520 }}>
              We empower regulated businesses with hybrid cloud architecture, seamless on-prem integration, and the operational rigour of a single throat to choke.
            </p>
            <div style={{ display: "flex", flexWrap: "wrap", gap: 12, marginTop: 4 }}>
              <a href="#contact" className="btn btn--accent" style={{ fontSize: 14.5 }}>
                Talk to an architect <Arrow size={12} />
              </a>
              <a href="#" className="btn btn--ghost" style={{ fontSize: 14.5 }}>
                Download platform paper
              </a>
            </div>

            <div style={{ height: 1, background: "var(--line)", marginBlock: 10 }} />
            <span className="eyebrow" style={{ fontFamily: "var(--font-mono)", fontSize: 11.5, color: "var(--ink-mute)", letterSpacing: "0.14em" }}>
              WHAT YOU GET
            </span>

            <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "flex", flexDirection: "column", gap: 16 }}>
              {features.map((f, i) => (
                <li key={i} style={{ display: "grid", gridTemplateColumns: "44px 1fr", gap: 14, alignItems: "flex-start" }}>
                  <FeatureGlyph index={i} tone={f.tone} />
                  <div style={{ display: "flex", flexDirection: "column", gap: 2 }}>
                    <span style={{ fontFamily: "var(--font-display)", fontWeight: 600, fontSize: 16, letterSpacing: "-0.01em" }}>{f.name}</span>
                    <span style={{ fontSize: 14, color: "var(--ink-soft)", lineHeight: 1.5 }}>{f.desc}</span>
                  </div>
                </li>
              ))}
            </ul>
          </div>
        </div>

        <style>{`
          .cloud-eco-grid {
            display: grid;
            grid-template-columns: 1.15fr 1fr;
            gap: 48px;
            align-items: start;
          }
          .cloud-eco-hub {
            display: flex; flex-direction: column; gap: 22px;
          }
          @media (max-width: 980px) {
            .cloud-eco-grid { grid-template-columns: 1fr; gap: 36px; }
          }
        `}</style>
      </div>
    </section>
  );
};

// ---------- ISO / accreditation chip strip ----------
const CertChipRow = () => (
  <div style={{
    display: "inline-flex", flexWrap: "wrap", alignItems: "center", gap: 10,
    alignSelf: "flex-start",
  }}>
    <CertChip line1="ISO 9001" line2="2015" />
    <CertChip line1="ISO 27001" line2="INFOSEC" />
    <CertChip line1="SOC 2" line2="TYPE II" />
    <span style={{
      display: "inline-flex", alignItems: "center", gap: 8,
      paddingInline: 12, height: 36,
      fontFamily: "var(--font-mono)", fontSize: 10.5, letterSpacing: "0.14em",
      color: "var(--ink-soft)", textTransform: "uppercase",
    }}>
      <span style={{ width: 6, height: 6, borderRadius: 999, background: "var(--bel-orange)" }} />
      Independently audited · FY25
    </span>
  </div>
);

const CertChip = ({ line1, line2 }) => (
  <div style={{
    display: "inline-flex", alignItems: "center", gap: 8,
    padding: "6px 12px 6px 8px",
    background: "var(--paper)",
    border: "1px solid var(--line)",
    borderRadius: 999,
    boxShadow: "0 6px 16px -12px rgba(24,24,27,0.18)",
  }}>
    <span style={{
      width: 24, height: 24, borderRadius: "50%",
      background: "var(--bel-orange)",
      display: "grid", placeItems: "center",
      color: "white",
    }}>
      <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round">
        <path d="M5 12l5 5L20 7" />
      </svg>
    </span>
    <div style={{ display: "flex", flexDirection: "column", lineHeight: 1.05 }}>
      <span style={{ fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 12.5, color: "var(--ink)", letterSpacing: "-0.005em" }}>{line1}</span>
      <span style={{ fontFamily: "var(--font-mono)", fontSize: 9, color: "var(--ink-mute)", letterSpacing: "0.12em" }}>{line2}</span>
    </div>
  </div>
);

// ---------- Hub & spokes diagram ----------
const HubDiagram = ({ partners, concepts = [] }) => {
  const SIZE = 560;       // viewBox / container square
  const CX = SIZE / 2;
  const CY = SIZE / 2;
  const HUB_R = 104;      // radius of central XSOL circle
  const SPOKE_R = 224;    // distance from center to each pill anchor
  const HALO_R = HUB_R + 22;
  const ORBIT_R = HUB_R + 42;
  const CONCEPT_R = HUB_R + 62;  // radius of inner concept-badge ring

  const positions = partners.map((p) => {
    const rad = ((p.angle - 90) * Math.PI) / 180; // 0° at top
    return {
      ...p,
      x: CX + SPOKE_R * Math.cos(rad),
      y: CY + SPOKE_R * Math.sin(rad),
      // line endpoints — stop just outside the hub halo
      x1: CX + HALO_R * Math.cos(rad),
      y1: CY + HALO_R * Math.sin(rad),
    };
  });

  const conceptPositions = concepts.map((c) => {
    const rad = ((c.angle - 90) * Math.PI) / 180;
    return {
      ...c,
      x: CX + CONCEPT_R * Math.cos(rad),
      y: CY + CONCEPT_R * Math.sin(rad),
    };
  });

  return (
    <div className="hub-wrap" style={{
      position: "relative",
      width: "100%", maxWidth: SIZE, margin: "0 auto",
      aspectRatio: "1 / 1",
    }}>
      {/* spoke lines + guides */}
      <svg
        viewBox={`0 0 ${SIZE} ${SIZE}`}
        style={{ position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none" }}
        aria-hidden
      >
        {/* faint concentric rings */}
        <circle cx={CX} cy={CY} r={SPOKE_R + 28} fill="none" stroke="var(--line)" strokeWidth="1" opacity="0.55" />
        <circle cx={CX} cy={CY} r={SPOKE_R - 24} fill="none" stroke="var(--line)" strokeWidth="1" opacity="0.45" strokeDasharray="3 6" />

        {positions.map((p, i) => (
          <line key={i}
            x1={p.x1} y1={p.y1} x2={p.x} y2={p.y}
            stroke="var(--ink-mute)" strokeWidth="1" opacity="0.5"
            strokeDasharray="2 4"
          />
        ))}
      </svg>

      {/* Soft pulsing halo behind hub — removed */}

      {/* Rotating dashed ring (clockwise) */}
      <svg aria-hidden className="hub-ring hub-ring--cw" viewBox={`0 0 ${SIZE} ${SIZE}`} style={{
        position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none",
      }}>
        <circle cx={CX} cy={CY} r={ORBIT_R} fill="none"
                stroke="var(--bel-orange)" strokeOpacity="0.45"
                strokeWidth="1.2" strokeDasharray="4 8" />
      </svg>

      {/* Rotating thin ring (counter-clockwise) */}
      <svg aria-hidden className="hub-ring hub-ring--ccw" viewBox={`0 0 ${SIZE} ${SIZE}`} style={{
        position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none",
      }}>
        <circle cx={CX} cy={CY} r={ORBIT_R + 14} fill="none"
                stroke="var(--bel-blue)" strokeOpacity="0.25"
                strokeWidth="1" strokeDasharray="1 7" />
      </svg>

      {/* Orbiting accent dot */}
      <span aria-hidden className="hub-orbit-dot" style={{
        position: "absolute",
        left: "50%", top: "50%",
        width: (ORBIT_R + 14) * 2, height: (ORBIT_R + 14) * 2,
        marginLeft: -(ORBIT_R + 14),
        marginTop: -(ORBIT_R + 14),
        pointerEvents: "none",
      }}>
        <span style={{
          position: "absolute", left: "50%", top: 0,
          width: 10, height: 10, marginLeft: -5,
          borderRadius: "50%", background: "var(--bel-orange)",
          boxShadow: "0 0 0 4px rgba(239,106,31,0.2), 0 4px 10px rgba(239,106,31,0.45)",
        }} />
      </span>

      {/* central XSOL hub */}
      <div className="hub-core" style={{
        position: "absolute",
        left: "50%", top: "50%",
        width: HUB_R * 2, height: HUB_R * 2,
        marginLeft: -HUB_R, marginTop: -HUB_R,
        borderRadius: "50%",
        background: "radial-gradient(circle at 32% 28%, #FFE5D2 0%, #FFB587 42%, var(--bel-orange) 78%, var(--bel-orange-deep) 100%)",
        boxShadow: "0 24px 60px -22px rgba(239,106,31,0.6), inset 0 2px 0 rgba(255,255,255,0.45), inset 0 -12px 24px rgba(140,55,10,0.18)",
        color: "white",
        overflow: "hidden",
      }}>
        {/* inner ring — removed */}
        {/* gloss highlight */}
        <span aria-hidden style={{
          position: "absolute", top: "8%", left: "18%",
          width: "62%", height: "30%",
          borderRadius: "50%",
          background: "radial-gradient(ellipse, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 70%)",
          filter: "blur(2px)",
        }} />

        <div style={{
          position: "absolute", inset: 0,
          display: "grid", placeItems: "center",
        }}>
          <XsolCloudMark size={HUB_R * 1.75} color="white" />
        </div>
      </div>

      {/* partner pills */}
      {positions.map((p, i) => (
        <div key={i} style={{
          position: "absolute",
          left: `${(p.x / SIZE) * 100}%`,
          top:  `${(p.y / SIZE) * 100}%`,
          transform: "translate(-50%, -50%)",
        }}>
          <div style={{
            animation: `belPopIn 0.6s cubic-bezier(.2,.9,.3,1.3) ${0.15 + i * 0.08}s both, xcPartnerFloat ${(5 + (i % 3) * 0.7).toFixed(2)}s ease-in-out ${(0.6 + i * 0.18).toFixed(2)}s infinite`,
            display: "inline-block",
          }}>
            <PartnerPill kind={p.kind} label={p.label} role={p.role} />
          </div>
        </div>
      ))}

      <style>{`
        .hub-wrap .partner-pill { transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
        .hub-wrap .partner-pill:hover { transform: translateY(-2px); border-color: var(--bel-orange); box-shadow: 0 16px 32px -16px rgba(239,106,31,0.45); }

        /* Tablet — shrink pills so they don't overflow */
        @media (max-width: 900px) {
          .hub-wrap .partner-pill { padding: 6px 12px 6px 6px !important; gap: 8px !important; }
          .hub-wrap .partner-pill > span:first-child { width: 34px !important; height: 34px !important; }
          .hub-wrap .partner-pill > span:first-child > svg { width: 20px !important; height: 20px !important; }
          .hub-wrap .partner-pill > div > span:first-child { font-size: 12px !important; }
          .hub-wrap .partner-pill > div > span:last-child  { font-size: 8.5px !important; }
        }

        /* Mobile — much more compact, smaller hub, no overflow */
        @media (max-width: 640px) {
          .hub-wrap {
            max-width: 380px !important;
          }
          .hub-wrap .partner-pill { padding: 5px 10px 5px 5px !important; gap: 6px !important; }
          .hub-wrap .partner-pill > span:first-child { width: 28px !important; height: 28px !important; }
          .hub-wrap .partner-pill > span:first-child > svg { width: 16px !important; height: 16px !important; }
          .hub-wrap .partner-pill > div > span:first-child { font-size: 10.5px !important; letter-spacing: -0.01em !important; }
          .hub-wrap .partner-pill > div > span:last-child  { font-size: 7.5px !important; letter-spacing: 0.06em !important; }
        }

        /* Tiny mobile — even tighter */
        @media (max-width: 420px) {
          .hub-wrap { max-width: 320px !important; }
          .hub-wrap .partner-pill > div > span:first-child { font-size: 10px !important; }
          .hub-wrap .partner-pill > div > span:last-child  { font-size: 7px !important; }
        }

        /* Concept badges (inner ring) */
        .concept-badge {
          display: flex; flex-direction: column; align-items: center; gap: 6px;
          pointer-events: none;
          animation: belPopIn 0.55s cubic-bezier(.2,.9,.3,1.3) both;
        }
        .concept-badge__chip {
          width: 52px; height: 52px;
          border-radius: 50%;
          background: var(--paper);
          border: 1px solid var(--line);
          display: grid; place-items: center;
          color: var(--bel-orange);
          box-shadow: 0 10px 22px -14px rgba(24,24,27,0.28), inset 0 1px 0 rgba(255,255,255,0.9);
        }
        .concept-badge__label {
          font-family: var(--font-mono);
          font-size: 9.5px;
          letter-spacing: 0.16em;
          color: var(--ink-soft);
          text-transform: uppercase;
          white-space: nowrap;
          font-weight: 600;
        }

        .hub-core { animation: xcCoreBreath 4.6s ease-in-out infinite; transform-origin: center; will-change: transform; }
        .hub-cloud {
          animation: xcCloudBob 3.4s ease-in-out infinite;
          filter: drop-shadow(0 4px 8px rgba(140,55,10,0.25));
          transform-origin: center;
        }
        .hub-wordmark { position: relative; }
        .hub-wordmark span {
          background: linear-gradient(100deg, #ffffff 0%, #ffffff 35%, #fff8ee 50%, #ffffff 65%, #ffffff 100%);
          background-size: 220% 100%;
          -webkit-background-clip: text;
          background-clip: text;
          color: transparent;
          -webkit-text-fill-color: transparent;
          text-shadow: 0 2px 8px rgba(140,55,10,0.18);
          animation: xcShimmer 5.2s linear infinite;
        }
        .hub-wordmark span:nth-child(2) { animation-delay: 0.4s; }
        .hub-halo { animation: xcHaloPulse 4.6s ease-in-out infinite; }
        .hub-ring--cw  { animation: xcSpinCW  28s linear infinite; transform-origin: 50% 50%; }
        .hub-ring--ccw { animation: xcSpinCCW 44s linear infinite; transform-origin: 50% 50%; }
        .hub-orbit-dot { animation: xcSpinCW 14s linear infinite; transform-origin: 50% 50%; }

        @keyframes xcCoreBreath {
          0%, 100% { transform: translate(0,0) scale(1); }
          50%      { transform: translate(0,0) scale(1.025); }
        }
        @keyframes xcCloudBob {
          0%, 100% { transform: translateY(0) scale(1); }
          50%      { transform: translateY(-4px) scale(1.04); }
        }
        @keyframes xcShimmer {
          0%   { background-position: 200% 0; }
          100% { background-position: -200% 0; }
        }
        @keyframes xcHaloPulse {
          0%, 100% { opacity: 0.85; transform: translate(-50%,-50%) scale(1); }
          50%      { opacity: 1;    transform: translate(-50%,-50%) scale(1.08); }
        }
        @keyframes xcSpinCW  { from { transform: rotate(0deg); }   to { transform: rotate(360deg); } }
        @keyframes xcSpinCCW { from { transform: rotate(0deg); }   to { transform: rotate(-360deg); } }
        @keyframes xcPartnerFloat {
          0%, 100% { transform: translateY(0); }
          50%      { transform: translateY(-5px); }
        }

        @media (prefers-reduced-motion: reduce) {
          .hub-core, .hub-halo, .hub-ring--cw, .hub-ring--ccw, .hub-orbit-dot,
          .hub-cloud, .hub-wordmark span,
          .hub-wrap [style*="xcPartnerFloat"] { animation: none !important; }
        }
      `}</style>
    </div>
  );
};

// Compact partner pill used on the hub diagram
const PartnerPill = ({ kind, label, role }) => (
  <div className="partner-pill" style={{
    background: "var(--paper)",
    border: "1.5px solid var(--line)",
    borderRadius: 999,
    padding: "8px 16px 8px 8px",
    display: "inline-flex", alignItems: "center", gap: 10,
    boxShadow: "0 10px 22px -16px rgba(24,24,27,0.25)",
    whiteSpace: "nowrap",
  }}>
    <span style={{
      width: 42, height: 42, borderRadius: "50%",
      background: "var(--cream)",
      display: "grid", placeItems: "center",
      flex: "0 0 auto",
    }}>
      <PartnerGlyph kind={kind} />
    </span>
    <div style={{ display: "flex", flexDirection: "column", lineHeight: 1.05 }}>
      <span style={{ fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 13.5, color: "var(--ink)", letterSpacing: "-0.005em" }}>{label}</span>
      <span style={{ fontFamily: "var(--font-mono)", fontSize: 9.5, color: "var(--ink-mute)", letterSpacing: "0.1em", textTransform: "uppercase" }}>{role}</span>
    </div>
  </div>
);

// Concept badge icons (inner ring of the hub diagram)
const ConceptIcon = ({ kind }) => {
  const p = { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round" };
  switch (kind) {
    case "solutions":      return <svg {...p}><path d="M12 3l8 3v6c0 5-4 9-8 10-4-1-8-5-8-10V6l8-3z"/><path d="M8 13l3 3 5-6"/></svg>;
    case "infrastructure": return <svg {...p}><path d="M16 19h2a4 4 0 0 0 0-8 6 6 0 0 0-11.6 1.5A3.5 3.5 0 0 0 6 19h10z"/></svg>;
    case "cloud":          return <svg {...p}><ellipse cx="12" cy="5.5" rx="7" ry="2.5"/><path d="M5 5.5v5c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5v-5"/><path d="M5 10.5v5c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5v-5"/></svg>;
    case "protection":     return <svg {...p}><path d="M12 3l8 3v6c0 5-4 9-8 10-4-1-8-5-8-10V6l8-3z"/></svg>;
    case "networking":     return <svg {...p}><circle cx="12" cy="5" r="2"/><circle cx="5" cy="18" r="2"/><circle cx="19" cy="18" r="2"/><path d="M12 7l-6 9M12 7l6 9M7 18h10"/></svg>;
    case "security":       return <svg {...p}><rect x="5" y="11" width="14" height="9" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg>;
    default: return null;
  }
};

// Tiny partner glyphs (~26px). Stylized abstractions, not full logos.
const PartnerGlyph = ({ kind }) => {
  const S = 26;
  if (kind === "microsoft") return (
    <svg viewBox="0 0 24 24" width={S} height={S}>
      <rect x="1" y="1" width="10" height="10" fill="#F25022"/>
      <rect x="13" y="1" width="10" height="10" fill="#7FBA00"/>
      <rect x="1" y="13" width="10" height="10" fill="#00A4EF"/>
      <rect x="13" y="13" width="10" height="10" fill="#FFB900"/>
    </svg>
  );
  if (kind === "aws") return (
    <svg viewBox="0 0 36 24" width={S + 6} height={S}>
      <text x="18" y="14" textAnchor="middle" fontFamily="Arial Black, Arial" fontSize="11" fontWeight="900" fill="#232F3E">aws</text>
      <path d="M6 20 C16 24, 26 24, 32 18" stroke="#FF9900" strokeWidth="2" fill="none" strokeLinecap="round"/>
      <path d="M30 16 L33 18 L30 20" stroke="#FF9900" strokeWidth="2" fill="none" strokeLinecap="round" strokeLinejoin="round"/>
    </svg>
  );
  if (kind === "googleCloud") return (
    <svg viewBox="0 0 48 48" width={S} height={S}>
      <path fill="#4285F4" d="M24 9.5c3.5 0 6.6 1.2 9 3.6l6.7-6.7C35.5 2.4 30 0 24 0 14.6 0 6.4 5.4 2.5 13.3l7.8 6c1.9-5.5 7.1-9.8 13.7-9.8z"/>
      <path fill="#34A853" d="M46.5 24.5c0-1.6-.1-3.2-.4-4.7H24v9h12.7c-.6 3-2.3 5.6-4.9 7.3l7.6 5.9c4.5-4.1 7.1-10.2 7.1-17.5z"/>
      <path fill="#FBBC05" d="M10.3 28.7a14.5 14.5 0 0 1 0-9.4l-7.8-6A24 24 0 0 0 0 24c0 3.8.9 7.5 2.5 10.7l7.8-6z"/>
      <path fill="#EA4335" d="M24 48c6.5 0 12-2.1 16-5.8l-7.6-5.9c-2.1 1.4-4.8 2.3-8.4 2.3-6.6 0-12.2-4.4-14.2-10.4l-7.8 6C6 42.6 14.4 48 24 48z"/>
    </svg>
  );
  if (kind === "fortinet") return (
    <svg viewBox="0 0 22 18" width={S} height={S - 4}>
      <g fill="#E2231A">
        <rect x="0" y="1" width="4" height="4"/>
        <rect x="5" y="1" width="4" height="4"/>
        <rect x="10" y="1" width="4" height="4"/>
        <rect x="15" y="1" width="4" height="4"/>
        <rect x="0" y="7" width="4" height="4"/>
        <rect x="5" y="7" width="4" height="4"/>
        <rect x="0" y="13" width="4" height="4"/>
      </g>
    </svg>
  );
  if (kind === "hpeAruba") return (
    <svg viewBox="0 0 24 24" width={S} height={S}>
      <rect x="1" y="6" width="22" height="3" fill="#01A982"/>
      <rect x="1" y="11" width="22" height="3" fill="#FF8300"/>
      <rect x="1" y="16" width="22" height="3" fill="#1A1F36"/>
    </svg>
  );
  if (kind === "kaspersky") return (
    <svg viewBox="0 0 24 24" width={S} height={S}>
      <rect x="1" y="1" width="22" height="22" rx="3" fill="#1A1F36"/>
      <text x="12" y="17" textAnchor="middle" fontFamily="Arial Black, Arial" fontSize="14" fontWeight="900" fill="#00A88E">K</text>
    </svg>
  );
  return null;
};

// ---------- Feature glyph (5 different stylized icons) ----------
const FeatureGlyph = ({ index, tone }) => {
  const wrapStyle = {
    width: 40, height: 40, borderRadius: 12,
    background: `color-mix(in oklab, ${tone} 14%, var(--paper))`,
    border: `1px solid color-mix(in oklab, ${tone} 30%, var(--line))`,
    color: tone,
    display: "grid", placeItems: "center",
  };
  const ico = { width: 20, height: 20, fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round" };
  const glyphs = [
    // Disaster Protection — shield with bolt
    <svg {...ico} viewBox="0 0 24 24"><path d="M12 3l8 3v6c0 5-3.5 8.5-8 10-4.5-1.5-8-5-8-10V6l8-3z"/><path d="M12 9l-2 4h3l-2 4"/></svg>,
    // Hardened Security — lock with ring
    <svg {...ico} viewBox="0 0 24 24"><rect x="5" y="11" width="14" height="9" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/><circle cx="12" cy="15.5" r="1.2"/></svg>,
    // Dedicated Provisioning — server stack
    <svg {...ico} viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="6" rx="1"/><rect x="3" y="14" width="18" height="6" rx="1"/><circle cx="7" cy="7" r="0.6" fill="currentColor"/><circle cx="7" cy="17" r="0.6" fill="currentColor"/><path d="M10 7h7M10 17h7"/></svg>,
    // Zero Ops — gear with check
    <svg {...ico} viewBox="0 0 24 24"><circle cx="12" cy="12" r="3.5"/><path d="M12 4v2M12 18v2M4 12h2M18 12h2M6.3 6.3l1.4 1.4M16.3 16.3l1.4 1.4M6.3 17.7l1.4-1.4M16.3 7.7l1.4-1.4"/></svg>,
    // Cost-controlled — chart up
    <svg {...ico} viewBox="0 0 24 24"><path d="M4 20V8M4 20h16"/><path d="M8 16l3-3 3 2 5-6"/><path d="M16 9h3v3"/></svg>,
  ];
  return <span style={wrapStyle}>{glyphs[index] || glyphs[0]}</span>;
};

// ============================================================
// Stats banner — Strategic Advisory / Tech Solutions / Security / Innovation
// ============================================================
const Stats = () => (
  <section style={{ paddingBlock: "clamp(48px, 5vw, 80px)" }}>
    <div className="wrap" style={{ display: "flex", flexDirection: "column", gap: 36 }}>
      <SectionHead
        eyebrow="ACHIEVEMENTS — FY 2025"
        title={<>Numbers we&apos;d defend in a room.<br /><span style={{ color: "var(--ink-mute)", fontWeight: 400 }}>The work, by the work.</span></>}
      />
      <div className="stats-grid" style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 0, borderTop: "1px solid var(--line)" }}>
        {[
          { value: "36", suffix: "M", label: "Strategic IT Advisory", sub: "Engagement value delivered for CIO/CTO offices across 9 sectors." },
          { value: "68", suffix: "M", label: "Technology Solutions Consulting", sub: "Cloud migrations, infra modernization, and platform rollouts." },
          { value: "12", suffix: "M", label: "Security & Compliance Audits", sub: "Posture reviews and remediation across regulated industries." },
          { value: "93", suffix: "%", label: "Digital Innovation Outcomes", sub: "Of FY25 transformation programs hit their stated business case." },
        ].map((s, i, arr) => (
          <div key={i} className="reveal stats-cell" style={{
            padding: "40px 24px 36px",
            borderRight: i < arr.length - 1 ? "1px solid var(--line)" : "none",
            display: "flex", flexDirection: "column", gap: 10,
          }}>
            <Stat {...s} />
          </div>
        ))}
      </div>

      <style>{`
        /* Mobile — stack stats and center-align each cell */
        @media (max-width: 720px) {
          .stats-grid {
            grid-template-columns: 1fr !important;
          }
          .stats-grid .stats-cell {
            border-right: none !important;
            border-bottom: 1px solid var(--line);
            align-items: center;
            text-align: center;
            padding: 28px 16px !important;
          }
          .stats-grid .stats-cell:last-child {
            border-bottom: none;
          }
          /* The big number block inside <Stat> uses inline-flex naturally;
             center it too. */
          .stats-grid .stats-cell > * { align-items: center; }
        }
      `}</style>
      <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", paddingTop: 24, borderTop: "1px solid var(--line)", flexWrap: "wrap", gap: 16 }}>
        <span style={{ fontSize: 13.5, color: "var(--ink-soft)", fontFamily: "var(--font-mono)", letterSpacing: 0.04 }}>
          *Reported value across FY24–25. Independent attestation available on request.
        </span>
        <a href="#" className="btn btn--ghost" style={{ height: 42, fontSize: 14 }}>
          Download FY25 outcomes report <Arrow size={12} />
        </a>
      </div>
    </div>
  </section>
);

// ============================================================
// Capabilities grid — what we do under each practice
// ============================================================
const Capabilities = () => {
  const items = [
    { code: "01", title: "Strategic IT advisory", desc: "Architecture reviews, vendor consolidation, cost modelling, CIO/CTO-as-a-service engagements." },
    { code: "02", title: "Cloud & platform consulting", desc: "Microsoft, AWS and GCP migrations — sized, planned, and stewarded end-to-end." },
    { code: "03", title: "Cybersecurity & compliance", desc: "Posture audits, DPDP readiness, ISO 27001 and SOC 2 pre-assessment." },
    { code: "04", title: "AI & data readiness", desc: "Data maturity audits, modern data stack design, and pragmatic AI use-case selection." },
    { code: "05", title: "Operating model design", desc: "Org structure, RACI, process re-engineering, and the KPI tree that ties it together." },
    { code: "06", title: "GTM & sales enablement", desc: "Positioning, sales playbooks, pipeline systems, and the dashboards that keep them honest." },
    { code: "07", title: "Corporate legal & contracts", desc: "MSAs, NDAs, vendor agreements, entity structuring, IP, and DPDP-grade data clauses." },
    { code: "08", title: "Regulatory advisory", desc: "Sector-specific compliance for healthcare, finance, energy, and public sector clients." },
  ];
  return (
    <section style={{ background: "var(--ink)", color: "var(--cream)" }}>
      <div className="wrap" style={{ display: "flex", flexDirection: "column", gap: 36 }}>
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 36, alignItems: "end" }}>
          <div className="reveal" style={{ display: "flex", flexDirection: "column", gap: 18 }}>
            <span className="eyebrow" style={{ color: "var(--bel-orange)" }}>CAPABILITIES — WHAT WE ACTUALLY DO</span>
            <h2 className="h2" style={{ margin: 0, color: "var(--cream)" }}>
              Eight specific things we&apos;re good at —{" "}
              <span style={{ color: "#A1A1A8", fontWeight: 400 }}>
                listed so you can tell whether to call us.
              </span>
            </h2>
          </div>
          <p className="lead reveal" style={{ margin: 0, color: "#C7C7CE", justifySelf: "end", maxWidth: 440 }}>
            We don&apos;t pretend to do everything. If your problem isn&apos;t on this list, we&apos;ll either refer you, or tell you honestly.
          </p>
        </div>

        <div className="swipe-grid swipe-grid--capabilities" style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", borderTop: "1px solid #2A2A2F", borderLeft: "1px solid #2A2A2F" }}>
          {items.map((c, i) => (
            <div key={i} className="reveal" style={{
              borderRight: "1px solid #2A2A2F",
              borderBottom: "1px solid #2A2A2F",
              padding: "30px 24px 36px",
              minHeight: 220,
              display: "flex", flexDirection: "column", gap: 14,
              transition: "background .25s",
              cursor: "pointer",
            }}
            onMouseEnter={e => e.currentTarget.style.background = "#202024"}
            onMouseLeave={e => e.currentTarget.style.background = "transparent"}>
              <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
                <span style={{ fontFamily: "var(--font-mono)", fontSize: 12, color: "var(--bel-orange)", letterSpacing: "0.08em" }}>{c.code}</span>
                <span style={{ width: 28, height: 28, borderRadius: "50%", border: "1px solid #3A3A40", display: "grid", placeItems: "center", color: "#A1A1A8" }}>
                  <Plus size={12} />
                </span>
              </div>
              <div style={{ fontFamily: "var(--font-display)", fontSize: 19, fontWeight: 600, letterSpacing: "-0.02em", color: "var(--cream)" }}>{c.title}</div>
              <div style={{ fontSize: 14, color: "#A1A1A8", lineHeight: 1.55 }}>{c.desc}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
};

Object.assign(window, { Pillars, Stats, Capabilities });
