// Norton-Gauss · Home page sections

const { useState: hS, useEffect: hE, useRef: hR, useMemo: hM } = React;

const NG = window.NG;

// ─── Tiny icons ──────────────────────────────────────────────────
const Arr = ({ size = 16 }) =>
<svg width={size} height={size} viewBox="0 0 16 16" fill="none" aria-hidden>
    <path d="M5 11L11 5M11 5H6.5M11 5V9.5"
  stroke="currentColor" strokeWidth="1.4"
  strokeLinecap="round" strokeLinejoin="round" />
  </svg>;

const Cross = ({ size = 12 }) =>
<svg width={size} height={size} viewBox="0 0 12 12" fill="none" aria-hidden>
    <path d="M3 3L9 9M9 3L3 9" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" />
  </svg>;

const Check = ({ size = 14 }) =>
<svg width={size} height={size} viewBox="0 0 14 14" fill="none" aria-hidden>
    <path d="M3 7.5L6 10.5L11 4" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
  </svg>;

const Globe = ({ size = 15 }) =>
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" aria-hidden>
    <circle cx="12" cy="12" r="9" stroke="currentColor" strokeWidth="1.6" />
    <path d="M3 12h18M12 3c2.5 2.5 2.5 15 0 18M12 3c-2.5 2.5-2.5 15 0 18" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" />
  </svg>;

const Caret = ({ size = 11 }) =>
<svg width={size} height={size} viewBox="0 0 12 12" fill="none" aria-hidden>
    <path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
  </svg>;

const Sun = ({ size = 16 }) =>
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" aria-hidden>
    <circle cx="12" cy="12" r="4.4" stroke="currentColor" strokeWidth="1.6" />
    <path d="M12 2v2.4M12 19.6V22M4.2 4.2l1.7 1.7M18.1 18.1l1.7 1.7M2 12h2.4M19.6 12H22M4.2 19.8l1.7-1.7M18.1 5.9l1.7-1.7" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" />
  </svg>;

const Moon = ({ size = 16 }) =>
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" aria-hidden>
    <path d="M20 14.5A8 8 0 1 1 9.5 4a6.4 6.4 0 0 0 10.5 10.5z" stroke="currentColor" strokeWidth="1.6" strokeLinejoin="round" />
  </svg>;

// Languages offered in the top-bar selector
const NG_LANGS = [
  { code: 'en', label: 'English' },
  { code: 'es', label: 'Español' },
  { code: 'fr', label: 'Français' },
  { code: 'pt', label: 'Português' },
  { code: 'pl', label: 'Polski' },
  { code: 'de', label: 'Deutsch' },
  { code: 'it', label: 'Italiano' },
  { code: 'uk', label: 'Українська' },
];


// ─── Topbar + Nav + Footer ─────────────────────────────────────
function Topbar() {
  const [time, setTime] = hS('');
  hE(() => {
    const upd = () => {
      const d = new Date();
      const hh = String(d.getUTCHours()).padStart(2, '0');
      const mm = String(d.getUTCMinutes()).padStart(2, '0');
      setTime(`${hh}:${mm} UTC`);
    };
    upd();const id = setInterval(upd, 30000);return () => clearInterval(id);
  }, []);
  return (
    <div className="topbar">
      <div>
        <span className="live">Norton-Gauss · 2026</span>
        <span>Consulting & engineering, in one pod</span>
        <span>5 practices</span>
      </div>
      <div>
        <span>{time}</span>
        <span>EMEA · NAM · LATAM · APAC</span>
        <span>Strategy that ships</span>
      </div>
    </div>);

}

function Nav({ route, setRoute, theme, lang, setTweak }) {
  const [langOpen, setLangOpen] = hS(false);
  const langRef = hR(null);
  hE(() => {
    if (!langOpen) return;
    const onDoc = (e) => { if (langRef.current && !langRef.current.contains(e.target)) setLangOpen(false); };
    document.addEventListener('mousedown', onDoc);
    return () => document.removeEventListener('mousedown', onDoc);
  }, [langOpen]);
  const cur = NG_LANGS.find((l) => l.code === lang) || NG_LANGS[0];
  return (
    <header className="nav">
      <div className="nav-inner">
        <a className="nav-logo" href="#" onClick={(e) => {e.preventDefault();setRoute('home');}}>
          <img src={(window.__resources && window.__resources.logoMarkColor) || "assets/logo-mark-color.png"} alt="" />
          <span className="wm">Norton-Gauss</span>
        </a>
        <nav className="nav-links">
          <button className={route === 'home' ? 'active' : ''} onClick={() => setRoute('home')}>Home</button>
          <button className={route === 'services' ? 'active' : ''} onClick={() => setRoute('services')}>Practices</button>
          <button onClick={() => {setRoute('home');setTimeout(() => document.getElementById('framework')?.scrollIntoView({ behavior: 'smooth' }), 50);}}>Framework</button>
          <button onClick={() => {setRoute('home');setTimeout(() => document.getElementById('industries')?.scrollIntoView({ behavior: 'smooth' }), 50);}}>Footprint</button>
          <button className={route === 'case' ? 'active' : ''} onClick={() => setRoute('case')}>Case</button>
          <button className={route === 'careers' || route === 'job' ? 'active' : ''} onClick={() => setRoute('careers')}>Careers</button>
          <button onClick={() => {setRoute('home');setTimeout(() => document.getElementById('about')?.scrollIntoView({ behavior: 'smooth' }), 50);}}>About</button>
        </nav>
        <div className="nav-actions">
          <div className="nav-lang" ref={langRef}>
            <button className="nav-iconbtn" aria-haspopup="listbox" aria-expanded={langOpen} onClick={() => setLangOpen((o) => !o)}>
              <Globe /><span className="lang-code">{cur.code.toUpperCase()}</span><Caret />
            </button>
            {langOpen &&
            <div className="nav-menu" role="listbox" aria-label="Select language">
              {NG_LANGS.map((l) =>
              <button
                key={l.code}
                role="option"
                aria-selected={l.code === lang}
                className={'nav-menu-item' + (l.code === lang ? ' is-sel' : '')}
                onClick={() => { setTweak('lang', l.code); setLangOpen(false); }}>
                <span className="mi-code">{l.code.toUpperCase()}</span>
                <span className="mi-label">{l.label}</span>
              </button>
              )}
            </div>
            }
          </div>
          <button className="nav-iconbtn theme-toggle" aria-label="Toggle dark / light theme"
            onClick={() => setTweak('theme', theme === 'light' ? 'dark' : 'light')}>
            {theme === 'light' ? <Moon /> : <Sun />}
          </button>
          <a className="btn primary" style={{ padding: '10px 18px', fontSize: 13.5 }} href="#" data-route="book"><Arr />Start a project</a>
        </div>
      </div>
    </header>);

}

function Footer({ setRoute }) {
  return (
    <footer className="footer">
      <div className="container">
        <div className="top">
          <div className="brand">
            <img src={(window.__resources && window.__resources.logoWordmarkWhite) || "assets/logo-wordmark-white.png"} alt="Norton-Gauss" />
            <p>A senior consulting and engineering partner. We help companies modernize operations through hyper-automation, Agentic AI, cloud-edge systems and custom software — built around real business outcomes.</p>
            <div className="addr">sales@nortongauss.com · www.nortongauss.com</div>
          </div>
          <div>
            <h5>Capabilities</h5>
            <ul>
              <li><a href="#" onClick={(e) => {e.preventDefault();setRoute('services');}}>Hyper-Automation</a></li>
              <li><a href="#" onClick={(e) => {e.preventDefault();setRoute('services');}}>Agentic AI</a></li>
              <li><a href="#" onClick={(e) => {e.preventDefault();setRoute('services');}}>Cloud & Edge</a></li>
              <li><a href="#" onClick={(e) => {e.preventDefault();setRoute('services');}}>Custom Software & Ops</a></li>
            </ul>
          </div>
          <div>
            <h5>Industries</h5>
            <ul>
              <li><a href="#">Financial Services</a></li>
              <li><a href="#">Telecom</a></li>
              <li><a href="#">Retail & Consumer</a></li>
              <li><a href="#">Manufacturing & Logistics</a></li>
              <li><a href="#">Platform Businesses</a></li>
            </ul>
          </div>
          <div>
            <h5>Company</h5>
            <ul>
              <li><a href="#">About</a></li>
              <li><a href="#" onClick={(e) => {e.preventDefault();setRoute('case');}}>Case studies</a></li>
              <li><a href="#" onClick={(e) => {e.preventDefault();setRoute('careers');}}>Careers</a></li>
              <li><a href="#">Press</a></li>
            </ul>
          </div>
          <div>
            <h5>Contact</h5>
            <ul>
              <li><a href="mailto:sales@nortongauss.com">sales@nortongauss.com</a></li>
              <li><a href="#">EMEA · Paris</a></li>
              <li><a href="#">NAR · Sheridan</a></li>
              <li><a href="#">LATAM · São Paulo</a></li>
              <li><a href="#">LinkedIn</a></li>
            </ul>
          </div>
        </div>
        <div className="bottom">
          <span>© 2026 Norton-Gauss LLC · All rights reserved</span>
          <span className="tagline serif">Drive disruptive change.</span>
          <span>v 2.0 · 2026.05</span>
        </div>
      </div>
    </footer>);

}

// ─── Ops feed (hero sidebar) ───────────────────────────────────
function OpsFeed() {
  const seed = NG.opsfeedSeed;
  const [rows, setRows] = hS(seed);

  hE(() => {
    let i = 0;
    const id = setInterval(() => {
      i = (i + 1) % NG.opsfeedSeed.length;
      const now = new Date();
      const hh = String(now.getUTCHours()).padStart(2, '0');
      const mm = String(now.getUTCMinutes()).padStart(2, '0');
      const ss = String(now.getUTCSeconds()).padStart(2, '0');
      const next = { ...NG.opsfeedSeed[i], ts: `${hh}:${mm}:${ss}`, _id: Date.now() };
      setRows((prev) => [next, ...prev].slice(0, 8));
    }, 1700);
    return () => clearInterval(id);
  }, []);

  return (
    <div className="opsfeed">
      <div className="opsfeed-head">
        <span className="tag">OPS · LIVE FEED</span>
        <span>{rows.length} EVENTS · STREAMING</span>
      </div>
      <div className="opsfeed-rows">
        {rows.map((r, i) =>
        <div key={r._id || r.ts} className={`opsfeed-row ${i === 0 ? 'new' : ''}`}>
            <span className="ts">{r.ts}</span>
            <span className="agent">{r.a}</span>
            <span className="ev">{r.e}</span>
            <span className="lat">{r.lat}</span>
          </div>
        )}
      </div>
    </div>);

}

// Counter — animates up to value when the element scrolls into view, then
// stays static. Uses IntersectionObserver so the animation isn't lost when
// rAF is throttled.
function Counter({ value, unit, prefix = '' }) {
  const str = String(value).trim();
  const m = str.match(/^([^\d.]*?)([\d.,]+)(.*)$/);
  const numeric = m ? parseFloat(m[2].replace(/,/g, '')) : NaN;
  const hasDecimal = m ? /\./.test(m[2]) : false;
  // Start at the FINAL value so even with no animation the user sees the
  // right number; the in-view observer kicks off a count-up animation.
  const [n, setN] = hS(Number.isNaN(numeric) ? 0 : numeric);
  const ref = hR(null);
  const ran = hR(false);

  hE(() => {
    const el = ref.current;
    if (!el || Number.isNaN(numeric) || ran.current) return;
    const io = new IntersectionObserver((entries) => {
      if (entries[0].isIntersecting && !ran.current) {
        ran.current = true;
        io.disconnect();
        // Snap to 0 then animate up
        setN(0);
        const dur = 1100;
        const start = performance.now();
        let raf;
        const tick = (t) => {
          const k = Math.min(1, (t - start) / dur);
          const eased = 1 - Math.pow(1 - k, 3);
          setN(Math.abs(numeric) * eased);
          if (k < 1) raf = requestAnimationFrame(tick);
        };
        raf = requestAnimationFrame(tick);
      }
    }, { threshold: 0.2 });
    io.observe(el);
    return () => io.disconnect();
  }, [numeric]);

  if (!m) return <span ref={ref}>{value}{unit ? <small>{unit}</small> : null}</span>;
  const head = m[1];
  const tail = m[3];
  const display = hasDecimal ? n.toFixed(2) : Math.round(n).toLocaleString();
  return <span ref={ref}>{prefix}{head}{display}{tail}{unit ? <small>{unit}</small> : null}</span>;
}

// ─── HERO ─────────────────────────────────────────────────────
function Hero({ heroVariant }) {
  const [agentsCount, setAgentsCount] = hS(247);
  hE(() => {
    const id = setInterval(() => setAgentsCount((c) => c + Math.floor(Math.random() * 3) - 1), 2400);
    return () => clearInterval(id);
  }, []);
  return (
    <>
      <section className="hero">
        <div className="hero-bg">
          <HeroVisual variant={heroVariant} />
        </div>

        <div className="hero-inner">
          <div className="hero-l">
            <h1 className="hero-h1">
              <span className="row"><span className="word">Operations.</span></span>
              <span className="row"><span className="word"><em className="lime-italic">Reimagined.</em></span></span>
            </h1>
            <p className="hero-sub">
              Norton-Gauss helps companies modernize workflows through <strong>hyper-automation, Agentic AI, cloud-edge systems</strong> and <strong>custom software</strong> — built around real business outcomes. We don't just advise. We diagnose, design, build, integrate and help you operate.
            </p>
            <div className="hero-ctas">
              <a className="btn primary" href="#" data-route="book"><Arr />Start a project</a>
              <a className="btn ghost" href="#" data-route="services"><Arr />Explore capabilities</a>
            </div>
          </div>

        </div>
      </section>

      <div className="hero-marquee">
        <div className="hero-marquee-track">
          {Array.from({ length: 2 }).flatMap((_, ii) =>
          NG.marquee.map((t, i) => <span key={`${ii}-${i}`} className={i % 2 === 1 ? 'muted' : ''}>{t}</span>)
          )}
        </div>
      </div>
    </>);

}

// ─── THESIS ──────────────────────────────────────────────────
function Thesis() {
  return (
    <section className="section-pad">
      <div className="section-tag">
        <span><span className="num">01</span> · The problem</span>
        <span>Why automation now</span>
      </div>
      <div className="container">
        <div className="section-head" style={{ marginBottom: 48 }}>
          <h2 className="thesis-h">
            A pile of tools isn’t an <em className="serif-em" style={{ color: 'var(--ng-lime)' }}>intelligent operation.</em>
          </h2>
          <p className="right">{NG.thesis.sub}</p>
        </div>
      </div>

      <div className="thesis-pin">
        <div className="thesis-sticky">
          <div className="container">
            {React.createElement(window.ThesisGraph)}
          </div>
        </div>
      </div>
    </section>);

}

// ─── PRACTICES ────────────────────────────────────────────────
// Featured agentic AI card with an embedded mini-diagram, then a list.
function AgenticMiniDiagram() {
  return (
    <svg viewBox="0 0 460 460" style={{ width: '100%', height: '100%' }}>
      <defs>
        <radialGradient id="ag-halo" cx="50%" cy="50%" r="50%">
          <stop offset="0%" stopColor="#D9FF35" stopOpacity=".55" />
          <stop offset="60%" stopColor="#D9FF35" stopOpacity=".06" />
          <stop offset="100%" stopColor="#D9FF35" stopOpacity="0" />
        </radialGradient>
      </defs>
      <circle cx="230" cy="230" r="180" fill="url(#ag-halo)" />
      {/* Concentric tracks */}
      {[80, 130, 180].map((r) =>
      <circle key={r} cx="230" cy="230" r={r} fill="none" stroke="#234234" strokeWidth=".7" strokeDasharray="3 5" opacity=".7" />
      )}
      {/* Hub */}
      <circle cx="230" cy="230" r="22" fill="#D9FF35" />
      <circle cx="230" cy="230" r="32" fill="none" stroke="#D9FF35" strokeWidth="1" opacity=".5" />
      <text x="230" y="234" textAnchor="middle" fontFamily="JetBrains Mono" fontSize="9" letterSpacing="1.4" fill="#0A1614">ORCH</text>
      {/* Orbiting agents */}
      {[
      { a: 0, r: 80, lbl: 'TRIAGE', dur: 12 },
      { a: 60, r: 80, lbl: 'CORRELATE', dur: 12 },
      { a: 120, r: 80, lbl: 'REMEDIATE', dur: 12 },
      { a: 180, r: 80, lbl: 'SUMMARISE', dur: 12 },
      { a: 240, r: 80, lbl: 'EVAL', dur: 12 },
      { a: 300, r: 80, lbl: 'POLICY', dur: 12 }].
      map((d, i) => {
        const rad = d.a * Math.PI / 180;
        const x = 230 + Math.cos(rad) * d.r;
        const y = 230 + Math.sin(rad) * d.r;
        return (
          <g key={i}>
            <line x1="230" y1="230" x2={x} y2={y} stroke="#D9FF35" strokeWidth=".5" opacity=".35" />
            <circle cx={x} cy={y} r="5" fill="#D9FF35" />
          </g>);

      })}
      {/* Outer ring of tools */}
      {[
      { a: 30, r: 180, lbl: 'CRM' },
      { a: 75, r: 180, lbl: 'OBSERV' },
      { a: 120, r: 180, lbl: 'CMDB' },
      { a: 165, r: 180, lbl: 'PRICE' },
      { a: 210, r: 180, lbl: 'TICKETS' },
      { a: 255, r: 180, lbl: 'POLICY' },
      { a: 300, r: 180, lbl: 'DATA-LAKE' },
      { a: 345, r: 180, lbl: 'ENG-DB' }].
      map((d, i) => {
        const rad = d.a * Math.PI / 180;
        const x = 230 + Math.cos(rad) * d.r;
        const y = 230 + Math.sin(rad) * d.r;
        const lx = 230 + Math.cos(rad) * (d.r + 22);
        const ly = 230 + Math.sin(rad) * (d.r + 22);
        return (
          <g key={i}>
            <circle cx={x} cy={y} r="4" fill="#0C1A18" stroke="#234234" strokeWidth="1.2" />
            <text x={lx} y={ly + 3} textAnchor={Math.cos(rad) > 0.3 ? 'start' : Math.cos(rad) < -0.3 ? 'end' : 'middle'}
            fontFamily="JetBrains Mono" fontSize="9" letterSpacing="1.4" fill="#8DA09B">{d.lbl}</text>
          </g>);

      })}
      {/* corner readouts */}
      <text x="20" y="30" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#5A6E6A">AGENTIC · TOPOLOGY</text>
      <text x="440" y="30" textAnchor="end" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#D9FF35">6 AGENTS · 8 TOOLS</text>
      <text x="20" y="445" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#5A6E6A">EVAL · TRACE · GUARDRAIL</text>
    </svg>);

}

function Practices({ setRoute }) {
  return (
    <section className="section-pad-sm">
      <div className="section-tag">
        <span><span className="num">02</span> · Capabilities</span>
        <span>Four pillars · One operating model</span>
      </div>
      <div className="container">
        <div className="section-head">
          <h2 className="display-2xl">Automation and AI, <span className="serif-em" style={{ color: 'var(--ng-lime)' }}>built into</span> your operation.</h2>
          <p className="right">
            Four capabilities, one operating model. Hyper-automation and Agentic AI lead; cloud & edge and custom software & operations transformation support the automation-first model — so each pillar reinforces the others instead of stacking in isolation.
          </p>
        </div>

        {/* Featured: Hyper-Automation */}
        <article className="featured-practice">
          <div className="l">
            <div className="ix">{NG.featured.num} · {NG.featured.eyebrow}</div>
            <h3>
              Remove the manual work that<br />slows your operation <em>down.</em>
            </h3>
            <p>{NG.featured.summary}</p>
            <ul>
              {NG.featured.bullets.map((b, i) => <li key={i}>{b}</li>)}
            </ul>
            <div className="kpi">
              {NG.featured.kpi.map((k, i) =>
              <div key={i}>
                  <div className="v">{k.v}</div>
                  <div className="k">{k.k}</div>
                </div>
              )}
            </div>
          </div>
          <div className="r">
            <AgenticMiniDiagram />
          </div>
        </article>

        {/* Compact list */}
        <div className="prac-list">
          {NG.services.slice(1).map((s) =>
          <div key={s.id} className="prac-row" onClick={() => setRoute('services')}>
              <span className="ix">{s.num}</span>
              <div>
                <div className="ttl">{s.title}</div>
                <div className="mono" style={{ marginTop: 6, color: 'var(--ng-ink-mute)', textTransform: 'none', letterSpacing: 'normal', fontFamily: 'var(--font-body)', fontSize: 13.5 }}>{s.summary.split('.')[0]}.</div>
              </div>
              <div className="meta">{s.meta}</div>
              <span className="go"><Arr /></span>
            </div>
          )}
        </div>
      </div>
    </section>);

}

// ─── FRAMEWORK ────────────────────────────────────────────────
function Framework() {
  const [active, setActive] = hS(0);
  const [paused, setPaused] = hS(false);
  const [progress, setProgress] = hS(0);
  const f = NG.framework;
  const cur = f[active];

  // Auto-advance with a progress indicator
  hE(() => {
    if (paused) return;
    const step = 4500;
    const startedAt = performance.now();
    let raf;
    const tick = (now) => {
      const elapsed = now - startedAt;
      const p = Math.min(1, elapsed / step);
      setProgress(p);
      if (p >= 1) {
        setActive((a) => (a + 1) % f.length);
        return;
      }
      raf = requestAnimationFrame(tick);
    };
    raf = requestAnimationFrame(tick);
    return () => raf && cancelAnimationFrame(raf);
  }, [active, paused, f.length]);

  const select = (i) => {setPaused(true);setActive(i);setProgress(0);};

  return (
    <section className="section-pad-sm" id="framework">
      <div className="section-tag">
        <span><span className="num">03</span> · How we work</span>
        <span>Diagnose · Prioritize · Design · Build · Automate · Scale</span>
      </div>
      <div className="container">
        <div className="section-head">
          <h2 className="display-2xl">From diagnosis to <em className="serif-em" style={{ color: 'var(--ng-lime)' }}>working</em> systems.</h2>
          <p className="right">
            A six-stage delivery model that pairs consulting with execution. We diagnose the bottlenecks, prioritize the highest-value workflows, then design, build, automate and scale — in focused cycles, in production, not in slideware.
          </p>
        </div>

        <div className="fw-wrap">
          <div className="fw-track" onMouseLeave={() => setPaused(false)}>
            {f.map((s, i) =>
            <button key={s.code}
            className={`fw-cell ${i === active ? 'active' : ''} ${i < active ? 'passed' : ''}`}
            onMouseEnter={() => select(i)}
            onClick={() => select(i)}>
                <span className="indicator" />
                <span className="step">{s.step} · {s.code}</span>
                <div className="ttl">{s.title}</div>
                <span className="arrow">→</span>
                {i === active && !paused &&
              <div className="fw-progress" style={{ width: `${progress * 100}%`, top: 'auto', bottom: -1 }} />
              }
              </button>
            )}
          </div>

          <div className="fw-detail" key={cur.code}>
            <div className="l">
              <div className="step-label">STAGE {cur.step} · {cur.code}</div>
              <h3>{cur.title}.</h3>
              <p className="lede" style={{ marginTop: 14 }}>{cur.lede}</p>
            </div>
            <div>
              <h5>What we do</h5>
              <p>{cur.body}</p>
            </div>
            <div>
              <h5>Deliverables</h5>
              <ul>{cur.out.map((o, i) => <li key={i}>{o}</li>)}</ul>
            </div>
          </div>
        </div>
      </div>
    </section>);

}

// ─── CASES ────────────────────────────────────────────────────
function CaseFeatureDash() {
  // A mini "agentic NOC" dashboard for the feature case visual
  const [t, setT] = hS(0);
  hE(() => {const i = setInterval(() => setT((x) => x + 1), 1200);return () => clearInterval(i);}, []);
  const rng = (s) => {s = s | 0;return () => {s = s * 1664525 + 1013904223 | 0;return (s >>> 0) % 100000 / 100000;};};
  const r1 = rng(t + 13);
  const r2 = rng(t + 27);
  const bars = Array.from({ length: 24 }, () => 25 + r1() * 65);
  const spark = Array.from({ length: 24 }, () => 30 + r2() * 60);
  const sparkPath = (data, w, h) => {
    const max = Math.max(...data);
    return data.map((v, i) => `${i / (data.length - 1) * w},${h - v / max * (h - 4) - 2}`).join(' ');
  };
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 14, height: '100%' }}>
      <div className="mini-dash" style={{ flex: 1 }}>
        <div className="tile">
          <div className="lbl">Agents · active</div>
          <div className="v">38</div>
          <div style={{ display: 'flex', alignItems: 'end', gap: 2, height: 36, marginTop: 12 }}>
            {bars.map((v, i) => <i key={i} style={{ flex: 1, height: `${v}%`, background: '#D9FF35', opacity: 0.85, borderRadius: 1 }} />)}
          </div>
        </div>
        <div className="tile">
          <div className="lbl">Tier-1 · auto-resolved</div>
          <div className="v">52<small>%</small></div>
          <div style={{ marginTop: 16, height: 36, position: 'relative' }}>
            <div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, height: 4, background: '#1A2E29', borderRadius: 2 }} />
            <div style={{ position: 'absolute', bottom: 0, left: 0, width: '52%', height: 4, background: '#D9FF35', borderRadius: 2 }} />
            <div style={{ position: 'absolute', bottom: 12, left: '52%', transform: 'translateX(-50%)', fontFamily: 'JetBrains Mono', fontSize: 9, color: '#D9FF35', letterSpacing: '0.1em' }}>↑ AI THRESHOLD</div>
          </div>
        </div>
        <div className="tile full">
          <div className="lbl">MTTR · last 30 days</div>
          <div className="v">−74<small>%</small> <span style={{ fontSize: 14, color: 'var(--ng-ink-mute)', marginLeft: 14 }}>cross-domain, sub-90s detect</span></div>
          <svg viewBox="0 0 360 36" style={{ width: '100%', height: 36, marginTop: 12 }}>
            <polyline points={sparkPath(spark, 360, 36)} fill="none" stroke="#D9FF35" strokeWidth="1.6" opacity="0.95" />
            <polyline points={sparkPath(spark.map((v, i) => v * (1 + i * 0.04)), 360, 36)} fill="none" stroke="#5A6E6A" strokeWidth="1" strokeDasharray="3 3" />
          </svg>
        </div>
        <div className="tile">
          <div className="lbl">Sites monitored</div>
          <div className="v">2,847</div>
          <div className="mono" style={{ marginTop: 14, fontSize: 10, color: 'var(--ng-lime)' }}>↑ 12 last 24h</div>
        </div>
        <div className="tile">
          <div className="lbl">Run-rate save</div>
          <div className="v">€21<small>M</small></div>
          <div className="mono" style={{ marginTop: 14, fontSize: 10, color: 'var(--ng-ink-dim)' }}>ANNUALISED</div>
        </div>
      </div>
    </div>);

}

function CaseSecondaryViz({ id }) {
  if (id === 'proposal') {
    return (
      <svg viewBox="0 0 460 220" style={{ width: '100%', height: 220 }}>
        <text x="20" y="28" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#5A6E6A">PROPOSAL CYCLE</text>
        <text x="20" y="64" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#8DA09B">BEFORE</text>
        <rect x="20" y="74" width="420" height="12" fill="#1A2E29" rx="2" />
        <text x="440" y="106" textAnchor="end" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#5A6E6A">6 WEEKS</text>
        <text x="20" y="148" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#D9FF35">AFTER</text>
        <rect x="20" y="158" width="14" height="12" fill="#D9FF35" rx="2" />
        <text x="42" y="186" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#D9FF35">6 HOURS</text>
        <text x="440" y="186" textAnchor="end" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#D9FF35">+4.1pts MARGIN</text>
      </svg>);

  }
  // edge: world map dots
  return (
    <svg viewBox="0 0 460 220" style={{ width: '100%', height: 220 }}>
      <text x="20" y="28" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#5A6E6A">EDGE FLEET · 4,200 STORES</text>
      {Array.from({ length: 80 }).map((_, i) => {
        const x = 25 + i * 31 % 420 + Math.floor(i / 14) * 7;
        const y = 60 + Math.floor(i / 14) * 22 + i % 3 * 4;
        const lit = i % 6 === 0;
        return <circle key={i} cx={x} cy={y} r={lit ? 3 : 1.6} fill={lit ? '#D9FF35' : '#1A2E29'} />;
      })}
      <text x="440" y="200" textAnchor="end" fontFamily="JetBrains Mono" fontSize="10" letterSpacing="1.4" fill="#D9FF35">−86% ON-PREM</text>
    </svg>);

}

function Cases({ setRoute }) {
  const f = NG.cases.feature;
  return (
    <section className="section-pad-sm">
      <div className="section-tag">
        <span><span className="num">09</span> · Use cases</span>
        <span>Production engagements · Five capabilities</span>
      </div>
      <div className="container">
        <div className="section-head">
          <h2 className="display-2xl">Automation and AI, <em className="serif-em" style={{ color: 'var(--ng-lime)' }}>in production.</em></h2>
          <p className="right">
            Concrete engagements that show the shape of how we work — when hyper-automation, Agentic AI and custom software are designed into the operation together rather than bought as separate workstreams.
          </p>
        </div>

        <article className="case-feature" onClick={() => setRoute('case')} style={{ cursor: 'pointer' }}>
          <div className="l">
            <div className="tag">{f.tag}</div>
            <div className="client">{f.client}</div>
            <h3>A treasury close that <em>runs itself</em><br />between 02:00 and 06:00.</h3>
            <p>{f.summary}</p>
            <div className="metrics">
              {f.metrics.map((m, i) =>
              <div key={i}>
                  <div className="v">{m.v}</div>
                  <div className="k">{m.k}</div>
                </div>
              )}
            </div>
            <span className="read">Read the case <Arr /></span>
          </div>
          <div className="r">
            <CaseFeatureDash />
          </div>
        </article>

        <div className="case-secondary-grid">
          {NG.cases.secondary.map((c) =>
          <article key={c.id} className="case-secondary" onClick={() => setRoute('case')}>
              <div className="tag">{c.tag}</div>
              <div className="client">{c.client}</div>
              <h3>{c.title}</h3>
              <p>{c.summary}</p>
              <CaseSecondaryViz id={c.id} />
              <div className="metrics">
                {c.metrics.map((m, i) =>
              <div key={i}>
                    <div className="v">{m.v}</div>
                    <div className="k">{m.k}</div>
                  </div>
              )}
              </div>
            </article>
          )}
        </div>
      </div>
    </section>);

}

// ─── INDUSTRIES ──────────────────────────────────────────────
function Industries() {
  return (
    <section className="section-pad-sm" id="industries">
      <div className="section-tag">
        <span><span className="num">05</span> · Industries</span>
        <span>Where we work</span>
      </div>
      <div className="container">
        <div className="section-head">
          <h2 className="display-2xl">Where we <em className="serif-em" style={{ color: 'var(--ng-lime)' }}>work.</em></h2>
          <p className="right">
            Anywhere operations are mission-critical. Concentrated depth in financial services, telecom and retail; growing footprint in manufacturing, logistics and platform businesses.
          </p>
        </div>
        <div className="ind-band">
          {NG.industries.map((ind) =>
          <div key={ind.num} className="ind-cell">
              <div className="num">{ind.num}</div>
              <h4>{ind.name}</h4>
              <div className="desc">{ind.desc}</div>
            </div>
          )}
        </div>
      </div>
    </section>);

}

// ─── IMPACT ──────────────────────────────────────────────────
function Impact() {
  return (
    <section className="section-pad-sm">
      <div className="section-tag">
        <span><span className="num">06</span> · Business impact</span>
        <span>Outcomes, instrumented</span>
      </div>
      <div className="container">
        <div className="section-head">
          <h2 className="display-2xl">Outcomes, <em className="serif-em" style={{ color: 'var(--ng-lime)' }}>instrumented.</em></h2>
          <p className="right">
            We instrument every engagement against the same outcome model — cost-to-serve, decision velocity, operational reliability, agents in production — so the business case stays honest from kickoff to scale.
          </p>
        </div>
        <div className="impact-strip">
          {NG.impact.map((k, i) =>
          <div key={i}>
              <div className="v"><Counter value={k.v} /><sup>{k.sup}</sup></div>
              <div className="label">{k.label}</div>
              <div className="desc">{k.desc}</div>
            </div>
          )}
        </div>
      </div>
    </section>);

}

// ─── MANIFESTO (About) ───────────────────────────────────────
function ManifestoH2({ parts }) {
  return (
    <h2>
      {parts.map((p, i) => {
        if (typeof p === 'string') return <React.Fragment key={i}>{p}</React.Fragment>;
        if (p.italic) return <em key={i} className="serif-em" style={{ color: p.lime ? 'var(--ng-lime)' : undefined }}>{p.text}</em>;
        return <React.Fragment key={i}>{p.text}</React.Fragment>;
      })}
    </h2>);

}

function Manifesto() {
  return (
    <section className="section-pad-sm" id="about">
      <div className="section-tag">
        <span><span className="num">11</span> · Manifesto</span>
        <span>The meaning of the name</span>
      </div>
      <div className="container">
        <div className="manifesto">
          <div className="l">
            <div className="logo-stage">
              <div className="logo-anim">
                <img className="morph bw" src={(window.__resources && window.__resources.logoMarkWhite) || "assets/logo-mark-white.png"} alt="" />
                <img className="morph color" src={(window.__resources && window.__resources.logoMarkColor) || "assets/logo-mark-color.png"} alt="" />
              </div>
              <div className="caption">GREY → GREEN · THE TRANSFORMATION LOOP</div>
            </div>
            <div className="manifesto-stats">
              {NG.manifesto.stats.map((s, i) =>
              <div key={i} className="cell">
                  <div className="v">{s.v}</div>
                  <div className="k">{s.k}</div>
                </div>
              )}
            </div>
          </div>
          <div className="r">
            <span className="eyebrow">About · Brand DNA</span>
            <ManifestoH2 parts={NG.manifesto.h2} />
            <div className="body">
              {NG.manifesto.body.map((p, i) => <p key={i} dangerouslySetInnerHTML={{ __html: p }} />)}
            </div>
          </div>
        </div>
      </div>
    </section>);

}

// ─── FINAL CTA ───────────────────────────────────────────────
function FinalCTA() {
  return (
    <section className="final-cta">
      <div className="inner">
        <span className="eyebrow">12 · Next step</span>
        <h2>Turn operational complexity into <em className="serif-em">intelligent execution.</em></h2>
        <p>A 45-minute working session with a partner. We help you identify the workflows, systems and decisions that can be automated, augmented or rebuilt for scale — and the fastest path to production. You leave with a concrete next move.</p>
        <div className="ctas">
          <a className="btn primary" href="#" data-route="book"><Arr />Start a project</a>
          <a className="btn ghost" href="#"><Arr />Capability deck</a>
        </div>
      </div>
    </section>);

}

Object.assign(window, {
  Topbar, Nav, Footer, OpsFeed,
  Hero, Thesis, Practices, Framework, Cases, Industries, Impact, Manifesto, FinalCTA,
  Counter, Arr
});