/* Hallmir marketing homepage — composes the design-system primitives. */
const {
  Button, IconButton, Badge, Card, Stat, SectionLabel,
  BalanceChip, TransactionRow, Tabs, AnnouncementBar,
} = window.HallmirDesignSystem_80aa39;

const MAIL = 'mailto:hello@hallmir.com';
const MAX = 1160;

/* Pre-launch gate. The pages behind the nav, the log-in, and the secondary CTAs
   are not built yet, so every one of those links resolves to href="#" and goes
   nowhere. Rather than ship dead affordances, they are hidden behind this flag.
   Flip to true (and give each link a real href) as the pages ship. */
const SHOW_UNBUILT_LINKS = false;
const wrap = { maxWidth: MAX, margin: '0 auto', padding: '0 40px' };

/* Reactively tracks the mobile layer (<=900px) so components can swap layouts. */
function useIsNarrow() {
  const [narrow, setNarrow] = React.useState(window.innerWidth <= 900);
  React.useEffect(() => {
    const on = () => setNarrow(window.innerWidth <= 900);
    window.addEventListener('resize', on);
    return () => window.removeEventListener('resize', on);
  }, []);
  return narrow;
}

/* ---------- Header (Revolut-style: nav pills + hover mega-menu) ---------- */
const heroMenus = {
  Services: {
    featured: { title: 'Services', desc: 'Production AI, engineered into the P&L and scoped to pay back inside the hold.', cta: 'How we work' },
    columns: [
      { title: 'Assess', desc: 'Know what moves the number.', items: ['2-week value diagnostic', 'AI due diligence', 'Value‑creation roadmap'] },
      { title: 'Build', desc: 'Systems that ship in weeks.', items: ['Production AI systems', 'Data & platform foundations', 'Copilots & automation'] },
      { title: 'Run', desc: 'Owned by your team, not us.', items: ['Handover & enablement', 'Governance & audit', 'Ongoing coverage'] },
    ],
    band: { title: 'Case studies', desc: 'Three engagements, still in production, told by the operators who run them.' },
  },
  Clients: {
    featured: { title: 'Clients', desc: 'Two ways in, one discipline: funds and the companies they own.', cta: 'Talk to us' },
    columns: [
      { title: 'PE funds', desc: 'Portfolio‑wide value creation.', items: ['Operating partners', 'Value‑creation teams', 'Deal teams & diligence'] },
      { title: 'Portfolio companies', desc: 'Built with your team, handed over.', items: ['CEOs & boards', 'CTOs & product leads', 'Operations leaders'] },
    ],
    band: { title: 'Our approach', desc: 'Senior teams, proven delivery, measurable value creation.' },
  },
  Work: {
    featured: { title: 'Work', desc: 'Every engagement lands as a line in the P&L.', cta: 'See case studies' },
    columns: [
      { title: 'Case studies', desc: 'Still in production.', items: ['Predictive maintenance', 'Pricing & load optimisation', 'Underwriting models', 'Portfolio AI programmes'] },
      { title: 'Insights', desc: 'How we think about the hold.', items: ['Build vs. buy in the hold', 'AI at diligence', 'The governance standard'] },
    ],
    band: { title: 'Talk to us', desc: 'Speak to a senior partner about your portfolio.' },
  },
  Firm: {
    featured: { title: 'Firm', desc: 'A productized AI engineering firm for private equity.', cta: 'About us' },
    columns: [
      { title: 'Company', desc: 'Who we are.', items: ['About', 'Team', 'Careers'] },
      { title: 'Trust', desc: 'How we operate.', items: ['Governance', 'Security', 'Press'] },
    ],
    band: { title: 'Careers', desc: 'Do the best work of your career alongside senior engineers.' },
  },
};

function Header() {
  const [open, setOpen] = React.useState(null);
  const [sheet, setSheet] = React.useState(false);
  const links = Object.keys(heroMenus);
  const menu = open ? heroMenus[open] : null;
  const glow = '0 1px 12px rgba(8,14,26,0.45)';
  const hairInv = '1px solid rgba(246,243,236,0.10)';
  return (
    <div onMouseLeave={() => setOpen(null)} style={{ position: 'relative', zIndex: 60, height: 0 }}>
      {/* Mercury-style transparent header floating over the hero footage */}
      <div className="rhdrwrap" style={{ position: 'absolute', top: 16, left: 20, right: 20 }}>

        {/* Expanded state: full-width dark panel attached under the bar (Mercury pattern) */}
        {menu ? (
          <div style={{ position: 'absolute', top: 0, left: 0, right: 0, borderRadius: '28px 28px 20px 20px', background: 'rgba(12,21,35,0.96)', backdropFilter: 'blur(24px)', WebkitBackdropFilter: 'blur(24px)', boxShadow: '0 30px 80px rgba(6,12,20,0.5)', paddingTop: 72, paddingBottom: 6 }}>
            <div style={{ display: 'flex', alignItems: 'stretch', padding: '6px 14px 0' }}>
              <div style={{ width: 220, flex: 'none', padding: '14px 22px 16px', display: 'flex', flexDirection: 'column' }}>
                <div style={{ fontFamily: 'var(--font-sans)', fontSize: 17, fontWeight: 600, color: '#fff' }}>{menu.featured.title}</div>
                <div style={{ fontFamily: 'var(--font-sans)', fontSize: 12.5, lineHeight: 1.5, color: 'rgba(246,243,236,0.66)', marginTop: 7, maxWidth: 190 }}>{menu.featured.desc}</div>
                <div style={{ flex: 1, minHeight: 28 }}></div>
                <a href="#" style={{ alignSelf: 'flex-start', display: 'inline-flex', alignItems: 'center', gap: 8, fontFamily: 'var(--font-sans)', fontSize: 13, fontWeight: 600, color: '#fff', border: '1px solid rgba(246,243,236,0.32)', borderRadius: 999, padding: '7px 14px' }}>{menu.featured.cta} <span aria-hidden="true" style={{ fontSize: 12 }}>↗</span></a>
              </div>
              {menu.columns.map((c) => (
                <div key={c.title} style={{ flex: 1, borderLeft: hairInv, padding: '14px 22px 16px' }}>
                  <div style={{ fontFamily: 'var(--font-sans)', fontSize: 14.5, fontWeight: 600, color: '#fff' }}>{c.title}</div>
                  <div style={{ fontFamily: 'var(--font-sans)', fontSize: 12.5, lineHeight: 1.5, color: 'rgba(246,243,236,0.6)', marginTop: 5, marginBottom: 12 }}>{c.desc}</div>
                  <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
                    {c.items.map((it) => (
                      <a key={it} href="#" style={{ fontFamily: 'var(--font-sans)', fontSize: 13.5, fontWeight: 500, color: 'rgba(255,255,255,0.88)', border: 0 }}>{it}</a>
                    ))}
                  </div>
                </div>
              ))}
            </div>
            <div style={{ borderTop: hairInv, margin: '10px 12px 0', padding: '12px 22px 12px' }}>
              <a href="#" style={{ display: 'inline-flex', alignItems: 'center', gap: 12, fontFamily: 'var(--font-sans)', fontSize: 15, fontWeight: 600, color: '#fff', border: 0 }}>
                {menu.band.title}
                <span aria-hidden="true" style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 20, height: 20, borderRadius: '50%', background: 'rgba(246,243,236,0.14)', fontSize: 11 }}>→</span>
              </a>
              <div style={{ fontFamily: 'var(--font-sans)', fontSize: 12.5, color: 'rgba(246,243,236,0.6)', marginTop: 4 }}>{menu.band.desc}</div>
            </div>
          </div>
        ) : null}

        {/* Bar (always above the panel) */}
        <div className="rhdrbar" style={{ position: 'relative', display: 'flex', alignItems: 'center', height: 62, padding: '0 30px', maxWidth: 1400, margin: '0 auto' }}>
          <span style={{ font: '400 25px/1 var(--font-display)', letterSpacing: '-0.01em', color: '#fff', textShadow: glow }}>hallmir</span>
          {SHOW_UNBUILT_LINKS ? (
            <nav className="rhide" style={{ display: 'flex', gap: 4, flex: 1, justifyContent: 'center', alignItems: 'center' }}>
              {links.map((l) => (
                <a key={l} href="#"
                  onMouseEnter={() => setOpen(l)}
                  style={{
                    display: 'inline-flex', alignItems: 'center', gap: 7,
                    fontFamily: 'var(--font-sans)', fontSize: 14, fontWeight: 500,
                    color: '#fff', textShadow: glow, border: 0,
                    background: open === l ? 'rgba(255,255,255,0.14)' : 'transparent',
                    borderRadius: 999, padding: '8px 14px', transition: 'background 120ms cubic-bezier(0.2,0,0,1)',
                  }}>{l}<span aria-hidden="true" style={{ fontSize: 9, opacity: 0.8, transform: open === l ? 'rotate(180deg)' : 'none', transition: 'transform 160ms' }}>▾</span></a>
              ))}
            </nav>
          ) : null}
          {/* spacer: unconditional, since the nav that used to carry flex:1 may be hidden */}
          <div style={{ flex: 1 }}></div>
          <div style={{ display: 'flex', gap: 22, alignItems: 'center' }}>
            {SHOW_UNBUILT_LINKS ? (
              <a href="#" className="rhide" style={{ fontFamily: 'var(--font-sans)', fontSize: 14, fontWeight: 500, color: '#fff', textShadow: glow, border: 0 }}>Log in</a>
            ) : null}
            <button onClick={() => { window.location.href = MAIL; }} style={{ fontFamily: 'var(--font-sans)', fontSize: 14, fontWeight: 600, color: 'var(--ink-1)', background: '#fff', border: 0, borderRadius: 999, padding: '10px 20px', cursor: 'pointer', whiteSpace: 'nowrap', boxShadow: '0 2px 14px rgba(8,14,26,0.18)' }}>Talk to us</button>
            {SHOW_UNBUILT_LINKS ? (
              <button className="rshow" aria-label="Menu" onClick={() => setSheet(true)} style={{ width: 40, height: 40, display: 'inline-flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 5, background: 'rgba(255,255,255,0.14)', border: 0, borderRadius: 999, cursor: 'pointer' }}>
                <span style={{ width: 16, height: 1.5, background: '#fff', display: 'block' }}></span>
                <span style={{ width: 16, height: 1.5, background: '#fff', display: 'block' }}></span>
              </button>
            ) : null}
          </div>
        </div>
      </div>

      {/* Mobile full-screen menu sheet */}
      {sheet ? (
        <div style={{ position: 'fixed', inset: 0, zIndex: 300, background: 'var(--inv-surface)', color: '#fff', overflowY: 'auto', padding: '18px 22px 40px' }}>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 26 }}>
            <span style={{ font: '400 26px/1 var(--font-display)', letterSpacing: '-0.01em' }}>hallmir</span>
            <button aria-label="Close menu" onClick={() => setSheet(false)} style={{ width: 40, height: 40, borderRadius: 999, border: 0, background: 'rgba(246,243,236,0.12)', color: '#fff', fontSize: 16, cursor: 'pointer' }}>✕</button>
          </div>
          {Object.keys(heroMenus).map((k) => (
            <div key={k} style={{ borderTop: '1px solid rgba(246,243,236,0.12)', padding: '18px 0' }}>
              <div style={{ fontFamily: 'var(--font-sans)', fontSize: 18, fontWeight: 600, marginBottom: 12 }}>{k}</div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 11 }}>
                {heroMenus[k].columns.flatMap((c) => c.items).map((it) => (
                  <a key={it} href="#" style={{ fontFamily: 'var(--font-sans)', fontSize: 15, fontWeight: 500, color: 'rgba(255,255,255,0.85)', border: 0 }}>{it}</a>
                ))}
              </div>
            </div>
          ))}
          <div style={{ borderTop: '1px solid rgba(246,243,236,0.12)', paddingTop: 22, display: 'flex', gap: 14, marginTop: 4 }}>
            <a href="#" style={{ fontFamily: 'var(--font-sans)', fontSize: 15, fontWeight: 600, color: '#fff', border: '1px solid rgba(246,243,236,0.35)', borderRadius: 999, padding: '12px 22px' }}>Log in</a>
            <a href={MAIL} style={{ fontFamily: 'var(--font-sans)', fontSize: 15, fontWeight: 600, color: 'var(--ink-1)', background: '#fff', borderRadius: 999, padding: '12px 22px', border: 0 }}>Talk to us</a>
          </div>
        </div>
      ) : null}
    </div>
  );
}

/* ---------- Hero (scroll morph: full-bleed photo breaks down into a card row) ---------- */
const heroLerp = (a, b, t) => a + (b - a) * t;
const heroClamp = (v) => Math.min(1, Math.max(0, v));
const heroSmooth = (t) => { const c = heroClamp(t); return c * c * (3 - 2 * c); };

function MiniTxChip({ icon, title, meta, amount }) {
  return (
    <div style={{ background: 'rgba(255,255,255,0.82)', backdropFilter: 'blur(8px)', WebkitBackdropFilter: 'blur(8px)', borderRadius: 14, padding: '13px 15px', display: 'flex', alignItems: 'center', gap: 12, boxShadow: 'var(--shadow-float)' }}>
      <span style={{ width: 34, height: 34, borderRadius: '50%', background: 'var(--ink-1)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'var(--paper-1)', flex: 'none', fontFamily: 'var(--font-display)', fontSize: 17, lineHeight: 1 }}>{icon}</span>
      <span style={{ flex: 1, minWidth: 0 }}>
        <span style={{ display: 'block', font: 'var(--type-body-sm)', fontWeight: 600, color: 'var(--ink-1)', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{title}</span>
        <span style={{ display: 'block', font: 'var(--type-body-sm)', fontSize: 12, color: 'var(--text-faint)', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{meta}</span>
      </span>
      <span style={{ font: 'var(--type-data)', fontSize: 13, color: 'var(--ink-1)' }}>{amount}</span>
    </div>
  );
}

function AbstractPanel({ variant }) {
  const grain = { position: 'absolute', inset: 0, backgroundImage: capGrain, opacity: 0.16, mixBlendMode: 'overlay', pointerEvents: 'none' };
  return (
    <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, #2B3947 0%, #1C2733 100%)', overflow: 'hidden' }}>
      <div style={{ position: 'absolute', left: '-22%', right: '-22%', bottom: '-30%', height: '62%', background: 'radial-gradient(ellipse at 50% 100%, rgba(198,212,222,0.5) 0%, rgba(198,212,222,0.14) 46%, transparent 72%)', filter: 'blur(24px)', animation: 'startMist 9s ease-in-out infinite alternate' }}></div>
      <svg viewBox="0 0 700 1000" preserveAspectRatio="none" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <defs>
          <linearGradient id="apSpire" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0" stopColor="#C9D6DF" stopOpacity="0" />
            <stop offset="1" stopColor="#C9D6DF" stopOpacity="0.5" />
          </linearGradient>
          <filter id="apB" x="-40%" y="-40%" width="180%" height="180%"><feGaussianBlur stdDeviation="10" /></filter>
        </defs>
        {variant === 'summit' ? (
          <g>
            <path d="M 350 260 C 356 480 380 630 480 740 C 550 810 640 860 700 885 L 700 1000 L 0 1000 L 0 885 C 60 860 150 810 220 740 C 320 630 344 480 350 260 Z" fill="url(#apSpire)" filter="url(#apB)" />
            <path d="M 350 1000 L 350 260" fill="none" stroke="rgba(247,243,237,0.5)" strokeWidth="1.2" />
            <path d="M 90 1000 C 230 850 320 640 344 430" fill="none" stroke="rgba(247,243,237,0.26)" strokeWidth="1" />
            <path d="M 610 1000 C 470 850 380 640 356 430" fill="none" stroke="rgba(247,243,237,0.26)" strokeWidth="1" />
            <circle cx="350" cy="260" r="9" fill="#F7F3ED" />
            <circle cx="350" cy="260" r="42" fill="none" stroke="rgba(247,243,237,0.35)" strokeWidth="1" />
            <circle cx="350" cy="260" r="90" fill="rgba(247,243,237,0.1)" filter="url(#apB)" />
            <circle r="5" fill="#F7F3ED"><animateMotion dur="10s" repeatCount="indefinite" path="M 350 1000 L 350 260" /></circle>
            <circle r="4" fill="#F7F3ED" opacity="0.8"><animateMotion dur="14s" begin="3s" repeatCount="indefinite" path="M 90 1000 C 230 850 320 640 344 430" /></circle>
          </g>
        ) : variant === 'orbits' ? (
          <g>
            {[110, 190, 275].map((r) => (
              <ellipse key={r} cx="350" cy="430" rx={r} ry={r * 1.18} fill="none" stroke={'rgba(247,243,237,' + (0.32 - r * 0.0008) + ')'} strokeWidth="1" />
            ))}
            <circle cx="350" cy="430" r="70" fill="rgba(247,243,237,0.12)" filter="url(#apB)" />
            <circle cx="350" cy="430" r="7" fill="#F7F3ED" />
            <circle r="4.5" fill="#F7F3ED"><animateMotion dur="16s" repeatCount="indefinite" path="M 350 300.4 A 110 129.8 0 1 1 349.9 300.4" /></circle>
            <circle r="4" fill="#F7F3ED" opacity="0.75"><animateMotion dur="24s" begin="4s" repeatCount="indefinite" path="M 350 205.8 A 190 224.2 0 1 1 349.9 205.8" /></circle>
            <circle r="4" fill="var(--coral-1)"><animateMotion dur="30s" begin="9s" repeatCount="indefinite" path="M 350 105.5 A 275 324.5 0 1 1 349.9 105.5" /></circle>
          </g>
        ) : (
          <g>
            <path d="M 60 740 L 640 740" fill="none" stroke="rgba(247,243,237,0.35)" strokeWidth="1" />
            {[130, 220, 310, 400, 495].map((x, j) => (
              <path key={x} d={'M ' + x + ' 732 L ' + x + ' 748'} fill="none" stroke={'rgba(247,243,237,' + (j === 4 ? 0.7 : 0.35) + ')'} strokeWidth="1" />
            ))}
            <rect x="483" y="250" width="24" height="490" fill="rgba(201,214,223,0.18)" filter="url(#apB)" />
            <path d="M 495 740 L 495 250" fill="none" stroke="rgba(247,243,237,0.6)" strokeWidth="1.4" />
            <circle cx="495" cy="250" r="8" fill="#F7F3ED" />
            <circle cx="495" cy="250" r="38" fill="none" stroke="rgba(247,243,237,0.35)" strokeWidth="1" />
            <circle cx="495" cy="250" r="80" fill="rgba(247,243,237,0.1)" filter="url(#apB)" />
            <circle r="5" fill="#F7F3ED"><animateMotion dur="8s" repeatCount="indefinite" path="M 60 740 L 495 740 L 495 250" /></circle>
          </g>
        )}
      </svg>
      <div style={grain}></div>
    </div>
  );
}

function SilkPanel({ variant }) {
  const bg = variant === 'summit'
    ? 'radial-gradient(115% 85% at 82% 4%, rgba(122,150,210,0.85) 0%, rgba(122,150,210,0) 52%), radial-gradient(105% 80% at 112% 40%, rgba(59,78,184,0.65) 0%, rgba(59,78,184,0) 55%), radial-gradient(120% 95% at 58% 82%, rgba(186,196,220,0.38) 0%, rgba(186,196,220,0) 58%), radial-gradient(95% 85% at 108% 108%, rgba(16,30,58,0.92) 0%, rgba(16,30,58,0) 60%), linear-gradient(150deg, #16233C 0%, #0A1322 100%)'
    : 'radial-gradient(115% 85% at 80% 4%, rgba(148,168,205,0.8) 0%, rgba(148,168,205,0) 52%), radial-gradient(105% 80% at 112% 42%, rgba(84,104,168,0.7) 0%, rgba(84,104,168,0) 55%), radial-gradient(120% 95% at 60% 84%, rgba(205,186,158,0.28) 0%, rgba(205,186,158,0) 58%), radial-gradient(95% 85% at 106% 108%, rgba(13,24,46,0.92) 0%, rgba(13,24,46,0) 60%), linear-gradient(150deg, #131E33 0%, #091120 100%)';
  return (
    <div style={{ position: 'absolute', inset: 0, background: bg, overflow: 'hidden' }}>
      <div style={{ position: 'absolute', inset: '-25%', background: 'conic-gradient(from 210deg at 62% 34%, transparent 0deg, rgba(255,255,255,0.16) 40deg, transparent 96deg)', filter: 'blur(34px)', animation: 'startMist 13s ease-in-out infinite alternate' }}></div>
      <div style={{ position: 'absolute', inset: 0, backgroundImage: capGrain, opacity: 0.14, mixBlendMode: 'overlay', pointerEvents: 'none' }}></div>
    </div>
  );
}

function SideCard({ variant, label, amount, chip, style, cta = 'Case study', image }) {
  return (
    <div style={{ position: 'absolute', borderRadius: 16, overflow: 'hidden', ...style }}>
      {image
        ? <img src={image} alt="" draggable="false" loading="lazy" decoding="async" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover' }} />
        : <AbstractPanel variant={variant} />}
      <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none', background: image ? 'linear-gradient(180deg, rgba(10,18,30,0.5) 0%, rgba(10,18,30,0.22) 44%, rgba(10,18,30,0.64) 100%)' : 'linear-gradient(180deg, rgba(12,25,38,0.38) 0%, rgba(12,25,38,0.14) 45%, rgba(12,25,38,0.42) 100%)' }}></div>
      <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'space-between', padding: 14 }}>
        <div style={{ marginTop: 56, textAlign: 'center' }}>
          <div style={{ font: 'var(--type-body-sm)', fontWeight: 500, color: '#fff', textShadow: '0 1px 10px rgba(17,34,49,0.45)' }}>{label}</div>
          <div style={{ font: '700 34px/1.15 var(--font-display)', letterSpacing: '-0.02em', color: '#fff', textShadow: '0 2px 14px rgba(17,34,49,0.45)', fontVariantNumeric: 'tabular-nums' }}>{amount}</div>
          <button style={{ pointerEvents: 'auto', font: 'var(--type-ui-medium)', fontSize: 13, color: 'var(--ink-1)', background: '#fff', border: 0, borderRadius: 999, padding: '9px 18px', marginTop: 10, cursor: 'pointer', boxShadow: 'var(--shadow-float)' }}>{cta}</button>
        </div>
        <div style={{ width: '100%' }}>{chip}</div>
      </div>
    </div>
  );
}

/* Mobile hero: Mercury-style stacked flow — no scroll-jacking below 900px. */
function HeroMorphMobile() {
  const [active, setActive] = React.useState(0);
  const [paused, setPaused] = React.useState(false);
  const startX = React.useRef(null);
  const resumeRef = React.useRef(0);
  const N = 3, CW = 300, CH = 500, SP = 150;
  const pauseAuto = () => { setPaused(true); clearTimeout(resumeRef.current); resumeRef.current = setTimeout(() => setPaused(false), 7000); };
  const go = (d) => setActive((a) => (a + d + N) % N);
  const jump = (i) => { setActive(i); pauseAuto(); };
  const onDown = (e) => { startX.current = e.touches ? e.touches[0].clientX : e.clientX; };
  const onUp = (e) => {
    if (startX.current == null) return;
    const x = e.changedTouches ? e.changedTouches[0].clientX : e.clientX;
    const dx = x - startX.current; startX.current = null;
    if (Math.abs(dx) > 36) { go(dx < 0 ? 1 : -1); pauseAuto(); }
  };
  // Auto-advance (loops), pausing for a while after any manual interaction.
  React.useEffect(() => {
    if (paused) return;
    const id = setInterval(() => setActive((a) => (a + 1) % N), 4200);
    return () => clearInterval(id);
  }, [paused]);
  React.useEffect(() => () => clearTimeout(resumeRef.current), []);
  // Revolut coverflow: active card centered + big, a smaller card on each side.
  const cardWrap = (i) => {
    let off = i - active;
    if (off > N / 2) off -= N;                     // wrap to nearest so both sides always show a card
    if (off < -N / 2) off += N;
    const a = Math.abs(off);
    const scale = a === 0 ? 1 : 0.84;
    return {
      position: 'absolute', top: 0, left: '50%', width: CW, height: CH, marginLeft: -(CW / 2), borderRadius: 16,
      transform: 'translateX(' + (off * SP) + 'px) scale(' + scale + ')',
      transformOrigin: 'center center', opacity: a === 0 ? 1 : 0.82, zIndex: 30 - a * 10,
      boxShadow: a === 0 ? '0 28px 60px rgba(10,18,30,0.36)' : '0 14px 32px rgba(10,18,30,0.20)',
      transition: 'transform 700ms cubic-bezier(0.16,1,0.3,1), opacity 500ms ease',
      willChange: 'transform', WebkitBackfaceVisibility: 'hidden', cursor: 'pointer',
    };
  };
  return (
    <div style={{ padding: '14px 12px 0' }}>
      <div style={{ position: 'relative', borderRadius: 24, overflow: 'hidden', height: '76vh', minHeight: 480, background: 'linear-gradient(165deg, #6FA3CC 0%, #8FBBDF 55%, #A8CCE7 100%)' }}>
        <video src="/uploads/Video Design.mp4?v=3" poster="/uploads/video-poster.jpg" autoPlay loop muted playsInline preload="auto" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover' }}></video>
        <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, rgba(8,14,26,0.45) 0%, rgba(8,14,26,0.12) 40%, rgba(8,14,26,0.55) 100%)' }}></div>
        <div style={{ position: 'absolute', left: 0, right: 0, bottom: 0, padding: '0 22px 40px' }}>
          <h1 style={{ font: '400 40px/1.06 var(--font-display)', letterSpacing: '-0.01em', color: '#fff', margin: 0, textShadow: '0 2px 24px rgba(8,14,26,0.5)', animation: 'capIn 600ms cubic-bezier(0.2,0,0,1) both' }}>AI that earns its place</h1>
          <p style={{ font: '400 16px/1.55 var(--font-sans)', color: 'rgba(255,255,255,0.94)', margin: '16px 0 26px', maxWidth: 330, textShadow: '0 1px 14px rgba(8,14,26,0.5)', animation: 'capIn 600ms cubic-bezier(0.2,0,0,1) 100ms both' }}>Productized AI engineering for private equity and the companies they own. Built by senior teams, measured in the P&amp;L.</p>
          <button onClick={() => { window.location.href = MAIL; }} style={{ font: '500 16px/1 var(--font-sans)', color: '#101D2E', background: '#FFFFFF', border: 0, borderRadius: 999, padding: '15px 32px', cursor: 'pointer', animation: 'capIn 600ms cubic-bezier(0.2,0,0,1) 200ms both' }}>Talk to us</button>
        </div>
      </div>

      {/* Value creation \u2014 Revolut-style: left-aligned intro + swipeable card carousel */}
      <div style={{ padding: '58px 22px 38px' }}>
        <h2 style={{ font: '400 34px/1.1 var(--font-display)', letterSpacing: '-0.01em', color: 'var(--ink-1)', margin: 0 }}>Value creation, engineered</h2>
        <p style={{ font: '400 16px/1.55 var(--font-sans)', color: 'var(--text-muted)', margin: '14px 0 26px', maxWidth: 430 }}>We partner with operating teams to design, build, and deploy AI where it earns its place: in the P&L, not the pitch deck.</p>
        <button style={{ font: '500 15px/1 var(--font-sans)', color: '#F6F3EC', background: '#101D2E', border: 0, borderRadius: 999, padding: '14px 28px', cursor: 'pointer' }}>Talk to us</button>
      </div>

      <div onTouchStart={onDown} onTouchEnd={onUp} onPointerDown={onDown} onPointerUp={onUp} onPointerCancel={() => { startX.current = null; }} style={{ position: 'relative', height: 500, margin: '0 -12px', overflow: 'visible', touchAction: 'pan-y' }}>
        <div onClick={() => jump(0)} style={cardWrap(0)}>
          <SideCard variant="orbits" image="/ui_kits/homepage/assets/card-ops.jpg" label="Portfolio impact" amount="+18% EBITDA" chip={<MiniTxChip icon={'M'} title="Ops copilot shipped" meta="Manufacturing co." amount="9 wks" />} style={{ position: 'absolute', inset: 0 }} />
        </div>
        <div onClick={() => jump(1)} style={cardWrap(1)}>
          <div style={{ position: 'absolute', inset: 0, borderRadius: 16, overflow: 'hidden', background: 'linear-gradient(165deg, #6FA3CC 0%, #8FBBDF 55%, #A8CCE7 100%)' }}>
            <video src="/uploads/distribution.mp4?v=1" poster="/uploads/distribution-poster.jpg" autoPlay loop muted playsInline preload="auto" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover' }}></video>
            <div style={{ position: 'absolute', inset: 0, background: 'linear-gradient(180deg, rgba(8,14,26,0.32) 0%, rgba(8,14,26,0.18) 45%, rgba(8,14,26,0.60) 100%)' }}></div>
            <div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'space-between', padding: 14 }}>
              <div style={{ marginTop: 48, textAlign: 'center' }}>
                <div style={{ font: 'var(--type-body-sm)', fontWeight: 500, color: '#fff', textShadow: '0 1px 10px rgba(17,34,49,0.45)' }}>Time to first value</div>
                <div style={{ font: '400 34px/1.15 var(--font-display)', letterSpacing: '-0.01em', color: '#fff', textShadow: '0 2px 14px rgba(8,14,26,0.45)' }}>6 weeks</div>
                <button style={{ font: '500 13px/1 var(--font-sans)', color: '#101D2E', background: '#FFFFFF', border: 0, borderRadius: 999, padding: '9px 18px', marginTop: 10, cursor: 'pointer' }}>How we work</button>
              </div>
              <div style={{ width: '100%' }}><MiniTxChip icon={'D'} title="Pricing engine live" meta="Distribution co." amount="6 wks" /></div>
            </div>
          </div>
        </div>
        <div onClick={() => jump(2)} style={cardWrap(2)}>
          <SideCard variant="beam" image="/ui_kits/homepage/assets/card-finance.jpg" label="Hold-period ROI" amount="3.4x" chip={<MiniTxChip icon={'F'} title="Underwriting model live" meta="Financial services co." amount="12 wks" />} style={{ position: 'absolute', inset: 0 }} />
        </div>
        {/* Edge fades: side cards dissolve softly into the page at the screen edges */}
        <div aria-hidden="true" style={{ position: 'absolute', top: -10, bottom: -10, left: 0, width: 40, zIndex: 40, pointerEvents: 'none', background: 'linear-gradient(to right, var(--paper-1), rgba(246,243,236,0))' }}></div>
        <div aria-hidden="true" style={{ position: 'absolute', top: -10, bottom: -10, right: 0, width: 40, zIndex: 40, pointerEvents: 'none', background: 'linear-gradient(to left, var(--paper-1), rgba(246,243,236,0))' }}></div>
      </div>

      <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', gap: 8, padding: '46px 22px 0' }}>
        {[0, 1, 2].map((i) => (
          <span key={i} onClick={() => jump(i)} style={{ width: i === active ? 24 : 8, height: 8, borderRadius: 999, background: i === active ? 'var(--ink-1)' : 'rgba(16,29,46,0.2)', transition: 'all 300ms cubic-bezier(0.2,0,0,1)', cursor: 'pointer' }}></span>
        ))}
      </div>
      <div style={{ margin: '18px 22px 0', textAlign: 'center', fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.18em', color: 'var(--text-faint)' }}>THREE ENGAGEMENTS, STILL IN PRODUCTION</div>
    </div>
  );
}

function HeroMorph() {
  const outerRef = React.useRef(null);
  const [p, setP] = React.useState(0);
  const [dims, setDims] = React.useState({ vw: window.innerWidth, vh: window.innerHeight });
  const [chrome, setChrome] = React.useState(178);
  const [slide, setSlide] = React.useState(0);
  const slides = [
    { slotId: 'hero-a', variant: 'summit', title: 'AI that earns its place', sub: 'A productized AI engineering firm for private equity and the companies they own. Senior teams, proven delivery, measurable value creation.', cta: 'Talk to us', proofLabel: 'Value created · LTM', proofValue: '$48.2M', chip: { icon: '◦', title: 'Ops copilot shipped', meta: 'Manufacturing co.', amount: '9 wks' } },
    { slotId: 'hero-b', variant: 'orbits', title: 'Value creation, engineered', sub: 'We embed with your portfolio companies and ship production AI that moves the numbers that matter, on the timeline that matters.', cta: 'See how we work', proofLabel: 'Initiatives in production', proofValue: '34', chip: { icon: '·', title: 'Underwriting model live', meta: 'Financial services co.', amount: '12 wks' } },
  ];
  const goPrev = () => setSlide((s) => (s + slides.length - 1) % slides.length);
  const goNext = () => setSlide((s) => (s + 1) % slides.length);

  React.useEffect(() => {
    let raf = 0;
    const measure = () => {
      const el = outerRef.current;
      if (!el) return;
      const rect = el.getBoundingClientRect();
      const range = el.offsetHeight - window.innerHeight;
      setP(heroClamp(-rect.top / Math.max(1, range)));
      setChrome(Math.max(0, el.offsetTop));
    };
    const onScroll = () => { cancelAnimationFrame(raf); raf = requestAnimationFrame(measure); };
    const onResize = () => { setDims({ vw: window.innerWidth, vh: window.innerHeight }); onScroll(); };
    window.addEventListener('scroll', onScroll, { passive: true });
    window.addEventListener('resize', onResize);
    measure();
    return () => { window.removeEventListener('scroll', onScroll); window.removeEventListener('resize', onResize); cancelAnimationFrame(raf); };
  }, []);

  const { vw, vh } = dims;
  const t = heroSmooth(p);
  const PAD = 20;
  const TOP2 = Math.max(340, vh * 0.40);
  // Cards + caption must fit inside the 100vh sticky frame (overflow: hidden
  // slices them otherwise): reserve 68px below TOP2+H2 for the caption row.
  // Shrink width and gap with height so the cards keep their 340x470
  // portrait aspect on shorter viewports instead of going squat.
  const H2 = Math.min(548, Math.max(320, vh - TOP2 - 60));
  const cardScale = H2 / 548;
  const W2 = Math.min(Math.round(408 * cardScale), vw - 36), GAP = Math.round(30 * cardScale);
  const w = heroLerp(vw - PAD * 2, W2, t);
  const h = heroLerp(vh - chrome - 60, H2, t);
  const x = heroLerp(PAD, (vw - W2) / 2, t);
  const y = heroLerp(16, TOP2, t);
  const r = heroLerp(28, 16, t);
  const oldO = 1 - heroClamp((p - 0.14) * 3.2);
  const newT = heroSmooth((p - 0.5) / 0.45);
  const sideT = heroSmooth((p - 0.45) / 0.5);
  const badgeO = heroClamp((p - 0.82) / 0.18);
  const sideW = W2 * 0.96, sideH = H2 * 0.92, sideTop = TOP2 + (H2 - H2 * 0.92) / 2;
  const cur = slides[slide];

  if (vw <= 900) {
    return <HeroMorphMobile />;
  }
  return (
    <div ref={outerRef} style={{ height: '260vh', position: 'relative' }}>
      <div style={{ position: 'sticky', top: 0, height: '100vh', overflow: 'hidden', background: 'var(--surface-page)' }}>

        {/* New hero (fades in as the panel breaks down) */}
        <div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', paddingTop: vh * 0.13, opacity: newT, transform: `translateY(${heroLerp(36, 0, newT)}px)`, pointerEvents: newT > 0.5 ? 'auto' : 'none' }}>
          <h2 className="rh1" style={{ font: '400 66px/1.04 var(--font-display)', letterSpacing: '-0.01em', color: 'var(--ink-1)', margin: 0, textAlign: 'center' }}>Value creation, engineered</h2>
          <p className="rp" style={{ font: '400 19px/1.5 var(--font-sans)', color: 'var(--text-muted)', margin: '20px 0 28px', maxWidth: 560, textAlign: 'center' }}>
            We partner with operating teams to design, build, and deploy AI where it earns its place: in the P&L, not the pitch deck.
          </p>
          <button onClick={() => { window.location.href = MAIL; }} style={{ font: '500 16px/1 var(--font-sans)', color: '#F6F3EC', background: '#101D2E', border: 0, borderRadius: 999, padding: '16px 32px', cursor: 'pointer' }}>Talk to us</button>
        </div>

        {/* Side cards */}
        <SideCard
          variant="orbits" image="/ui_kits/homepage/assets/card-ops.jpg"
          label="Portfolio impact" amount="+18% EBITDA"
          chip={<MiniTxChip icon={'M'} title="Ops copilot shipped" meta="Manufacturing co." amount="9 wks" />}
          style={{ left: (vw - W2) / 2 - GAP - sideW + heroLerp(120, 0, sideT), top: sideTop, width: sideW, height: sideH, opacity: sideT }}
        />
        <SideCard
          variant="beam" image="/ui_kits/homepage/assets/card-finance.jpg"
          label="Hold-period ROI" amount="3.4x"
          chip={<MiniTxChip icon={'F'} title="Underwriting model live" meta="Financial services co." amount="12 wks" />}
          style={{ left: (vw + W2) / 2 + GAP - heroLerp(120, 0, sideT), top: sideTop, width: sideW, height: sideH, opacity: sideT }}
        />

        {/* Morphing hero panel → middle card */}
        <div style={{ position: 'absolute', left: x, top: y, width: w, height: h, borderRadius: r, overflow: 'hidden', background: 'linear-gradient(165deg, #6FA3CC 0%, #8FBBDF 55%, #A8CCE7 100%)' }}>
          <video src="/uploads/Video Design.mp4?v=3" poster="/uploads/video-poster.jpg" autoPlay loop muted playsInline preload="auto" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover' }}></video>
          {/* Distribution clip crossfades in as the hero morphs into the middle card */}
          <video src="/uploads/distribution.mp4?v=1" poster="/uploads/distribution-poster.jpg" autoPlay loop muted playsInline preload="auto" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', opacity: heroClamp((t - 0.5) / 0.42), pointerEvents: 'none' }}></video>
          <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none', opacity: 1 - t, background: 'linear-gradient(97deg, rgba(8,14,26,0.66) 0%, rgba(8,14,26,0.46) 42%, rgba(8,14,26,0.28) 68%, rgba(8,14,26,0.18) 100%)' }}></div>
          <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none', opacity: t, background: 'linear-gradient(180deg, rgba(8,14,26,0.32) 0%, rgba(8,14,26,0.18) 45%, rgba(8,14,26,0.60) 100%)' }}></div>
          <div style={{ position: 'absolute', left: 0, right: 0, top: 0, height: 150, pointerEvents: 'none', opacity: 1 - t, background: 'linear-gradient(180deg, rgba(8,14,26,0.55) 0%, rgba(8,14,26,0) 100%)' }}></div>

          {/* Rest-state overlay: headline + sub + CTA + slide nav */}
          <div className="rpadhero" style={{ position: 'absolute', inset: 0, opacity: oldO, pointerEvents: oldO > 0.5 ? 'auto' : 'none', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', padding: '0 64px 72px' }}>
            <h1 className="rh1" style={{ font: '400 64px/1.05 var(--font-display)', letterSpacing: '-0.01em', color: '#fff', margin: 0, maxWidth: 640, textShadow: '0 2px 24px rgba(8,14,26,0.5)', animation: 'capIn 600ms cubic-bezier(0.2,0,0,1) both' }}>AI that earns its place</h1>
            <p className="rp" style={{ font: '400 18px/1.5 var(--font-sans)', color: 'rgba(255,255,255,0.92)', margin: '18px 0 32px', maxWidth: 540, textShadow: '0 1px 14px rgba(8,14,26,0.5)', animation: 'capIn 600ms cubic-bezier(0.2,0,0,1) 100ms both' }}>Productized AI engineering for private equity and the companies they own. Built by senior teams, measured in the P&L.</p>
            <button onClick={() => { window.location.href = MAIL; }} style={{ alignSelf: 'flex-start', font: '500 16px/1 var(--font-sans)', color: '#101D2E', background: '#FFFFFF', border: 0, borderRadius: 999, padding: '16px 32px', cursor: 'pointer', animation: 'capIn 600ms cubic-bezier(0.2,0,0,1) 200ms both' }}>Talk to us</button>
          </div>

          {/* End-state overlay — matches side cards */}
          <div style={{ position: 'absolute', inset: 0, opacity: sideT, pointerEvents: sideT > 0.5 ? 'auto' : 'none', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'space-between', padding: 14 }}>
            <div style={{ marginTop: 56, textAlign: 'center' }}>
              <div style={{ font: 'var(--type-body-sm)', fontWeight: 500, color: '#fff', textShadow: '0 1px 10px rgba(17,34,49,0.45)' }}>Time to first value</div>
              <div style={{ font: '400 38px/1.15 var(--font-display)', letterSpacing: '-0.01em', color: '#fff', textShadow: '0 2px 14px rgba(8,14,26,0.45)', fontVariantNumeric: 'tabular-nums' }}>6 weeks</div>
              <button style={{ pointerEvents: 'auto', font: '500 13px/1 var(--font-sans)', color: '#101D2E', background: '#FFFFFF', border: 0, borderRadius: 999, padding: '9px 18px', marginTop: 10, cursor: 'pointer' }}>How we work</button>
            </div>
            <div style={{ width: '100%' }}><MiniTxChip icon={'D'} title="Pricing engine live" meta="Distribution co." amount="6 wks" /></div>
          </div>
        </div>

        {/* Caption under the three cards */}
        <div style={{ position: 'absolute', left: 0, right: 0, top: TOP2 + H2 + 26, textAlign: 'center', opacity: badgeO, fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.18em', color: 'var(--text-faint)' }}>THREE ENGAGEMENTS, STILL IN PRODUCTION</div>
      </div>
    </div>
  );
}
/* ============================================================
   HERO SWITCH, set HERO_VARIANT to 'morph' to revert to the
   original scroll-morphing hero. 'celonis' = new clean dark hero.
   ============================================================ */
function Hero() {
  const HERO_VARIANT = 'morph';
  return HERO_VARIANT === 'celonis' ? <HeroCelonis /> : <HeroMorph />;
}

/* Dotted particle dome — calm monochrome, slow rotation */
function DotDome({ dot }) {
  const canvasRef = React.useRef(null);
  React.useEffect(() => {
    const canvas = canvasRef.current;
    if (!canvas) return;
    const ctx = canvas.getContext('2d');
    const dpr = Math.min(window.devicePixelRatio || 1, 1.5);
    let W = 0, H = 0, raf = 0;
    const t0 = performance.now();
    const N = 1500, gold = Math.PI * (3 - Math.sqrt(5)), pts = [];
    for (let i = 0; i < N; i++) {
      const y = 1 - (i / (N - 1)) * 2, rr = Math.sqrt(1 - y * y), th = gold * i;
      pts.push([Math.cos(th) * rr, y, Math.sin(th) * rr]);
    }
    const resize = () => {
      const rect = canvas.getBoundingClientRect();
      W = rect.width; H = rect.height;
      canvas.width = Math.max(1, W * dpr); canvas.height = Math.max(1, H * dpr);
    };
    resize();
    const tiltX = -0.5, cosT = Math.cos(tiltX), sinT = Math.sin(tiltX);
    const draw = (now) => {
      const yaw = (now - t0) * 0.00006, cy0 = Math.cos(yaw), sy0 = Math.sin(yaw);
      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
      ctx.clearRect(0, 0, W, H);
      const R = H * 1.02, cx = W * 0.52, cyc = H * 1.24;
      for (let i = 0; i < N; i++) {
        const p = pts[i];
        const x1 = p[0] * cy0 + p[2] * sy0, z1 = -p[0] * sy0 + p[2] * cy0;
        const y2 = p[1] * cosT - z1 * sinT, z2 = p[1] * sinT + z1 * cosT;
        const sx = cx + x1 * R, sy = cyc - y2 * R;
        if (sy < -20 || sy > H + 20 || sx < -20 || sx > W + 20) continue;
        const depth = (z2 + 1) / 2;
        ctx.fillStyle = 'rgba(' + dot + ',' + (0.09 + depth * 0.5).toFixed(3) + ')';
        ctx.beginPath();
        ctx.arc(sx, sy, 0.7 + depth * 1.1, 0, 6.283);
        ctx.fill();
      }
      raf = requestAnimationFrame(draw);
    };
    raf = requestAnimationFrame(draw);
    window.addEventListener('resize', resize);
    return () => { cancelAnimationFrame(raf); window.removeEventListener('resize', resize); };
  }, []);
  return <canvas ref={canvasRef} style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', pointerEvents: 'none' }} />;
}

function HeroCelonis() {
  const words = ['manufacturing.', 'financial services.', 'the back office.', 'distribution.', 'the boardroom.'];
  const [wi, setWi] = React.useState(0);
  React.useEffect(() => {
    const id = setInterval(() => setWi((w) => (w + 1) % words.length), 2600);
    return () => clearInterval(id);
  }, []);
  // ---- HERO COLOR SCHEMES — set HERO_SCHEME to compare ----
  const SCHEMES = {
    navy:     { bg: '#0C1926', vig: 'rgba(6,14,22,0.55)',   dot: '247,243,237', muted: 'rgba(247,243,237,0.32)', bright: '#F7F3ED', accent: '#FF4F40', accentText: '#fff', accentTick: '#0C1926', arrow: 'rgba(247,243,237,0.5)' },
    ink:      { bg: '#0B0B0C', vig: 'rgba(0,0,0,0.6)',      dot: '236,232,226', muted: 'rgba(236,232,226,0.28)', bright: '#F4F1EB', accent: '#FF4F40', accentText: '#fff', accentTick: '#0B0B0C', arrow: 'rgba(236,232,226,0.5)' },
    slate:    { bg: '#141A20', vig: 'rgba(8,11,14,0.55)',   dot: '210,224,232', muted: 'rgba(226,236,242,0.30)', bright: '#EAF1F5', accent: '#E7B24C', accentText: '#20160A', accentTick: '#141A20', arrow: 'rgba(226,236,242,0.5)' },
    forest:   { bg: '#0E1A16', vig: 'rgba(6,14,11,0.55)',   dot: '224,236,228', muted: 'rgba(230,240,233,0.30)', bright: '#EAF2EC', accent: '#FF4F40', accentText: '#fff', accentTick: '#0E1A16', arrow: 'rgba(230,240,233,0.5)' },
    plum:     { bg: '#17111C', vig: 'rgba(10,6,14,0.6)',    dot: '234,226,238', muted: 'rgba(238,230,242,0.30)', bright: '#F1EBF4', accent: '#E7B24C', accentText: '#241407', accentTick: '#17111C', arrow: 'rgba(238,230,242,0.5)' },
  };
  const HERO_SCHEME = 'navy'; // 'navy' | 'ink' | 'slate' | 'forest' | 'plum'
  const S = SCHEMES[HERO_SCHEME];
  const cream = S.bright, muted = S.muted;
  return (
    <section style={{ position: 'relative', minHeight: '100vh', background: S.bg, overflow: 'hidden' }}>
      <DotDome dot={S.dot} />
      <div style={{ position: 'absolute', inset: 0, background: 'radial-gradient(120% 78% at 50% 122%, transparent 42%, ' + S.vig + ' 100%)', pointerEvents: 'none' }}></div>
      <div style={{ position: 'relative', zIndex: 2, maxWidth: 1440, margin: '0 auto', padding: '164px 56px 0', minHeight: '100vh', display: 'flex', flexDirection: 'column' }}>
        <h1 style={{ margin: 0, font: '700 clamp(50px, 6.6vw, 100px)/1.0 var(--font-display)', letterSpacing: 'var(--tracking-display)', maxWidth: 960 }}>
          <span style={{ color: muted, display: 'block' }}>AI that earns its place</span>
          <span style={{ color: cream, display: 'block', marginTop: 10 }}>
            in <span key={wi} style={{ display: 'inline-block', animation: 'capIn 620ms cubic-bezier(0.2,0,0,1) both' }}>{words[wi]}</span>
          </span>
        </h1>
        <a href="#platform" style={{ display: 'inline-flex', alignItems: 'center', gap: 13, marginTop: 46, textDecoration: 'none', color: cream, fontFamily: 'var(--font-sans)', fontWeight: 500, fontSize: 18 }}>
          <span style={{ width: 11, height: 11, background: S.accent, flexShrink: 0 }}></span>
          Discover how we work
        </a>
        <div style={{ position: 'absolute', right: 56, top: '50%', width: 240, display: 'flex', flexDirection: 'column', gap: 18 }}>
          <div style={{ borderRadius: 12, overflow: 'hidden', height: 156, background: 'rgba(247,243,237,0.05)', border: '1px solid var(--inv-hairline)' }}>
            <image-slot id="hero-ops-shot" shape="rect" placeholder="Ops / product photo" style={{ width: '100%', height: '100%' }}></image-slot>
          </div>
          <div style={{ borderRadius: 12, background: S.accent, color: S.accentText, padding: '20px 20px 24px', boxShadow: '0 20px 50px -18px ' + S.accent + '88' }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 9, fontFamily: 'var(--font-mono)', fontSize: 12, letterSpacing: '0.04em' }}>
              <span style={{ width: 9, height: 9, background: S.accentTick, flexShrink: 0 }}></span>
              Time to first value
            </div>
            <div style={{ font: '700 46px/1 var(--font-display)', letterSpacing: '-0.02em', marginTop: 20, fontVariantNumeric: 'tabular-nums' }}>6 wks</div>
          </div>
        </div>
        <div style={{ marginTop: 'auto', paddingBottom: 42 }}>
          <div style={{ width: 26, height: 26, color: S.arrow, animation: 'startBob 1.8s ease-in-out infinite alternate' }}>
            <svg viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M12 4v15M6 13l6 6 6-6" /></svg>
          </div>
        </div>
      </div>
    </section>
  );
}

const platformViews = [
  {
    key: 'value', title: 'Value creation, engineered',
    body: 'We embed senior engineers with your operating team to design, build, and deploy AI where it moves the P&L, not the pitch deck.',
    metricLabel: 'Value created · LTM', prefix: '$', num: 48.2, dec: 1, suffix: 'M',
    stats: [['Initiatives live', '34'], ['Avg. time to value', '6 wks']],
    colHead: ['Initiative', 'Impact'],
    rows: [
      ['Demand forecasting', 'Consumer goods co.', '+$12.4M'],
      ['Underwriting model', 'Financial services co.', '+$9.1M'],
      ['Operations copilot', 'Manufacturing co.', '+$7.8M'],
      ['Churn engine', 'SaaS co.', '+$6.2M'],
      ['Pricing engine', 'Distribution co.', '+$5.0M'],
    ],
  },
  {
    key: 'diligence', title: 'Diligence & underwriting',
    body: 'Pressure-test the thesis before close. We stand up the data room, model the upside, and quantify AI‑driven value creation ahead of signing.',
    metricLabel: 'Deals supported · LTM', prefix: '', num: 27, dec: 0, suffix: '',
    stats: [['Avg. diligence', '11 days'], ['Thesis hit rate', '92%']],
    colHead: ['Workstream', 'Turnaround'],
    rows: [
      ['Data room ingested', 'Project Atlas', '3 days'],
      ['Value‑creation model', 'Project Meridian', '5 days'],
      ['Technical due diligence', 'Project Vantage', '8 days'],
      ['AI opportunity map', 'Project Cedar', '6 days'],
      ['Synergy model', 'Project Harbor', '4 days'],
    ],
  },
  {
    key: 'ops', title: 'Operations & automation',
    body: 'Turn manual workflows into measured throughput. We ship production automation across finance, supply chain, and the back office.',
    metricLabel: 'Hours returned · monthly', prefix: '', num: 18400, dec: 0, suffix: '',
    stats: [['Processes automated', '62'], ['Error rate', '−71%']],
    colHead: ['Process', 'Reclaimed'],
    rows: [
      ['Invoice processing', 'Accounts payable', '4,200 hrs'],
      ['Reconciliation', 'Finance ops', '3,600 hrs'],
      ['Order routing', 'Supply chain', '3,100 hrs'],
      ['Ticket triage', 'Customer ops', '2,900 hrs'],
      ['Report assembly', 'FP&A', '2,400 hrs'],
    ],
  },
  {
    key: 'reporting', title: 'Reporting & insight',
    body: 'One source of truth across the portfolio. Board‑ready dashboards, refreshed automatically, from the systems you already run.',
    metricLabel: 'Dashboards live', prefix: '', num: 140, dec: 0, suffix: '+',
    stats: [['Refresh cadence', 'Daily'], ['Companies covered', '40']],
    colHead: ['Dashboard', 'Refresh'],
    rows: [
      ['Portfolio KPI board', 'All companies', 'Daily'],
      ['Value‑creation tracker', 'Operating partners', 'Daily'],
      ['Cash & liquidity', 'CFO office', 'Hourly'],
      ['AI adoption index', 'Portfolio‑wide', 'Weekly'],
      ['Board pack', 'Investment team', 'Quarterly'],
    ],
  },
];

function useCountUp(target, deps, dur = 1000) {
  const [v, setV] = React.useState(target);
  React.useEffect(() => {
    let raf, start;
    const step = (ts) => {
      if (!start) start = ts;
      const p = Math.min(1, (ts - start) / dur);
      setV(target * (1 - Math.pow(1 - p, 3)));
      if (p < 1) raf = requestAnimationFrame(step);
    };
    raf = requestAnimationFrame(step);
    return () => cancelAnimationFrame(raf);
  }, deps);
  return v;
}

function PortfolioPanel({ view }) {
  const DWELL = 6000;
  const count = useCountUp(view.num, [view.key]);
  const shown = view.num >= 1000 ? Math.round(count).toLocaleString('en-US') : count.toFixed(view.dec);
  return (
    <div style={{ position: 'relative', borderRadius: 20, padding: '30px 32px 14px', background: '#111E2B', border: '1px solid var(--inv-hairline)', boxShadow: '0 40px 100px -50px rgba(0,0,0,0.75)' }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 26 }}>
        <span style={{ font: 'var(--type-display-3)', color: 'var(--inv-text-1)', letterSpacing: 'var(--tracking-display)' }}>Portfolio</span>
        <span style={{ display: 'inline-flex', alignItems: 'center', gap: 7, font: 'var(--type-ui-medium)', fontSize: 12, color: 'var(--inv-text-2)', background: 'rgba(247,243,237,0.06)', border: '1px solid var(--inv-hairline)', borderRadius: 999, padding: '5px 11px' }}>
          <span style={{ width: 7, height: 7, borderRadius: '50%', background: 'var(--coral-1)' }}></span>Live
        </span>
      </div>
      <div style={{ display: 'flex', gap: 34, borderBottom: '1px solid var(--inv-hairline)', paddingBottom: 15, marginBottom: 26 }}>
        {platformViews.map((v) => (
          <span key={v.key} style={{ fontFamily: 'var(--font-sans)', fontSize: 14.5, fontWeight: v.key === view.key ? 600 : 400, whiteSpace: 'nowrap', color: v.key === view.key ? 'var(--inv-text-1)' : 'rgba(247,243,237,0.45)', borderBottom: v.key === view.key ? '2px solid var(--coral-1)' : '2px solid transparent', paddingBottom: 13, marginBottom: -17 }}>{v.title.split(' & ')[0].split(', ')[0]}</span>
        ))}
      </div>
      <div key={view.key} style={{ animation: 'hmPanelIn 500ms cubic-bezier(0.2,0,0,1) both' }}>
        <div style={{ display: 'flex', gap: 48, marginBottom: 30 }}>
          <div>
            <div style={{ fontFamily: 'var(--font-sans)', fontSize: 13.5, color: 'var(--inv-text-2)', marginBottom: 12 }}>{view.metricLabel}</div>
            <div style={{ fontFamily: 'var(--font-display)', fontWeight: 600, fontSize: 42, lineHeight: 1, letterSpacing: 'var(--tracking-display)', color: 'var(--inv-text-1)', fontVariantNumeric: 'tabular-nums' }}>{view.prefix}{shown}{view.suffix}</div>
          </div>
          {view.stats.map(([l, val]) => (
            <div key={l} style={{ alignSelf: 'flex-end' }}>
              <div style={{ fontFamily: 'var(--font-sans)', fontSize: 13.5, color: 'var(--inv-text-2)', marginBottom: 12 }}>{l}</div>
              <div style={{ fontFamily: 'var(--font-display)', fontWeight: 500, fontSize: 20, lineHeight: 1, color: 'var(--inv-text-1)', fontVariantNumeric: 'tabular-nums' }}>{val}</div>
            </div>
          ))}
        </div>
        <div style={{ display: 'flex', justifyContent: 'space-between', fontFamily: 'var(--font-sans)', fontSize: 13, color: 'rgba(247,243,237,0.45)', paddingBottom: 15, borderBottom: '1px solid var(--inv-hairline)' }}>
          <span>{view.colHead[0]}</span><span>{view.colHead[1]}</span>
        </div>
        {view.rows.map((r, i) => (
          <div key={r[0]} style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '15px 0', borderBottom: i < view.rows.length - 1 ? '1px solid var(--inv-hairline)' : 'none', opacity: 0, animation: `hmRowIn 520ms cubic-bezier(0.2,0,0,1) ${120 + i * 90}ms both` }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 15 }}>
              <span style={{ width: 38, height: 38, borderRadius: '50%', border: '1.5px solid rgba(247,243,237,0.28)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
                <span style={{ width: 16, height: 16, borderRadius: '50%', border: '1.5px solid rgba(247,243,237,0.28)' }}></span>
              </span>
              <div>
                <div style={{ fontFamily: 'var(--font-sans)', fontSize: 16, fontWeight: 500, color: 'var(--inv-text-1)' }}>{r[0]}</div>
                <div style={{ fontFamily: 'var(--font-sans)', fontSize: 13, color: 'var(--inv-text-2)', marginTop: 2 }}>{r[1]}</div>
              </div>
            </div>
            <div style={{ fontFamily: 'var(--font-display)', fontWeight: 500, fontSize: 15.5, color: 'var(--inv-text-1)', fontVariantNumeric: 'tabular-nums' }}>{r[2]}</div>
          </div>
        ))}
      </div>
    </div>
  );
}

function Platform() {
  const DWELL = 6000;
  const [active, setActive] = React.useState(0);
  const [paused, setPaused] = React.useState(false);
  React.useEffect(() => {
    if (paused) return;
    const t = setTimeout(() => setActive((a) => (a + 1) % platformViews.length), DWELL);
    return () => clearTimeout(t);
  }, [active, paused]);
  const view = platformViews[active];
  return (
    <section style={{ background: 'var(--inv-surface)' }} onMouseEnter={() => setPaused(true)} onMouseLeave={() => setPaused(false)}>
      <div className="rw rg" style={{ maxWidth: 1200, margin: '0 auto', padding: '120px 48px', display: 'grid', gridTemplateColumns: '0.82fr 1fr', gap: 88, alignItems: 'center' }}>
        <div>
          <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 40, letterSpacing: 'var(--tracking-display)', color: 'var(--inv-text-1)', margin: '0 0 44px' }}>
            Everything AI can do for the business.<br />In one engagement.
          </h2>
          <div style={{ borderTop: '1px solid var(--inv-hairline)' }}>
            {platformViews.map((v, i) => {
              const on = i === active;
              return (
                <div key={v.key} style={{ borderBottom: '1px solid var(--inv-hairline)' }}>
                  <button onClick={() => setActive(i)} style={{ width: '100%', textAlign: 'left', background: 'none', border: 0, cursor: 'pointer', padding: on ? '24px 0 8px' : '22px 0' }}>
                    <span style={{ display: 'flex', alignItems: 'center', gap: 12, font: 'var(--type-display-3)', fontSize: 20, color: on ? 'var(--inv-text-1)' : 'rgba(247,243,237,0.5)', transition: 'color 300ms' }}>
                      {on && <span style={{ width: 8, height: 8, borderRadius: '50%', background: 'var(--coral-1)', flexShrink: 0 }}></span>}
                      {v.title}
                    </span>
                  </button>
                  <div style={{ display: 'grid', gridTemplateRows: on ? '1fr' : '0fr', transition: 'grid-template-rows 420ms cubic-bezier(0.2,0,0,1)' }}>
                    <div style={{ overflow: 'hidden' }}>
                      <p style={{ font: 'var(--type-body-lg)', color: 'var(--inv-text-2)', margin: '0 0 20px', maxWidth: 440 }}>{v.body}</p>
                      {SHOW_UNBUILT_LINKS ? (
                        <a href="#" style={{ display: 'inline-block', font: 'var(--type-ui-medium)', color: 'var(--inv-text-1)', textDecoration: 'none', borderBottom: '1.5px solid var(--coral-1)', paddingBottom: 3, marginBottom: 24 }}>Launch demo</a>
                      ) : null}
                    </div>
                  </div>
                  {on && !paused && <div style={{ height: 2, background: 'rgba(247,243,237,0.1)', marginBottom: -1 }}><div key={active} style={{ height: '100%', background: 'var(--coral-1)', animation: `hmBar ${DWELL}ms linear both` }}></div></div>}
                </div>
              );
            })}
          </div>
        </div>
        <PortfolioPanel view={view} />
      </div>
    </section>
  );
}

/* ---------- Stat band: proof strip on dark ---------- */
function StatBand({ inView }) {
  const [ref, shown] = useReveal(0.4);
  const ink = inView ? 'var(--inv-text-1)' : 'var(--ink-1)';
  const muted = inView ? 'var(--inv-text-2)' : 'var(--text-muted)';
  const hair = inView ? 'var(--inv-hairline)' : 'var(--hairline)';
  const faint = inView ? 'rgba(247,243,237,0.42)' : 'rgba(12,25,38,0.42)';
  const CT = 'color 1400ms cubic-bezier(0.4,0,0.2,1)';
  const stats = [
    { v: '31x', l: 'Median revenue multiple for AI business‑building portfolio companies, 2023–25', src: 'McKinsey' },
    { v: '6.1x', l: 'Higher shareholder-return CAGR for AI leaders vs. laggards', src: 'McKinsey · QuantumBlack' },
    { v: '+$180k', l: 'Median revenue-per-employee gain at the top AI maturity level', src: 'McKinsey' },
    { v: '~20%', l: 'Of portfolio companies have AI in production with real results', src: 'Bain', note: '1' },
  ];
  const rule = { position: 'absolute', left: 0, top: '50%', transform: 'translateY(-50%)', width: 1, height: 96, background: `linear-gradient(180deg, transparent 0%, ${hair} 22%, ${hair} 78%, transparent 100%)` };
  return (
    <section ref={ref} style={{ position: 'relative', background: inView ? 'var(--inv-surface)' : 'var(--surface-page)', transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1)' }}>
      <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 300, zIndex: 0, background: 'linear-gradient(180deg, var(--surface-page) 0%, rgba(247,243,237,0.985) 6%, rgba(247,243,237,0.95) 13%, rgba(247,243,237,0.88) 21%, rgba(247,243,237,0.78) 30%, rgba(247,243,237,0.66) 39%, rgba(247,243,237,0.53) 48%, rgba(247,243,237,0.4) 57%, rgba(247,243,237,0.28) 66%, rgba(247,243,237,0.18) 75%, rgba(247,243,237,0.1) 84%, rgba(247,243,237,0.04) 92%, transparent 100%)', opacity: inView ? 1 : 0, transition: 'opacity 1400ms cubic-bezier(0.4,0,0.2,1)', pointerEvents: 'none' }}></div>
      <div className="rstatsec" style={{ position: 'relative', zIndex: 1, maxWidth: 1240, margin: '0 auto', padding: '88px 48px 80px' }}>
        <div className="rstat-head" style={{ textAlign: 'center', marginBottom: 100 }}>
          <div style={{ fontFamily: 'var(--font-mono)', fontSize: 12.5, letterSpacing: '0.22em', color: inView ? 'rgba(247,243,237,0.82)' : 'rgba(12,25,38,0.72)', transition: CT, marginBottom: 34, ...capIn(shown, 0) }}>PROVEN IN PUBLIC, NOT IN THE PITCH</div>
          <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 46, lineHeight: 1.14, letterSpacing: 'var(--tracking-display)', fontWeight: 600, color: ink, transition: CT, margin: '0 auto', maxWidth: 780, textWrap: 'balance', ...capIn(shown, 90) }}>
            The value is already proven.<br />The gap is who actually builds it.
          </h2>
        </div>
        <div className="rstats" style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)' }}>
          {stats.map((s, i) => (
            <div key={s.l} style={{ position: 'relative', minWidth: 0, padding: '4px 30px', ...capIn(shown, 260 + i * 100) }}>
              {i > 0 ? <span style={rule}></span> : null}
              <div style={{ display: 'flex', alignItems: 'flex-start', gap: 4 }}>
                <span style={{ fontFamily: 'var(--font-display)', fontWeight: 600, fontSize: 'clamp(38px, 3.6vw, 56px)', lineHeight: 1, letterSpacing: 'var(--tracking-display)', color: ink, transition: CT, fontVariantNumeric: 'tabular-nums', whiteSpace: 'nowrap' }}>{s.v}</span>
                {s.note ? <span style={{ fontFamily: 'var(--font-sans)', fontSize: 15, color: muted, transition: CT, marginTop: 4 }}>{s.note}</span> : null}
              </div>
              <div style={{ fontFamily: 'var(--font-sans)', fontSize: 16, lineHeight: 1.4, color: muted, transition: CT, marginTop: 22, textWrap: 'pretty', maxWidth: 210 }}>{s.l}</div>
              <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.12em', color: faint, transition: CT, marginTop: 16, textTransform: 'uppercase' }}>{s.src}</div>
            </div>
          ))}
        </div>
        <div style={{ marginTop: 84, paddingTop: 30, borderTop: `1px solid ${hair}`, transition: 'border-color 1400ms cubic-bezier(0.4,0,0.2,1)', display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 24, flexWrap: 'wrap', ...capIn(shown, 680) }}>
          <span style={{ fontFamily: 'var(--font-sans)', fontSize: 13.5, color: faint, transition: CT, textWrap: 'pretty', maxWidth: 720 }}>1&nbsp;&nbsp;Sources: McKinsey, “Beyond AI productivity: Creating value in private equity,” 2025 (analysis of 471 PE-backed companies); Bain Global Private Equity Report, 2025. The industry has proven the value. Most portfolios still can’t capture it. That&rsquo;s the gap we build for.</span>
          {SHOW_UNBUILT_LINKS ? (
            <a href="#" style={{ fontFamily: 'var(--font-sans)', fontSize: 15, fontWeight: 500, color: ink, transition: CT, textDecoration: 'none', whiteSpace: 'nowrap', display: 'inline-flex', alignItems: 'center', gap: 8 }}>How we close it<span aria-hidden="true">{'\u2192'}</span></a>
          ) : null}
        </div>
      </div>
    </section>
  );
}

/* ---------- Assurance: how the value gets captured (workable cards) ---------- */
function GlowBar({ shown, tall }) {
  const h = shown ? (tall ? 272 : 52) : 0;
  return (
    <div style={{ position: 'relative', width: 132, height: h, transition: 'height 1200ms cubic-bezier(0.2,0,0,1) ' + (tall ? '200ms' : '420ms') }}>
      {tall ? <div style={{ position: 'absolute', inset: -26, borderRadius: 30, background: '#F7F3ED', filter: 'blur(30px)', opacity: 0.4 }}></div> : null}
      <div style={{ position: 'absolute', inset: 0, borderRadius: tall ? 18 : 26, background: tall ? 'linear-gradient(180deg, #FCFBF8 0%, #ECE7DC 100%)' : 'rgba(247,243,237,0.09)', boxShadow: tall ? 'inset 0 1px 0 rgba(255,255,255,0.7)' : 'inset 0 1px 0 rgba(247,243,237,0.06)' }}></div>
    </div>
  );
}
function BuildBarViz({ shown }) {
  /* Time comparison: bar LENGTH is proportional to elapsed time, so the shorter
     bar reads as the faster option. (It previously gave Hallmir the tall bar for
     the shorter duration, which read as "we take longer".) 12 wks vs 12-18 mo
     to 65 weeks, drawn on one shared scale. */
  const rows = [
    { name: 'Hallmir', val: '12 wks', pct: 18, us: true },
    { name: 'Typical programme', val: '12\u201318 mo', pct: 100, us: false },
  ];
  return (
    <div className="rbench" style={{ position: 'relative', width: '100%', height: '100%', display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 34, padding: '52px 54px' }}>
      {rows.map((r, i) => (
        <div key={r.name}>
          <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', gap: 16, marginBottom: 12 }}>
            <span style={{ fontFamily: 'var(--font-sans)', fontSize: 15.5, fontWeight: r.us ? 600 : 400, color: r.us ? 'var(--inv-text-1)' : 'var(--inv-text-2)' }}>{r.name}</span>
            <span style={{ fontFamily: 'var(--font-mono)', fontSize: r.us ? 19 : 16, color: r.us ? '#F7F3ED' : 'rgba(247,243,237,0.6)', fontVariantNumeric: 'tabular-nums', whiteSpace: 'nowrap' }}>{r.val}</span>
          </div>
          <div style={{ position: 'relative', height: r.us ? 22 : 16, borderRadius: 999, background: 'rgba(247,243,237,0.07)', overflow: 'visible' }}>
            {r.us ? <div style={{ position: 'absolute', left: 0, top: -10, bottom: -10, width: (shown ? r.pct : 0) + '%', borderRadius: 999, background: '#F7F3ED', filter: 'blur(22px)', opacity: 0.34, transition: 'width 1200ms cubic-bezier(0.2,0,0,1) 200ms' }}></div> : null}
            <div style={{ position: 'absolute', left: 0, top: 0, bottom: 0, width: (shown ? r.pct : 0) + '%', borderRadius: 999, background: r.us ? 'linear-gradient(90deg, #FCFBF8 0%, #ECE7DC 100%)' : 'rgba(247,243,237,0.16)', boxShadow: r.us ? '0 10px 30px rgba(12,25,38,0.4)' : 'none', transition: 'width 1200ms cubic-bezier(0.2,0,0,1) ' + (r.us ? '200ms' : '420ms') }}></div>
          </div>
        </div>
      ))}
      <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'rgba(247,243,237,0.42)', marginTop: 4 }}>Time to a working system</div>
    </div>
  );
}

function AuditRippleViz() {
  return (
    <div style={{ position: 'relative', width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', overflow: 'hidden' }}>
      <div style={{ position: 'absolute', width: 480, height: 480, borderRadius: '50%', background: 'radial-gradient(circle, rgba(247,243,237,0.10) 0%, rgba(247,243,237,0.04) 34%, transparent 62%)', filter: 'blur(6px)' }}></div>
      {[[430, 0.05], [330, 0.08], [232, 0.11], [140, 0.16]].map(([d, o], i) => (
        <div key={d} style={{ position: 'absolute', width: d, height: d, borderRadius: '50%', border: `1px solid rgba(247,243,237,${o})`, boxShadow: `0 0 40px rgba(247,243,237,${o * 0.7}) inset`, animation: `hmRipple 2.4s ease-in-out ${i * 0.24}s infinite` }}></div>
      ))}
      <div style={{ position: 'absolute', width: 150, height: 150, borderRadius: '50%', background: 'radial-gradient(circle, rgba(247,243,237,0.55) 0%, rgba(247,243,237,0.12) 40%, transparent 70%)', filter: 'blur(8px)' }}></div>
      <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="#F7F3ED" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" style={{ position: 'relative', filter: 'drop-shadow(0 0 10px rgba(247,243,237,0.5))' }}><path d="M12 3l7 3v5c0 4.5-3 8-7 10-4-2-7-5.5-7-10V6l7-3z" /><path d="M9 12l2 2 4-4" /></svg>
    </div>
  );
}
function Sphere({ size, dark }) {
  return <div style={{ width: size, height: size, borderRadius: '50%', background: dark ? 'radial-gradient(circle at 36% 30%, #39424f 0%, #171e29 62%, #0d1219 100%)' : 'radial-gradient(circle at 36% 30%, #ffffff 0%, #ece7db 60%, #d3cdbf 100%)', boxShadow: dark ? '0 6px 14px rgba(0,0,0,0.45), inset 0 1px 1px rgba(255,255,255,0.12)' : '0 6px 16px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,255,255,0.9)' }}></div>;
}
function OwnershipTogglesViz({ shown }) {
  const [s1, setS1] = React.useState(false);
  const [s2, setS2] = React.useState(false);
  const [on, setOn] = React.useState(false);
  React.useEffect(() => {
    if (!shown) return;
    const t1 = setTimeout(() => setS1(true), 350);
    const t2 = setTimeout(() => setS2(true), 650);
    const t3 = setTimeout(() => setOn(true), 1000);
    return () => { clearTimeout(t1); clearTimeout(t2); clearTimeout(t3); };
  }, [shown]);
  const rowLabel = { fontFamily: 'var(--font-sans)', fontSize: 14.5, color: 'var(--inv-text-2)' };
  const smallToggle = (active) => (
    <div style={{ position: 'relative', width: 92, height: 42, borderRadius: 999, flexShrink: 0, background: active ? 'linear-gradient(180deg, #FCFBF8 0%, #ECE7DC 100%)' : 'linear-gradient(180deg, rgba(247,243,237,0.13) 0%, rgba(247,243,237,0.08) 100%)', boxShadow: active ? '0 0 24px rgba(247,243,237,0.28), inset 0 1px 0 rgba(255,255,255,0.7)' : 'inset 0 1px 2px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(247,243,237,0.06)', transition: 'background 400ms ease, box-shadow 400ms ease' }}>
      <div style={{ position: 'absolute', top: '50%', left: active ? 'calc(100% - 36px)' : 6, transform: 'translateY(-50%)', transition: 'left 420ms cubic-bezier(0.2,0,0,1)' }}><Sphere size={30} dark /></div>
    </div>
  );
  return (
    <div style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 30, padding: '48px 44px' }}>
      <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 16 }}>
        <span style={rowLabel}>Source code</span>
        {smallToggle(s1)}
      </div>
      <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 16 }}>
        <span style={rowLabel}>Trained models</span>
        {smallToggle(s2)}
      </div>
      <div onClick={() => setOn((v) => !v)} style={{ cursor: 'pointer' }}>
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 }}>
          <span style={{ ...rowLabel, fontWeight: 600, color: 'var(--inv-text-1)' }}>Handed to your team</span>
          <span style={{ fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.12em', color: on ? 'var(--inv-text-1)' : 'var(--inv-text-2)', transition: 'color 300ms ease' }}>{on ? 'OWNED' : 'PENDING'}</span>
        </div>
        <div style={{ position: 'relative', width: '100%', height: 64, borderRadius: 999, background: on ? 'linear-gradient(180deg, #FCFBF8 0%, #ECE7DC 100%)' : 'rgba(247,243,237,0.12)', boxShadow: on ? '0 0 55px rgba(247,243,237,0.42), inset 0 1px 0 rgba(255,255,255,0.7)' : 'inset 0 1px 3px rgba(0,0,0,0.3)', transition: 'background 400ms ease, box-shadow 400ms ease' }}>
          <div style={{ position: 'absolute', top: '50%', left: on ? 'calc(100% - 56px)' : 8, transform: 'translateY(-50%)', transition: 'left 460ms cubic-bezier(0.2,0,0,1)' }}><Sphere size={48} dark /></div>
        </div>
      </div>
    </div>
  );
}
function Assurance({ inView }) {
  const [ref, shown] = useReveal(0.12);
  const ink = inView ? 'var(--inv-text-1)' : 'var(--ink-1)';
  const muted = inView ? 'var(--inv-text-2)' : 'var(--text-muted)';
  const CT = 'color 1400ms cubic-bezier(0.4,0,0.2,1)';
  const cards = [
    { viz: <BuildBarViz shown={shown} />, title: 'Built, not advised', body: 'We ship production systems in weeks, not a transformation programme that lands after the hold period.' },
    { viz: <AuditRippleViz />, title: 'Governance-first, audit‑ready', body: 'Every model, decision and data flow is documented as it ships, so the work survives diligence and the exit.' },
    { viz: <OwnershipTogglesViz shown={shown} />, title: 'You own what we build', body: 'Code, models and playbooks are yours. Your team runs everything before we leave, no licences, no lock‑in.' },
  ];
  return (
    <section ref={ref} style={{ background: inView ? 'var(--inv-surface)' : 'var(--surface-page)', transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1)' }}>
      <style>{'@keyframes hmRipple{0%,100%{transform:scale(1);opacity:0.7}50%{transform:scale(1.04);opacity:1}}'}</style>
      <div className="rband" style={{ maxWidth: 1240, margin: '0 auto', padding: '88px 48px 80px' }}>
        <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 40, lineHeight: 1.16, letterSpacing: 'var(--tracking-display)', fontWeight: 600, color: ink, transition: CT, margin: '0 0 84px', maxWidth: 520, textWrap: 'balance', ...capIn(shown, 0) }}>
          Most AI advice stops at the deck.<br />We stay until it runs.
        </h2>
        <div className="rg" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 28 }}>
          {cards.map((c, i) => (
            <div key={c.title} style={{ minWidth: 0, ...capIn(shown, 140 + i * 120) }}>
              <div className="rviz" style={{ height: 480, borderRadius: 24, border: '1px solid rgba(247,243,237,0.10)', background: 'linear-gradient(180deg, #1a2431 0%, #131b26 100%)', boxShadow: inView ? '0 20px 50px rgba(0,0,0,0.28)' : '0 26px 70px rgba(12,25,38,0.22)', transition: 'box-shadow 1400ms cubic-bezier(0.4,0,0.2,1)', overflow: 'hidden' }}>{c.viz}</div>
              <h3 style={{ fontFamily: 'var(--font-sans)', fontSize: 20, fontWeight: 600, color: ink, transition: CT, margin: '32px 0 14px' }}>{c.title}</h3>
              <p style={{ fontFamily: 'var(--font-sans)', fontSize: 15.5, lineHeight: 1.6, color: muted, transition: CT, margin: 0, textWrap: 'pretty', maxWidth: 320 }}>{c.body}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ---------- Closing CTA: audience split ---------- */
function ClosingCTA({ inView }) {
  const [ref, shown] = useReveal(0.2);
  const ink = inView ? 'var(--inv-text-1)' : 'var(--ink-1)';
  const muted = inView ? 'var(--inv-text-2)' : 'var(--text-muted)';
  const hair = inView ? 'var(--inv-hairline)' : 'var(--hairline)';
  const CT = 'color 1400ms cubic-bezier(0.4,0,0.2,1)';
  const ghostBg = inView ? 'rgba(247,243,237,0.08)' : 'rgba(12,25,38,0.05)';
  const ghostHover = inView ? 'rgba(247,243,237,0.14)' : 'rgba(12,25,38,0.09)';
  const cardBg = inView ? 'linear-gradient(180deg, rgba(247,243,237,0.045) 0%, rgba(247,243,237,0.012) 100%)' : 'linear-gradient(180deg, rgba(12,25,38,0.035) 0%, rgba(12,25,38,0.01) 100%)';
  const arrow = (<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" style={{ marginLeft: 2 }}><path d="M7 17L17 7" /><path d="M8 7h9v9" /></svg>);
  const cards = [
    { t: 'Hallmir for funds', d: 'A portfolio‑wide programme: we prioritise where AI moves EBITDA, then embed and build across your companies through the hold.', cta: 'Our approach', href: '#' },
    { t: 'Hallmir for portfolio companies', d: 'Production AI built with your team and handed over before we leave: first system live in weeks, full ownership at the end.', cta: 'See a build', href: '#' },
  ];
  const pill = { display: 'inline-flex', alignItems: 'center', gap: 6, whiteSpace: 'nowrap', fontFamily: 'var(--font-sans)', fontSize: 14.5, fontWeight: 500, borderRadius: 999, padding: '11px 20px', textDecoration: 'none', cursor: 'pointer', transition: 'background 400ms ease, color 400ms ease, transform 220ms ease, border-color 400ms ease' };
  return (
    <section ref={ref} style={{ background: inView ? 'var(--inv-surface)' : 'var(--surface-page)', transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1)' }}>
      <div className="rclose" style={{ maxWidth: 1080, margin: '0 auto', padding: '88px 48px 80px' }}>
        <div style={{ textAlign: 'center', marginBottom: 60 }}>
          <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 38, lineHeight: 1.14, letterSpacing: 'var(--tracking-display)', fontWeight: 600, color: ink, transition: CT, margin: '0 auto 30px', maxWidth: 560, textWrap: 'balance', ...capIn(shown, 0) }}>
            Value creation, engineered<br />end to end.
          </h2>
          <div style={{ display: 'flex', justifyContent: 'center', gap: 12, flexWrap: 'wrap', ...capIn(shown, 120) }}>
            <a href={MAIL} style={{ ...pill, padding: '12px 26px', fontSize: 15, background: inView ? 'var(--inv-text-1)' : 'var(--ink-1)', color: inView ? 'var(--ink-1)' : 'var(--inv-text-1)' }} onMouseEnter={(e) => { e.currentTarget.style.transform = 'translateY(-2px)'; }} onMouseLeave={(e) => { e.currentTarget.style.transform = 'none'; }}>Talk to us</a>
            {SHOW_UNBUILT_LINKS ? (
              <a href="#" style={{ ...pill, padding: '12px 22px', fontSize: 15, background: ghostBg, color: ink, border: `1px solid ${hair}` }} onMouseEnter={(e) => { e.currentTarget.style.background = ghostHover; }} onMouseLeave={(e) => { e.currentTarget.style.background = ghostBg; }}>See how we work{arrow}</a>
            ) : null}
          </div>
        </div>
        <div className="rg" style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 22 }}>
          {cards.map((c, i) => (
            <div key={c.t} style={{ minWidth: 0, display: 'flex', flexDirection: 'column', borderRadius: 16, border: `1px solid ${hair}`, background: cardBg, transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1), border-color 1400ms cubic-bezier(0.4,0,0.2,1)', padding: '30px 32px', ...capIn(shown, 200 + i * 120) }}>
              <h3 style={{ font: 'var(--type-display-2)', fontSize: 22, letterSpacing: 'var(--tracking-display)', fontWeight: 600, color: ink, transition: CT, margin: '0 0 12px' }}>{c.t}</h3>
              {/* the 24px bottom margin exists to clear the CTA pill; drop it when the pill is hidden */}
              <p style={{ fontFamily: 'var(--font-sans)', fontSize: 15, lineHeight: 1.55, color: muted, transition: CT, margin: SHOW_UNBUILT_LINKS ? '0 0 24px' : 0, maxWidth: 420, textWrap: 'pretty' }}>{c.d}</p>
              {SHOW_UNBUILT_LINKS ? (
                <a href={c.href} style={{ ...pill, marginTop: 'auto', alignSelf: 'flex-start', background: ghostBg, color: ink, border: `1px solid ${hair}` }} onMouseEnter={(e) => { e.currentTarget.style.background = ghostHover; }} onMouseLeave={(e) => { e.currentTarget.style.background = ghostBg; }}>{c.cta}{arrow}</a>
              ) : null}
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ---------- Post-hero dark run: white↔blue scroll transition through to footer ---------- */
function PostRun() {
  const ref = React.useRef(null);
  const [inView, setInView] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    let last = window.scrollY, upDist = 0;
    const onScroll = () => {
      const y = window.scrollY;
      const dy = y - last;
      last = y;
      upDist = dy < 0 ? upDist - dy : 0;
      const r = el.getBoundingClientRect();
      const line = window.innerHeight * 0.55;
      setInView(r.top < line && r.bottom > line && upDist < 220);
    };
    onScroll();
    window.addEventListener('scroll', onScroll, { passive: true });
    return () => window.removeEventListener('scroll', onScroll);
  }, []);
  return <div ref={ref}><StatBand inView={inView} /><Assurance inView={inView} /><ClosingCTA inView={inView} /><Footer inView={inView} /></div>;
}

/* ---------- Recognition / trust strip ---------- */
function Recognition() {
  /* Hallmir has no clients yet, so this cannot be a logo wall. Per the approved
     content doc it states the sectors we build for: the real economy that PE
     owns and that AI has barely reached. */
  const sectors = ['Manufacturing', 'Distribution', 'Logistics', 'Industrial healthcare', 'Professional services', 'Business services'];
  return (
    <section className="rsectors" style={{ padding: '88px 0 40px' }}>
      <p className="rp" style={{ fontFamily: 'var(--font-sans)', fontSize: 16, fontWeight: 400, color: 'var(--text-muted)', textAlign: 'center', margin: '0 auto 46px', maxWidth: 560, padding: '0 24px' }}>
        Built for the real economy that private equity owns
      </p>
      <div className="marquee">
        <div className="marquee-track">
          {[...sectors, ...sectors].map((n, i) => (
            <span key={i} aria-hidden={i >= sectors.length ? 'true' : undefined} style={{ color: 'rgba(16,29,46,0.5)', whiteSpace: 'nowrap', flex: 'none', marginRight: 64, fontFamily: 'var(--font-display)', fontSize: 26, letterSpacing: '-0.01em' }}>{n}</span>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ---------- 02 The gap: coverage exhibit ---------- */
function GapScene({ active }) {
  const narrow = useIsNarrow();
  const [tick, setTick] = React.useState(0);
  React.useEffect(() => { setTick((t) => t + 1); }, [active]);
  if (narrow) return <GapSceneMobile active={active} />;
  const stages = [['Strategy', '& Diligence'], ['Data', '& Systems'], ['Engineering', '& Build'], ['Operations', '& Adoption'], ['The P&L', 'the outcome']];
  const rows = [
    { name: 'Strategy houses', from: 0, to: 20, note: 'leave after the roadmap' },
    { name: 'Dev shops', from: 20, to: 60, note: 'leave at handover' },
    { name: 'Hallmir', from: 0, to: 100, note: 'owns it to the number' },
  ];
  const covered = [[0], [1, 2], [0, 1, 2, 3, 4]][active] || [];
  const T = 'all 600ms cubic-bezier(0.4,0,0.2,1)';
  return (
    <div className="rxscroll" style={{ width: '100%', userSelect: 'none', animation: 'hmSceneIn 900ms ease both' }}>
      <div style={{ minWidth: 620, background: 'linear-gradient(180deg, #FCFAF5 0%, #F2EEE5 100%)', border: '1px solid var(--hairline)', borderRadius: 20, boxShadow: '0 1px 2px rgba(16,29,46,0.04), 0 18px 50px rgba(16,29,46,0.07)', padding: '30px 28px 10px' }}>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', marginBottom: 22 }}>
        {stages.map((s, i) => {
          const on = covered.includes(i);
          return (
            <div key={i} style={{ textAlign: 'center', fontFamily: 'var(--font-sans)', fontSize: 15, lineHeight: 1.4, fontWeight: on ? 500 : 400, color: on ? (i === 4 ? 'var(--coral-2)' : 'var(--ink-1)') : 'rgba(17,34,49,0.4)', transform: on ? 'translateY(-3px)' : 'none', transition: T, transitionDelay: on ? (i * 90) + 'ms' : '0ms' }}>
              {s[0]}<br />
              <span style={{ fontSize: 13, fontWeight: 400, color: on ? 'var(--text-muted)' : 'rgba(17,34,49,0.32)', transition: T }}>{s[1]}</span>
            </div>
          );
        })}
      </div>
      <div style={{ position: 'relative', borderTop: '1px solid var(--hairline)', borderBottom: '1px solid var(--hairline)', overflow: 'hidden' }}>
        {[20, 40, 60, 80].map((x) => (
          <div key={x} style={{ position: 'absolute', left: x + '%', top: 0, bottom: 0, width: 1, background: 'var(--hairline)' }}></div>
        ))}
        <div style={{ position: 'absolute', left: '60%', right: 0, top: 0, bottom: 0, background: 'repeating-linear-gradient(-45deg, rgba(16,29,46,0.09) 0 1px, transparent 1px 8px)', backgroundSize: '200% 200%', animation: 'gapDrift 4s linear infinite', opacity: active === 2 ? 0 : 1, transition: T }}></div>
        <div style={{ position: 'absolute', left: '60%', right: 0, top: 16, textAlign: 'center', fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.18em', color: 'rgba(16,29,46,0.55)', opacity: active === 2 ? 0 : 1, transition: T }}>NEVER REACHED</div>
        <div key={'s' + tick} style={{ position: 'absolute', top: 0, bottom: 0, width: 2, background: 'linear-gradient(180deg, transparent, rgba(140,109,63,0.5), transparent)', animation: 'gapScan 1100ms cubic-bezier(0.2,0,0,1) both', pointerEvents: 'none' }}></div>
        {rows.map((r, i) => {
          const on = i === active;
          const isH = i === 2;
          const bar = 'var(--coral-1)';
          const dur = isH ? 1300 : 900;
          const startX = 'calc(' + r.from + '% + 16px)';
          const widthX = 'calc(' + (r.to - r.from) + '% - 32px)';
          return (
            <div key={r.name} style={{ position: 'relative', height: 118 }}>
              <div style={{ position: 'absolute', left: startX, top: 28, font: 'var(--type-label)', letterSpacing: 'var(--tracking-label)', textTransform: 'uppercase', color: on ? (isH ? 'var(--ink-1)' : 'var(--coral-2)') : 'rgba(17,34,49,0.42)', transition: T, whiteSpace: 'nowrap' }}>{r.name}</div>
              <div style={{ position: 'absolute', left: startX, width: widthX, top: 57, height: 10, borderRadius: 5, background: 'rgba(16,29,46,0.16)' }}></div>
              <div style={{ position: 'absolute', left: startX, width: widthX, top: 57, height: 10, borderRadius: 5, background: bar, opacity: on ? 1 : 0, transition: 'opacity 400ms cubic-bezier(0.4,0,0.2,1)', transformOrigin: 'left center', animation: on ? 'gapGrow ' + dur + 'ms cubic-bezier(0.2,0,0,1) both' : 'none', overflow: 'hidden' }}>
                {on ? <div style={{ position: 'absolute', inset: 0, width: '55%', background: 'linear-gradient(100deg, transparent 15%, rgba(247,243,237,0.5) 50%, transparent 85%)', animation: 'gapSweep 3s cubic-bezier(0.4,0,0.2,1) ' + (dur + 600) + 'ms infinite' }}></div> : null}
              </div>
              <div style={{ position: 'absolute', left: startX, width: widthX, top: 57, height: 10, pointerEvents: 'none' }}>
                <div style={{ position: 'absolute', top: -3, left: 0, width: 16, height: 16, borderRadius: '50%', background: bar, boxShadow: '0 0 0 5px rgba(140,109,63,0.18)', opacity: 0, animation: on ? 'gapRun ' + dur + 'ms cubic-bezier(0.2,0,0,1) both' : 'none' }}></div>
              </div>
              {isH ? (
                <React.Fragment>
                  <div style={{ position: 'absolute', left: 'calc(100% - 23px)', top: 55, width: 14, height: 14, animation: on ? 'gapPop 600ms cubic-bezier(0.2,0,0,1) ' + (dur - 150) + 'ms both' : 'none' }}>
                    <div style={{ position: 'absolute', inset: 0, borderRadius: '50%', background: on ? 'var(--coral-1)' : 'rgba(16,29,46,0.5)', boxShadow: on ? '0 4px 12px rgba(140,109,63,0.4)' : 'none', transition: 'all 500ms cubic-bezier(0.4,0,0.2,1) ' + (on ? (dur - 200) + 'ms' : '0ms') }}></div>
                  </div>
                  {on ? <div style={{ position: 'absolute', left: 'calc(100% - 23px)', top: 55, width: 14, height: 14, borderRadius: '50%', border: '1.5px solid var(--coral-1)', animation: 'gapRing 2s cubic-bezier(0.2,0,0,1) ' + (dur + 300) + 'ms infinite' }}></div> : null}
                  <div style={{ position: 'absolute', right: 16, top: 84, fontFamily: 'var(--font-sans)', fontSize: 13.5, color: on ? 'var(--text-muted)' : 'rgba(17,34,49,0.35)', opacity: on ? 1 : 0.9, transform: on ? 'none' : 'translateY(3px)', transition: 'all 500ms cubic-bezier(0.2,0,0,1) ' + (on ? dur + 'ms' : '0ms') }}>{r.note}</div>
                </React.Fragment>
              ) : (
                <React.Fragment>
                  <div style={{ position: 'absolute', left: 'calc(' + r.to + '% - 17px)', top: 52, width: 2, height: 20, background: on ? bar : 'rgba(17,34,49,0.25)', transition: 'background 300ms cubic-bezier(0.4,0,0.2,1) ' + (on ? (dur - 150) + 'ms' : '0ms'), animation: on ? 'gapThud 450ms cubic-bezier(0.2,0,0,1) ' + (dur - 120) + 'ms both' : 'none' }}></div>
                  {on ? <div style={{ position: 'absolute', left: 'calc(' + r.to + '% + 4px)', width: 'calc(' + (100 - r.to) + '% - 44px)', top: 61, height: 2, background: 'repeating-linear-gradient(90deg, rgba(140,109,63,0.45) 0 6px, transparent 6px 14px)', transformOrigin: 'left center', animation: 'gapGrow 1300ms cubic-bezier(0.2,0,0,1) ' + (dur + 150) + 'ms both' }}></div> : null}
                  {on ? <div style={{ position: 'absolute', right: 14, top: 53, fontFamily: 'var(--font-mono)', fontSize: 14, color: 'var(--coral-2)', animation: 'hmPanelIn 400ms cubic-bezier(0.2,0,0,1) ' + (dur + 1300) + 'ms both' }}>{'\u2715'}</div> : null}
                  <div style={{ position: 'absolute', left: 'calc(' + r.to + '% - 17px)', top: 84, fontFamily: 'var(--font-sans)', fontSize: 13.5, whiteSpace: 'nowrap', color: on ? 'var(--text-muted)' : 'rgba(17,34,49,0.35)', opacity: on ? 1 : 0.9, transform: on ? 'none' : 'translateY(3px)', transition: 'all 500ms cubic-bezier(0.2,0,0,1) ' + (on ? (dur - 100) + 'ms' : '0ms') }}>{r.note}</div>
                </React.Fragment>
              )}
            </div>
          );
        })}
      </div>
      <div style={{ display: 'flex', marginTop: 14, fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.18em', color: 'rgba(17,34,49,0.45)' }}>
        <span style={{ width: '20%' }}>ADVICE</span>
        <span style={{ width: '40%' }}>EXECUTION</span>
        <span style={{ width: '40%', textAlign: 'right' }}>OUTCOME</span>
      </div>
      </div>
    </div>
  );
}

/* Mobile coverage exhibit: full-width vertical stack. All three players are shown
   at once (a stronger static comparison than desktop's timed reveal), so nothing
   is clipped and there is no sideways scroll. Active row (driven by the accordion)
   draws in coral; the others sit muted for contrast. */
function GapSceneMobile({ active }) {
  const rows = [
    { name: 'Strategy houses', from: 0, to: 20, cov: '0–20%', note: 'leave after the roadmap' },
    { name: 'Dev shops', from: 20, to: 60, cov: '20–60%', note: 'leave at handover' },
    { name: 'Hallmir', from: 0, to: 100, cov: '0–100%', note: 'owns it to the number' },
  ];
  const T = 'all 500ms cubic-bezier(0.4,0,0.2,1)';
  const peek = { position: 'absolute', top: 26, bottom: 26, width: 26, borderRadius: 13, background: 'linear-gradient(180deg, #FBF9F3, #EFEAE0)', border: '1px solid var(--hairline)', filter: 'blur(2.5px)', opacity: 0.72, zIndex: 0 };
  return (
    <div style={{ width: '100%', userSelect: 'none', animation: 'hmSceneIn 900ms ease both' }}>
      <div style={{ position: 'relative' }}>
        {/* ambient drifting glow — the motion layer that gives the panel depth */}
        <div aria-hidden style={{ position: 'absolute', inset: '-8px -8px -12px -8px', borderRadius: 26, background: 'radial-gradient(120% 80% at 22% 12%, rgba(140,109,63,0.16), transparent 58%), radial-gradient(120% 90% at 84% 96%, rgba(16,29,46,0.13), transparent 55%)', filter: 'blur(14px)', zIndex: 0, animation: 'mediaGlow 13s ease-in-out infinite alternate', willChange: 'transform, opacity' }}></div>
        {/* blurred side panels peeking behind the sharp card (Mercury-style depth) */}
        <div aria-hidden style={{ ...peek, left: -9 }}></div>
        <div aria-hidden style={{ ...peek, right: -9 }}></div>
        {/* the sharp media card */}
        <div style={{ position: 'relative', zIndex: 1, background: 'linear-gradient(180deg, #FCFAF5 0%, #F2EEE5 100%)', border: '1px solid var(--hairline)', borderRadius: 20, boxShadow: '0 1px 2px rgba(16,29,46,0.05), 0 24px 60px rgba(16,29,46,0.11)', padding: '22px 20px 20px', overflow: 'hidden' }}>
        <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'rgba(17,34,49,0.5)', marginBottom: 18 }}>Coverage of the AI journey</div>
        <div style={{ position: 'relative' }}>
          {[20, 60].map((x) => (
            <div key={x} style={{ position: 'absolute', left: x + '%', top: 0, bottom: 0, width: 1, background: 'var(--hairline)', zIndex: 0 }}></div>
          ))}
          {rows.map((r, i) => {
            const on = i === active;
            const isH = i === 2;
            const fill = on ? 'var(--coral-1)' : 'rgba(16,29,46,0.22)';
            const dur = isH ? 1200 : 900;
            return (
              <div key={r.name} style={{ position: 'relative', zIndex: 1, padding: '16px 0', borderTop: i ? '1px solid var(--hairline)' : 'none' }}>
                <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', marginBottom: 13 }}>
                  <span style={{ font: 'var(--type-label)', letterSpacing: 'var(--tracking-label)', textTransform: 'uppercase', color: on ? (isH ? 'var(--ink-1)' : 'var(--coral-2)') : 'rgba(17,34,49,0.5)', transition: T }}>{r.name}</span>
                  <span style={{ fontFamily: 'var(--font-mono)', fontSize: 12, letterSpacing: '0.04em', fontVariantNumeric: 'tabular-nums', color: on ? (isH ? 'var(--ink-1)' : 'var(--coral-2)') : 'rgba(17,34,49,0.4)', transition: T }}>{r.cov}</span>
                </div>
                <div style={{ position: 'relative', height: 10 }}>
                  <div style={{ position: 'absolute', inset: 0, borderRadius: 5, background: 'rgba(16,29,46,0.10)' }}></div>
                  {!isH ? <div style={{ position: 'absolute', left: 'calc(' + r.to + '% + 4px)', right: 0, top: 4, height: 2, background: 'repeating-linear-gradient(90deg, rgba(16,29,46,0.26) 0 5px, transparent 5px 11px)' }}></div> : null}
                  <div key={'f' + i + '-' + active} style={{ position: 'absolute', left: r.from + '%', width: (r.to - r.from) + '%', top: 0, height: 10, borderRadius: 5, background: fill, transition: 'background 500ms cubic-bezier(0.4,0,0.2,1)', transformOrigin: 'left center', animation: on ? 'gapGrow ' + dur + 'ms cubic-bezier(0.2,0,0,1) both' : 'none', overflow: 'hidden' }}>
                    {on ? <div style={{ position: 'absolute', inset: 0, width: '55%', background: 'linear-gradient(100deg, transparent 15%, rgba(247,243,237,0.5) 50%, transparent 85%)', animation: 'gapSweep 3s cubic-bezier(0.4,0,0.2,1) ' + (dur + 600) + 'ms infinite' }}></div> : null}
                  </div>
                  {isH ? (
                    <div style={{ position: 'absolute', left: 'calc(100% - 7px)', top: -2, width: 14, height: 14, borderRadius: '50%', background: on ? 'var(--coral-1)' : 'rgba(16,29,46,0.28)', boxShadow: on ? '0 0 0 5px rgba(140,109,63,0.16)' : 'none', transition: T }}></div>
                  ) : (
                    <div style={{ position: 'absolute', left: 'calc(' + r.to + '% - 1px)', top: -3, width: 2, height: 16, background: on ? 'var(--coral-1)' : 'rgba(16,29,46,0.3)', transition: T }}></div>
                  )}
                </div>
                <div style={{ display: 'flex', alignItems: 'center', gap: 7, marginTop: 11, fontFamily: 'var(--font-sans)', fontSize: 13, color: on ? 'var(--text-muted)' : 'rgba(17,34,49,0.4)', transition: T }}>
                  {isH
                    ? <span style={{ width: 6, height: 6, borderRadius: '50%', background: on ? 'var(--coral-1)' : 'rgba(17,34,49,0.3)', display: 'inline-block', flex: 'none' }}></span>
                    : <span style={{ fontFamily: 'var(--font-mono)', fontSize: 12.5, color: on ? 'var(--coral-2)' : 'rgba(17,34,49,0.35)' }}>{'✕'}</span>}
                  {r.note}
                </div>
              </div>
            );
          })}
        </div>
        <div style={{ display: 'flex', marginTop: 18, paddingTop: 14, borderTop: '1px solid var(--hairline)', fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'rgba(17,34,49,0.45)' }}>
          <span style={{ width: '20%' }}>Advice</span>
          <span style={{ width: '40%', textAlign: 'center' }}>Execution</span>
          <span style={{ width: '40%', textAlign: 'right' }}>Outcome</span>
        </div>
        </div>
      </div>
    </div>
  );
}

/* Motion-graphics demo: an animated on-brand "Hallmir · Production" console
   (Mercury-style live product panel). Counting hero metric + drawing sparkline +
   staggered deploy-event feed + sheen, with a pause control. Reusable anywhere.
   The hero metric changes with the accordion so each open reveals a new figure. */
function HallmirConsole({ active = 0 }) {
  const heroes = [
    { label: 'Value created · LTM', pre: '$', num: 48.2, dec: 1, suf: 'M', sub: 'across 40+ portfolio companies' },
    { label: 'Margin impact · avg', pre: '+', num: 18, dec: 0, suf: '%', sub: 'EBITDA within the hold period' },
    { label: 'Still in production', pre: '', num: 94, dec: 0, suf: '%', sub: 'owned by the company’s own team' },
  ];
  const events = [
    { m: 'M', t: 'Ops copilot shipped', meta: 'Manufacturing co.', d: '9 wks' },
    { m: 'D', t: 'Pricing engine live', meta: 'Distribution co.', d: '6 wks' },
    { m: 'F', t: 'Underwriting model live', meta: 'Financial services', d: '12 wks' },
  ];
  const hero = heroes[active] || heroes[0];
  const [paused, setPaused] = React.useState(false);
  const [cycle, setCycle] = React.useState(0);
  const [disp, setDisp] = React.useState(0);
  React.useEffect(() => {
    if (paused) return;
    const id = setInterval(() => setCycle((c) => c + 1), 9000);
    return () => clearInterval(id);
  }, [paused]);
  React.useEffect(() => {
    if (paused) return;
    setDisp(0);
    let raf, start = null;
    const tick = (t) => {
      if (start === null) start = t;
      const p = Math.min(1, (t - start) / 1500);
      setDisp(hero.num * (1 - Math.pow(1 - p, 3)));
      if (p < 1) raf = requestAnimationFrame(tick);
    };
    raf = requestAnimationFrame(tick);
    return () => { if (raf) cancelAnimationFrame(raf); };
  }, [active, cycle, paused, hero.num]);
  const ps = paused ? 'paused' : 'running';
  const brass = '#C79A5B', cream = '#F3EFE6', dim = 'rgba(243,239,230,0.56)', line = 'rgba(243,239,230,0.10)';
  const rk = active + '-' + cycle;
  return (
    <div style={{ width: '100%', userSelect: 'none', animation: 'hmSceneIn 700ms ease both' }}>
      <div style={{ position: 'relative', borderRadius: 20, background: 'linear-gradient(180deg, #0E1B2B 0%, #091220 100%)', border: '1px solid rgba(243,239,230,0.12)', boxShadow: '0 1px 2px rgba(9,18,32,0.4), 0 26px 60px rgba(9,18,32,0.42)', overflow: 'hidden', padding: '18px 18px 16px' }}>
        <div aria-hidden style={{ position: 'absolute', inset: '-20%', background: 'radial-gradient(50% 40% at 78% 8%, rgba(199,154,91,0.16), transparent 60%), radial-gradient(52% 50% at 8% 96%, rgba(60,90,130,0.22), transparent 60%)', animation: 'mediaGlow 14s ease-in-out infinite alternate', animationPlayState: ps, pointerEvents: 'none' }}></div>
        <div aria-hidden style={{ position: 'absolute', top: 0, bottom: 0, left: 0, width: '45%', background: 'linear-gradient(105deg, transparent 20%, rgba(243,239,230,0.06) 50%, transparent 80%)', animation: 'shotSheen 8s ease-in-out 1.5s infinite', animationPlayState: ps, pointerEvents: 'none' }}></div>
        <div style={{ position: 'relative' }}>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 18 }}>
            <span style={{ fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase', color: dim }}>Hallmir · Production</span>
            <span style={{ display: 'flex', alignItems: 'center', gap: 7, fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase', color: brass }}>
              <span style={{ width: 6, height: 6, borderRadius: '50%', background: brass, animation: 'shotLive 2.4s ease-in-out infinite', animationPlayState: ps }}></span>Live
            </span>
          </div>
          <div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between', gap: 14 }}>
            <div>
              <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.14em', textTransform: 'uppercase', color: brass, marginBottom: 8 }}>{hero.label}</div>
              <div style={{ fontFamily: 'var(--font-display)', fontSize: 40, lineHeight: 1, color: cream, fontVariantNumeric: 'tabular-nums' }}>{hero.pre}{disp.toFixed(hero.dec)}{hero.suf}</div>
              <div style={{ fontFamily: 'var(--font-sans)', fontSize: 12.5, color: dim, marginTop: 8 }}>{hero.sub}</div>
            </div>
            <svg key={'g' + rk} width="120" height="60" viewBox="0 0 120 60" style={{ flex: 'none', overflow: 'visible' }}>
              <defs>
                <linearGradient id="hcArea" x1="0" y1="0" x2="0" y2="1">
                  <stop offset="0" stopColor={brass} stopOpacity="0.28" />
                  <stop offset="1" stopColor={brass} stopOpacity="0" />
                </linearGradient>
              </defs>
              <path d="M0,52 L18,46 L36,48 L54,34 L72,36 L90,20 L120,6 L120,60 L0,60 Z" fill="url(#hcArea)" style={{ animation: 'valArea 2200ms ease both', animationPlayState: ps }} />
              <path d="M0,52 L18,46 L36,48 L54,34 L72,36 L90,20 L120,6" fill="none" stroke={brass} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" pathLength="1" style={{ strokeDasharray: 1, animation: 'valDraw 2200ms cubic-bezier(0.4,0,0.2,1) both', animationPlayState: ps }} />
              <circle cx="120" cy="6" r="3.5" fill={cream} style={{ animation: 'valGlow 2400ms ease both', animationPlayState: ps }} />
            </svg>
          </div>
          <div style={{ height: 1, background: line, margin: '18px 0 4px' }}></div>
          <div>
            {events.map((e, i) => (
              <div key={'e' + rk + i} style={{ display: 'flex', alignItems: 'center', gap: 12, padding: '11px 0', borderBottom: i < events.length - 1 ? '1px solid ' + line : 'none', animation: 'hmPanelIn 620ms cubic-bezier(0.2,0,0,1) ' + (700 + i * 320) + 'ms both', animationPlayState: ps }}>
                <span style={{ width: 30, height: 30, flex: 'none', borderRadius: '50%', background: 'rgba(243,239,230,0.08)', border: '1px solid rgba(243,239,230,0.12)', display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'var(--font-display)', fontSize: 15, color: cream }}>{e.m}</span>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ fontFamily: 'var(--font-sans)', fontSize: 13.5, fontWeight: 500, color: cream, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{e.t}</div>
                  <div style={{ fontFamily: 'var(--font-sans)', fontSize: 11.5, color: dim, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{e.meta}</div>
                </div>
                <span style={{ display: 'flex', alignItems: 'center', gap: 7, flex: 'none' }}>
                  <span style={{ fontFamily: 'var(--font-mono)', fontSize: 12, color: dim, fontVariantNumeric: 'tabular-nums' }}>{e.d}</span>
                  <span style={{ width: 16, height: 16, borderRadius: '50%', background: brass, color: '#0A1420', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 10, fontWeight: 700 }}>{'✓'}</span>
                </span>
              </div>
            ))}
          </div>
          <button onClick={() => setPaused((v) => !v)} aria-label={paused ? 'Play' : 'Pause'} style={{ marginTop: 14, width: 34, height: 34, borderRadius: '50%', border: '1px solid rgba(243,239,230,0.22)', background: 'rgba(243,239,230,0.06)', color: cream, cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 0 }}>
            {paused
              ? <svg width="11" height="12" viewBox="0 0 11 12"><path d="M1 1 L10 6 L1 11 Z" fill="currentColor" /></svg>
              : <svg width="10" height="12" viewBox="0 0 10 12"><rect x="0" y="0" width="3" height="12" fill="currentColor" /><rect x="7" y="0" width="3" height="12" fill="currentColor" /></svg>}
          </button>
        </div>
      </div>
    </div>
  );
}

/* Mercury-style media panel: a looping cinematic Flow (Remotion + Higgsfield),
   self-titled in the video. Breakpoint-aware: landscape desktop cut vs. taller
   mobile cut. Framed screen with a soft glow + pause control. */
function MotionPanel({ srcDesktop, srcMobile, poster, posterMobile }) {
  const narrow = useIsNarrow();
  const [paused, setPaused] = React.useState(false);
  const vref = React.useRef(null);
  const userPaused = React.useRef(false);
  const ringRef = React.useRef(null);
  const RC = 2 * Math.PI * 20;
  const toggle = () => {
    const v = vref.current; if (!v) return;
    if (v.paused) {
      v.removeAttribute('data-user-paused');
      v.play().catch(() => {}); setPaused(false); userPaused.current = false;
    } else {
      v.setAttribute('data-user-paused', '');
      v.pause(); setPaused(true); userPaused.current = true;
    }
  };
  const src = narrow ? srcMobile : srcDesktop;
  const pos = narrow ? (posterMobile || poster) : poster;
  // best practice: only play while on-screen (saves battery/data), respect manual pause
  React.useEffect(() => {
    const v = vref.current; if (!v) return;
    v.muted = true; v.playsInline = true; // React won't set `muted` reliably; mobile blocks autoplay without it
    const io = new IntersectionObserver(([e]) => {
      if (e.isIntersecting) { if (!userPaused.current) v.play().catch(() => {}); } else { v.pause(); }
    }, { threshold: 0.2 });
    io.observe(v);
    return () => io.disconnect();
  }, [src]);
  // circular progress ring on the control — fills as the video plays, resets each loop
  React.useEffect(() => {
    const v = vref.current; if (!v) return;
    let raf;
    const tick = () => {
      const el = ringRef.current;
      if (el && v.duration) el.style.strokeDashoffset = String(RC * (1 - (v.currentTime / v.duration)));
      raf = requestAnimationFrame(tick);
    };
    raf = requestAnimationFrame(tick);
    return () => cancelAnimationFrame(raf);
  }, [src]);
  return (
    <div style={{ width: '100%', userSelect: 'none', animation: 'hmSceneIn 700ms ease both' }}>
      <div style={{ position: 'relative' }}>
        <div aria-hidden style={{ position: 'absolute', inset: '-8px -8px -14px', borderRadius: 24, background: 'radial-gradient(60% 60% at 50% 42%, rgba(199,154,91,0.16), transparent 70%)', filter: 'blur(16px)', zIndex: 0 }}></div>
        <div style={{ position: 'relative', zIndex: 1, borderRadius: 18, overflow: 'hidden', border: '1px solid rgba(243,239,230,0.14)', boxShadow: '0 1px 2px rgba(9,18,32,0.4), 0 26px 60px rgba(9,18,32,0.40)', background: '#0A1420', aspectRatio: narrow ? '1 / 1' : '16 / 10' }}>
          <video key={src} ref={vref} src={src} poster={pos} autoPlay loop muted playsInline preload="metadata" data-managed="" aria-label="Representative engagement, animated case study" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', display: 'block' }}></video>
          <div style={{ position: 'absolute', bottom: 14, left: 16, width: 44, height: 44 }}>
            <svg width="44" height="44" viewBox="0 0 44 44" style={{ position: 'absolute', inset: 0, transform: 'rotate(-90deg)', pointerEvents: 'none' }}>
              <circle cx="22" cy="22" r="20" fill="none" stroke="rgba(243,239,230,0.2)" strokeWidth="2" />
              <circle ref={ringRef} cx="22" cy="22" r="20" fill="none" stroke="#EDCB8B" strokeWidth="2" strokeLinecap="round" strokeDasharray={RC} strokeDashoffset={RC} />
            </svg>
            <button onClick={toggle} aria-label={paused ? 'Play' : 'Pause'} style={{ position: 'absolute', top: 5, left: 5, width: 34, height: 34, borderRadius: '50%', border: 0, background: 'rgba(9,18,32,0.5)', backdropFilter: 'blur(6px)', WebkitBackdropFilter: 'blur(6px)', color: '#F3EFE6', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 0 }}>
              {paused
                ? <svg width="11" height="12" viewBox="0 0 11 12"><path d="M1 1 L10 6 L1 11 Z" fill="currentColor" /></svg>
                : <svg width="10" height="12" viewBox="0 0 10 12"><rect x="0" y="0" width="3" height="12" fill="currentColor" /><rect x="7" y="0" width="3" height="12" fill="currentColor" /></svg>}
            </button>
          </div>
        </div>
      </div>
    </div>
  );
}

/* Signature exhibit — "The Journey to the P&L". One responsive component for
   desktop + mobile. The section's argument rendered as a data-film: real figures
   (20% / 60% / 100% / +$48.2M) as luminous brass light-streams on a navy field.
   The two that quit fray into embers; Hallmir completes into a bloom. Rational
   (figures, axis, labels) fused with irrational (light, glow, particles). */
function JourneyExhibit({ active = 0 }) {
  const narrow = useIsNarrow();
  const players = [
    { name: 'Strategy houses', from: 0, to: 20, note: 'leave after the roadmap', fig: '20%', kind: 'dissolve' },
    { name: 'Dev shops', from: 20, to: 60, note: 'leave at handover', fig: '60%', kind: 'dissolve' },
    { name: 'Hallmir', from: 0, to: 100, note: 'owns it to the number', fig: '100%', sub: '+$48.2M', kind: 'complete' },
  ];
  const T = 'all 600ms cubic-bezier(0.4,0,0.2,1)';
  const brass = '#C79A5B', brassLite = '#E7C588', cream = '#F3EFE6';
  const dim = 'rgba(243,239,230,0.55)', faint = 'rgba(243,239,230,0.30)', track = 'rgba(243,239,230,0.09)', line = 'rgba(243,239,230,0.11)';
  const laneH = narrow ? 12 : 14;
  const pad = narrow ? '20px 18px 16px' : '32px 32px 26px';
  const gapY = narrow ? 18 : 28;
  const grain = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")";
  return (
    <div style={{ width: '100%', userSelect: 'none', animation: 'hmSceneIn 800ms ease both' }}>
      <div style={{ position: 'relative', borderRadius: 20, overflow: 'hidden', background: 'linear-gradient(180deg, #0E1B2B 0%, #091220 100%)', border: '1px solid rgba(243,239,230,0.12)', boxShadow: '0 1px 2px rgba(9,18,32,0.4), 0 26px 60px rgba(9,18,32,0.42)', padding: pad }}>
        <div aria-hidden style={{ position: 'absolute', inset: '-20%', background: 'radial-gradient(46% 40% at 82% 6%, rgba(199,154,91,0.16), transparent 60%), radial-gradient(52% 50% at 6% 98%, rgba(50,80,120,0.20), transparent 60%)', animation: 'mediaGlow 15s ease-in-out infinite alternate', pointerEvents: 'none' }}></div>
        <div aria-hidden style={{ position: 'absolute', inset: 0, backgroundImage: grain, backgroundSize: '160px 160px', opacity: 0.05, mixBlendMode: 'overlay', pointerEvents: 'none' }}></div>
        <div aria-hidden style={{ position: 'absolute', inset: 0, background: 'radial-gradient(120% 100% at 50% 40%, transparent 55%, rgba(9,18,32,0.5) 100%)', pointerEvents: 'none' }}></div>
        <div style={{ position: 'relative' }}>
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: narrow ? 16 : 24 }}>
            <span style={{ fontFamily: 'var(--font-mono)', fontSize: narrow ? 10 : 11, letterSpacing: '0.18em', textTransform: 'uppercase', color: dim }}>Coverage of the engagement</span>
            <span style={{ display: 'flex', alignItems: 'center', gap: 7, fontFamily: 'var(--font-mono)', fontSize: narrow ? 9.5 : 10.5, letterSpacing: '0.16em', textTransform: 'uppercase', color: brass }}>
              <span style={{ width: 6, height: 6, borderRadius: '50%', background: brass, animation: 'shotLive 2.6s ease-in-out infinite' }}></span>Live
            </span>
          </div>
          <div style={{ position: 'relative' }}>
            {[20, 60].map((x) => <div key={x} aria-hidden style={{ position: 'absolute', left: x + '%', top: 0, bottom: 0, width: 1, background: line, zIndex: 0 }}></div>)}
            {players.map((p, i) => {
              const on = i === active;
              const isC = p.kind === 'complete';
              const rk = i + '-' + active;
              return (
                <div key={p.name} style={{ position: 'relative', zIndex: 1, paddingTop: i ? gapY : 0 }}>
                  <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', marginBottom: narrow ? 11 : 14 }}>
                    <span style={{ fontFamily: 'var(--font-mono)', fontSize: narrow ? 11 : 12.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: on ? cream : faint, transition: T }}>{p.name}</span>
                    <span style={{ display: 'flex', alignItems: 'baseline', gap: 8 }}>
                      {p.sub ? <span style={{ fontFamily: 'var(--font-sans)', fontSize: narrow ? 12 : 13.5, color: on ? brassLite : faint, transition: T }}>{p.sub}</span> : null}
                      <span style={{ fontFamily: 'var(--font-mono)', fontSize: narrow ? 13 : 16, fontVariantNumeric: 'tabular-nums', color: on ? (isC ? brassLite : cream) : faint, transition: T }}>{p.fig}</span>
                    </span>
                  </div>
                  <div style={{ position: 'relative', height: laneH }}>
                    <div style={{ position: 'absolute', inset: 0, borderRadius: laneH / 2, background: track }}></div>
                    {!isC ? <div style={{ position: 'absolute', left: 'calc(' + p.to + '% + 6px)', right: 0, top: '50%', height: 2, transform: 'translateY(-50%)', background: 'repeating-linear-gradient(90deg, rgba(243,239,230,0.18) 0 5px, transparent 5px 12px)', opacity: on ? 0.9 : 0.5, transition: T }}></div> : null}
                    <div key={'f' + rk} style={{ position: 'absolute', left: p.from + '%', width: (p.to - p.from) + '%', top: 0, height: laneH, borderRadius: laneH / 2, transformOrigin: 'left center', background: on ? ('linear-gradient(90deg, rgba(199,154,91,0.5), ' + brass + ' 42%, ' + brassLite + ')') : 'rgba(243,239,230,0.16)', boxShadow: on ? '0 0 18px rgba(199,154,91,0.5), 0 0 6px rgba(231,197,136,0.7)' : 'none', animation: on ? ('gapGrow ' + (isC ? 1300 : 1000) + 'ms cubic-bezier(0.2,0,0,1) both') : 'none', transition: 'background 500ms, box-shadow 500ms', overflow: 'hidden' }}>
                      {on ? <div style={{ position: 'absolute', inset: 0, width: '55%', background: 'linear-gradient(100deg, transparent 15%, rgba(255,255,255,0.55) 50%, transparent 85%)', animation: 'gapSweep 3s cubic-bezier(0.4,0,0.2,1) ' + (isC ? 1900 : 1600) + 'ms infinite' }}></div> : null}
                    </div>
                    {isC ? (
                      <React.Fragment>
                        <div key={'b' + rk} style={{ position: 'absolute', left: '100%', top: '50%', width: narrow ? 72 : 100, height: narrow ? 72 : 100, transform: 'translate(-46%,-50%)', borderRadius: '50%', background: 'radial-gradient(circle, rgba(231,197,136,0.6) 0%, rgba(199,154,91,0.32) 30%, transparent 68%)', filter: 'blur(2px)', opacity: on ? 1 : 0.18, animation: on ? 'valGlow 1400ms ease both' : 'none', transition: T, pointerEvents: 'none' }}></div>
                        <div style={{ position: 'absolute', left: 'calc(100% - ' + (narrow ? 6 : 7) + 'px)', top: '50%', width: narrow ? 12 : 14, height: narrow ? 12 : 14, transform: 'translateY(-50%)', borderRadius: '50%', background: on ? cream : 'rgba(243,239,230,0.3)', boxShadow: on ? '0 0 14px rgba(231,197,136,0.9)' : 'none', transition: T }}></div>
                        {on ? <div key={'r' + rk} style={{ position: 'absolute', left: 'calc(100% - ' + (narrow ? 6 : 7) + 'px)', top: '50%', width: narrow ? 12 : 14, height: narrow ? 12 : 14, transform: 'translateY(-50%)', borderRadius: '50%', border: '1.5px solid ' + brassLite, animation: 'gapRing 2.2s cubic-bezier(0.2,0,0,1) 1200ms infinite' }}></div> : null}
                      </React.Fragment>
                    ) : (
                      <React.Fragment>
                        <div style={{ position: 'absolute', left: 'calc(' + p.to + '% - 1px)', top: '50%', width: 2, height: laneH + 8, transform: 'translateY(-50%)', background: on ? brassLite : 'rgba(243,239,230,0.28)', transition: T }}></div>
                        {on ? <div key={'h' + rk} style={{ position: 'absolute', left: p.to + '%', top: '50%', width: narrow ? 48 : 66, height: narrow ? 36 : 46, transform: 'translate(-30%,-50%)', borderRadius: '50%', background: 'radial-gradient(circle, rgba(199,154,91,0.28), transparent 68%)', filter: 'blur(3px)', pointerEvents: 'none' }}></div> : null}
                        {on ? [0, 1, 2, 3, 4, 5].map((k) => (
                          <span key={'e' + rk + k} style={{ position: 'absolute', left: 'calc(' + p.to + '% - 2px)', top: '50%', width: 3, height: 3, borderRadius: '50%', background: brassLite, ['--ex']: ((k % 3) * 8 + 6) + 'px', ['--ey']: (((k % 2) ? -1 : 1) * (6 + k * 2)) + 'px', animation: 'hmEmber ' + (1600 + k * 140) + 'ms ease-out ' + (700 + k * 120) + 'ms infinite', opacity: 0 }}></span>
                        )) : null}
                      </React.Fragment>
                    )}
                  </div>
                  <div style={{ marginTop: narrow ? 10 : 12, fontFamily: 'var(--font-sans)', fontSize: narrow ? 12.5 : 13.5, color: on ? dim : 'rgba(243,239,230,0.32)', transition: T }}>{p.note}</div>
                </div>
              );
            })}
          </div>
          <div style={{ display: 'flex', marginTop: narrow ? 18 : 26, paddingTop: narrow ? 14 : 16, borderTop: '1px solid ' + line, fontFamily: 'var(--font-mono)', fontSize: narrow ? 9.5 : 10.5, letterSpacing: '0.16em', textTransform: 'uppercase', color: faint }}>
            <span style={{ width: '20%' }}>Advice</span>
            <span style={{ width: '40%', textAlign: 'center' }}>Execution</span>
            <span style={{ width: '40%', textAlign: 'right' }}>Outcome</span>
          </div>
        </div>
      </div>
    </div>
  );
}

/* Quiet link CTA (Mercury "Launch demo" pattern): small text, thin underline
   sitting just under it, whisper arrow. Understated by design. */
function EngageLink({ children, href = '#', style }) {
  const [h, setH] = React.useState(false);
  return (
    <a href={href} onMouseEnter={() => setH(true)} onMouseLeave={() => setH(false)}
      style={{ display: 'inline-flex', alignItems: 'baseline', gap: 8, fontFamily: 'var(--font-sans)', fontSize: 14.5, fontWeight: 500, letterSpacing: '0.01em', color: 'var(--ink-1)', textDecoration: 'none', borderBottom: 'none', cursor: 'pointer', ...style }}>
      <span style={{ paddingBottom: 5, borderBottom: '1.5px solid ' + (h ? 'var(--ink-1)' : 'rgba(16,29,46,0.32)'), transition: 'border-color 280ms' }}>{children}</span>
      <span aria-hidden="true" style={{ fontSize: 14, transform: h ? 'translateX(3px)' : 'none', transition: 'transform 300ms cubic-bezier(0.2,0,0,1)' }}>→</span>
    </a>
  );
}

function Accounts() {
  const items = [
    { t: 'Consultants ship decks', d: 'Strategy houses hand over the roadmap and leave before the build. The thinking is sound; the software never arrives.', vDesk: '/uploads/flow-meridian-cl.mp4?v=1', vMob: '/uploads/flow-meridian-cl-m.mp4?v=1', poster: '/uploads/poster-flow-meridian-cl.jpg', posterMob: '/uploads/poster-flow-meridian-cl-m.jpg' },
    { t: "Dev shops don't speak EBITDA", d: 'Agencies can write the code, but not underwrite the outcome. Nothing is scoped against margin, multiple, or the hold period.', vDesk: '/uploads/flow-northgate-cl.mp4?v=1', vMob: '/uploads/flow-northgate-cl-m.mp4?v=1', poster: '/uploads/poster-flow-northgate-cl.jpg', posterMob: '/uploads/poster-flow-northgate-cl-m.jpg' },
    { t: 'Nobody ties it to the P&L', d: 'Hallmir engineers the system and owns the number it moves. Every engagement lands as a line in the P&L.', vDesk: '/uploads/flow-alder-cl.mp4?v=1', vMob: '/uploads/flow-alder-cl-m.mp4?v=1', poster: '/uploads/poster-flow-alder-cl.jpg', posterMob: '/uploads/poster-flow-alder-cl-m.jpg' },
  ];
  const [active, setActive] = React.useState(0);
  const [hov, setHov] = React.useState(null);
  const narrow = useIsNarrow();
  return (
    <section className="rw raccts" style={{ ...wrap, maxWidth: 1280, padding: '88px 48px 80px' }}>
      <div className="rg" style={{ display: 'grid', gridTemplateColumns: '0.82fr 1fr', gap: 110, alignItems: 'center' }}>
        <div>
          <div className="raccl" style={{ fontFamily: 'var(--font-mono)', fontSize: 12, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--text-link)', margin: '0 0 20px' }}>The build gap</div>
          <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 42, letterSpacing: 'var(--tracking-display)', color: 'var(--ink-1)', margin: '0 0 18px' }}>
            Everyone advises on AI.<br />Almost nobody builds it.
          </h2>
          <p className="rp racc-intro" style={{ font: 'var(--type-body-lg)', color: 'var(--text-muted)', margin: '0 0 34px', maxWidth: 400 }}>Three reasons AI stalls between the boardroom and the P&L:</p>
          <div style={{ borderTop: '1px solid var(--hairline)' }}>
            {items.map((it, i) => {
              const on = i === active;
              return (
                <div key={it.t} style={{ position: 'relative', borderBottom: '1px solid var(--hairline)' }}>
                  <button className="racc-t" aria-expanded={on} onMouseEnter={() => setHov(i)} onMouseLeave={() => setHov(null)} onClick={() => setActive((a) => (a === i && narrow) ? null : i)} style={{ display: 'flex', alignItems: 'baseline', gap: 18, width: '100%', textAlign: 'left', background: 'none', border: 0, cursor: 'pointer', padding: on ? '26px 0 12px' : '22px 0', fontFamily: 'var(--font-sans)', fontSize: 19, fontWeight: on ? 500 : 400, color: on || hov === i ? 'var(--ink-1)' : 'var(--text-muted)', transition: 'color 300ms, padding 420ms cubic-bezier(0.2,0,0,1)' }}>
                    <span style={{ flex: 1 }}>{it.t}</span>
                    <span style={{ fontFamily: 'var(--font-mono)', fontSize: 19, fontWeight: 300, color: on ? 'var(--coral-2)' : 'var(--text-faint)', transform: on ? 'rotate(45deg)' : 'none', transition: 'transform 420ms cubic-bezier(0.2,0,0,1), color 300ms', alignSelf: 'center', lineHeight: 1 }}>+</span>
                  </button>
                  <div style={{ display: 'grid', gridTemplateRows: on ? '1fr' : '0fr', transition: 'grid-template-rows 420ms cubic-bezier(0.2,0,0,1)' }}>
                    <div style={{ overflow: 'hidden', minHeight: 0 }}>
                      <p className="rp" style={{ font: 'var(--type-body-lg)', color: 'var(--text-muted)', margin: '0 0 22px 0', maxWidth: 400 }}>{it.d}</p>
                      {narrow && on ? <div style={{ margin: '2px 0 30px' }}><MotionPanel srcDesktop={it.vDesk} srcMobile={it.vMob} poster={it.poster} posterMobile={it.posterMob} /></div> : null}
                    </div>
                  </div>
                </div>
              );
            })}
          </div>
          {SHOW_UNBUILT_LINKS ? <EngageLink style={{ marginTop: 34 }}>Walk through an engagement</EngageLink> : null}
        </div>
        {!narrow && active != null ? <div key={active} style={{ animation: 'hmPanelIn 620ms cubic-bezier(0.2,0,0,1) both' }}><MotionPanel srcDesktop={items[active].vDesk} srcMobile={items[active].vMob} poster={items[active].poster} posterMobile={items[active].posterMob} /></div> : null}
      </div>
    </section>
  );
}

/* ---------- Proof: trust band + testimonial carousel ---------- */
function Proof({ inView }) {
  const quotes = [
    { tag: 'Commitment \u00B7 01', img: '/ui_kits/homepage/assets/commit-embedded.jpg?v=2', imgM: '/ui_kits/homepage/assets/commit-embedded-m.jpg?v=1', q: 'Senior engineers on your floor from week one.', sub: 'Partner‑led delivery. No leveraged juniors, no offshore hand‑off, no learning on your time.', name: 'Embedded, not advisory', role: 'Written into the engagement', metrics: [['2 wks', 'to diagnostic'], ['Senior‑only', 'delivery team'], ['On‑site', 'with your ops']] },
    { tag: 'Commitment \u00B7 02', img: '/ui_kits/homepage/assets/commit-scoped.jpg?v=2', imgM: '/ui_kits/homepage/assets/commit-scoped-m.jpg?v=1', q: 'One number, agreed before we build.', sub: 'Scoped against margin, multiple and the hold period. The target goes in the contract, not the pitch.', name: 'Underwritten to the P&L', role: 'Written into the engagement', metrics: [['EBITDA‑first', 'scope'], ['6 wks', 'to first value'], ['In writing', 'not in a deck']] },
    { tag: 'Commitment \u00B7 03', img: '/ui_kits/homepage/assets/commit-handover.jpg?v=2', imgM: '/ui_kits/homepage/assets/commit-handover-m.jpg?v=1', q: 'Your team runs it after we leave.', sub: 'Code, models, documentation and runbooks transfer in full. We build for handover from day one.', name: 'Built to be owned', role: 'Written into the engagement', metrics: [['100%', 'IP transferred'], ['In‑house', 'operated by you'], ['No lock‑in', 'by design']] },  ];
  const [i, setI] = React.useState(0);
  const [paused, setPaused] = React.useState(false);
  React.useEffect(() => {
    if (paused) return;
    const t = setTimeout(() => setI((v) => (v + 1) % quotes.length), 8000);
    return () => clearTimeout(t);
  }, [i, paused]);
  const cur = quotes[i];
  const bg = inView ? 'var(--inv-surface)' : 'var(--surface-page)';
  const bgT = 'background 1400ms cubic-bezier(0.4,0,0.2,1)';
  return (
    <section onMouseEnter={() => setPaused(true)} onMouseLeave={() => setPaused(false)} style={{ position: 'relative' }}>
      <div className="rfade" style={{ position: 'absolute', left: 0, right: 0, top: 0, height: 240, background: 'linear-gradient(180deg, rgba(247,243,237,1) 0%, rgba(247,243,237,0.93) 10%, rgba(247,243,237,0.82) 20%, rgba(247,243,237,0.68) 30%, rgba(247,243,237,0.52) 40%, rgba(247,243,237,0.36) 50%, rgba(247,243,237,0.22) 60%, rgba(247,243,237,0.12) 70%, rgba(247,243,237,0.05) 80%, rgba(247,243,237,0.015) 90%, rgba(247,243,237,0) 100%)', pointerEvents: 'none', zIndex: 1 }}></div>
      <div style={{ background: bg, transition: bgT }}>
        <div className="rstd-head" style={{ maxWidth: 1280, margin: '0 auto', padding: '88px 48px 64px', textAlign: 'center' }}>
          <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 52, letterSpacing: 'var(--tracking-display)', color: inView ? 'var(--inv-text-1)' : 'var(--ink-1)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: '0 auto', maxWidth: 760 }}>
            The standard we sign to.
          </h2>
          <p style={{ font: 'var(--type-body-lg)', color: inView ? 'var(--inv-text-2)' : 'var(--text-muted)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: '22px auto 0', maxWidth: 540 }}>Most firms show you logos. We show you the terms. Three commitments, written into every engagement, and you hold us to all three.</p>
        </div>
      </div>
      <div style={{ background: bg, transition: bgT }}>
        <div className="rstd-wrap" style={{ maxWidth: 1280, margin: '0 auto', padding: '0 48px' }}>
          <div className="rproof" style={{ position: 'relative', borderRadius: 22, overflow: 'hidden', aspectRatio: '1320/640', background: '#31424f', boxShadow: '0 32px 80px rgba(12,25,38,0.3)' }}>
            {quotes.map((q, k) => (
              <picture key={q.name}>
                <source media="(max-width: 900px)" srcSet={q.imgM} />
                <img src={q.img} alt={q.name} loading="lazy" decoding="async" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', objectPosition: '58% 50%', opacity: k === i ? 1 : 0, transform: k === i ? 'scale(1)' : 'scale(1.05)', transition: 'opacity 900ms cubic-bezier(0.2,0,0,1), transform 1400ms cubic-bezier(0.2,0,0,1)' }} />
              </picture>
            ))}
            <div className="rproof-grad" style={{ position: 'absolute', inset: 0, background: 'linear-gradient(90deg, rgba(8,16,26,0.92) 0%, rgba(8,16,26,0.66) 34%, rgba(8,16,26,0.18) 58%, rgba(8,16,26,0.72) 88%, rgba(8,16,26,0.82) 100%)' }}></div>
            <span className="rproof-tag" style={{ position: 'absolute', top: 48, left: 64, font: 'var(--type-label)', letterSpacing: 'var(--tracking-label)', textTransform: 'uppercase', color: 'var(--inv-text-1)', background: 'rgba(12,25,38,0.55)', borderRadius: 6, padding: '8px 12px', backdropFilter: 'blur(6px)' }}>{cur.tag}</span>
            <div key={i} className="rproof-q" style={{ position: 'absolute', left: 64, bottom: 64, maxWidth: 500, animation: 'hmPanelIn 700ms cubic-bezier(0.2,0,0,1) both' }}>
              <div className="rproof-name" style={{ fontFamily: 'var(--font-mono)', fontSize: 12, letterSpacing: '0.18em', textTransform: 'uppercase', color: '#EDCB8B', marginBottom: 18 }}>{cur.name}</div>
              <p className="rproof-stmt" style={{ fontFamily: 'var(--font-display)', fontSize: 40, lineHeight: 1.12, letterSpacing: '-0.01em', color: 'var(--inv-text-1)', margin: '0 0 18px', textShadow: '0 1px 24px rgba(12,25,38,0.45)' }}>{cur.q}</p>
              <p className="rproof-sub" style={{ fontFamily: 'var(--font-sans)', fontSize: 16.5, lineHeight: 1.55, color: 'rgba(247,243,237,0.78)', margin: 0, maxWidth: 460, textShadow: '0 1px 18px rgba(12,25,38,0.4)' }}>{cur.sub}</p>
            </div>
            <div key={'m' + i} className="rproof-m" style={{ position: 'absolute', right: 64, bottom: 64, display: 'flex', flexDirection: 'column', gap: 22, textAlign: 'right', paddingLeft: 26, borderLeft: '1px solid rgba(245,241,233,0.18)', animation: 'hmPanelIn 700ms cubic-bezier(0.2,0,0,1) 150ms both' }}>
              {cur.metrics.map(([v, l]) => (
                <div key={l}>
                  <div style={{ font: 'var(--type-data-lg)', fontSize: 25, letterSpacing: '-0.01em', color: 'var(--inv-text-1)', fontVariantNumeric: 'tabular-nums', textShadow: '0 1px 18px rgba(12,25,38,0.55)' }}>{v}</div>
                  <div style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'rgba(247,243,237,0.62)', marginTop: 5 }}>{l}</div>
                </div>
              ))}
            </div>
          </div>
        </div>
        <div style={{ display: 'flex', justifyContent: 'center', gap: 10, padding: '40px 0 0' }}>
          {quotes.map((q, k) => (
            <button key={q.name} onClick={() => setI(k)} aria-label={'Commitment ' + (k + 1)} style={{ width: k === i ? 52 : 26, height: 3, border: 0, borderRadius: 2, padding: 0, cursor: 'pointer', background: k === i ? (inView ? 'var(--inv-text-1)' : 'var(--ink-1)') : (inView ? 'rgba(247,243,237,0.28)' : 'rgba(17,34,49,0.22)'), transition: 'all 300ms cubic-bezier(0.2,0,0,1), background 1400ms cubic-bezier(0.4,0,0.2,1)' }}></button>
          ))}
        </div>
        <div className="rstd-band" style={{ maxWidth: 1280, margin: '0 auto', padding: '64px 48px 80px' }}>
          <div className="rterms" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, minmax(0, 1fr))', gap: '40px 48px', borderTop: '1px solid', borderTopColor: inView ? 'var(--inv-hairline)' : 'var(--hairline)', transition: 'border-color 1400ms cubic-bezier(0.4,0,0.2,1)', paddingTop: 48 }}>
            {[['Engagements at a time', '3', 'Partner‑led and senior‑only. We take three, so every one gets the founders'], ['Diagnostic, then you decide', '2 wks', 'Flat fee, credited in full against the build. Walk away with the roadmap either way'], ['Of the IP transfers to you', '100%', 'Code, models, docs and runbooks. Your team runs it, with no lock‑in']].map(([l, v, d]) => (
              <div key={l}>
                <div style={{ font: 'var(--type-data-lg)', fontSize: 44, color: inView ? 'var(--inv-text-1)' : 'var(--ink-1)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', fontVariantNumeric: 'tabular-nums', letterSpacing: '-0.02em' }}>{v}</div>
                <div style={{ font: 'var(--type-ui-medium)', fontSize: 15, color: inView ? 'var(--inv-text-1)' : 'var(--ink-1)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: '14px 0 6px' }}>{l}</div>
                <div style={{ font: 'var(--type-body-sm)', fontSize: 14, lineHeight: 1.55, color: inView ? 'var(--inv-text-2)' : 'var(--text-muted)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', maxWidth: '38ch' }}>{d}</div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- 03 Cards ---------- */
function Cards() {
  const [frozen, setFrozen] = React.useState(false);
  return (
    <section style={{ background: 'var(--inv-surface)', borderTop: '1px solid var(--inv-hairline)', borderBottom: '1px solid var(--inv-hairline)' }}>
      <div className="rw" style={{ ...wrap, padding: '120px 40px' }}>
        <SectionLabel number="03" inverse>Cards</SectionLabel>
        <div className="rg" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 64, marginTop: 56, alignItems: 'center' }}>
          <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 20 }}>
            <div style={{
              width: 380, height: 238, borderRadius: 16, background: 'linear-gradient(135deg, rgba(247,243,237,0.10), rgba(247,243,237,0.04))', border: '1px solid var(--inv-hairline)',
              padding: 28, display: 'flex', flexDirection: 'column', justifyContent: 'space-between',
              boxShadow: 'var(--shadow-float)', opacity: frozen ? 0.55 : 1, transition: 'opacity 200ms cubic-bezier(0.2,0,0,1)',
            }}>
              <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
                <span style={{ font: '400 19px/1 var(--font-display)', letterSpacing: '-0.01em', color: 'var(--inv-text-1)' }}>hallmir</span>
                {frozen ? <Badge tone="ink" style={{ background: 'rgba(247,243,237,0.14)', color: 'var(--inv-text-1)' }}>Frozen</Badge> : null}
              </div>
              <div>
                <div style={{ font: 'var(--type-data)', color: 'var(--inv-text-2)', letterSpacing: '0.08em' }}>•••• •••• •••• 4021</div>
                <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 10 }}>
                  <span style={{ font: 'var(--type-data)', color: 'var(--inv-text-1)' }}>E. HALLORAN</span>
                  <span style={{ font: 'var(--type-data)', color: 'var(--inv-text-2)' }}>08/29</span>
                </div>
              </div>
            </div>
            <label style={{ display: 'inline-flex', alignItems: 'center', gap: 10, cursor: 'pointer', font: 'var(--type-body)', color: 'var(--inv-text-2)' }}>
              <window.HallmirSwitchProxy checked={frozen} onChange={setFrozen} />
              Freeze card instantly
            </label>
          </div>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 20, alignItems: 'flex-start' }}>
            <h2 className="rh2" style={{ font: 'var(--type-display-2)', letterSpacing: 'var(--tracking-display)', margin: 0, color: 'var(--inv-text-1)' }}>
              One card. Spend anywhere, in any currency.
            </h2>
            <p style={{ font: 'var(--type-body-lg)', color: 'var(--inv-text-2)', margin: 0, maxWidth: 440 }}>
              Interbank exchange rates, no weekend markup. Freeze it, set limits, or issue a virtual card, all from the app.
            </p>
            <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
              <Badge style={{ background: 'rgba(247,243,237,0.12)', color: 'var(--inv-text-1)' }}>No FX markup</Badge>
              <Badge style={{ background: 'rgba(247,243,237,0.12)', color: 'var(--inv-text-1)' }}>Apple Pay</Badge>
              <Badge style={{ background: 'rgba(247,243,237,0.12)', color: 'var(--inv-text-1)' }}>Virtual cards</Badge>
            </div>
            <Button variant="outline" arrow style={{ color: 'var(--inv-text-1)', border: '1px solid rgba(247,243,237,0.35)' }}>Get the card</Button>
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- 04 Savings ---------- */
function Savings() {
  return (
    <section style={{ background: inView ? 'var(--inv-surface)' : 'var(--surface-page)', transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1)' }}>
      <div className="rw" style={{ ...wrap, padding: '120px 40px' }}>
      <SectionLabel number="04" inverse>Savings</SectionLabel>
      <div className="rg" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 24, marginTop: 56 }}>
        <div style={{ gridColumn: '1 / 2' }}>
          <h2 className="rh2" style={{ font: 'var(--type-display-2)', letterSpacing: 'var(--tracking-display)', margin: 0, color: 'var(--inv-text-1)' }}>
            Interest, paid daily.
          </h2>
          <p style={{ font: 'var(--type-body-lg)', color: 'var(--inv-text-2)', margin: '16px 0 24px', maxWidth: 380 }}>
            Instant-access savings. No fees, no lock‑ins, no small print surprises.
          </p>
          <Button arrow>Start saving</Button>
        </div>
        <Card padding={28} style={{ alignSelf: 'start' }}>
          <Stat label="Easy access" value="4.50%" delta="AER variable" deltaTone="neutral" footnote="Paid daily, withdraw anytime" />
        </Card>
        <Card padding={28} style={{ alignSelf: 'start' }}>
          <Stat label="Fixed · 12 months" value="5.10%" delta="AER fixed" deltaTone="neutral" footnote="FSCS protected up to £85,000" />
        </Card>
      </div>
      </div>
    </section>
  );
}

/* ---------- 05 Business ---------- */
function Business() {
  return (
    <section style={{ background: inView ? 'var(--inv-surface)' : 'var(--surface-page)', transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1)' }}>
      <div className="rw" style={{ ...wrap, padding: '120px 40px' }}>
        <SectionLabel number="05" inverse>Business</SectionLabel>
        <div className="rg" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 64, marginTop: 56, alignItems: 'center' }}>
          <div style={{ display: 'flex', flexDirection: 'column', gap: 20, alignItems: 'flex-start' }}>
            <h2 className="rh2" style={{ font: 'var(--type-display-2)', letterSpacing: 'var(--tracking-display)', margin: 0, color: 'var(--inv-text-1)' }}>
              The same ledger, for your company.
            </h2>
            <p style={{ font: 'var(--type-body-lg)', color: 'var(--inv-text-2)', margin: 0, maxWidth: 440 }}>
              Multi-currency accounts, corporate cards with receipt capture, and payment rails your accountant will actually thank you for.
            </p>
            <Button variant="primary" arrow>Explore Business</Button>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 1, background: 'var(--inv-hairline)', border: '1px solid var(--inv-hairline)' }}>
            {[
              ['GBP · Operating', '£412,806.19'],
              ['EUR · Payroll', '€96,114.02'],
              ['USD · Revenue', '$1,204,551.87'],
              ['Cards issued', '38'],
            ].map(([l, v]) => (
              <div key={l} style={{ background: 'var(--inv-surface)', padding: '22px 20px' }}>
                <div className="h-label" style={{ color: 'var(--inv-text-2)', marginBottom: 10 }}>{l}</div>
                <div style={{ font: 'var(--type-data-lg)', fontSize: 22, color: 'var(--inv-text-1)', fontVariantNumeric: 'tabular-nums' }}>{v}</div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Trust ---------- */
function Trust() {
  return (
    <section style={{ background: 'var(--inv-surface)', borderTop: '1px solid var(--inv-hairline)' }}>
      <div className="rw" style={{ ...wrap, padding: '96px 40px' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 24, flexWrap: 'wrap' }}>
        <div style={{ display: 'flex', gap: 8 }}>
          <Badge style={{ background: 'var(--paper-1)', color: 'var(--ink-1)' }}>FSCS Protected</Badge>
          <Badge style={{ background: 'rgba(247,243,237,0.12)', color: 'var(--inv-text-1)' }}>FCA Regulated</Badge>
          <Badge style={{ background: 'rgba(247,243,237,0.12)', color: 'var(--inv-text-1)' }}>Current account switch guarantee</Badge>
        </div>
        <div style={{ display: 'flex', gap: 48 }}>
          {[['Customers', '1.2M'], ['Uptime, 12 months', '99.98%'], ['Support', '24/7']].map(([l, v]) => (
            <div key={l}>
              <div className="h-label" style={{ color: 'var(--inv-text-2)', marginBottom: 10 }}>{l}</div>
              <div style={{ font: 'var(--type-data-lg)', color: 'var(--inv-text-1)', fontVariantNumeric: 'tabular-nums' }}>{v}</div>
            </div>
          ))}
        </div>
      </div>
      </div>
    </section>
  );
}

/* ---------- Capabilities: Mercury-style feature grid ---------- */
function useReveal(threshold = 0.4) {
  const ref = React.useRef(null);
  const [shown, setShown] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const io = new IntersectionObserver(([e]) => { if (e.isIntersecting) { setShown(true); io.disconnect(); } }, { threshold });
    io.observe(el);
    return () => io.disconnect();
  }, []);
  return [ref, shown];
}
const capIn = (shown, delay, name) => ({ opacity: 0, animation: shown ? (name || 'capIn') + ' 700ms cubic-bezier(0.2,0,0,1) ' + delay + 'ms both' : 'none' });
function CapChip({ children, shown, delay, style }) {
  return (
    <div className="rcapchip" style={{ position: 'absolute', display: 'flex', alignItems: 'center', gap: 10, background: '#fff', borderRadius: 999, padding: '15px 24px', boxShadow: '0 12px 34px rgba(12,25,38,0.18)', fontFamily: 'var(--font-sans)', fontSize: 17, fontWeight: 500, color: 'var(--ink-1)', whiteSpace: 'nowrap', ...capIn(shown, delay, 'capPop'), ...style }}>
      <span style={{ color: 'var(--coral-1)', fontSize: 13 }}>{'\u2726'}</span>{children}
    </div>
  );
}
const capGrain = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E\")";
function FeatureTile({ children, inView, tRef }) {
  return (
    <div ref={tRef} className="rcaptile" style={{ position: 'relative', height: 430, borderRadius: 16, background: 'linear-gradient(180deg, #F1EEE8 0%, #E9E5DD 100%)', overflow: 'hidden', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      <div style={{ position: 'absolute', inset: 0, background: 'radial-gradient(120% 90% at 50% 8%, rgba(255,255,255,0.5), transparent 55%)', pointerEvents: 'none' }}></div>
      <div className="rcapinner" style={{ width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>{children}</div>
      <div style={{ position: 'absolute', inset: 0, backgroundImage: capGrain, opacity: 0.22, mixBlendMode: 'overlay', pointerEvents: 'none' }}></div>
    </div>
  );
}
function ValueTile({ inView }) {
  const [ref, shown] = useReveal();
  return (
    <FeatureTile inView={inView} tRef={ref}>
      <div style={{ width: 470, maxWidth: '100%', background: 'rgba(255,255,255,0.78)', borderRadius: 14, padding: '34px 38px 28px', boxShadow: '0 1px 2px rgba(12,25,38,0.05), 0 14px 44px rgba(12,25,38,0.12)', border: '1px solid rgba(12,25,38,0.04)', ...capIn(shown, 0) }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginBottom: 30 }}>
          <span style={{ font: '600 28px/1 var(--font-display)', color: 'rgba(17,34,49,0.6)' }}>Value model</span>
          <span style={{ fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.16em', color: 'rgba(17,34,49,0.45)' }}>FY26 PLAN</span>
        </div>
        {[[150, 64], [190, 48], [110, 72], [168, 42], [128, 56]].map(([w, v], j) => (
          <div key={j} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '13px 0', borderTop: '1px solid rgba(17,34,49,0.05)', filter: 'blur(5px)', opacity: 0.75 }}>
            <span style={{ width: w, height: 10, borderRadius: 6, background: 'rgba(17,34,49,0.2)' }}></span>
            <span style={{ width: v, height: 10, borderRadius: 6, background: 'rgba(17,34,49,0.12)' }}></span>
          </div>
        ))}
      </div>
      <CapChip shown={shown} delay={250} style={{ top: '32%', left: 36 }}>EBITDA +2.1pts</CapChip>
      <CapChip shown={shown} delay={430} style={{ top: '48%', right: 34 }}>Payback 9 mo</CapChip>
      <CapChip shown={shown} delay={610} style={{ bottom: '9%', right: 120 }}>$4.2M run‑rate</CapChip>
    </FeatureTile>
  );
}
function SpeedTile({ inView }) {
  const [ref, shown] = useReveal();
  const rows = [
    { l: 'Scope & value model', s: 0, w: 20, c: 'rgba(17,34,49,0.28)', d: 250 },
    { l: 'Build, embedded', s: 20, w: 34, c: 'rgba(17,34,49,0.45)', d: 450 },
    { l: 'Live in operations', s: 54, w: 46, c: 'var(--coral-1)', d: 650 },
  ];
  return (
    <FeatureTile inView={inView} tRef={ref}>
      <div style={{ width: 470, maxWidth: '100%', background: 'rgba(255,255,255,0.78)', borderRadius: 14, padding: '34px 38px 30px', boxShadow: '0 1px 2px rgba(12,25,38,0.05), 0 14px 44px rgba(12,25,38,0.12)', border: '1px solid rgba(12,25,38,0.04)', ...capIn(shown, 0) }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', marginBottom: 28 }}>
          <span style={{ font: '600 28px/1 var(--font-display)', color: 'rgba(17,34,49,0.6)' }}>Delivery plan</span>
          <span style={{ fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.16em', color: 'rgba(17,34,49,0.45)' }}>WEEKS 1{'–'}12</span>
        </div>
        <div style={{ position: 'relative' }}>
          {[25, 50, 75].map((x) => <div key={x} style={{ position: 'absolute', left: x + '%', top: 0, bottom: 0, width: 1, background: 'rgba(17,34,49,0.06)' }}></div>)}
          {rows.map((r, ri) => (
            <div key={r.l} style={{ marginBottom: ri === 2 ? 4 : 22 }}>
              <div style={{ fontFamily: 'var(--font-sans)', fontSize: 14, fontWeight: 500, color: 'var(--text-muted)', marginBottom: 8 }}>{r.l}</div>
              <div style={{ position: 'relative', height: 12, borderRadius: 6, background: 'rgba(17,34,49,0.06)' }}>
                <div style={{ position: 'absolute', left: r.s + '%', width: r.w + '%', top: 0, bottom: 0, borderRadius: 6, background: r.c, transformOrigin: 'left center', animation: shown ? 'gapGrow 900ms cubic-bezier(0.2,0,0,1) ' + r.d + 'ms both' : 'none', opacity: shown ? 1 : 0 }}></div>
              </div>
            </div>
          ))}
          <div style={{ position: 'absolute', left: '54%', top: -4, bottom: 26, width: 1.5, background: 'rgba(140,109,63,0.55)', ...capIn(shown, 900) }}></div>
        </div>
      </div>
      <CapChip shown={shown} delay={1050} style={{ bottom: '5%', right: 40 }}>First value {'·'} week 6</CapChip>
    </FeatureTile>
  );
}
function GovTile({ inView }) {
  const [ref, shown] = useReveal();
  const rows = [['Mar', 'Pricing engine', '+$412k', 'Live'], ['Feb', 'Claims triage', '+$188k', 'Live'], ['Jan', 'Forecasting', '+$95k', 'Handover']];
  return (
    <FeatureTile inView={inView} tRef={ref}>
      <div style={{ width: 440, background: 'rgba(255,255,255,0.72)', borderRadius: 14, padding: '26px 32px 8px', boxShadow: '0 1px 2px rgba(12,25,38,0.05), 0 14px 44px rgba(12,25,38,0.12)', border: '1px solid rgba(12,25,38,0.04)', ...capIn(shown, 0) }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', fontFamily: 'var(--font-sans)', fontSize: 13.5, color: 'var(--text-faint)', paddingBottom: 12 }}><span style={{ width: 56 }}>Month</span><span style={{ flex: 1 }}>Workstream</span><span style={{ width: 84, textAlign: 'right' }}>Impact</span><span style={{ width: 84, textAlign: 'right' }}>Status</span></div>
        {rows.map((r, j) => (
          <div key={j} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', fontFamily: 'var(--font-sans)', fontSize: 15.5, color: 'var(--ink-1)', padding: '14px 0', borderTop: '1px solid rgba(17,34,49,0.07)', ...capIn(shown, 200 + j * 140) }}>
            <span style={{ width: 56, color: 'var(--text-muted)' }}>{r[0]}</span><span style={{ flex: 1 }}>{r[1]}</span>
            <span style={{ width: 84, textAlign: 'right', fontFamily: 'var(--font-mono)', fontSize: 14.5 }}>{r[2]}</span>
            <span style={{ width: 84, textAlign: 'right', display: 'inline-flex', justifyContent: 'flex-end', alignItems: 'center', gap: 6, fontSize: 14, color: r[3] === 'Live' ? 'var(--coral-2)' : 'var(--text-muted)' }}>{r[3] === 'Live' ? <span style={{ width: 6, height: 6, borderRadius: '50%', background: 'var(--coral-1)' }}></span> : null}{r[3]}</span>
          </div>
        ))}
        {[[64, 110], [50, 90]].map(([a, b], j) => (
          <div key={j} style={{ display: 'flex', justifyContent: 'space-between', padding: '14px 0', borderTop: '1px solid rgba(17,34,49,0.07)', filter: 'blur(5px)' }}>{[a, b, 58, 48].map((x, k) => <span key={k} style={{ width: x, height: 10, borderRadius: 6, background: 'rgba(17,34,49,0.2)' }}></span>)}</div>
        ))}
      </div>
      <CapChip shown={shown} delay={700} style={{ bottom: '12%', right: 54 }}>Audit trail attached</CapChip>
    </FeatureTile>
  );
}
function HandoverTile({ inView }) {
  const [ref, shown] = useReveal();
  const [on, setOn] = React.useState(false);
  const [pressed, setPressed] = React.useState(false);
  React.useEffect(() => {
    if (!shown) { setOn(false); return; }
    const t = setTimeout(() => setOn(true), 900);
    return () => clearTimeout(t);
  }, [shown]);
  const spring = 'cubic-bezier(0.34,1.56,0.64,1)';
  const field = { border: '1px solid rgba(17,34,49,0.13)', borderRadius: 10, padding: '13px 16px', fontFamily: 'var(--font-sans)', fontSize: 16, color: 'var(--ink-1)', overflow: 'hidden' };
  const label = { fontFamily: 'var(--font-sans)', fontSize: 13.5, color: 'var(--text-muted)', marginBottom: 8 };
  const swap = (key) => ({ animation: 'capIn 340ms cubic-bezier(0.2,0,0,1) both', display: 'inline-block' });
  return (
    <FeatureTile inView={inView} tRef={ref}>
      <div style={{ width: 408, background: 'rgba(255,255,255,0.78)', borderRadius: 14, padding: '30px 34px', boxShadow: '0 1px 2px rgba(12,25,38,0.05), 0 14px 44px rgba(12,25,38,0.12)', border: '1px solid rgba(12,25,38,0.04)', ...capIn(shown, 0) }}>
        <div style={{ display: 'flex', gap: 20, marginBottom: 24, ...capIn(shown, 160) }}>
          <div style={{ flex: 1 }}><div style={label}>Handover date</div><div style={{ ...field, display: 'flex', justifyContent: 'space-between', color: on ? 'var(--ink-1)' : 'var(--coral-2)', transition: 'color 300ms' }}><span key={'d' + on} style={swap()}>{on ? 'Sep 1, 2026' : 'Never'}</span> <span style={{ color: 'var(--text-faint)' }}>{'▾'}</span></div></div>
          <div style={{ width: 128 }}><div style={label}>Owner</div><div style={field}><span key={'o' + on} style={swap()}>{on ? 'Your team' : 'The vendor'}</span></div></div>
        </div>
        <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 24, ...capIn(shown, 320) }}>
          <button onClick={() => setOn(v => !v)} onPointerDown={() => setPressed(true)} onPointerUp={() => setPressed(false)} onPointerLeave={() => setPressed(false)} aria-pressed={on} style={{ width: 44, height: 26, borderRadius: 999, border: 0, padding: 0, cursor: 'pointer', background: on ? 'var(--coral-1)' : 'rgba(17,34,49,0.25)', transition: 'background 280ms cubic-bezier(0.4,0,0.2,1)', position: 'relative', flexShrink: 0, transform: pressed ? 'scale(0.94)' : 'none' }}>
            <span style={{ position: 'absolute', top: 3, left: 3, width: pressed ? 24 : 20, height: 20, borderRadius: 999, background: '#fff', boxShadow: '0 1px 4px rgba(12,25,38,0.3)', transform: on ? 'translateX(' + (pressed ? 14 : 18) + 'px)' : 'none', transition: 'transform 380ms ' + spring + ', width 160ms cubic-bezier(0.4,0,0.2,1)' }}></span>
          </button>
          <span style={{ fontFamily: 'var(--font-sans)', fontSize: 16, color: 'var(--ink-1)' }}>Hand everything over</span>
        </div>
        <div style={{ ...capIn(shown, 480) }}>
          <div style={label}>Included at handover</div>
          <div style={{ ...field, color: on ? 'var(--ink-1)' : 'var(--text-muted)', transition: 'color 300ms' }}><span key={'i' + on} style={swap()}>{on ? 'Runbook, on-call rota, retraining plan' : 'A licence and a support ticket'}</span></div>
          <div style={{ fontFamily: 'var(--font-sans)', fontSize: 13, color: on ? 'var(--text-faint)' : 'var(--coral-2)', transition: 'color 300ms', marginTop: 10, minHeight: 18 }}><span key={'n' + on} style={swap()}>{on ? 'How every Hallmir engagement ends.' : 'How it usually works. Not how we work, tap it back.'}</span></div>
        </div>
      </div>
    </FeatureTile>
  );
}
function FeatureCell({ tile, title, body, inView }) {
  return (
    <div className="rcap-cell">
      {React.cloneElement(tile, { inView })}
      <h3 style={{ fontFamily: 'var(--font-sans)', fontSize: 19, fontWeight: 600, color: inView ? 'var(--inv-text-1)' : 'var(--ink-1)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: '26px 0 8px' }}>{title}</h3>
      <p style={{ font: 'var(--type-body-lg)', color: inView ? 'var(--inv-text-2)' : 'var(--text-muted)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: 0, maxWidth: 520 }}>{body}</p>
    </div>
  );
}
function Capabilities({ inView }) {
  return (
    <section style={{ position: 'relative', background: inView ? 'var(--inv-surface)' : 'var(--surface-page)', transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1)' }}>
      <div className="rw" style={{ ...wrap, maxWidth: 1280, padding: '56px 48px 80px' }}>
      <div style={{ borderTop: '1px solid', borderTopColor: inView ? 'var(--inv-hairline)' : 'var(--hairline)', transition: 'border-color 1400ms cubic-bezier(0.4,0,0.2,1)', paddingTop: 48, marginBottom: 64 }}>
        <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 44, letterSpacing: 'var(--tracking-display)', color: inView ? 'var(--inv-text-1)' : 'var(--ink-1)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: 0, maxWidth: 640 }}>AI’s been a promise. Now, it’s a line item.</h2>
      </div>
      <div className="rg rcap-grid" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', columnGap: 56, rowGap: 88 }}>
        <FeatureCell inView={inView} tile={<ValueTile />} title="Value creation, not cost‑cutting" body="Revenue, pricing and velocity through product and marketing, not headcount cuts. The model shows which line moves before any code is written." />
        <FeatureCell inView={inView} tile={<SpeedTile />} title="Speed, at hold‑period pace" body="First system live in weeks, not a transformation programme. Every workstream is scoped to pay back inside the hold, not after it." />
        <FeatureCell inView={inView} tile={<GovTile />} title="Governance-first, audit‑ready" body="Every model, decision and data flow is documented as it ships, so the work survives diligence, not just the demo." />
        <FeatureCell inView={inView} tile={<HandoverTile />} title="You own the IP" body="Everything we build is yours: code, models, playbooks. Your team runs it before we leave. No licences, no lock‑in, nothing to negotiate at exit." />
      </div>
      </div>

    </section>
  );
}

/* ---------- Dark band: Proof + Capabilities share one background state ---------- */
function DarkBand() {
  const ref = React.useRef(null);
  const [inView, setInView] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    let last = window.scrollY, upDist = 0;
    const onScroll = () => {
      const y = window.scrollY;
      const dy = y - last;
      last = y;
      upDist = dy < 0 ? upDist - dy : 0;
      const r = el.getBoundingClientRect();
      const line = window.innerHeight * 0.49;
      const q = el.lastElementChild.getBoundingClientRect();
      setInView(r.top < line && r.bottom > line && upDist < 160 && q.top > window.innerHeight * 0.55);
    };
    onScroll();
    window.addEventListener('scroll', onScroll, { passive: true });
    return () => window.removeEventListener('scroll', onScroll);
  }, []);
  return <div ref={ref}><Proof inView={inView} /><Capabilities inView={inView} /><QuoteBand inView={inView} /></div>;
}

/* ---------- Closing quote ---------- */
function QuoteBand({ inView }) {
  const [ref, shown] = useReveal(0.5);
  return (
    <section ref={ref} style={{ position: 'relative', background: inView ? 'var(--inv-surface)' : 'var(--surface-page)', transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1)' }}>
      <div className="rqb" style={{ maxWidth: 980, margin: '0 auto', padding: '88px 48px 80px', textAlign: 'center' }}>
        <div style={{ fontFamily: 'var(--font-mono)', fontSize: 12, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--text-link)', marginBottom: 30, ...capIn(shown, 0) }}>How we work</div>
        <p className="rqb-line" style={{ fontFamily: 'var(--font-display)', fontSize: 40, lineHeight: 1.24, color: inView ? 'var(--inv-text-1)' : 'var(--ink-1)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: 0, ...capIn(shown, 90) }}>
          We would rather be judged on the number we moved than the deck we left behind.
        </p>
        <p className="rqb-sub" style={{ fontFamily: 'var(--font-sans)', fontSize: 17, lineHeight: 1.6, color: inView ? 'var(--inv-text-2)' : 'var(--text-muted)', transition: 'color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: '28px auto 0', maxWidth: 560, ...capIn(shown, 220) }}>
          Every engagement is scoped against one line in the P&L, built by the people who sold it, and handed to your team to run.
        </p>
      </div>
      <div style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 380, background: 'linear-gradient(0deg, rgba(247,243,237,1) 0%, rgba(247,243,237,0.93) 10%, rgba(247,243,237,0.82) 20%, rgba(247,243,237,0.68) 30%, rgba(247,243,237,0.52) 40%, rgba(247,243,237,0.36) 50%, rgba(247,243,237,0.22) 60%, rgba(247,243,237,0.12) 70%, rgba(247,243,237,0.05) 80%, rgba(247,243,237,0.015) 90%, rgba(247,243,237,0) 100%)', pointerEvents: 'none', opacity: inView ? 0 : 1, transition: 'opacity 1400ms cubic-bezier(0.4,0,0.2,1)' }}></div>
    </section>
  );
}

/* ---------- Get started: accordion + switching exhibit ---------- */
function ShotWindow({ src, label, chip, offset, delay, floatB, imgH, bodyPad, maxW }) {
  const pos = offset
    ? { position: 'absolute', left: offset.x, right: offset.r, top: offset.y }
    : { position: 'relative', width: '100%', maxWidth: maxW || 520 };
  // className hook lives on the wrapper below
  return (
    <div className="rshot" style={{ ...pos, animation: 'shotIn 700ms cubic-bezier(0.2,0,0,1) ' + delay + 'ms both' }}>
      <div style={{ animation: (floatB ? 'shotFloatB' : 'shotFloat') + ' ' + (floatB ? 8 : 7) + 's ease-in-out infinite', animationDelay: delay + 'ms' }}>
        <div style={{ borderRadius: 12, overflow: 'hidden', background: '#0f151d', border: '1px solid rgba(247,243,237,0.12)', boxShadow: '0 30px 60px -18px rgba(6,12,20,0.7), 0 8px 20px rgba(6,12,20,0.4)' }}>
          <div style={{ display: 'flex', alignItems: 'center', gap: 7, padding: '9px 12px', background: 'rgba(247,243,237,0.04)', borderBottom: '1px solid rgba(247,243,237,0.08)' }}>
            <span style={{ width: 8, height: 8, borderRadius: '50%', background: 'rgba(247,243,237,0.22)' }}></span>
            <span style={{ width: 8, height: 8, borderRadius: '50%', background: 'rgba(247,243,237,0.22)' }}></span>
            <span style={{ width: 8, height: 8, borderRadius: '50%', background: 'rgba(247,243,237,0.22)' }}></span>
            <span style={{ marginLeft: 8, fontFamily: 'var(--font-mono)', fontSize: 9.5, letterSpacing: '0.12em', color: 'rgba(247,243,237,0.5)' }}>{label}</span>
            {chip ? <span style={{ marginLeft: 'auto', display: 'inline-flex', alignItems: 'center', gap: 5, fontFamily: 'var(--font-mono)', fontSize: 9, letterSpacing: '0.14em', color: 'rgba(247,243,237,0.55)' }}><span style={{ width: 6, height: 6, borderRadius: '50%', background: '#3ecf8e', animation: 'shotLive 1.8s ease-in-out infinite' }}></span>LIVE</span> : null}
          </div>
          <div style={{ position: 'relative', overflow: 'hidden', padding: bodyPad || 0, background: '#0f151d' }}>
            <img className="rshot-img" src={src} alt={label} draggable="false" loading="lazy" decoding="async" style={{ display: 'block', width: '100%', height: 'auto' }} />
            <div style={{ position: 'absolute', top: 0, bottom: 0, width: '38%', background: 'linear-gradient(105deg, transparent, rgba(247,243,237,0.12), transparent)', animation: 'shotSheen 7s ease-in-out infinite', animationDelay: (delay + 900) + 'ms', pointerEvents: 'none' }}></div>
          </div>
        </div>
      </div>
    </div>
  );
}

function StartVisual({ active }) {
  const cardBg = 'linear-gradient(180deg, #1a2431 0%, #131b26 100%)';
  const grid = 'linear-gradient(rgba(247,243,237,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(247,243,237,0.035) 1px, transparent 1px)';
  return (
    <div className="rcase" style={{ position: 'relative', height: 640, borderRadius: 20, background: cardBg, border: '1px solid rgba(247,243,237,0.10)', boxShadow: '0 26px 70px rgba(12,25,38,0.22)', overflow: 'hidden' }}>
      <div style={{ position: 'absolute', inset: 0, backgroundImage: grid, backgroundSize: '46px 46px', pointerEvents: 'none' }}></div>
      <div style={{ position: 'absolute', inset: 0, background: active === 0 ? 'radial-gradient(52% 40% at 62% 34%, rgba(140,109,63,0.15), transparent 72%)' : 'radial-gradient(52% 40% at 40% 30%, rgba(140,109,63,0.14), transparent 72%)', transition: 'background 700ms ease', pointerEvents: 'none' }}></div>
      {active === 0 ? (
        <div key="v0" className="rstart-pane" style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '54px 40px 96px' }}>
          <ShotWindow src="/ui_kits/homepage/assets/shot-apexure.png" label="Apexure OS · Boardroom" chip delay={0} maxW={620} />
          <div style={{ position: 'absolute', left: 34, bottom: 30, right: 34, animation: 'capIn 500ms cubic-bezier(0.2,0,0,1) 200ms both' }}>
            <span style={{ fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.16em', color: 'rgba(247,243,237,0.6)' }}>PROVE IT IN ONE. ROLL IT ACROSS THE FUND.</span>
          </div>
        </div>
      ) : (
        <div key="v1" className="rstart-pane" style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '54px 40px 96px' }}>
          <ShotWindow src="/ui_kits/homepage/assets/shot-signal.png" label="Signal · Marketing intelligence" chip delay={0} />
          <div style={{ position: 'absolute', left: 34, bottom: 30, right: 34, animation: 'capIn 500ms cubic-bezier(0.2,0,0,1) 200ms both' }}>
            <span style={{ fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.16em', color: 'rgba(247,243,237,0.6)' }}>REVENUE UP. VALUATION FOLLOWS.</span>
          </div>
        </div>
      )}
      <div style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 96, background: 'linear-gradient(180deg, transparent, rgba(19,27,38,0.92))', pointerEvents: 'none' }}></div>
    </div>
  );
}
function GetStarted() {
  /* Mirrors the "build gap" section: eyebrow, headline, intro, accordion,
     quiet link CTA, panel vertically centred. No flex spacer (it was pushing
     the accordion to the bottom and leaving a void under the headline). */
  const items = [
    { t: 'For PE funds', w: 'Operating partners and value-creation leads', d: 'Portfolio\u2011wide value creation. Prove it in one company, then roll it across the fund at near\u2011zero marginal cost.', cta: 'How we work with funds' },
    { t: 'For portfolio companies', w: 'CEOs, CTOs, marketing and product leads', d: 'A marketing, product and back\u2011office AI stack: the CMO-and-product capability that lifts revenue and valuation.', cta: 'How we work with companies' },
  ];
  const [active, setActive] = React.useState(0);
  const [hov, setHov] = React.useState(null);
  const narrow = useIsNarrow();
  return (
    <section className="rw rways" style={{ ...wrap, maxWidth: 1280, padding: '88px 48px 80px' }}>
      <div className="rg" style={{ display: 'grid', gridTemplateColumns: '0.82fr 1fr', gap: 110, alignItems: 'center' }}>
        <div>
          <div className="raccl" style={{ fontFamily: 'var(--font-mono)', fontSize: 12, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--text-link)', margin: '0 0 20px' }}>Who it{'\u2019'}s for</div>
          <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 42, letterSpacing: 'var(--tracking-display)', color: 'var(--ink-1)', margin: '0 0 18px', maxWidth: 520 }}>Two ways in. The same discipline.</h2>
          <p className="rp racc-intro" style={{ font: 'var(--type-body-lg)', color: 'var(--text-muted)', margin: '0 0 34px', maxWidth: 420 }}>Whether you own the company or run it, the engagement is scoped the same way:</p>
          <div style={{ borderTop: '1px solid var(--hairline)' }}>
            {items.map((it, i) => {
              const on = i === active;
              return (
                <div key={it.t} style={{ position: 'relative', borderBottom: '1px solid var(--hairline)' }}>
                  <button className="racc-t" aria-expanded={on} onMouseEnter={() => setHov(i)} onMouseLeave={() => setHov(null)} onClick={() => setActive((a) => (a === i && narrow) ? null : i)} style={{ display: 'flex', alignItems: 'baseline', gap: 18, width: '100%', textAlign: 'left', background: 'none', border: 0, cursor: 'pointer', padding: on ? '26px 0 12px' : '22px 0', fontFamily: 'var(--font-sans)', fontSize: 19, fontWeight: on ? 500 : 400, color: on || hov === i ? 'var(--ink-1)' : 'var(--text-muted)', transition: 'color 300ms, padding 420ms cubic-bezier(0.2,0,0,1)' }}>
                    <span style={{ flex: 1 }}>{it.t}</span>
                    <span style={{ fontFamily: 'var(--font-mono)', fontSize: 19, fontWeight: 300, color: on ? 'var(--coral-2)' : 'var(--text-faint)', transform: on ? 'rotate(45deg)' : 'none', transition: 'transform 420ms cubic-bezier(0.2,0,0,1), color 300ms', alignSelf: 'center', lineHeight: 1 }}>+</span>
                  </button>
                  <div style={{ display: 'grid', gridTemplateRows: on ? '1fr' : '0fr', transition: 'grid-template-rows 420ms cubic-bezier(0.2,0,0,1)' }}>
                    <div style={{ overflow: 'hidden', minHeight: 0 }}>
                      <div style={{ fontFamily: 'var(--font-mono)', fontSize: 11.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--text-link)', margin: '0 0 12px' }}>{it.w}</div>
                      <p className="rp" style={{ font: 'var(--type-body-lg)', color: 'var(--text-muted)', margin: '0 0 22px 0', maxWidth: 420 }}>{it.d}</p>
                      {narrow && on ? <div style={{ margin: '2px 0 24px' }}><StartVisual active={active} /></div> : null}
                      {SHOW_UNBUILT_LINKS ? <EngageLink style={{ margin: '0 0 28px' }}>{it.cta}</EngageLink> : null}
                    </div>
                  </div>
                </div>
              );
            })}
          </div>
        </div>
        {!narrow ? <div key={active} style={{ animation: 'hmPanelIn 620ms cubic-bezier(0.2,0,0,1) both' }}><StartVisual active={active} /></div> : null}
      </div>
    </section>
  );
}

/* ---------- Engagement: bespoke data exhibit built from real portfolio figures ---------- */
function EngageVisual({ active }) {
  const grain = { position: 'absolute', inset: 0, backgroundImage: capGrain, opacity: 0.3, mixBlendMode: 'overlay', pointerEvents: 'none' };
  const labels = ['TWO WEEKS. A GOVERNANCE SNAPSHOT.', 'ONE P&L LINE. ONE TARGET.', 'YOURS, LIVE, IN ≤12 WEEKS.'];
  const ink = '#1b2a38', coral = 'var(--coral-1)';
  const vals = [10, 11, 15, 8, 16, 16, 7, 36, 33, 28, 25, 9];
  const months = ['Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'];
  const X0 = 56, DX = 25.8, BASE = 470, YV = (v) => (BASE - (v / 40) * 256);
  const pts = vals.map((v, i) => [X0 + i * DX, YV(v)]);
  const line = 'M ' + pts.map((p) => p[0].toFixed(1) + ' ' + p[1].toFixed(1)).join(' L ');
  const area = line + ' L ' + pts[11][0].toFixed(1) + ' ' + BASE + ' L ' + pts[0][0].toFixed(1) + ' ' + BASE + ' Z';
  const yAvg = YV(17), yTgt = YV(30);
  const proj = 'M ' + pts[11][0].toFixed(1) + ' ' + pts[11][1].toFixed(1) + ' L 372 ' + YV(20).toFixed(1) + ' L 404 ' + YV(34).toFixed(1);
  const assessOn = active === 0 ? 1 : 0;
  const scopeOn = active >= 1 ? 1 : 0;
  const shipOn = active === 2 ? 1 : 0;
  const chip = { display: 'inline-flex', alignItems: 'center', gap: 8, padding: '7px 12px', borderRadius: 8, background: 'rgba(255,255,255,0.6)', border: '1px solid rgba(27,42,56,0.1)', fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.04em', color: ink };
  const dot = (c) => ({ width: 7, height: 7, borderRadius: '50%', background: c });
  return (
    <div className="rengage" style={{ position: 'relative', height: 620, borderRadius: 20, background: 'linear-gradient(180deg, #F5F2EC 0%, #ECE8E0 55%, #E1DCD2 100%)', overflow: 'hidden' }}>
      <div style={{ position: 'absolute', inset: 0, background: 'radial-gradient(90% 55% at 30% 0%, rgba(255,255,255,0.75), transparent 60%)', pointerEvents: 'none' }}></div>
      {[320, 460].map((d, k) => (
        <div key={d} style={{ position: 'absolute', left: '52%', top: '46%', width: d, height: d, margin: (-d / 2) + 'px 0 0 ' + (-d / 2) + 'px', borderRadius: '50%', border: (22 - k * 6) + 'px solid rgba(17,34,49,' + (0.03 - k * 0.008) + ')', filter: 'blur(' + (12 + k * 4) + 'px)', animation: 'startPulse ' + (8 + k * 2) + 's ease-in-out ' + (k * 800) + 'ms infinite' }}></div>
      ))}
      <div style={{ position: 'absolute', left: '-22%', right: '-22%', bottom: '-30%', height: '58%', background: 'radial-gradient(ellipse at 50% 100%, rgba(155,175,190,0.5) 0%, rgba(155,175,190,0.18) 46%, transparent 72%)', filter: 'blur(26px)', animation: 'startMist 9s ease-in-out infinite alternate', pointerEvents: 'none' }}></div>

      <div style={{ position: 'absolute', left: 34, top: 40, right: 34 }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 10, fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.16em', color: 'rgba(27,42,56,0.5)' }}>
          <span style={dot(coral)}></span>ONE COMPANY · REVENUE, LAST 12 MONTHS
        </div>
        <div style={{ marginTop: 22, display: 'flex', gap: 10, flexWrap: 'wrap', opacity: assessOn, transform: assessOn ? 'translateY(0)' : 'translateY(-6px)', transition: 'opacity 500ms ease, transform 500ms ease' }}>
          <span style={chip}><span style={dot('#2f9e7a')}></span>£62k ACTIVE</span>
          <span style={chip}><span style={dot(coral)}></span>−18% VELOCITY</span>
          <span style={chip}><span style={dot('#c9a227')}></span>£61k AT RISK</span>
        </div>
        <div style={{ marginTop: 22, display: 'flex', alignItems: 'center', gap: 10, opacity: shipOn, transform: shipOn ? 'translateY(0)' : 'translateY(-6px)', transition: 'opacity 500ms ease 120ms, transform 500ms ease 120ms' }}>
          <span style={{ ...chip, background: 'rgba(140,109,63,0.1)', borderColor: 'rgba(140,109,63,0.28)', color: '#8C6D3F' }}><span style={{ ...dot('#3ecf8e'), animation: 'shotLive 1.8s ease-in-out infinite' }}></span>LIVE IN OPERATIONS</span>
          <span style={chip}>OWNED BY YOUR TEAM</span>
        </div>
      </div>

      <svg viewBox="0 0 460 620" preserveAspectRatio="xMidYMax meet" style={{ position: 'absolute', inset: 0, width: '100%', height: '100%' }}>
        <defs>
          <linearGradient id="hmEngArea" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stopColor={ink} stopOpacity="0.16" /><stop offset="100%" stopColor={ink} stopOpacity="0" /></linearGradient>
          <filter id="hmEngB" x="-60%" y="-60%" width="220%" height="220%"><feGaussianBlur stdDeviation="6" /></filter>
        </defs>
        <line x1={X0} y1={BASE} x2="404" y2={BASE} stroke="rgba(27,42,56,0.22)" strokeWidth="1" />
        {months.map((m, i) => <text key={m + i} x={pts[i][0]} y={BASE + 22} textAnchor="middle" fill="rgba(27,42,56,0.4)" style={{ fontFamily: 'var(--font-mono)', fontSize: 9 }}>{m}</text>)}
        <line x1={X0} y1={yAvg} x2="404" y2={yAvg} stroke="rgba(27,42,56,0.3)" strokeWidth="1" strokeDasharray="3 4" />
        <text x="404" y={yAvg - 7} textAnchor="end" fill="rgba(27,42,56,0.45)" style={{ fontFamily: 'var(--font-mono)', fontSize: 9.5, letterSpacing: '0.08em' }}>AVG £17k</text>
        <path d={area} fill="url(#hmEngArea)" />
        <path d={line} fill="none" stroke={ink} strokeWidth="2.4" strokeLinejoin="round" strokeLinecap="round" pathLength="1" style={{ strokeDasharray: 1, animation: 'valDraw 1.8s cubic-bezier(0.35,0,0.2,1) both' }} />
        {pts.map((p, i) => <circle key={i} cx={p[0]} cy={p[1]} r="2.6" fill={ink} style={{ opacity: 0, animation: 'startGlow 600ms ease ' + (600 + i * 70) + 'ms forwards' }} />)}

        <g style={{ opacity: scopeOn, transition: 'opacity 600ms ease' }}>
          <line x1={X0} y1={yTgt} x2="404" y2={yTgt} stroke={coral} strokeWidth="1.6" strokeDasharray="5 4" />
          <text x={X0} y={yTgt - 8} fill="#a33f2c" style={{ fontFamily: 'var(--font-mono)', fontSize: 9.5, letterSpacing: '0.08em' }}>TARGET £30k</text>
          <path d={'M ' + (X0 + 4) + ' ' + yAvg + ' L ' + (X0 + 4) + ' ' + yTgt} stroke="rgba(140,109,63,0.5)" strokeWidth="1" />
          <path d={'M ' + (X0 - 1) + ' ' + yAvg + ' L ' + (X0 + 9) + ' ' + yAvg + ' M ' + (X0 - 1) + ' ' + yTgt + ' L ' + (X0 + 9) + ' ' + yTgt} stroke="rgba(140,109,63,0.5)" strokeWidth="1" />
          <text x={X0 + 14} y={(yAvg + yTgt) / 2 + 3} fill="#a33f2c" style={{ fontFamily: 'var(--font-mono)', fontSize: 9, letterSpacing: '0.06em' }}>+£13k / MO</text>
        </g>

        {shipOn ? (
          <g key={'ship' + active}>
            <path d={proj} fill="none" stroke={coral} strokeWidth="2.6" strokeLinejoin="round" strokeLinecap="round" strokeDasharray="6 5" pathLength="1" style={{ strokeDasharray: 1, animation: 'valDraw 2.2s cubic-bezier(0.35,0,0.2,1) both' }} />
            <circle cx="404" cy={YV(34)} r="18" fill={coral} opacity="0.22" filter="url(#hmEngB)" style={{ animation: 'valGlow 2.2s ease both' }} />
            <circle cx="404" cy={YV(34)} r="6" fill={coral} style={{ animation: 'valGlow 2.2s ease both' }} />
            <circle cx="404" cy={YV(34)} r="2.4" fill="#fff" style={{ animation: 'valGlow 2.2s ease both' }} />
          </g>
        ) : null}
      </svg>

      <div key={'l' + active} style={{ position: 'absolute', left: 30, bottom: 26, fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '0.18em', color: 'rgba(17,34,49,0.5)', animation: 'capIn 500ms cubic-bezier(0.2,0,0,1) both' }}>{labels[active]}</div>
      <div style={grain}></div>
    </div>
  );
}
function Engage() {
  /* Same ladder as the other two sections: eyebrow, headline, intro, accordion.
     No flex spacer, panel vertically centred, mobile reveals the visual inline. */
  const items = [
    { t: 'Assess the ground truth', w: 'WKS 1\u20132', d: 'A two\u2011week governance snapshot of one company: the data, the systems, the decisions. Where AI can move the number, and where it can\u2019t.' },
    { t: 'Scope to a single P&L line', w: 'WK 3', d: 'One line, one target, one owner. The engagement is priced and scoped against a number you can hold us to, in writing.' },
    { t: 'Ship a system you own', w: 'WKS 4\u201312', d: 'A working system, live in operations in twelve weeks or less, built inside your team\u2019s tools, documented, and yours on handover.' },
  ];
  const [active, setActive] = React.useState(0);
  const [hov, setHov] = React.useState(null);
  const narrow = useIsNarrow();
  return (
    <section className="rw rways" style={{ ...wrap, maxWidth: 1280, padding: '56px 48px 80px' }}>
      <div className="rg rengage-grid" style={{ display: 'grid', gridTemplateColumns: '1fr 0.82fr', gap: 110, alignItems: 'center' }}>
        {!narrow ? <div key={active} style={{ animation: 'hmPanelIn 620ms cubic-bezier(0.2,0,0,1) both' }}><EngageVisual active={active} /></div> : null}
        <div>
          <div className="raccl" style={{ fontFamily: 'var(--font-mono)', fontSize: 12, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--text-link)', margin: '0 0 20px' }}>The engagement</div>
          <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 42, letterSpacing: 'var(--tracking-display)', color: 'var(--ink-1)', margin: '0 0 18px', maxWidth: 480 }}>How it works.</h2>
          <p className="rp racc-intro" style={{ font: 'var(--type-body-lg)', color: 'var(--text-muted)', margin: '0 0 34px', maxWidth: 420 }}>No transformation programme. One company, one number, one working system, then repeat.</p>
          <div style={{ borderTop: '1px solid var(--hairline)' }}>
            {items.map((it, i) => {
              const on = i === active;
              return (
                <div key={it.t} style={{ position: 'relative', borderBottom: '1px solid var(--hairline)' }}>
                  <button className="racc-t" aria-expanded={on} onMouseEnter={() => setHov(i)} onMouseLeave={() => setHov(null)} onClick={() => setActive((a) => (a === i && narrow) ? null : i)} style={{ display: 'flex', alignItems: 'baseline', gap: 14, width: '100%', textAlign: 'left', background: 'none', border: 0, cursor: 'pointer', padding: on ? '26px 0 12px' : '22px 0', fontFamily: 'var(--font-sans)', fontSize: 19, fontWeight: on ? 500 : 400, color: on || hov === i ? 'var(--ink-1)' : 'var(--text-muted)', transition: 'color 300ms, padding 420ms cubic-bezier(0.2,0,0,1)' }}>
                    <span style={{ flex: 1 }}>{it.t}</span>
                    <span style={{ fontFamily: 'var(--font-mono)', fontSize: 11.5, letterSpacing: '0.14em', color: on ? 'var(--coral-2)' : 'var(--text-faint)', alignSelf: 'center', transition: 'color 300ms' }}>{it.w}</span>
                    <span style={{ fontFamily: 'var(--font-mono)', fontSize: 19, fontWeight: 300, color: on ? 'var(--coral-2)' : 'var(--text-faint)', transform: on ? 'rotate(45deg)' : 'none', transition: 'transform 420ms cubic-bezier(0.2,0,0,1), color 300ms', alignSelf: 'center', lineHeight: 1 }}>+</span>
                  </button>
                  <div style={{ display: 'grid', gridTemplateRows: on ? '1fr' : '0fr', transition: 'grid-template-rows 420ms cubic-bezier(0.2,0,0,1)' }}>
                    <div style={{ overflow: 'hidden', minHeight: 0 }}>
                      <p className="rp" style={{ font: 'var(--type-body-lg)', color: 'var(--text-muted)', margin: '0 0 22px 0', maxWidth: 420 }}>{it.d}</p>
                      {narrow && on ? <div style={{ margin: '2px 0 26px' }}><EngageVisual active={active} /></div> : null}
                    </div>
                  </div>
                </div>
              );
            })}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ---------- Operate: mixed dark/light exhibit grid ---------- */
function ScaledStage({ w, h, children }) {
  const ref = React.useRef(null);
  const [s, setS] = React.useState(1);
  React.useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const ro = new ResizeObserver(() => setS(Math.min(1, el.clientWidth / w, el.clientHeight / h)));
    ro.observe(el);
    return () => ro.disconnect();
  }, []);
  return (
    <div ref={ref} style={{ position: 'absolute', inset: 0, overflow: 'hidden' }}>
      <div style={{ position: 'absolute', left: '50%', top: '50%', width: w, height: h, transform: 'translate(-50%, -50%) scale(' + s + ')' }}>{children}</div>
    </div>
  );
}
function OpTile({ dark, children }) {
  const grain = { position: 'absolute', inset: 0, backgroundImage: capGrain, opacity: dark ? 0.16 : 0.28, mixBlendMode: 'overlay', pointerEvents: 'none' };
  return (
    <div className="roptile" style={{ position: 'relative', height: 430, borderRadius: 16, background: dark ? 'linear-gradient(180deg, #2B343F 0%, #1E2731 100%)' : 'linear-gradient(180deg, #E9EDED 0%, #DEE4E5 100%)', overflow: 'hidden', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      {children}
      <div style={grain}></div>
    </div>
  );
}
function OpCell({ tile, title, body }) {
  return (
    <div className="rcap-cell">
      {tile}
      <h3 style={{ fontFamily: 'var(--font-sans)', fontSize: 19, fontWeight: 600, color: 'var(--ink-1)', margin: '26px 0 8px' }}>{title}</h3>
      <p style={{ font: 'var(--type-body-lg)', color: 'var(--text-muted)', margin: 0, maxWidth: 520 }}>{body}</p>
    </div>
  );
}
function FlowCard({ icon, t, s, delay, shown, style }) {
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 14, background: '#fff', borderRadius: 14, padding: '16px 22px', boxShadow: '0 10px 30px rgba(12,25,38,0.1)', width: 'fit-content', ...capIn(shown, delay), ...style }}>
      {icon ? <span style={{ width: 34, height: 34, borderRadius: 10, background: 'var(--ink-1)', color: '#F7F3ED', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontSize: 13, flexShrink: 0 }}>{icon}</span> : null}
      <span>
        <span style={{ display: 'block', fontFamily: 'var(--font-sans)', fontSize: 15.5, fontWeight: 500, color: 'var(--ink-1)', whiteSpace: 'nowrap' }}>{t}</span>
        {s ? <span style={{ display: 'block', fontFamily: 'var(--font-sans)', fontSize: 13.5, color: 'var(--text-muted)', marginTop: 3, whiteSpace: 'nowrap' }}>{s}</span> : null}
      </span>
    </div>
  );
}
function PermCard({ shown }) {
  const roles = ['Operator', 'Approver', 'Viewer'];
  const perms = [
    ['Run and monitor the system', [1, 0, 0]],
    ['Approve retraining windows', [1, 1, 0]],
    ['Change model parameters', [0, 1, 0]],
    ['View the full audit log', [1, 1, 1]],
  ];
  const [r, setR] = React.useState(0);
  React.useEffect(() => {
    if (!shown) return;
    const t = setInterval(() => setR((v) => (v + 1) % 3), 3600);
    return () => clearInterval(t);
  }, [shown]);
  return (
    <div style={{ position: 'absolute', left: 90, top: 30, width: 380, background: '#fff', borderRadius: 16, padding: '24px 28px 16px', boxShadow: '0 14px 44px rgba(12,25,38,0.12)', ...capIn(shown, 150) }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 13, marginBottom: 20 }}>
        <span style={{ width: 40, height: 40, borderRadius: '50%', background: 'var(--ink-1)', color: '#F7F3ED', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'var(--font-sans)', fontSize: 14, fontWeight: 600, flexShrink: 0 }}>RO</span>
        <span>
          <span style={{ display: 'block', font: '600 19px/1.2 var(--font-display)', color: 'var(--ink-1)' }}>Revenue Ops Lead</span>
          <span style={{ display: 'block', fontFamily: 'var(--font-sans)', fontSize: 13, color: 'var(--text-muted)', marginTop: 3 }}>Pricing engine · access, portfolio co.</span>
        </span>
      </div>
      <div style={{ display: 'flex', gap: 3, background: 'rgba(17,34,49,0.05)', borderRadius: 10, padding: 3, marginBottom: 16 }}>
        {roles.map((name, j) => (
          <button key={name} onClick={() => setR(j)} style={{ flex: 1, border: 0, cursor: 'pointer', borderRadius: 8, padding: '8px 0', fontFamily: 'var(--font-sans)', fontSize: 13.5, fontWeight: j === r ? 600 : 400, color: j === r ? 'var(--ink-1)' : 'var(--text-muted)', background: j === r ? '#fff' : 'transparent', boxShadow: j === r ? '0 2px 8px rgba(12,25,38,0.12)' : 'none', transition: 'all 300ms cubic-bezier(0.2,0,0,1)' }}>{name}</button>
        ))}
      </div>
      <div style={{ fontFamily: 'var(--font-sans)', fontSize: 12.5, color: 'var(--text-muted)', marginBottom: 2 }}>This role can</div>
      {perms.map(([label, ok], j) => (
        <div key={label + r} style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '9px 0', borderTop: j ? '1px solid rgba(17,34,49,0.05)' : 'none', animation: 'capIn 380ms cubic-bezier(0.2,0,0,1) ' + (j * 80) + 'ms both' }}>
          <span style={{ width: 14, textAlign: 'center', color: ok[r] ? 'var(--coral-1)' : 'var(--text-faint)', fontSize: 13 }}>{ok[r] ? '✓' : ''}</span>
          <span style={{ fontFamily: 'var(--font-sans)', fontSize: 14.5, color: ok[r] ? 'var(--ink-1)' : 'var(--text-faint)' }}>{label}</span>
        </div>
      ))}
    </div>
  );
}
function Operate() {
  const [ref, shown] = useReveal(0.2);
  const check = (t, j) => (
    <div key={t} style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '9px 0', borderTop: j ? '1px solid rgba(17,34,49,0.05)' : 'none', ...capIn(shown, 400 + j * 150) }}>
      <span style={{ color: 'var(--coral-1)', fontSize: 13 }}>{'✓'}</span>
      <span style={{ fontFamily: 'var(--font-sans)', fontSize: 14.5, color: 'var(--ink-1)' }}>{t}</span>
    </div>
  );
  return (
    <section ref={ref} className="rw" style={{ ...wrap, maxWidth: 1280, padding: '56px 48px 80px' }}>
      <div style={{ borderTop: '1px solid var(--hairline)', paddingTop: 48, marginBottom: 64 }}>
        <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 40, letterSpacing: 'var(--tracking-display)', color: 'var(--ink-1)', margin: 0, maxWidth: 640 }}>Built to be run, not just admired.</h2>
      </div>
      <div className="rg rcap-grid" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', columnGap: 56, rowGap: 88 }}>
        <OpCell
          title="Total visibility"
          body="See what every system moved this month: margin, velocity and adoption, in one snapshot."
          tile={<OpTile dark>
            {[[-90, 0], [0, 800], [90, 1600]].map(([x, d]) => (
              <div key={x} style={{ position: 'absolute', left: '50%', top: '50%', margin: '-150px 0 0 ' + (x - 150) + 'px', width: 300, height: 300, borderRadius: '50%', background: 'radial-gradient(circle, rgba(247,243,237,0.16) 0%, rgba(247,243,237,0.05) 55%, transparent 70%)', border: '1px solid rgba(247,243,237,0.18)', filter: 'blur(1.5px)', animation: 'startGlow 6s ease-in-out ' + d + 'ms infinite' }}></div>
            ))}
            <div style={{ position: 'relative', width: '78%' }}>
              <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', marginBottom: 22 }}>
                <span style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'rgba(247,243,237,0.55)' }}>This month</span>
                <span style={{ fontFamily: 'var(--font-mono)', fontSize: 10.5, letterSpacing: '0.14em', textTransform: 'uppercase', color: '#EDCB8B' }}>3 systems live</span>
              </div>
              <div style={{ fontFamily: 'var(--font-display)', fontSize: 44, lineHeight: 1, color: '#F7F3ED', textShadow: '0 0 24px rgba(247,243,237,0.28)' }}>EBITDA +2.1pts</div>
              <div style={{ fontFamily: 'var(--font-sans)', fontSize: 13.5, color: 'rgba(247,243,237,0.6)', margin: '10px 0 24px' }}>attributed across every system in production</div>
              {[['Pricing engine', '+0.9pts'], ['Forecast engine', '+0.8pts'], ['Claims triage', '+0.4pts']].map(([n, v], k) => (
                <div key={n} style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '10px 0', borderTop: '1px solid rgba(247,243,237,0.12)', ...capIn(shown, 420 + k * 120) }}>
                  <span style={{ fontFamily: 'var(--font-sans)', fontSize: 14, color: 'rgba(247,243,237,0.88)' }}>{n}</span>
                  <span style={{ fontFamily: 'var(--font-mono)', fontSize: 13.5, color: '#EDCB8B' }}>{v}</span>
                </div>
              ))}
            </div>
          </OpTile>}
        />
        <OpCell
          title="Automations"
          body="Reduce busywork with automated repricing, retraining and approval flows, with every action routed through a named owner."
          tile={<OpTile>
            <ScaledStage w={560} h={430}>
            <div style={{ position: 'absolute', left: 100, top: 122, width: 68, height: 94, borderLeft: '1.5px solid rgba(17,34,49,0.22)', borderBottom: '1.5px solid rgba(17,34,49,0.22)', borderBottomLeftRadius: 16, pointerEvents: 'none' }}></div>
            <div style={{ position: 'absolute', left: 100, top: 122, width: 68, height: 194, borderLeft: '1.5px solid rgba(17,34,49,0.22)', borderBottom: '1.5px solid rgba(17,34,49,0.22)', borderBottomLeftRadius: 16, pointerEvents: 'none' }}></div>
            <span style={{ position: 'absolute', left: 0, top: 0, width: 7, height: 7, borderRadius: '50%', background: 'var(--coral-1)', boxShadow: '0 0 10px rgba(140,109,63,0.7)', offsetPath: "path('M 100 122 L 100 200 Q 100 216 116 216 L 168 216')", animation: 'opTravel 3.2s cubic-bezier(0.4,0,0.4,1) 0s infinite' }}></span>
            <span style={{ position: 'absolute', left: 0, top: 0, width: 7, height: 7, borderRadius: '50%', background: 'var(--coral-1)', boxShadow: '0 0 10px rgba(140,109,63,0.7)', offsetPath: "path('M 100 122 L 100 300 Q 100 316 116 316 L 168 316')", animation: 'opTravel 3.6s cubic-bezier(0.4,0,0.4,1) 1.6s infinite' }}></span>
            <div style={{ position: 'absolute', left: 64, top: 58 }}>
              <FlowCard shown={shown} delay={150} t="‘Forecast engine’" s="+0.8pts margin attributed" />
            </div>
            <div style={{ position: 'absolute', left: 132, top: 188 }}>
              <FlowCard shown={shown} delay={400} icon={'D'} t="Reprice the spring catalogue" s="VP Commercial · tomorrow" />
            </div>
            <div style={{ position: 'absolute', left: 132, top: 288 }}>
              <FlowCard shown={shown} delay={650} icon={'◀'} t="Retrain on last quarter" s="After each quarterly close" />
            </div>
            </ScaledStage>
          </OpTile>}
        />
        <OpCell
          title="Team control"
          body="Curb risk with role‑scoped permissions, approval windows and a full audit log, set per system and per person."
          tile={<OpTile>
            <ScaledStage w={560} h={430}>
            <PermCard shown={shown} />
            </ScaledStage>
          </OpTile>}
        />
        <OpCell
          title="Guidance"
          body="The engineers who built your system stay on the line, plus dedicated coverage for portfolio‑wide programmes."
          tile={<OpTile dark>
            <div style={{ position: 'absolute', left: '50%', top: '50%', width: 460, height: 460, transform: 'translate(-50%, -50%)', background: 'radial-gradient(circle, rgba(247,243,237,0.08) 0%, transparent 55%)', pointerEvents: 'none' }}></div>
            {[74, 130, 192, 262].map((r, k) => (
              <div key={r} style={{ position: 'absolute', left: '50%', top: '50%', width: r * 2, height: r * 2, margin: (-r) + 'px 0 0 ' + (-r) + 'px', borderRadius: '50%', border: '1.5px solid rgba(247,243,237,' + (0.3 - k * 0.07) + ')', filter: 'blur(' + k + 'px)', animation: 'startGlow ' + (5 + k * 1.5) + 's ease-in-out ' + (k * 600) + 'ms infinite' }}></div>
            ))}
            {[0, 1].map((k) => (
              <div key={'r' + k} style={{ position: 'absolute', left: '50%', top: '50%', width: 120, height: 120, margin: '-60px 0 0 -60px', borderRadius: '50%', border: '1px solid rgba(247,243,237,0.45)', animation: 'gapRing 5s cubic-bezier(0.2,0,0,1) ' + (k * 2500) + 'ms infinite' }}></div>
            ))}
            <div style={{ position: 'relative', width: '76%', background: 'rgba(247,243,237,0.07)', border: '1px solid rgba(247,243,237,0.16)', borderRadius: 14, padding: '18px 20px', backdropFilter: 'blur(6px)', ...capIn(shown, 320) }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 11, marginBottom: 14 }}>
                <span style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(247,243,237,0.12)', border: '1px solid rgba(247,243,237,0.18)', display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'var(--font-display)', fontSize: 14, color: '#F7F3ED', flex: 'none' }}>H</span>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ fontFamily: 'var(--font-sans)', fontSize: 13.5, fontWeight: 600, color: '#F7F3ED' }}>Build engineer</div>
                  <div style={{ fontFamily: 'var(--font-sans)', fontSize: 11.5, color: 'rgba(247,243,237,0.55)' }}>On your system since week one</div>
                </div>
                <span style={{ width: 7, height: 7, borderRadius: '50%', background: '#EDCB8B', flex: 'none', animation: 'shotLive 2.4s ease-in-out infinite' }}></span>
              </div>
              <div style={{ fontFamily: 'var(--font-sans)', fontSize: 13.5, lineHeight: 1.5, color: 'rgba(247,243,237,0.86)', paddingTop: 13, borderTop: '1px solid rgba(247,243,237,0.12)' }}>Retraining window looks fine. I have queued the Q3 refresh and flagged one input to watch.</div>
            </div>
          </OpTile>}
        />
      </div>
    </section>
  );
}

/* ---------- Footer ---------- */
function Footer({ inView }) {
  const ink = inView ? 'var(--inv-text-1)' : 'var(--ink-1)';
  const muted = inView ? 'var(--inv-text-2)' : 'var(--text-muted)';
  const hair = inView ? 'var(--inv-hairline)' : 'var(--hairline)';
  const CT = 'color 1400ms cubic-bezier(0.4,0,0.2,1)';
  const cols = [
    ['Firm', ['About', 'Our approach', 'The standard we sign to']],
    ['What we do', ['Margin expansion', 'Value expansion', 'AI strategy & enablement', 'Governance snapshot']],
    ['Who we work with', ['PE funds', 'Portfolio companies', 'Talk to us']],
  ];
  const linkHover = (e, on) => { e.currentTarget.style.color = on ? 'var(--coral-2, #FF6F5B)' : ink; };
  return (
    <footer style={{ background: inView ? 'var(--inv-surface)' : 'var(--surface-page)', transition: 'background 1400ms cubic-bezier(0.4,0,0.2,1)' }}>
      <div className="rw rfoot-wrap" style={{ ...wrap, padding: '88px 40px 44px' }}>
        <div className="rfoot" style={{ display: 'grid', gridTemplateColumns: SHOW_UNBUILT_LINKS ? '1.6fr 1fr 1fr 1fr' : '1fr', gap: 48 }}>
          <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
            <span style={{ font: '400 27px/1 var(--font-display)', letterSpacing: '-0.01em', color: ink, transition: CT }}>hallmir</span>
            <p style={{ font: 'var(--type-body)', color: muted, transition: CT, margin: '20px 0 28px', maxWidth: 320, lineHeight: 1.55 }}>
              Productized AI engineering for private equity and the companies they own.
            </p>
            <Button arrow onClick={() => { window.location.href = MAIL; }}>Talk to us</Button>
          </div>
          {SHOW_UNBUILT_LINKS ? cols.map(([title, links]) => (
            <div key={title} style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
              <div className="h-label" style={{ color: muted, transition: CT, marginBottom: 4 }}>{title}</div>
              {links.map((l) => (
                <a key={l} href={/talk to us/i.test(l) ? MAIL : '#'} style={{ font: 'var(--type-body)', color: ink, transition: CT, border: 0, textDecoration: 'none', width: 'fit-content' }} onMouseEnter={(e) => linkHover(e, true)} onMouseLeave={(e) => linkHover(e, false)}>{l}</a>
              ))}
            </div>
          )) : null}
        </div>
        <hr style={{ border: 0, borderTop: `1px solid ${hair}`, transition: 'border-color 1400ms cubic-bezier(0.4,0,0.2,1)', margin: '64px 0 22px' }} />
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: 'wrap', gap: 12 }}>
          <span style={{ font: 'var(--type-body-sm)', color: muted, transition: CT }}>© 2026 Hallmir Ltd. All rights reserved.</span>
          <a className="h-label" href={MAIL} style={{ color: muted, transition: CT, border: 0, textDecoration: 'none' }}>hello@hallmir.com</a>
        </div>
      </div>
    </footer>
  );
}

/* Switch proxy (keeps Cards section tidy) */
window.HallmirSwitchProxy = function ({ checked, onChange }) {
  const { Switch } = window.HallmirDesignSystem_80aa39;
  return <Switch checked={checked} onChange={onChange} />;
};

/* ---------- The room: the senior people behind the promise ---------- */
function TeamRoom() {
  /* Copy per the approved content doc: collective credentials, no invented
     people. Hallmir is a new firm; the honest claim is the operators, not a
     fabricated partner roster. */
  const creds = [
    { k: '10+ yrs', t: 'Shipping production software', d: 'Not prototypes or pilots. Systems that run in operations after we leave.' },
    { k: 'Fortune 500', t: 'Enterprise delivery teams', d: 'Led delivery for enterprise and Fortune 500 clients, at their standard of scrutiny.' },
    { k: 'Governance', t: 'Enterprise IT at scale', d: 'Audit, risk and controls experience, so the work survives diligence rather than surprising it.' },
  ];
  return (
    <section className="rw rteam" style={{ ...wrap, maxWidth: 1280, padding: '56px 48px 80px' }}>
      <div style={{ borderTop: '1px solid var(--hairline-strong)', paddingTop: 48, marginBottom: 56, display: 'flex', flexWrap: 'wrap', alignItems: 'flex-end', justifyContent: 'space-between', gap: 24 }}>
        <h2 className="rh2" style={{ font: 'var(--type-display-2)', fontSize: 44, letterSpacing: 'var(--tracking-display)', color: 'var(--ink-1)', margin: 0, maxWidth: 560 }}>Senior operators do the work.</h2>
        <p className="rp" style={{ font: 'var(--type-body-lg)', color: 'var(--text-muted)', margin: 0, maxWidth: 380 }}>The people who scope the work are the people who build it. No bench of juniors behind the logo.</p>
      </div>
      <div className="rg rteam-grid" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 48 }}>
        {creds.map((c) => (
          <div key={c.t} style={{ borderTop: '1px solid var(--hairline)', paddingTop: 26 }}>
            <div style={{ fontFamily: 'var(--font-mono)', fontSize: 12, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--text-link)', marginBottom: 16 }}>{c.k}</div>
            <div style={{ fontFamily: 'var(--font-sans)', fontSize: 19, fontWeight: 600, color: 'var(--ink-1)', marginBottom: 10 }}>{c.t}</div>
            <p style={{ font: 'var(--type-body)', color: 'var(--text-muted)', margin: 0, maxWidth: 300 }}>{c.d}</p>
          </div>
        ))}
      </div>
      <p className="rp" style={{ font: 'var(--type-body)', color: 'var(--text-muted)', margin: '46px 0 0', maxWidth: 620 }}>
        A new firm, run by proven operators, with a working network across private equity. We share evidence and a point of view, not invented case studies.
      </p>
    </section>
  );
}

function HallmirHomepage() {
  return (
    <div data-screen-label="Homepage">
      <AnnouncementBar linkLabel={SHOW_UNBUILT_LINKS ? 'See how we work' : undefined} style={{ fontSize: 14, padding: '13px 24px' }}>
        <span className="rhide">New: our 2-week value‑creation diagnostic for portfolio companies.</span>
        <span className="rshow">New: our 2-week value‑creation diagnostic</span>
      </AnnouncementBar>
      <Header />
      <Hero />
      <Recognition />
      <Accounts />
      <DarkBand />
      <GetStarted />
      <Engage />
      <TeamRoom />
      <Operate />
      <PostRun />
    </div>
  );
}

window.HallmirHomepage = HallmirHomepage;
