// 100kSaved — single-file React app
// Architecture: standard high-ticket service direct-response landing pattern
// (Hero / Proof / Phased offer timeline / Agent grid + showcase / Guarantee /
// FAQ / Multi-step apply funnel / Final CTA / Footer + careers funnel).
// All copy original to 100kSaved's $100K-saved-or-you-don't-pay offer.

// ===== Primitives =====
const HkButton = ({ variant = 'primary', size = 'md', children, className = '', ...rest }) => {
  const base = { fontFamily: 'var(--hk-font-body)', fontWeight: 600, border: '1px solid transparent', borderRadius: 999, cursor: 'pointer', display: 'inline-flex', alignItems: 'center', gap: 8, letterSpacing: '-0.005em', transition: 'all 220ms cubic-bezier(0.16,1,0.3,1)', textDecoration: 'none', whiteSpace: 'nowrap' };
  const sizes = { sm: { padding: '8px 14px', fontSize: 12 }, md: { padding: '12px 22px', fontSize: 14 }, lg: { padding: '16px 28px', fontSize: 16 } };
  const variants = {
    primary:   { background: 'var(--hk-grn-500)', color: '#030806', boxShadow: 'var(--hk-glow-soft)' },
    secondary: { background: 'transparent', color: 'var(--hk-fg-1)', borderColor: 'var(--hk-ink-600)' },
    ghost:     { background: 'transparent', color: 'var(--hk-fg-2)' },
  };
  return <button className={`hk-btn hk-btn--${variant} ${className}`} style={{ ...base, ...sizes[size], ...variants[variant] }} {...rest}>{children}</button>;
};

const HkGlobalStyles = () => (
  <style>{`
    #hk-root .hk-btn { position: relative; }
    #hk-root .hk-btn--primary:hover { background: var(--hk-grn-400) !important; transform: translateY(-1px); box-shadow: 0 12px 32px -8px rgba(16,185,129,0.6), 0 0 0 1px rgba(52,211,153,0.4) !important; }
    #hk-root .hk-btn--primary:active { transform: translateY(0); }
    #hk-root .hk-btn--secondary:hover { border-color: var(--hk-grn-400) !important; background: rgba(16,185,129,0.08) !important; color: var(--hk-grn-300) !important; }
    #hk-root .hk-btn--ghost:hover { color: var(--hk-grn-300) !important; background: rgba(16,185,129,0.06) !important; }
    #hk-root .hk-btn:focus-visible { outline: 2px solid var(--hk-grn-400); outline-offset: 2px; }
  `}</style>
);

const HkEyebrow = ({ children, color = 'var(--hk-grn-300)' }) => (
  <span style={{ fontSize: 12, letterSpacing: '0.18em', textTransform: 'uppercase', fontWeight: 600, color, fontFamily: 'var(--hk-font-body)' }}>{children}</span>
);

const HkBadge = ({ tone = 'grn', children, dot = false }) => {
  const tones = {
    grn:     { bg: 'rgba(16,185,129,0.10)',  bd: 'rgba(16,185,129,0.30)', fg: 'var(--hk-grn-300)' },
    live:    { bg: 'rgba(94,230,224,0.08)',  bd: 'rgba(94,230,224,0.30)', fg: 'var(--hk-accent-cyan)' },
    lime:    { bg: 'rgba(200,242,106,0.08)', bd: 'rgba(200,242,106,0.30)', fg: 'var(--hk-accent-lime)' },
    amber:   { bg: 'rgba(245,177,73,0.08)',  bd: 'rgba(245,177,73,0.30)', fg: 'var(--hk-accent-amber)' },
    neutral: { bg: 'var(--hk-ink-900)',      bd: 'var(--hk-ink-700)',     fg: 'var(--hk-fg-2)' },
  }[tone];
  return (
    <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, padding: '6px 12px', borderRadius: 999, fontSize: 12, fontWeight: 500, fontFamily: 'var(--hk-font-body)', background: tones.bg, border: `1px solid ${tones.bd}`, color: tones.fg, whiteSpace: 'nowrap' }}>
      {dot && <span style={{ width: 6, height: 6, borderRadius: '50%', background: 'currentColor', boxShadow: '0 0 8px currentColor' }} />}
      {children}
    </span>
  );
};

const HkSection = ({ children, padY, bg, id }) => (
  <section id={id} style={{ padding: padY != null ? `${padY}px 20px` : 'clamp(56px, 7vw, 96px) 20px', background: bg, position: 'relative' }}>
    <div style={{ maxWidth: 1240, margin: '0 auto', position: 'relative' }}>{children}</div>
  </section>
);

const HkArrow = ({ size = 14 }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
    <path d="M5 12h14M13 6l6 6-6 6"/>
  </svg>
);

const Sparkle = ({ size = 12, color = 'currentColor', style }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill={color} style={{ flexShrink: 0, ...style }} aria-hidden="true"><path d="M12 2l1.8 6.6L20 10l-6.2 1.4L12 18l-1.8-6.6L4 10l6.2-1.4L12 2z"/></svg>
);

// ===== Constants pluggable by Gian =====
const BOOKING_URL = 'https://cal.com/100ksaved/intro';
const APPLY_WEBHOOK_URL = '';
const APPLY_REDIRECT_URL = '';

// ===== Wordmark =====
const Wordmark = ({ size = 26 }) => (
  <span style={{ fontFamily: 'var(--hk-font-display)', fontSize: Math.round(size * 0.85), fontWeight: 800, letterSpacing: '-0.03em', color: 'var(--hk-fg-1)', lineHeight: 1, display: 'inline-block' }}>
    100k<span style={{ color: 'var(--hk-grn-400)' }}>Saved</span>
  </span>
);

// ===== Nav =====
const Nav = () => {
  const [scrolled, setScrolled] = React.useState(false);
  const [menuOpen, setMenuOpen] = React.useState(false);
  React.useEffect(() => {
    const on = () => setScrolled(window.scrollY > 20);
    window.addEventListener('scroll', on); on();
    return () => window.removeEventListener('scroll', on);
  }, []);
  React.useEffect(() => {
    document.body.style.overflow = menuOpen ? 'hidden' : '';
    return () => { document.body.style.overflow = ''; };
  }, [menuOpen]);
  const links = [
    { label: 'The offer',    id: 'offer' },
    { label: 'The agents',   id: 'agents' },
    { label: 'Guarantee',    id: 'guarantee' },
    { label: 'FAQ',          id: 'faq' },
  ];
  const goToSection = (id) => {
    document.getElementById(id)?.scrollIntoView({ behavior: 'smooth', block: 'start' });
    setMenuOpen(false);
  };
  const goApply = () => { document.getElementById('apply')?.scrollIntoView({ behavior: 'smooth', block: 'start' }); setMenuOpen(false); };
  return (
    <React.Fragment>
      <div style={{ position: 'fixed', top: 16, left: '50%', transform: 'translateX(-50%)', zIndex: 100, width: 'calc(100% - 32px)', maxWidth: 1180, transition: 'all 240ms cubic-bezier(0.16,1,0.3,1)' }}>
        <nav style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: scrolled ? '10px 14px 10px 22px' : '14px 14px 14px 26px', background: 'rgba(5,16,11,0.78)', backdropFilter: 'blur(20px)', WebkitBackdropFilter: 'blur(20px)', border: '1px solid rgba(255,255,255,0.06)', borderRadius: 999, transition: 'all 240ms cubic-bezier(0.16,1,0.3,1)', gap: 18 }}>
          <a href="#" onClick={(e) => { e.preventDefault(); window.location.hash = ''; window.scrollTo({ top: 0, behavior: 'smooth' }); }} style={{ display: 'flex', alignItems: 'center', gap: 10, textDecoration: 'none' }}>
            <Wordmark size={24} />
          </a>
          <div className="hk-nav-links" style={{ display: 'flex', gap: 30, alignItems: 'center' }}>
            {links.map(l => (
              <a key={l.id} href={`#${l.id}`} className="hk-nav-link"
                onClick={(e) => { e.preventDefault(); goToSection(l.id); }}
                style={{ color: 'var(--hk-fg-2)', fontSize: 15, fontWeight: 500, textDecoration: 'none', cursor: 'pointer', letterSpacing: '-0.005em', transition: 'color 180ms ease' }}>
                {l.label}
              </a>
            ))}
          </div>
          <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
            <span className="hk-nav-cta">
              <HkButton size="sm" variant="primary" onClick={goApply}>Get audit <HkArrow size={12}/></HkButton>
            </span>
            <button aria-label={menuOpen ? "Close" : "Open menu"} onClick={() => setMenuOpen(!menuOpen)} className="hk-nav-hamburger"
              style={{ display: 'none', width: 40, height: 40, borderRadius: 999, background: 'rgba(16,185,129,0.12)', border: '1px solid rgba(16,185,129,0.3)', color: 'var(--hk-fg-1)', cursor: 'pointer', alignItems: 'center', justifyContent: 'center', padding: 0, flexShrink: 0 }}>
              <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round">
                {menuOpen ? <path d="M6 6L18 18M6 18L18 6"/> : <path d="M4 7h16M4 12h16M4 17h16"/>}
              </svg>
            </button>
          </div>
        </nav>
      </div>
      <div role="dialog" aria-modal={menuOpen ? "true" : "false"}
        style={{ position: 'fixed', inset: 0, zIndex: 99, background: 'radial-gradient(ellipse at top, rgba(4,120,87,0.55), rgba(3,8,6,0.96) 70%)', backdropFilter: 'blur(18px)', opacity: menuOpen ? 1 : 0, pointerEvents: menuOpen ? 'auto' : 'none', transition: 'opacity 260ms ease', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: 24, gap: 6 }}>
        {links.map((l, i) => (
          <button key={l.label} onClick={() => goToSection(l.id)}
            style={{ background: 'transparent', border: 0, color: 'var(--hk-fg-1)', fontFamily: 'var(--hk-font-display)', fontSize: 28, fontWeight: 600, letterSpacing: '-0.022em', padding: '12px 24px', cursor: 'pointer', opacity: menuOpen ? 1 : 0, transform: menuOpen ? 'translateY(0)' : 'translateY(12px)', transition: `opacity 320ms ease ${menuOpen ? 80 + i * 50 : 0}ms, transform 320ms ease ${menuOpen ? 80 + i * 50 : 0}ms` }}>
            {l.label}
          </button>
        ))}
        <div style={{ height: 12 }}/>
        <div style={{ opacity: menuOpen ? 1 : 0, transform: menuOpen ? 'translateY(0)' : 'translateY(12px)', transition: `opacity 320ms ease ${menuOpen ? 80 + links.length * 50 : 0}ms, transform 320ms ease ${menuOpen ? 80 + links.length * 50 : 0}ms` }}>
          <HkButton size="lg" variant="primary" onClick={goApply}>Get audit <HkArrow/></HkButton>
        </div>
      </div>
      <style>{`
        #hk-root .hk-nav-link:hover { color: #FFFFFF !important; }
        @media (max-width: 900px) {
          #hk-root .hk-nav-links { display: none !important; }
          #hk-root .hk-nav-cta { display: none !important; }
          #hk-root .hk-nav-hamburger { display: inline-flex !important; }
        }
      `}</style>
    </React.Fragment>
  );
};

// ===== Hero =====
const HeroStat = ({ k, v }) => (
  <div style={{ minWidth: 110 }}>
    <div style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(22px, 2vw, 30px)', letterSpacing: '-0.025em', color: 'var(--hk-fg-1)', lineHeight: 1, whiteSpace: 'nowrap' }}>{k}</div>
    <div style={{ color: 'var(--hk-fg-3)', fontSize: 12, marginTop: 6, letterSpacing: '0.02em', whiteSpace: 'nowrap' }}>{v}</div>
  </div>
);

// ===== DeckSlideLetter (DSL) — click-through sales letter in the hero frame =====
// VSL story arc: hook → agitate → solution → guarantee → offer → CTA
const DSL_SLIDES = [
  {
    title: <>$100,000 is <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>hiding</span> inside your business right now.</>,
    body: 'It is sitting in software you forgot you bought, ad spend nobody tracks, and tasks paid hourly to do what an agent does in seconds.',
  },
  {
    title: <>You will <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>never</span> find it on your own.</>,
    body: 'Operators do not pay themselves to audit their books. Bookkeepers do not get paid to kill subscriptions. The leak compounds, quietly, every month.',
  },
  {
    title: <>We deploy agents that <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>find it for you.</span></>,
    body: 'They audit every dollar leaving your business and cut the waste line by line. First documented savings inside thirty days.',
  },
  {
    title: <>If we do not save you $100,000, <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>you do not pay.</span></>,
    body: 'Nothing. No deposit kept, no setup invoice, no clawback clause. Most clients hit the floor before month nine.',
  },
  {
    title: <>Five to eight agents. Sixty days. <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>Documented savings.</span></>,
    body: 'Once the floor is hit, the engagement converts to a retainer that finds the next $100K. Most clients run a $300K savings curve by month eighteen.',
  },
  {
    title: <>Sixty minutes is all it takes to find <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>your $100,000.</span></>,
    body: 'Four questions. A working session with a senior strategist. If we cannot pull $100K from your P&L, we will tell you on the call.',
    cta: { label: 'Book my savings audit', anchor: 'apply' },
  },
];

const DeckSlideLetter = () => {
  const [idx, setIdx] = React.useState(0);
  const total = DSL_SLIDES.length;
  const go = (n) => setIdx(Math.max(0, Math.min(total - 1, n)));
  const next = React.useCallback(() => setIdx(i => Math.min(total - 1, i + 1)), [total]);
  const prev = React.useCallback(() => setIdx(i => Math.max(0, i - 1)), []);
  React.useEffect(() => {
    const onKey = (e) => {
      const tag = (e.target && e.target.tagName) || '';
      if (tag === 'INPUT' || tag === 'TEXTAREA') return;
      if (e.key === 'ArrowRight') { e.preventDefault(); next(); }
      if (e.key === 'ArrowLeft')  { e.preventDefault(); prev(); }
    };
    window.addEventListener('keydown', onKey);
    return () => window.removeEventListener('keydown', onKey);
  }, [next, prev]);
  return (
    <div className="hk-dsl-wrap" style={{ position: 'relative', maxWidth: 1040, margin: '0 auto 28px' }}>
      <style>{`
        #hk-root .hk-dsl-glow { position: absolute; inset: -20px; background: radial-gradient(ellipse at center, rgba(16,185,129,0.35), transparent 65%); filter: blur(30px); pointer-events: none; }
        #hk-root .hk-dsl-frame { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid rgba(16,185,129,0.3); box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04) inset, 0 0 60px rgba(16,185,129,0.2); background: linear-gradient(180deg, #07140E 0%, #030806 100%); aspect-ratio: 16 / 9; display: flex; flex-direction: column; }
        @media (max-width: 720px) { #hk-root .hk-dsl-frame { aspect-ratio: 4 / 5; } }
        #hk-root .hk-dsl-topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-bottom: 1px solid var(--hk-ink-800); background: rgba(3,8,6,0.6); backdrop-filter: blur(6px); flex-shrink: 0; }
        #hk-root .hk-dsl-counter { font-family: var(--hk-font-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--hk-grn-300); font-weight: 600; }
        #hk-root .hk-dsl-brand { font-family: var(--hk-font-display); font-size: 13px; font-weight: 800; letter-spacing: -0.02em; color: var(--hk-fg-1); }
        #hk-root .hk-dsl-brand-saved { color: var(--hk-grn-400); }
        #hk-root .hk-dsl-dots { display: flex; gap: 6px; align-items: center; }
        #hk-root .hk-dsl-dot { width: 22px; height: 4px; border-radius: 999px; background: var(--hk-ink-700); border: 0; padding: 0; cursor: pointer; transition: background 220ms ease, width 220ms ease; }
        #hk-root .hk-dsl-dot:hover { background: var(--hk-ink-600); }
        #hk-root .hk-dsl-dot.is-active { background: var(--hk-grn-400); width: 36px; box-shadow: 0 0 12px rgba(52,211,153,0.6); }
        #hk-root .hk-dsl-stage { position: relative; flex: 1; min-height: 0; }
        #hk-root .hk-dsl-slide { position: absolute; inset: 0; padding: clamp(32px, 5.5vw, 84px); display: flex; flex-direction: column; justify-content: center; text-align: left; opacity: 0; transform: translateY(8px); transition: opacity 360ms cubic-bezier(0.16,1,0.3,1), transform 360ms cubic-bezier(0.16,1,0.3,1); pointer-events: none; }
        #hk-root .hk-dsl-slide.is-active { opacity: 1; transform: translateY(0); pointer-events: auto; }
        #hk-root .hk-dsl-title { font-family: var(--hk-font-display); font-weight: 700; font-size: clamp(32px, 4.6vw, 62px); letter-spacing: -0.03em; line-height: 1.04; color: var(--hk-fg-1); margin: 0 0 26px; text-wrap: balance; max-width: 920px; }
        #hk-root .hk-dsl-body { color: var(--hk-fg-2); font-size: clamp(16px, 1.45vw, 20px); line-height: 1.6; margin: 0; max-width: 720px; }
        #hk-root .hk-dsl-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--hk-ink-800); background: rgba(3,8,6,0.6); backdrop-filter: blur(6px); flex-shrink: 0; }
        #hk-root .hk-dsl-back { background: transparent; border: 1px solid transparent; color: var(--hk-fg-3); font-family: var(--hk-font-body); font-size: 13px; font-weight: 500; padding: 8px 14px 8px 10px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 200ms ease; }
        #hk-root .hk-dsl-back:hover:not(:disabled) { color: var(--hk-fg-1); border-color: var(--hk-ink-700); background: rgba(255,255,255,0.03); }
        #hk-root .hk-dsl-back:disabled { opacity: 0; pointer-events: none; }
        #hk-root .hk-dsl-continue { background: var(--hk-grn-500); color: #030806; border: 0; font-family: var(--hk-font-body); font-weight: 600; font-size: 14px; letter-spacing: -0.005em; padding: 11px 22px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--hk-glow-soft); transition: all 220ms cubic-bezier(0.16,1,0.3,1); white-space: nowrap; }
        #hk-root .hk-dsl-continue:hover { background: var(--hk-grn-400); transform: translateY(-1px); box-shadow: 0 12px 32px -8px rgba(16,185,129,0.6), 0 0 0 1px rgba(52,211,153,0.4); }
        #hk-root .hk-dsl-continue-pulse { position: relative; }
        #hk-root .hk-dsl-continue-pulse::after { content: ''; position: absolute; inset: -2px; border-radius: 999px; border: 1.5px solid rgba(52,211,153,0.5); animation: hkDslPulse 2s ease-out infinite; pointer-events: none; }
        @keyframes hkDslPulse { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(1.18); opacity: 0; } }
      `}</style>
      <div className="hk-dsl-glow" aria-hidden="true"/>
      <div className="hk-dsl-frame">
        <div className="hk-dsl-topbar">
          <span className="hk-dsl-counter">{String(idx + 1).padStart(2, '0')} / {String(total).padStart(2, '0')}</span>
          <div className="hk-dsl-dots" role="tablist" aria-label="Slide navigation">
            {DSL_SLIDES.map((_, i) => (
              <button key={i} role="tab" aria-selected={i === idx} aria-label={`Slide ${i + 1}`}
                onClick={() => go(i)} className={`hk-dsl-dot${i === idx ? ' is-active' : ''}`}/>
            ))}
          </div>
          <span className="hk-dsl-brand">100k<span className="hk-dsl-brand-saved">Saved</span></span>
        </div>
        <div className="hk-dsl-stage">
          {DSL_SLIDES.map((s, i) => (
            <div key={i} className={`hk-dsl-slide${i === idx ? ' is-active' : ''}`} aria-hidden={i !== idx}>
              <h3 className="hk-dsl-title">{s.title}</h3>
              <p className="hk-dsl-body">{s.body}</p>
            </div>
          ))}
        </div>
        <div className="hk-dsl-controls">
          <button onClick={prev} disabled={idx === 0} aria-label="Previous slide" className="hk-dsl-back">
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><path d="M15 6l-6 6 6 6"/></svg>
            Back
          </button>
          {DSL_SLIDES[idx].cta ? (
            <button onClick={() => document.getElementById(DSL_SLIDES[idx].cta.anchor)?.scrollIntoView({ behavior: 'smooth', block: 'start' })}
              className="hk-dsl-continue hk-dsl-continue-pulse" aria-label={DSL_SLIDES[idx].cta.label}>
              {DSL_SLIDES[idx].cta.label}
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
            </button>
          ) : (
            <button onClick={next} aria-label="Next slide" className="hk-dsl-continue">
              Continue
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
            </button>
          )}
        </div>
      </div>
    </div>
  );
};

const Hero = () => (
  <section style={{ position: 'relative', padding: 'clamp(96px, 8vw, 120px) 20px clamp(56px, 5vw, 72px)', overflow: 'hidden' }}>
    <div style={{ position: 'absolute', inset: 0, background: 'var(--hk-grad-hero)', pointerEvents: 'none' }}/>
    <div style={{ position: 'absolute', inset: 0, backgroundImage: 'radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px)', backgroundSize: '28px 28px', maskImage: 'radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%)', WebkitMaskImage: 'radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%)', pointerEvents: 'none' }}/>
    <div className="hk-hero-wrap" style={{ maxWidth: 1080, margin: '0 auto', position: 'relative', zIndex: 2, textAlign: 'center' }}>
      <DeckSlideLetter/>
      <div className="hk-hero-cta" style={{ display: 'flex', gap: 20, alignItems: 'center', flexWrap: 'wrap', marginTop: 36, marginBottom: 36, justifyContent: 'center' }}>
        <HkButton size="lg" variant="primary" onClick={() => document.getElementById('apply')?.scrollIntoView({ behavior: 'smooth', block: 'start' })}>
          Get my free savings audit <HkArrow/>
        </HkButton>
        <a href="#agents" className="hk-hero-secondary" style={{ color: 'var(--hk-fg-2)', fontSize: 14, fontWeight: 500, textDecoration: 'none', display: 'inline-flex', alignItems: 'center', gap: 6, borderBottom: '1px solid var(--hk-ink-600)', paddingBottom: 2, transition: 'color 180ms, border-color 180ms' }}>
          See the agents we deploy
        </a>
      </div>
      <div className="hk-hero-numbers" style={{ display: 'flex', alignItems: 'stretch', gap: 28, flexWrap: 'wrap', justifyContent: 'center' }}>
        <HeroStat k="$100K" v="Year-one floor"/>
        <div className="hk-hero-stat-sep" style={{ width: 1, background: 'var(--hk-ink-700)', alignSelf: 'stretch' }}/>
        <HeroStat k="60 days" v="To first cut"/>
        <div className="hk-hero-stat-sep" style={{ width: 1, background: 'var(--hk-ink-700)', alignSelf: 'stretch' }}/>
        <HeroStat k="100%" v="Refund if we miss"/>
      </div>
      <style>{`
        #hk-root .hk-hero-secondary:hover { color: var(--hk-grn-300) !important; border-bottom-color: var(--hk-grn-400) !important; }
        @media (max-width: 520px) { #hk-root .hk-hero-stat-sep { display: none; } }
      `}</style>
    </div>
  </section>
);

// ===== ProofStrip =====
const ProofStrip = () => {
  const tiles = ['SaaS founders', 'Service agencies', 'E-commerce ops', 'Coaching businesses', 'Local franchises', 'Brick-and-mortar groups', 'Professional services', 'Subscription brands', 'B2B platforms', 'Direct-to-consumer', 'Manufacturing ops'];
  const marquee = [...tiles, ...tiles];
  return (
    <div style={{ borderTop: '1px solid var(--hk-ink-800)', borderBottom: '1px solid var(--hk-ink-800)', padding: '22px 0', background: 'var(--hk-ink-1000)', position: 'relative' }}>
      <style>{`
        @keyframes hk-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
        #hk-root .hk-marq-track { display: flex; gap: 18px; width: max-content; animation: hk-marquee 48s linear infinite; }
        #hk-root .hk-marq-track:hover { animation-play-state: paused; }
        #hk-root .hk-proof-row { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(260px, auto) 1fr; gap: 48px; align-items: center; padding: 0 24px; }
        @media (max-width: 900px) { #hk-root .hk-proof-row { grid-template-columns: 1fr; gap: 20px; } }
        #hk-root .hk-marq-wrap { position: relative; overflow: hidden; mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%); -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8%, #000 92%, transparent 100%); }
        #hk-root .hk-marq-tile { display: inline-flex; align-items: center; justify-content: center; height: 56px; padding: 0 22px; border: 1px solid var(--hk-ink-700); border-radius: 12px; background: var(--hk-ink-900); flex-shrink: 0; color: var(--hk-fg-2); font-weight: 600; font-size: 14px; letter-spacing: -0.005em; }
      `}</style>
      <div className="hk-proof-row">
        <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
          <div style={{ display: 'flex', gap: 3 }}>
            {[0,1,2,3,4].map(i => (
              <div key={i} style={{ width: 22, height: 22, background: 'var(--hk-grn-500)', display: 'flex', alignItems: 'center', justifyContent: 'center', borderRadius: 4, color: '#030806' }}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l2.9 6.9L22 9.6l-5.4 4.8L18.2 22 12 18.3 5.8 22l1.6-7.6L2 9.6l7.1-.7z"/></svg>
              </div>
            ))}
          </div>
          <div style={{ display: 'flex', alignItems: 'center', gap: 6, whiteSpace: 'nowrap' }}>
            <span style={{ color: 'var(--hk-fg-1)', fontWeight: 700, fontSize: 14 }}>For operators doing $1M–$50M/yr</span>
          </div>
        </div>
        <div className="hk-marq-wrap">
          <div className="hk-marq-track">
            {marquee.map((t, i) => <div key={i} className="hk-marq-tile">{t}</div>)}
          </div>
        </div>
      </div>
    </div>
  );
};

// ===== OfferStack =====
const OfferStack = () => {
  const items = [
    { n: '01', week: 'Week 1', t: 'The Audit',
      d: 'Seven days. A senior strategist walks every dollar that left your business in the last ninety days. Output: a line-item map of where the $100K is hiding, ranked by speed-to-savings.',
      deliverable: 'Your signed savings map',
      more: { inside: ['Two-hour strategy session. Every team member, every tool, every recurring charge on the table.', 'Software stack audit. Zombie subs, overlapping tools, unused seats — itemized and totaled.', 'Payroll-to-agent mapping for every recurring task currently consuming human hours.', 'Ad-spend forensics and tracking-gap report against your last ninety days of spend.'], whoDoes: 'Senior strategist plus a forensic analyst', youLeaveWith: 'A ranked, dollar-attributed savings ledger. Signed by us, baselined against your P&L. Yours to keep whether you proceed or not.' } },
    { n: '02', week: 'Weeks 2 to 4', t: 'The Build',
      d: 'Two to four weeks. We deploy the agent stack into your tools, with your data, under your brand. Not templates. Not Notion docs. Working systems that fire on day one.',
      deliverable: 'Five to eight agents in production', featured: true,
      more: { inside: ['Build sprints shipped weekly. Every agent tested inside your actual stack before it goes live.', 'Slack channel with your build team. Async updates, daily standups only if you want them.', 'First agent is always a documented-savings win: a killed sub or a fully replaced workflow inside week one of the build.', 'Audit logs on by default. Every agent action reviewable.'], whoDoes: 'Senior AI engineer plus integrations lead', youLeaveWith: 'Five to eight agents running in production against your existing tools. No new dashboards to learn. No data migrations.' } },
    { n: '03', week: 'Weeks 5 to 12', t: 'The Cut',
      d: 'Five to twelve weeks. With agents running, we make the operational call: which seats convert to oversight, which subs die, which workflows retire. Documented savings each step. No surprise firings.',
      deliverable: 'Per-line savings ledger, weekly',
      more: { inside: ['Role-by-role transition plan. Always built with the team, never around them.', 'Subscription kill list signed off by you, before anything cancels.', 'Per-line savings ledger updated weekly. We send it Friday.', 'Quarterly board-ready P&L impact memo. Your CFO signs off.'], whoDoes: 'Senior strategist plus the original audit analyst', youLeaveWith: 'A documented, finance-approved savings trail. Every dollar saved shows up on a real line in your books.' } },
    { n: '04', week: 'Ongoing', t: 'The Compound',
      d: 'Once the floor is hit, the engagement converts to a retainer that finds and cuts the next $100K. Most clients run a $300K cumulative savings curve by month eighteen.',
      deliverable: 'Quarterly P&L delta report',
      more: { inside: ['Monthly savings audit. New agents shipped against newly-discovered leaks.', 'Quarterly stack review. Tools retire on a documented cycle, not a guess.', 'Direct access to a senior strategist. Not a ticket queue, not a chatbot, not a CSM.', 'Annual P&L delta presented to your CFO or board, in writing.'], whoDoes: 'Senior strategist quarterly, agents nightly', youLeaveWith: 'A compounding savings curve. Every quarter the gap between your costs and your competitors widens.' } },
  ];
  const [open, setOpen] = React.useState(1);
  const handleKey = (e, i) => {
    if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setOpen(open === i ? -1 : i); }
    else if (e.key === 'ArrowDown' || e.key === 'ArrowRight') { e.preventDefault(); setOpen(Math.min(items.length - 1, i + 1)); }
    else if (e.key === 'ArrowUp' || e.key === 'ArrowLeft')   { e.preventDefault(); setOpen(Math.max(0, i - 1)); }
  };
  return (
    <HkSection id="offer" bg="var(--hk-ink-950)">
      <div style={{ maxWidth: 760, margin: '0 auto 56px' }}>
        <HkEyebrow>The engagement</HkEyebrow>
        <h2 style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(36px, 4.6vw, 58px)', letterSpacing: '-0.03em', lineHeight: 1.02, color: 'var(--hk-fg-1)', margin: '18px 0 18px', textWrap: 'balance' }}>
          Not advice on a Notion doc. <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>The team</span> that finds the money and removes it.
        </h2>
        <p style={{ color: 'var(--hk-fg-3)', fontSize: 17, margin: 0, lineHeight: 1.55 }}>
          Four phases across twelve months. First savings line documented inside thirty days. <b style={{ color: 'var(--hk-fg-2)' }}>Click any phase</b> to see exactly what happens inside.
        </p>
      </div>
      <style>{`
        #hk-root .hk-of-timeline { position: relative; padding-left: 30px; }
        #hk-root .hk-of-timeline::before { content: ''; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 2px; background: linear-gradient(180deg, rgba(16,185,129,0.5), rgba(16,185,129,0.15) 70%, rgba(234,255,243,0.05)); border-radius: 2px; }
        #hk-root .hk-of-step { position: relative; padding: 20px 0; cursor: pointer; border-radius: 14px; transition: background 280ms cubic-bezier(0.16,1,0.3,1), padding 280ms; }
        #hk-root .hk-of-step + .hk-of-step { border-top: 1px solid var(--hk-ink-800); }
        #hk-root .hk-of-step:hover { background: linear-gradient(90deg, rgba(16,185,129,0.06), transparent 60%); }
        #hk-root .hk-of-step.is-open { background: linear-gradient(90deg, rgba(16,185,129,0.10), rgba(16,185,129,0.02) 80%); padding-left: 10px; }
        #hk-root .hk-of-row { display: grid; grid-template-columns: 180px 1fr 300px; gap: 32px; align-items: start; }
        @media (max-width: 880px) { #hk-root .hk-of-row { grid-template-columns: 1fr; gap: 14px; } }
        #hk-root .hk-of-node { position: absolute; left: -30px; top: 30px; width: 24px; height: 24px; border-radius: 50%; background: var(--hk-ink-950); border: 2px solid rgba(234,255,243,0.12); display: flex; align-items: center; justify-content: center; transition: all 260ms cubic-bezier(0.16,1,0.3,1); z-index: 2; }
        #hk-root .hk-of-node-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hk-fg-3); transition: all 220ms; }
        #hk-root .hk-of-step:hover .hk-of-node { transform: scale(1.3); border-color: rgba(52,211,153,0.8); box-shadow: 0 0 20px rgba(16,185,129,0.5); }
        #hk-root .hk-of-step:hover .hk-of-node-dot { background: #fff; box-shadow: 0 0 10px #fff; }
        #hk-root .hk-of-step.is-open .hk-of-node { transform: scale(1.4); background: rgba(52,211,153,0.25); border-color: rgba(52,211,153,1); box-shadow: 0 0 28px rgba(52,211,153,0.6); }
        #hk-root .hk-of-step.is-open .hk-of-node-dot { background: #fff; box-shadow: 0 0 12px #fff; }
        #hk-root .hk-of-step--feat:not(.is-open) .hk-of-node { background: rgba(16,185,129,0.18); border-color: rgba(16,185,129,0.6); box-shadow: 0 0 18px rgba(16,185,129,0.4); }
        #hk-root .hk-of-step--feat:not(.is-open) .hk-of-node-dot { background: #fff; }
        #hk-root .hk-of-step--feat .hk-of-node::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1.5px solid rgba(52,211,153,0.5); animation: hkOfPulse 2.4s ease-out infinite; }
        @keyframes hkOfPulse { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(1.8); opacity: 0; } }
        #hk-root .hk-of-title { font-family: var(--hk-font-display); font-weight: 700; font-size: clamp(22px, 2.2vw, 28px); letter-spacing: -0.02em; color: var(--hk-fg-1); margin: 0 0 10px; line-height: 1.1; transition: color 200ms; }
        #hk-root .hk-of-step:hover .hk-of-title, #hk-root .hk-of-step.is-open .hk-of-title { color: var(--hk-grn-200); }
        #hk-root .hk-of-deliv { background: rgba(234,255,243,0.03); border: 1px solid var(--hk-ink-800); border-radius: 14px; padding: 16px; transition: all 300ms cubic-bezier(0.16,1,0.3,1); }
        #hk-root .hk-of-step:hover .hk-of-deliv { transform: translateY(-3px) scale(1.02); border-color: rgba(16,185,129,0.5); box-shadow: 0 14px 36px -16px rgba(0,0,0,0.6); }
        #hk-root .hk-of-step--feat .hk-of-deliv { background: linear-gradient(180deg, rgba(16,185,129,0.12), rgba(16,185,129,0.02)); border-color: rgba(16,185,129,0.35); box-shadow: 0 0 20px rgba(16,185,129,0.12); }
        #hk-root .hk-of-step.is-open .hk-of-deliv { border-color: rgba(52,211,153,0.7); box-shadow: 0 0 32px rgba(16,185,129,0.2); }
        #hk-root .hk-of-expand { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--hk-ink-700); color: var(--hk-fg-3); margin-left: 8px; transition: all 300ms cubic-bezier(0.16,1,0.3,1); flex-shrink: 0; }
        #hk-root .hk-of-step:hover .hk-of-expand { border-color: var(--hk-grn-400); color: var(--hk-grn-300); background: rgba(16,185,129,0.1); }
        #hk-root .hk-of-step.is-open .hk-of-expand { transform: rotate(45deg); border-color: var(--hk-grn-300); color: #fff; background: rgba(16,185,129,0.25); }
        #hk-root .hk-of-detail { overflow: hidden; display: grid; grid-template-rows: 0fr; transition: grid-template-rows 420ms cubic-bezier(0.16,1,0.3,1), margin-top 420ms; }
        #hk-root .hk-of-step.is-open .hk-of-detail { grid-template-rows: 1fr; margin-top: 20px; }
        #hk-root .hk-of-detail-inner { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
        @media (max-width: 880px) { #hk-root .hk-of-detail-inner { grid-template-columns: 1fr; } }
        #hk-root .hk-of-detail-card { background: rgba(234,255,243,0.03); border: 1px solid var(--hk-ink-800); border-radius: 12px; padding: 22px 24px; }
        #hk-root .hk-of-detail-eyebrow { font-family: var(--hk-font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hk-grn-300); font-weight: 600; margin-bottom: 12px; }
        #hk-root .hk-of-detail ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
        #hk-root .hk-of-detail li { color: var(--hk-fg-2); font-size: 15px; line-height: 1.6; padding-left: 22px; position: relative; }
        #hk-root .hk-of-detail li::before { content: ''; position: absolute; left: 4px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--hk-grn-400); opacity: 0.85; }
        #hk-root .hk-of-detail-meta { display: flex; flex-direction: column; gap: 18px; }
        #hk-root .hk-of-detail-meta p { color: var(--hk-fg-2); font-size: 15px; line-height: 1.6; margin: 0; }
        #hk-root .hk-of-detail-meta b { color: var(--hk-fg-1); font-weight: 600; }
      `}</style>
      <div className="hk-of-timeline" role="list">
        {items.map((it, i) => {
          const isOpen = open === i;
          return (
            <div key={it.n} role="listitem" tabIndex={0} aria-expanded={isOpen}
              onClick={() => setOpen(isOpen ? -1 : i)}
              onKeyDown={(e) => handleKey(e, i)}
              className={`hk-of-step${it.featured ? ' hk-of-step--feat' : ''}${isOpen ? ' is-open' : ''}`}>
              <div className="hk-of-node"><div className="hk-of-node-dot"/></div>
              <div className="hk-of-row">
                <div>
                  <div style={{ fontFamily: 'var(--hk-font-mono)', fontSize: 11, letterSpacing: '0.16em', color: it.featured || isOpen ? 'var(--hk-grn-300)' : 'var(--hk-fg-4)', fontWeight: 600, textTransform: 'uppercase', marginBottom: 8 }}>Phase {it.n}</div>
                  <div style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 18, letterSpacing: '-0.02em', color: 'var(--hk-fg-1)', lineHeight: 1.15 }}>{it.week}</div>
                </div>
                <div>
                  <div style={{ display: 'flex', alignItems: 'flex-start', gap: 6 }}>
                    <h3 className="hk-of-title" style={{ flex: 1 }}>{it.t}</h3>
                    <span className="hk-of-expand" aria-hidden="true">
                      <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"><path d="M12 5v14M5 12h14"/></svg>
                    </span>
                  </div>
                  <p style={{ color: 'var(--hk-fg-2)', fontSize: 17, lineHeight: 1.6, margin: 0, maxWidth: 580 }}>{it.d}</p>
                </div>
                <div className="hk-of-deliv">
                  <div style={{ fontSize: 10, letterSpacing: '0.14em', textTransform: 'uppercase', color: it.featured || isOpen ? 'var(--hk-grn-300)' : 'var(--hk-fg-4)', fontWeight: 600, marginBottom: 8 }}>You walk away with</div>
                  <div style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 17, color: 'var(--hk-fg-1)', letterSpacing: '-0.01em', lineHeight: 1.25 }}>{it.deliverable}</div>
                </div>
              </div>
              <div className="hk-of-detail">
                <div className="hk-of-detail-inner">
                  <div className="hk-of-detail-card">
                    <div className="hk-of-detail-eyebrow">What happens inside</div>
                    <ul>{it.more.inside.map((line, j) => <li key={j}>{line}</li>)}</ul>
                  </div>
                  <div className="hk-of-detail-card hk-of-detail-meta">
                    <div><div className="hk-of-detail-eyebrow">Who runs the work</div><p>{it.more.whoDoes}</p></div>
                    <div><div className="hk-of-detail-eyebrow">What you actually keep</div><p><b>{it.more.youLeaveWith}</b></p></div>
                  </div>
                </div>
              </div>
            </div>
          );
        })}
      </div>
    </HkSection>
  );
};

// ===== AGENTS data =====
const AGENTS = [
  { id: 'inbox',    name: 'Inbox Triage',     tagline: 'Reads, routes, replies — before you open Gmail', tint: '#10B981', icon: 'IN',
    problem: 'Founders and senior operators bleed two to four hours a day to inbox triage. Every reply, every chase, every scheduling thread compounds.',
    solution: 'An agent trained on your past replies, your tone, your decision rules. It triages every thread, drafts replies in your voice, books the meetings that need booking, and surfaces only what actually needs you.',
    result: '$32K/yr of senior-time recovered. Inbox-zero by 9am, every morning. Drafts ready for one-tap approval.',
    integrations: ['Gmail', 'Slack', 'Calendar', 'HubSpot'],
    metrics: [{ label: 'Inbox time', before: '3 hr/day', after: '20 min' }, { label: 'Annual savings', before: 'none', after: '$32K' }, { label: 'Avg reply time', before: '8 hr', after: '12 min' }],
    ui: 'inbox' },
  { id: 'software', name: 'Software Audit',   tagline: 'Kills the SaaS subs you forgot you bought',         tint: '#34D399', icon: 'SW',
    problem: 'The average mid-market stack carries eleven zombie SaaS subscriptions. Annual renewals roll silently. Nobody owns the audit.',
    solution: 'An agent that catalogs every recurring charge across your business credit cards, scores each by last-used-date and team usage, and drafts a kill list with renegotiation prompts for the tools worth keeping.',
    result: '$28K/yr in killed subs and renegotiated contracts. Documented audit trail your CFO can verify.',
    integrations: ['Stripe', 'Brex', 'Ramp', 'QuickBooks'],
    metrics: [{ label: 'Subs killed', before: '0', after: '11' }, { label: 'Annual savings', before: 'none', after: '$28K' }, { label: 'Audit time', before: '12 hr/qtr', after: '0 hr' }],
    ui: 'software' },
  { id: 'finance',  name: 'Finance Triage',   tagline: 'Flags every leak before month-end',                tint: '#6EE7B7', icon: 'FN',
    problem: 'AP/AR drags the team. Invoice chasing falls between roles. Recurring charges sneak through the books unaudited. Month-end takes a week.',
    solution: 'An agent that reconciles transactions nightly, chases overdue invoices on your schedule, flags anomalies, and prepares a month-end pack your accountant signs off in fifteen minutes.',
    result: '$42K/yr saved on bookkeeping coordination plus 4-day month-end close. Books always one hour out of date, never one month.',
    integrations: ['QuickBooks', 'Stripe', 'Plaid', 'Slack'],
    metrics: [{ label: 'Close time', before: '8 days', after: '2 days' }, { label: 'Annual savings', before: 'none', after: '$42K' }, { label: 'Error rate', before: '2.4%', after: '0.3%' }],
    ui: 'ledger' },
  { id: 'sales',    name: 'Sales Ops',        tagline: 'Quote, follow-up, report — on autopilot',           tint: '#A7F3D0', icon: 'SO',
    problem: 'A coordinator costs $60K/yr to build quotes, run follow-up sequences, keep deal stages clean, and produce the weekly pipeline report.',
    solution: 'An agent that watches your CRM, generates quotes against your pricebook, sends follow-up sequences in the right tone, keeps deal hygiene clean, and ships the Monday pipeline report before standup.',
    result: '$48K/yr in coordinator overhead removed. Faster quotes, cleaner pipeline, better forecasting.',
    integrations: ['HubSpot', 'Salesforce', 'Close', 'Slack'],
    metrics: [{ label: 'Quote turnaround', before: '2 days', after: '6 min' }, { label: 'Annual savings', before: 'none', after: '$48K' }, { label: 'Pipeline hygiene', before: '64%', after: '98%' }],
    ui: 'sales' },
  { id: 'support',  name: 'Support Agent',    tagline: 'Resolves 70% of tickets before a human reads them', tint: '#D1FAE5', icon: 'SP',
    problem: 'Tier-1 support absorbs entire FTEs. Most tickets are the same five questions repeated. Response time slips. Customers churn.',
    solution: 'An agent with your knowledge base, your policy doc, and your refund authority. First-touch on every ticket, resolves the simple ones, escalates with a clean summary on the rest.',
    result: '$58K/yr in tier-1 headcount avoided. Sub-90-second first reply, every ticket, every timezone.',
    integrations: ['Intercom', 'Zendesk', 'Front', 'HelpScout'],
    metrics: [{ label: 'First reply', before: '4 hr', after: '90 sec' }, { label: 'Annual savings', before: 'none', after: '$58K' }, { label: 'Auto-resolve %', before: '0%', after: '72%' }],
    ui: 'support' },
  { id: 'ads',      name: 'Ad Forensics',     tagline: 'Finds the waste, kills it, compounds the winners', tint: '#059669', icon: 'AD',
    problem: 'Ad spend leaks compound silently. Untracked campaigns. Ghost audiences. Manual reporting. Most operators have no idea where the wasted spend lives until QBR.',
    solution: 'An agent that pulls every campaign nightly, scores against your blended target, drafts a kill list, and reallocates budget to the lines that actually pay back inside your window.',
    result: '$84K/yr recovered in cut ad waste. Weekly digest in your Slack. Quarterly board memo on demand.',
    integrations: ['Meta Ads', 'Google Ads', 'TikTok', 'Slack'],
    metrics: [{ label: 'Wasted spend', before: '$14K/mo', after: '$2K/mo' }, { label: 'Annual savings', before: 'none', after: '$84K' }, { label: 'Reporting hours', before: '8 hr/wk', after: '0 hr' }],
    ui: 'ads' },
];

// ----- end of file part 1 (continued below) -----

// ===== Mock UI helpers =====
const mockPanel = { background: '#05100B', border: '1px solid var(--hk-ink-700)', borderRadius: 14, overflow: 'hidden', fontFamily: 'var(--hk-font-body)' };
const chromeBar = { display: 'flex', alignItems: 'center', gap: 6, padding: '10px 14px', borderBottom: '1px solid var(--hk-ink-800)', background: 'rgba(255,255,255,0.02)' };
const chromeDots = ['#FF5F57', '#FFBD2E', '#28CA41'];

const MockChrome = ({ title }) => (
  <div style={chromeBar}>
    {chromeDots.map(c => <span key={c} style={{ width: 10, height: 10, borderRadius: '50%', background: c }}/>)}
    <span style={{ fontSize: 11, color: 'var(--hk-fg-4)', marginLeft: 10, fontFamily: 'var(--hk-font-mono)' }}>{title}</span>
  </div>
);

const MockInbox = () => {
  const threads = [
    { from: 'Olivia / Finance', subj: 'Q2 vendor renewals — need your sign-off', tag: 'handled', tagFg: 'var(--hk-grn-300)', summary: 'Drafted approval. Kill list attached. Two renewals flagged.' },
    { from: 'Kyle @ Stripe', subj: 'New annual contract proposal', tag: 'negotiated', tagFg: 'var(--hk-accent-cyan)', summary: 'Counter sent. 12% saved if they accept by Friday.' },
    { from: 'Megan / HR', subj: 'New hire onboarding checklist', tag: 'auto-replied', tagFg: 'var(--hk-grn-300)', summary: 'Sent SOPs. Calendar block scheduled. Followed up.' },
    { from: 'Outbound from David', subj: 'Lunch next Tue?', tag: 'booked', tagFg: 'var(--hk-accent-lime)', summary: 'Booked Tuesday 12:30. Confirmed via Calendar.' },
    { from: 'CEO @ Helios', subj: 'Renewal discussion', tag: 'escalated', tagFg: 'var(--hk-accent-amber)', summary: 'Drafted reply. Flagged for your read — high-value account.' },
  ];
  return (
    <div style={mockPanel}>
      <MockChrome title="inbox-agent / triage-queue"/>
      <div style={{ padding: 14 }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
          <div>
            <div style={{ fontSize: 12, fontWeight: 600, color: 'var(--hk-fg-1)' }}>This morning / 47 threads triaged</div>
            <div style={{ fontSize: 10, color: 'var(--hk-fg-4)', marginTop: 2, fontFamily: 'var(--hk-font-mono)' }}>42 auto-handled / 5 flagged for your read</div>
          </div>
          <HkBadge tone="grn" dot>Inbox zero</HkBadge>
        </div>
        {threads.map((t, i) => (
          <div key={i} style={{ padding: '10px 12px', borderRadius: 10, background: 'rgba(255,255,255,0.02)', border: '1px solid var(--hk-ink-800)', marginBottom: 8, display: 'flex', gap: 12, alignItems: 'flex-start' }}>
            <div style={{ flex: 1, minWidth: 0 }}>
              <div style={{ display: 'flex', alignItems: 'baseline', gap: 8 }}>
                <span style={{ fontSize: 12, fontWeight: 600, color: 'var(--hk-fg-1)' }}>{t.from}</span>
                <span style={{ fontSize: 10, padding: '2px 8px', borderRadius: 999, background: `${t.tagFg}1a`, color: t.tagFg, fontWeight: 600, letterSpacing: '0.04em' }}>{t.tag}</span>
              </div>
              <div style={{ fontSize: 12, color: 'var(--hk-fg-2)', marginTop: 2 }}>{t.subj}</div>
              <div style={{ fontSize: 11, color: 'var(--hk-fg-4)', marginTop: 3, fontStyle: 'italic' }}>{t.summary}</div>
            </div>
          </div>
        ))}
      </div>
    </div>
  );
};

const MockSoftware = () => {
  const rows = [
    { name: 'Notion (team)',     cost: '$840/mo', usage: '2 of 14 seats used',   action: 'Downgrade',  fg: 'var(--hk-accent-amber)' },
    { name: 'Loom (business)',   cost: '$520/mo', usage: 'Last login: 47 days',  action: 'Kill',       fg: '#E98B8B' },
    { name: 'Calendly (team)',   cost: '$310/mo', usage: 'Replaced by inbox agent', action: 'Kill',    fg: '#E98B8B' },
    { name: 'Zapier (corp)',     cost: '$2,400/mo', usage: 'Migrating to native',  action: 'Sunset',   fg: 'var(--hk-accent-amber)' },
    { name: 'Asana (premium)',   cost: '$890/mo', usage: 'Overlapping with Linear', action: 'Kill',    fg: '#E98B8B' },
    { name: 'Superhuman (team)', cost: '$560/mo', usage: 'Keep for founders only', action: 'Downgrade', fg: 'var(--hk-accent-amber)' },
  ];
  return (
    <div style={mockPanel}>
      <MockChrome title="software-audit / kill-list"/>
      <div style={{ padding: 14 }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
          <div>
            <div style={{ fontSize: 12, fontWeight: 600, color: 'var(--hk-fg-1)' }}>11 zombie subs identified</div>
            <div style={{ fontSize: 10, color: 'var(--hk-fg-4)', marginTop: 2, fontFamily: 'var(--hk-font-mono)' }}>$4,720/mo recoverable / awaiting your sign-off</div>
          </div>
          <HkBadge tone="lime"><Sparkle size={10} style={{ marginRight: 4 }}/>$28K/yr</HkBadge>
        </div>
        {rows.map((r, i) => (
          <div key={i} style={{ display: 'grid', gridTemplateColumns: '1fr auto auto', gap: 12, padding: '10px 12px', borderRadius: 10, background: 'rgba(255,255,255,0.02)', border: '1px solid var(--hk-ink-800)', marginBottom: 6, alignItems: 'center' }}>
            <div>
              <div style={{ fontSize: 12, fontWeight: 600, color: 'var(--hk-fg-1)' }}>{r.name}</div>
              <div style={{ fontSize: 10, color: 'var(--hk-fg-4)', marginTop: 2 }}>{r.usage}</div>
            </div>
            <div style={{ fontSize: 12, color: 'var(--hk-fg-2)', fontFamily: 'var(--hk-font-mono)' }}>{r.cost}</div>
            <span style={{ fontSize: 10, padding: '3px 10px', borderRadius: 999, background: `${r.fg}1a`, color: r.fg, fontWeight: 600, letterSpacing: '0.04em' }}>{r.action}</span>
          </div>
        ))}
      </div>
    </div>
  );
};

const MockLedger = () => {
  const rows = [
    { d: 'May 21', v: 'Stripe payout',         a: '+$18,420.00', cat: 'Revenue',  ok: true },
    { d: 'May 21', v: 'Meta Ads',              a: '-$4,280.00',  cat: 'Marketing', ok: true },
    { d: 'May 20', v: 'AWS invoice',           a: '-$612.00',    cat: 'Infra',     ok: true },
    { d: 'May 20', v: 'Unknown / TXN_98',      a: '-$1,400.00',  cat: 'Flagged',   ok: false },
    { d: 'May 19', v: 'Payroll / Gusto',       a: '-$28,100.00', cat: 'Payroll',   ok: true },
    { d: 'May 18', v: 'Refund / order #4412', a: '-$220.00',    cat: 'Revenue',   ok: true },
  ];
  return (
    <div style={mockPanel}>
      <MockChrome title="finance-agent / ledger"/>
      <div style={{ padding: 0 }}>
        <div style={{ display: 'grid', gridTemplateColumns: '90px 1fr 130px 110px 20px', padding: '10px 16px', fontSize: 10, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--hk-fg-4)', fontWeight: 600, borderBottom: '1px solid var(--hk-ink-800)', background: 'rgba(255,255,255,0.02)' }}>
          <span>Date</span><span>Description</span><span style={{ textAlign: 'right' }}>Amount</span><span>Category</span><span/>
        </div>
        {rows.map((r, i) => (
          <div key={i} style={{ display: 'grid', gridTemplateColumns: '90px 1fr 130px 110px 20px', padding: '10px 16px', fontSize: 12, borderBottom: '1px solid var(--hk-ink-800)', alignItems: 'center', background: !r.ok ? 'rgba(245,177,73,0.04)' : 'transparent' }}>
            <span style={{ color: 'var(--hk-fg-4)', fontFamily: 'var(--hk-font-mono)' }}>{r.d}</span>
            <span style={{ color: 'var(--hk-fg-1)' }}>{r.v}</span>
            <span style={{ color: r.a.startsWith('+') ? 'var(--hk-accent-lime)' : 'var(--hk-fg-2)', fontFamily: 'var(--hk-font-mono)', textAlign: 'right', fontWeight: 500 }}>{r.a}</span>
            <span><span style={{ fontSize: 10, padding: '3px 8px', borderRadius: 999, background: r.ok ? 'rgba(110,231,183,0.1)' : 'rgba(245,177,73,0.12)', color: r.ok ? 'var(--hk-grn-200)' : 'var(--hk-accent-amber)', fontWeight: 500 }}>{r.cat}</span></span>
            <span>{!r.ok && <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" style={{ color: 'var(--hk-accent-amber)' }} aria-hidden="true"><path d="M12 2L2 20h20L12 2z"/><path d="M12 10v4"/><circle cx="12" cy="17.5" r="0.8" fill="currentColor"/></svg>}</span>
          </div>
        ))}
        <div style={{ padding: '10px 16px', fontSize: 11, color: 'var(--hk-fg-3)', background: 'rgba(16,185,129,0.04)' }}>
          <b style={{ color: 'var(--hk-grn-200)', display: 'inline-flex', alignItems: 'center', gap: 4 }}><Sparkle size={11}/>Agent note.</b> $1,400 charge flagged. No matching invoice. Slacked ops to confirm.
        </div>
      </div>
    </div>
  );
};

const MockSales = () => {
  const rows = [
    { stage: 'Quote sent',     name: 'Helios Group',     v: '$48K',  age: '2h',  hot: true },
    { stage: 'Follow-up #3',   name: 'Arc Industries',   v: '$22K',  age: '1d' },
    { stage: 'Demo booked',    name: 'Stilt & Co',       v: '$18K',  age: '3h',  hot: true },
    { stage: 'Stale 14d',      name: 'NorthRiver',       v: '$36K',  age: '14d', warn: true },
  ];
  return (
    <div style={mockPanel}>
      <MockChrome title="sales-ops / pipeline-monday"/>
      <div style={{ padding: 14 }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
          <div>
            <div style={{ fontSize: 12, fontWeight: 600, color: 'var(--hk-fg-1)' }}>Pipeline / $124K open / weekly digest</div>
            <div style={{ fontSize: 10, color: 'var(--hk-fg-4)', marginTop: 2, fontFamily: 'var(--hk-font-mono)' }}>shipped to your slack 8:14am Mon</div>
          </div>
          <HkBadge tone="grn" dot>Auto-reported</HkBadge>
        </div>
        {rows.map((r, i) => (
          <div key={i} style={{ display: 'grid', gridTemplateColumns: '120px 1fr auto auto auto', gap: 12, padding: '10px 12px', borderRadius: 10, background: 'rgba(255,255,255,0.02)', border: '1px solid var(--hk-ink-800)', marginBottom: 6, alignItems: 'center' }}>
            <span style={{ fontSize: 10, padding: '3px 8px', borderRadius: 999, background: r.warn ? 'rgba(245,177,73,0.1)' : 'rgba(16,185,129,0.1)', color: r.warn ? 'var(--hk-accent-amber)' : 'var(--hk-grn-300)', fontWeight: 600, letterSpacing: '0.04em', textAlign: 'center' }}>{r.stage}</span>
            <span style={{ fontSize: 13, color: 'var(--hk-fg-1)', fontWeight: 500 }}>{r.name}</span>
            <span style={{ fontSize: 13, color: 'var(--hk-fg-2)', fontFamily: 'var(--hk-font-mono)', fontWeight: 600 }}>{r.v}</span>
            <span style={{ fontSize: 11, color: 'var(--hk-fg-4)', fontFamily: 'var(--hk-font-mono)' }}>{r.age}</span>
            {r.hot && <span style={{ fontSize: 9, background: 'rgba(200,242,106,0.12)', color: 'var(--hk-accent-lime)', padding: '3px 6px', borderRadius: 4, fontWeight: 600 }}>HOT</span>}
            {r.warn && <span style={{ fontSize: 9, background: 'rgba(245,177,73,0.12)', color: 'var(--hk-accent-amber)', padding: '3px 6px', borderRadius: 4, fontWeight: 600 }}>WARN</span>}
            {!r.hot && !r.warn && <span/>}
          </div>
        ))}
      </div>
    </div>
  );
};

const MockSupport = () => {
  const tickets = [
    { who: 'Jordan K.', q: 'Where is my order?',     ai: 'Order shipped 4/19. UPS 1Z442. ETA Wed.', status: 'resolved', fg: 'var(--hk-grn-300)' },
    { who: 'Riya M.',   q: 'Refund for #4892',       ai: 'Refund issued ($140). Receipt sent.',     status: 'resolved', fg: 'var(--hk-grn-300)' },
    { who: 'CEO @ Pace', q: 'Enterprise pricing',    ai: 'Drafted reply. Flagged — high-value.',    status: 'escalated', fg: 'var(--hk-accent-amber)' },
    { who: 'Tom V.',    q: 'Cancel subscription',    ai: 'Retention flow triggered. 1 reply due.',  status: 'in flow',  fg: 'var(--hk-accent-cyan)' },
  ];
  return (
    <div style={mockPanel}>
      <MockChrome title="support-agent / first-touch"/>
      <div style={{ padding: 14 }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
          <div>
            <div style={{ fontSize: 12, fontWeight: 600, color: 'var(--hk-fg-1)' }}>Today / 142 tickets / 102 auto-resolved</div>
            <div style={{ fontSize: 10, color: 'var(--hk-fg-4)', marginTop: 2, fontFamily: 'var(--hk-font-mono)' }}>72% auto-resolve / 87s avg first reply</div>
          </div>
          <HkBadge tone="grn" dot>Live</HkBadge>
        </div>
        {tickets.map((t, i) => (
          <div key={i} style={{ padding: '10px 12px', borderRadius: 10, background: 'rgba(255,255,255,0.02)', border: '1px solid var(--hk-ink-800)', marginBottom: 6 }}>
            <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 4 }}>
              <span style={{ fontSize: 12, fontWeight: 600, color: 'var(--hk-fg-1)' }}>{t.who} — {t.q}</span>
              <span style={{ fontSize: 10, padding: '2px 8px', borderRadius: 999, background: `${t.fg}1a`, color: t.fg, fontWeight: 600, letterSpacing: '0.04em' }}>{t.status}</span>
            </div>
            <div style={{ fontSize: 11, color: 'var(--hk-fg-3)', fontStyle: 'italic' }}>{t.ai}</div>
          </div>
        ))}
      </div>
    </div>
  );
};

const MockAds = () => {
  const lines = [
    { camp: 'Awareness — Q2 broad', spend: '$4,200', cpa: '$87',  verdict: 'Kill',       fg: '#E98B8B' },
    { camp: 'Retargeting — site visitors', spend: '$2,800', cpa: '$24',  verdict: 'Compound',  fg: 'var(--hk-accent-lime)' },
    { camp: 'Lookalike — top 1%',   spend: '$3,600', cpa: '$31',  verdict: 'Scale',     fg: 'var(--hk-accent-lime)' },
    { camp: 'Cold prospecting V2',  spend: '$5,100', cpa: '$112', verdict: 'Kill',      fg: '#E98B8B' },
  ];
  return (
    <div style={mockPanel}>
      <MockChrome title="ad-forensics / nightly-cut-list"/>
      <div style={{ padding: 14 }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
          <div>
            <div style={{ fontSize: 12, fontWeight: 600, color: 'var(--hk-fg-1)' }}>4 campaigns reviewed / 2 kill / 2 scale</div>
            <div style={{ fontSize: 10, color: 'var(--hk-fg-4)', marginTop: 2, fontFamily: 'var(--hk-font-mono)' }}>$9,300 to reallocate this week</div>
          </div>
          <HkBadge tone="lime">$84K saved YTD</HkBadge>
        </div>
        {lines.map((l, i) => (
          <div key={i} style={{ display: 'grid', gridTemplateColumns: '1fr auto auto auto', gap: 12, padding: '10px 12px', borderRadius: 10, background: 'rgba(255,255,255,0.02)', border: '1px solid var(--hk-ink-800)', marginBottom: 6, alignItems: 'center' }}>
            <span style={{ fontSize: 12, fontWeight: 500, color: 'var(--hk-fg-1)' }}>{l.camp}</span>
            <span style={{ fontSize: 11, color: 'var(--hk-fg-3)', fontFamily: 'var(--hk-font-mono)' }}>{l.spend}</span>
            <span style={{ fontSize: 11, color: 'var(--hk-fg-2)', fontFamily: 'var(--hk-font-mono)' }}>CPA {l.cpa}</span>
            <span style={{ fontSize: 10, padding: '3px 10px', borderRadius: 999, background: `${l.fg}1a`, color: l.fg, fontWeight: 600, letterSpacing: '0.04em' }}>{l.verdict}</span>
          </div>
        ))}
      </div>
    </div>
  );
};

const AGENT_UIS = { inbox: MockInbox, software: MockSoftware, ledger: MockLedger, sales: MockSales, support: MockSupport, ads: MockAds };

// ===== Agent avatar =====
const AgentAvatar = ({ agent, size = 56, radius = 16 }) => (
  <div style={{ width: size, height: size, borderRadius: radius, border: `1px solid ${agent.tint}66`, boxShadow: `0 0 24px ${agent.tint}33, inset 0 1px 0 rgba(255,255,255,0.12)`, background: `linear-gradient(135deg, ${agent.tint}33, ${agent.tint}0a)`, flex: '0 0 auto', display: 'flex', alignItems: 'center', justifyContent: 'center', color: agent.tint, fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: Math.round(size / 3), letterSpacing: '-0.02em' }}>{agent.icon}</div>
);

// ===== AgentShowcase =====
const ToolPill = ({ label, center, tint }) => (
  <span className="hk-as-pill" style={{ padding: '6px 12px', fontSize: 11, fontWeight: 500, background: center ? `${tint}14` : 'rgba(234,255,243,0.04)', border: `1px solid ${center ? `${tint}44` : 'rgba(234,255,243,0.1)'}`, color: center ? 'var(--hk-fg-1)' : 'var(--hk-fg-2)', borderRadius: 999, fontFamily: 'var(--hk-font-body)', letterSpacing: '-0.005em', display: 'inline-block' }}>{label}</span>
);

const IntegrationFlow = ({ tools, tint }) => (
  <div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap', position: 'relative' }}>
    <ToolPill label="Your stack" center tint={tint}/>
    <svg width="24" height="10" viewBox="0 0 24 10" style={{ flexShrink: 0 }}>
      <path d="M0 5 L22 5" stroke={tint} strokeWidth="1.5" strokeDasharray="2 2" opacity="0.6"/>
      <path d="M18 1 L22 5 L18 9" stroke={tint} strokeWidth="1.5" fill="none" strokeLinecap="round" strokeLinejoin="round"/>
    </svg>
    <div style={{ display: 'inline-flex', alignItems: 'center', gap: 6, padding: '6px 12px', background: `linear-gradient(135deg, ${tint}, ${tint}aa)`, borderRadius: 999, color: '#030806', fontSize: 12, fontWeight: 700, letterSpacing: '-0.005em', boxShadow: `0 0 16px ${tint}66` }}>
      <Sparkle size={10}/>AI Agent
    </div>
    <svg width="24" height="10" viewBox="0 0 24 10" style={{ flexShrink: 0 }}>
      <path d="M0 5 L22 5" stroke={tint} strokeWidth="1.5" strokeDasharray="2 2" opacity="0.6"/>
      <path d="M18 1 L22 5 L18 9" stroke={tint} strokeWidth="1.5" fill="none" strokeLinecap="round" strokeLinejoin="round"/>
    </svg>
    <div style={{ display: 'flex', gap: 6, flexWrap: 'wrap' }}>{tools.map(t => <ToolPill key={t} label={t}/>)}</div>
  </div>
);

const AgentSurface = ({ agent, UI }) => (
  <React.Fragment>
    <div>
      <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 20 }}>
        <AgentAvatar agent={agent} size={56} radius={16}/>
        <div>
          <div style={{ fontSize: 22, fontWeight: 700, fontFamily: 'var(--hk-font-display)', letterSpacing: '-0.02em', color: 'var(--hk-fg-1)' }}>{agent.name}</div>
          <div style={{ fontSize: 13, color: 'var(--hk-fg-3)', marginTop: 2 }}>{agent.tagline}</div>
        </div>
      </div>
      <div style={{ display: 'flex', flexDirection: 'column', gap: 18, marginBottom: 24 }}>
        <div><HkEyebrow color="var(--hk-fg-4)">The leak</HkEyebrow><p style={{ fontSize: 15, color: 'var(--hk-fg-2)', lineHeight: 1.55, margin: '6px 0 0' }}>{agent.problem}</p></div>
        <div><HkEyebrow color={`${agent.tint}cc`}>What we deploy</HkEyebrow><p style={{ fontSize: 15, color: 'var(--hk-fg-2)', lineHeight: 1.55, margin: '6px 0 0' }}>{agent.solution}</p></div>
        <div><HkEyebrow color="var(--hk-accent-lime)">Documented savings</HkEyebrow><p style={{ fontSize: 15, color: 'var(--hk-fg-1)', lineHeight: 1.55, margin: '6px 0 0', fontWeight: 500 }}>{agent.result}</p></div>
      </div>
      <div style={{ padding: 16, background: 'rgba(234,255,243,0.02)', border: '1px solid var(--hk-ink-800)', borderRadius: 14 }}>
        <div style={{ fontSize: 11, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--hk-fg-4)', fontWeight: 600, marginBottom: 12 }}>Native to</div>
        <IntegrationFlow tools={agent.integrations} tint={agent.tint}/>
      </div>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 8, marginTop: 16 }}>
        {agent.metrics.map((m, i) => (
          <div key={i} className="hk-as-metric">
            <div style={{ fontSize: 10, color: 'var(--hk-fg-4)', letterSpacing: '0.08em', textTransform: 'uppercase' }}>{m.label}</div>
            <div style={{ display: 'flex', alignItems: 'center', gap: 6, marginTop: 4 }}>
              <span style={{ fontSize: 11, color: 'var(--hk-fg-4)', textDecoration: 'line-through' }}>{m.before}</span>
              <HkArrow size={10}/>
              <span style={{ fontSize: 17, fontWeight: 700, color: 'var(--hk-accent-lime)', fontFamily: 'var(--hk-font-display)', letterSpacing: '-0.02em' }}>{m.after}</span>
            </div>
          </div>
        ))}
      </div>
    </div>
    <div className="hk-as-ui-wrap">
      <div style={{ position: 'absolute', inset: '-20px', background: `radial-gradient(ellipse at center, ${agent.tint}2a, transparent 65%)`, filter: 'blur(30px)', pointerEvents: 'none' }}/>
      <div style={{ position: 'relative', boxShadow: `0 30px 80px -20px rgba(0,0,0,0.6), 0 0 0 1px ${agent.tint}33 inset, 0 0 60px ${agent.tint}15`, borderRadius: 18, overflow: 'hidden', border: `1px solid ${agent.tint}33` }}>
        {UI && <UI/>}
      </div>
    </div>
  </React.Fragment>
);

const AgentShowcase = () => {
  const [active, setActive] = React.useState(AGENTS[0].id);
  const [swapping, setSwapping] = React.useState(false);
  const agent = AGENTS.find(a => a.id === active) || AGENTS[0];
  const UI = AGENT_UIS[agent.ui];
  const handleSwap = (id) => {
    if (id === active) return;
    setSwapping(true);
    setTimeout(() => { setActive(id); setSwapping(false); }, 160);
  };
  return (
    <section onKeyDown={(e) => {
      if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight') return;
      e.preventDefault();
      const idx = AGENTS.findIndex(a => a.id === active);
      const next = e.key === 'ArrowRight' ? (idx + 1) % AGENTS.length : (idx - 1 + AGENTS.length) % AGENTS.length;
      handleSwap(AGENTS[next].id);
    }} tabIndex={-1} style={{ padding: 'clamp(24px, 3vw, 48px) 20px clamp(64px, 7vw, 112px)', background: 'var(--hk-ink-1000)', position: 'relative', outline: 'none' }}>
      <style>{`
        #hk-root .hk-as-tab { position: relative; padding: 8px 16px 8px 8px; border-radius: 999px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-family: var(--hk-font-body); letter-spacing: -0.005em; transition: all 240ms cubic-bezier(0.16,1,0.3,1); }
        #hk-root .hk-as-tab:hover { transform: translateY(-2px) scale(1.04); }
        #hk-root .hk-as-tab::after { content: ''; position: absolute; left: 50%; bottom: -10px; width: 6px; height: 6px; border-radius: 50%; transform: translate(-50%, 0) scale(0); background: currentColor; transition: transform 260ms cubic-bezier(0.16,1,0.3,1); }
        #hk-root .hk-as-tab.is-active::after { transform: translate(-50%, 0) scale(1); }
        #hk-root .hk-as-content { transition: opacity 220ms ease, transform 260ms cubic-bezier(0.16,1,0.3,1); }
        #hk-root .hk-as-content.is-swapping { opacity: 0; transform: translateY(6px); }
        #hk-root .hk-as-ui-wrap { position: relative; transition: transform 420ms cubic-bezier(0.16,1,0.3,1); }
        #hk-root .hk-as-ui-wrap:hover { transform: translateY(-4px) scale(1.01); }
        #hk-root .hk-as-metric { padding: 12px; background: rgba(234,255,243,0.02); border: 1px solid var(--hk-ink-800); border-radius: 10px; transition: all 240ms cubic-bezier(0.16,1,0.3,1); }
        #hk-root .hk-as-metric:hover { transform: translateY(-3px); border-color: rgba(200,242,106,0.35); background: rgba(200,242,106,0.04); }
        #hk-root .hk-as-pill { transition: transform 220ms cubic-bezier(0.16,1,0.3,1); }
        #hk-root .hk-as-pill:hover { transform: translateY(-2px) scale(1.05); }
        @media (max-width: 880px) { #hk-root .hk-as-surface { grid-template-columns: 1fr !important; gap: 24px !important; } }
      `}</style>
      <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none', background: 'radial-gradient(ellipse at 80% 10%, rgba(16,185,129,0.18), transparent 55%), radial-gradient(ellipse at 15% 90%, rgba(94,230,224,0.08), transparent 50%)' }}/>
      <div style={{ maxWidth: 1240, margin: '0 auto', position: 'relative', zIndex: 2 }}>
        <div style={{ maxWidth: 720, marginBottom: 48 }}>
          <HkEyebrow>The agents we deploy</HkEyebrow>
          <h2 style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(32px, 4vw, 54px)', letterSpacing: '-0.032em', lineHeight: 1.04, color: 'var(--hk-fg-1)', margin: '14px 0 16px', textWrap: 'balance' }}>
            Six agents we have shipped. Yours are <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>built against your books</span>.
          </h2>
          <p style={{ fontSize: 16, color: 'var(--hk-fg-3)', margin: 0, lineHeight: 1.55 }}>
            Click any agent below to switch the preview. The UI on the right is what your team will actually see.
          </p>
        </div>
        <div style={{ display: 'flex', gap: 10, marginBottom: 32, flexWrap: 'wrap', paddingBottom: 18, borderBottom: '1px solid var(--hk-ink-800)', alignItems: 'center' }}>
          {AGENTS.map(a => {
            const isActive = active === a.id;
            return (
              <button key={a.id} onClick={() => handleSwap(a.id)} className={`hk-as-tab ${isActive ? 'is-active' : ''}`} aria-pressed={isActive}
                style={{ background: isActive ? `linear-gradient(180deg, ${a.tint}22, ${a.tint}0a)` : 'transparent', border: `1px solid ${isActive ? `${a.tint}88` : 'rgba(234,255,243,0.08)'}`, color: isActive ? 'var(--hk-fg-1)' : 'var(--hk-fg-3)', boxShadow: isActive ? `0 8px 26px -10px ${a.tint}66, 0 0 0 1px ${a.tint}44` : 'none' }}>
                <AgentAvatar agent={a} size={32} radius={999}/>
                {a.name}
              </button>
            );
          })}
        </div>
        <div className={`hk-as-surface hk-as-content ${swapping ? 'is-swapping' : ''}`} style={{ display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1.25fr)', gap: 32, alignItems: 'start' }}>
          <AgentSurface agent={agent} UI={UI}/>
        </div>
      </div>
    </section>
  );
};

// ===== AgentMap =====
const AGENT_MAP = [
  { id: 'vault',    name: 'Vault',           role: 'Orchestrates every other agent',     model: 'Claude Opus 4.7',   tint: '#F5B149', icon: 'VL',
    summary: 'The orchestrator. Routes work to every other agent, monitors documented savings, surfaces blockers, and delivers your weekly P&L digest.',
    responsibilities: ['Weekly savings digest', 'Cross-agent task routing', 'Documented-savings tracking', 'Budget oversight'],
    metrics: { time: '30 to 45 hrs / mo', setup: '5 to 7 days', cost: '$160/mo' },
    availability: '24/7/365. Never sleeps, never drops a thread, never lets a savings line slip past month-end.' },
  { id: 'inbox',    name: 'Inbox Triage',    role: 'Reads, routes, replies before you open Gmail', model: 'Claude Sonnet 4.6', tint: '#10B981', icon: 'IN',
    summary: 'Triages every email, books meetings inside your rules, drafts replies in your voice, and surfaces only what truly needs you.',
    responsibilities: ['Thread triage and routing', 'Calendar booking', 'Reply drafting in your tone', 'One-tap approval queue'],
    metrics: { time: '$32K / yr saved',   setup: '3 to 5 days', cost: '$90/mo' },
    availability: '24/7/365. Inbox-zero by 9am, every morning, every timezone.' },
  { id: 'software', name: 'Software Audit',  role: 'Kills zombie SaaS, renegotiates the rest',     model: 'Claude Sonnet 4.6', tint: '#34D399', icon: 'SW',
    summary: 'Catalogs every recurring charge across your business cards, scores by usage, drafts a kill list, and produces renegotiation prompts for the tools worth keeping.',
    responsibilities: ['Recurring-charge audit', 'Usage scoring', 'Kill / downgrade list', 'Renegotiation drafting'],
    metrics: { time: '$28K / yr saved',   setup: '4 to 6 days', cost: '$80/mo' },
    availability: '24/7/365. Runs the audit nightly, flags renewals before they auto-roll.' },
  { id: 'finance',  name: 'Finance Triage',  role: 'AP, AR, reconciliation, close prep',           model: 'Claude Opus 4.7',   tint: '#6EE7B7', icon: 'FN',
    summary: 'Reconciles transactions nightly. Chases overdue invoices on your schedule. Flags anomalies the day they hit. Prepares a month-end pack your accountant signs off in fifteen minutes.',
    responsibilities: ['Nightly reconciliation', 'Invoice chasing', 'Anomaly detection', 'Month-end close pack'],
    metrics: { time: '$42K / yr saved',   setup: '5 to 7 days', cost: '$110/mo' },
    availability: '24/7/365. Books one hour out of date, never one month.' },
  { id: 'sales',    name: 'Sales Ops',       role: 'Quote, follow-up, pipeline, report',           model: 'Claude Sonnet 4.6', tint: '#A7F3D0', icon: 'SO',
    summary: 'Watches your CRM, generates quotes against your pricebook, runs follow-up sequences in the right tone, keeps stages clean, ships the Monday pipeline report.',
    responsibilities: ['Quote generation', 'Follow-up sequences', 'CRM hygiene', 'Weekly pipeline digest'],
    metrics: { time: '$48K / yr saved',   setup: '5 to 7 days', cost: '$120/mo' },
    availability: '24/7/365. Reports ship Monday 8am. Stale deals never sit past day fourteen.' },
  { id: 'support',  name: 'Support Agent',   role: 'Resolves 70% of tickets before escalation',    model: 'Claude Sonnet 4.6', tint: '#D1FAE5', icon: 'SP',
    summary: 'First-touch on every ticket. Reads order history, applies policy, issues refunds within your authority limit. Escalates only what actually needs you, with a clean summary.',
    responsibilities: ['First-touch reply', 'Policy-driven resolution', 'Refund authority within limits', 'Clean escalation handoffs'],
    metrics: { time: '$58K / yr saved',   setup: '5 to 7 days', cost: '$130/mo' },
    availability: '24/7/365. Sub-90-second first reply, every ticket, every timezone.' },
  { id: 'ads',      name: 'Ad Forensics',    role: 'Cuts ad waste, compounds the winners',         model: 'Claude Opus 4.7',   tint: '#059669', icon: 'AD',
    summary: 'Pulls every campaign nightly, scores against your blended target, drafts a kill list, reallocates budget to the lines that pay back inside your window.',
    responsibilities: ['Nightly spend audit', 'Waste detection', 'Kill list drafting', 'Budget reallocation'],
    metrics: { time: '$84K / yr saved',   setup: '7 to 10 days', cost: '$180/mo' },
    availability: '24/7/365. Slack digest every Monday. Quarterly board memo on demand.' },
  { id: 'vendor',   name: 'Vendor Watch',    role: 'Tracks renewals, drafts renegotiations',       model: 'Claude Sonnet 4.6', tint: '#047857', icon: 'VD',
    summary: 'Watches every vendor contract end-date, flags ninety days out, drafts renegotiation prompts citing usage data and market comparables.',
    responsibilities: ['Contract tracking', 'Renewal forecasting', 'Renegotiation prompts', 'Market comparables'],
    metrics: { time: '$22K / yr saved',   setup: '4 to 6 days', cost: '$70/mo' },
    availability: '24/7/365. Ninety-day renewal alert, every contract, before the auto-roll.' },
  { id: 'reporting', name: 'Reporting Agent', role: 'Pulls data, drafts the recap, ships Monday',   model: 'Claude Sonnet 4.6', tint: '#10B981', icon: 'RP',
    summary: 'Pulls performance data from your stack, drafts the weekly internal recap, builds the client report, ghostwrites the board update.',
    responsibilities: ['Weekly recap drafting', 'Performance pulls', 'Client report builds', 'Board update ghostwrites'],
    metrics: { time: '$36K / yr saved',   setup: '5 to 7 days', cost: '$100/mo' },
    availability: '24/7/365. Drafts ship Sunday night so Monday starts with the recap in your inbox.' },
];

const AgentMap = () => {
  const [active, setActive] = React.useState(null);
  const vault = AGENT_MAP[0];
  const team = AGENT_MAP.slice(1);
  const agent = active ? AGENT_MAP.find(a => a.id === active) : null;
  React.useEffect(() => {
    if (!agent) return;
    const mq = window.matchMedia('(max-width: 1100px)');
    if (!mq.matches) return;
    const prev = document.body.style.overflow;
    document.body.style.overflow = 'hidden';
    const onKey = (e) => { if (e.key === 'Escape') setActive(null); };
    window.addEventListener('keydown', onKey);
    return () => { document.body.style.overflow = prev; window.removeEventListener('keydown', onKey); };
  }, [agent]);
  return (
    <HkSection id="agents" bg="var(--hk-ink-1000)">
      <style>{`
        #hk-root .hk-om-header { max-width: 820px; margin: 0 auto 56px; text-align: center; }
        #hk-root .hk-om-title { font-family: var(--hk-font-display); font-weight: 700; font-size: clamp(36px, 4.6vw, 58px); letter-spacing: -0.03em; line-height: 1.02; color: var(--hk-fg-1); margin: 18px 0 18px; text-wrap: balance; }
        #hk-root .hk-om-sub { color: var(--hk-fg-3); font-size: 17px; line-height: 1.55; margin: 0; }
        #hk-root .hk-om-grid { position: relative; display: grid; grid-template-columns: 1fr; gap: 24px; }
        #hk-root .hk-om-grid.has-open { grid-template-columns: 1fr 380px; }
        @media (max-width: 1100px) { #hk-root .hk-om-grid.has-open { grid-template-columns: 1fr; } }
        #hk-root .hk-om-backdrop { display: none; }
        @media (max-width: 1100px) { #hk-root .hk-om-backdrop { display: block; position: fixed; inset: 0; z-index: 120; background: rgba(3,8,6,0.78); backdrop-filter: blur(12px); } }
        #hk-root .hk-om-chart { position: relative; background: radial-gradient(ellipse at 50% 0%, rgba(16,185,129,0.14) 0%, transparent 60%), #07140E; border: 1px solid var(--hk-ink-700); border-radius: 24px; padding: 48px 28px 56px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); overflow: hidden; }
        #hk-root .hk-om-chart-title { text-align: center; font-family: var(--hk-font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; color: var(--hk-fg-1); margin: 0 0 6px; }
        #hk-root .hk-om-chart-sub { text-align: center; color: var(--hk-fg-3); font-size: 13px; margin: 0 0 36px; }
        #hk-root .hk-om-chart-sub b { color: var(--hk-fg-1); font-weight: 600; }
        #hk-root .hk-om-coo-wrap { display: flex; justify-content: center; }
        #hk-root .hk-om-team { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; margin-top: 60px; }
        @media (max-width: 1280px) { #hk-root .hk-om-team { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
        @media (max-width: 720px)  { #hk-root .hk-om-team { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
        #hk-root .hk-om-card { background: #0C1A14; border: 1px solid var(--hk-ink-700); border-radius: 14px; padding: 14px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; transition: all 260ms cubic-bezier(0.16,1,0.3,1); min-height: 124px; }
        #hk-root .hk-om-card:hover { transform: translateY(-3px); border-color: rgba(16,185,129,0.55); background: #0D241B; box-shadow: 0 0 0 1px rgba(16,185,129,0.2), 0 18px 40px -18px rgba(0,0,0,0.7); }
        #hk-root .hk-om-card.is-active { border-color: rgba(52,211,153,0.9); background: rgba(16,185,129,0.12); box-shadow: 0 0 28px rgba(16,185,129,0.35); }
        #hk-root .hk-om-card.is-vault { padding: 22px 20px; min-width: 220px; max-width: 260px; }
        #hk-root .hk-om-card-name { color: var(--hk-fg-1); font-family: var(--hk-font-display); font-weight: 700; font-size: 12px; letter-spacing: -0.01em; line-height: 1.2; text-wrap: balance; }
        #hk-root .hk-om-card.is-vault .hk-om-card-name { font-size: 18px; }
        #hk-root .hk-om-card-model { font-family: var(--hk-font-mono); font-size: 9px; letter-spacing: 0.04em; color: var(--hk-grn-300); }
        #hk-root .hk-om-card.is-vault .hk-om-card-role { color: var(--hk-fg-3); font-size: 11px; margin-top: 2px; letter-spacing: 0.04em; text-transform: uppercase; font-family: var(--hk-font-mono); }
        #hk-root .hk-om-inspector { position: sticky; top: 96px; align-self: start; background: linear-gradient(180deg, rgba(18,38,32,0.92), rgba(10,24,18,0.95)); border: 1px solid rgba(16,185,129,0.28); border-radius: 20px; padding: 24px; box-shadow: var(--hk-glow-soft); max-height: calc(100vh - 120px); overflow-y: auto; }
        @media (max-width: 1100px) { #hk-root .hk-om-inspector { position: fixed !important; top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); width: calc(100vw - 24px) !important; max-width: 440px !important; max-height: calc(100vh - 32px) !important; z-index: 121; } }
        #hk-root .hk-om-ins-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
        #hk-root .hk-om-ins-eyebrow { font-family: var(--hk-font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--hk-grn-300); font-weight: 600; }
        #hk-root .hk-om-ins-close { width: 30px; height: 30px; border-radius: 8px; background: transparent; border: 1px solid var(--hk-ink-700); color: var(--hk-fg-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
        #hk-root .hk-om-ins-close:hover { border-color: var(--hk-grn-400); color: var(--hk-fg-1); background: rgba(16,185,129,0.12); }
        #hk-root .hk-om-ins-name { text-align: center; font-family: var(--hk-font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; color: var(--hk-fg-1); margin: 20px 0 4px; }
        #hk-root .hk-om-ins-model { text-align: center; font-family: var(--hk-font-mono); font-size: 11px; color: var(--hk-grn-300); margin: 0 0 22px; }
        #hk-root .hk-om-ins-section { margin-top: 18px; }
        #hk-root .hk-om-ins-label { font-family: var(--hk-font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--hk-grn-300); font-weight: 600; margin-bottom: 10px; }
        #hk-root .hk-om-ins-body { color: var(--hk-fg-2); font-size: 14px; line-height: 1.55; margin: 0; }
        #hk-root .hk-om-ins-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
        #hk-root .hk-om-ins-list li { padding: 9px 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--hk-ink-700); border-radius: 10px; color: var(--hk-fg-2); font-size: 13px; line-height: 1.35; }
        #hk-root .hk-om-ins-metrics { display: flex; flex-direction: column; gap: 8px; }
        #hk-root .hk-om-ins-metric { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: rgba(255,255,255,0.03); border: 1px solid var(--hk-ink-700); border-radius: 10px; }
        #hk-root .hk-om-ins-metric-label { color: var(--hk-fg-3); font-size: 12px; }
        #hk-root .hk-om-ins-metric-value { font-family: var(--hk-font-mono); color: var(--hk-grn-200); font-weight: 600; font-size: 13px; }
        #hk-root .hk-om-ins-metric.is-saving .hk-om-ins-metric-value { color: var(--hk-accent-lime); }
      `}</style>
      <div className="hk-om-header">
        <HkEyebrow>Your custom savings team</HkEyebrow>
        <h2 className="hk-om-title">We deploy the full stack <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>end to end</span>.</h2>
        <p className="hk-om-sub">Click any agent to see what it owns, how it plugs in, and how much it saves.</p>
      </div>
      <div className={`hk-om-grid ${agent ? 'has-open' : ''}`}>
        <div className="hk-om-chart">
          <h3 className="hk-om-chart-title">Your custom $100K savings stack</h3>
          <p className="hk-om-chart-sub">Built against your books, deployed in your tools. <b>Click any agent</b> to see what it does and how much it pulls back per year.</p>
          <div className="hk-om-coo-wrap">
            <div className={`hk-om-card is-vault ${active === vault.id ? 'is-active' : ''}`} onClick={() => setActive(active === vault.id ? null : vault.id)} role="button" tabIndex={0}>
              <AgentAvatar agent={vault} size={72} radius={20}/>
              <div className="hk-om-card-name">{vault.name}</div>
              <div className="hk-om-card-role">{vault.role}</div>
            </div>
          </div>
          <div className="hk-om-team">
            {team.map((a) => (
              <div key={a.id} className={`hk-om-card ${active === a.id ? 'is-active' : ''}`} onClick={() => setActive(active === a.id ? null : a.id)} role="button" tabIndex={0}>
                <AgentAvatar agent={a} size={52} radius={14}/>
                <div className="hk-om-card-name">{a.name}</div>
                <div className="hk-om-card-model">{a.model}</div>
              </div>
            ))}
          </div>
        </div>
        {agent && <div className="hk-om-backdrop" onClick={() => setActive(null)} aria-hidden="true"/>}
        {agent && (
          <aside className="hk-om-inspector" key={agent.id} role="dialog" aria-modal="true">
            <div className="hk-om-ins-head">
              <span className="hk-om-ins-eyebrow">Agent inspector</span>
              <button className="hk-om-ins-close" onClick={() => setActive(null)} aria-label="Close">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><path d="M18 6L6 18M6 6l12 12"/></svg>
              </button>
            </div>
            <div style={{ display: 'flex', justifyContent: 'center', margin: '14px 0 4px' }}>
              <AgentAvatar agent={agent} size={72} radius={20}/>
            </div>
            <h4 className="hk-om-ins-name">{agent.name}</h4>
            <div className="hk-om-ins-model">Powered by {agent.model}</div>
            <div className="hk-om-ins-section">
              <div className="hk-om-ins-label">What this agent does</div>
              <p className="hk-om-ins-body">{agent.summary}</p>
            </div>
            <div className="hk-om-ins-section">
              <div className="hk-om-ins-label">Key responsibilities</div>
              <ul className="hk-om-ins-list">{agent.responsibilities.map((r, i) => <li key={i}>{r}</li>)}</ul>
            </div>
            <div className="hk-om-ins-section">
              <div className="hk-om-ins-label">Performance metrics</div>
              <div className="hk-om-ins-metrics">
                <div className="hk-om-ins-metric is-saving"><span className="hk-om-ins-metric-label">Savings produced</span><span className="hk-om-ins-metric-value">{agent.metrics.time}</span></div>
                <div className="hk-om-ins-metric"><span className="hk-om-ins-metric-label">Setup time</span><span className="hk-om-ins-metric-value">{agent.metrics.setup}</span></div>
                <div className="hk-om-ins-metric"><span className="hk-om-ins-metric-label">Operating cost</span><span className="hk-om-ins-metric-value">{agent.metrics.cost}</span></div>
              </div>
            </div>
            <div className="hk-om-ins-section">
              <div className="hk-om-ins-label">Availability</div>
              <p className="hk-om-ins-body">{agent.availability}</p>
            </div>
          </aside>
        )}
      </div>
    </HkSection>
  );
};

// ===== GuaranteeBlock =====
const GuaranteeBlock = () => (
  <HkSection id="guarantee" bg="var(--hk-ink-950)">
    <div style={{ background: 'linear-gradient(135deg, rgba(16,185,129,0.10), rgba(16,185,129,0.015))', border: '1px solid rgba(16,185,129,0.28)', borderRadius: 32, padding: 'clamp(40px, 5vw, 64px) clamp(24px, 4vw, 56px)', boxShadow: 'var(--hk-glow-soft), inset 0 1px 0 rgba(255,255,255,0.06)', position: 'relative', overflow: 'hidden', textAlign: 'center' }}>
      <div style={{ position: 'absolute', top: -100, left: '50%', transform: 'translateX(-50%)', width: 640, height: 260, background: 'radial-gradient(ellipse at center, rgba(16,185,129,0.25), transparent 65%)', pointerEvents: 'none' }}/>
      <div style={{ position: 'relative', zIndex: 2, maxWidth: 820, margin: '0 auto' }}>
        <div style={{ marginBottom: 24 }}><HkBadge tone="grn" dot>The guarantee</HkBadge></div>
        <h2 style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(38px, 5vw, 68px)', letterSpacing: '-0.035em', lineHeight: 1.02, color: 'var(--hk-fg-1)', margin: '0 0 22px', textWrap: 'balance' }}>
          If we do not save you <span style={{ color: 'var(--hk-grn-300)', fontFamily: 'var(--hk-font-display)', fontWeight: 700 }}>$100,000 / year</span>, you do not pay.
        </h2>
        <p style={{ color: 'var(--hk-fg-2)', fontSize: 17, lineHeight: 1.55, margin: '0 auto 36px', maxWidth: 660 }}>
          Baseline P&L signed in week one. Every savings line documented against that baseline. At month twelve we run the math against the signed number. If we miss the floor, your fees are refunded in full inside thirty days. No make-goods, no re-engagements, no fine print.
        </p>
        <HkButton size="lg" variant="primary" onClick={() => document.getElementById('apply')?.scrollIntoView({ behavior: 'smooth', block: 'start' })}>
          Lock in the guarantee <HkArrow/>
        </HkButton>
      </div>
    </div>
  </HkSection>
);

// ===== FAQ =====
const FAQ = () => {
  const qs = [
    { q: 'When does the first savings line land?', a: 'The audit takes seven days. The first documented savings line — usually a killed sub or a fully replaced workflow — lands inside the first thirty days of the build. The full $100K floor is structured to hit between month eight and month eleven, with buffer baked in.' },
    { q: 'How is "$100K saved" actually measured?', a: 'In week one we sit with you (and your accountant if you want) and document a baseline P&L for the trailing twelve months: payroll, software, ads, ops costs, recurring vendors. That number is signed. Every savings line we deliver after that gets logged against that baseline. At month twelve, we run the math. Short of $100K, you get refunded.' },
    { q: 'What if I do not want to fire anyone?', a: 'You do not have to. Savings can come from killed software, cheaper ad waste, faster AR, reduced overtime, renegotiated vendors, or repurposed roles (the coordinator who was doing inbox triage now runs the agent layer). Most clients hit the $100K floor without a single layoff.' },
    { q: 'What does this cost?', a: 'Setup fee covers the audit and the build (two installments). Monthly retainer covers the agent operations layer. Total year-one cost runs $36K to $72K depending on stack complexity. If we miss the floor, you get all of it back. Worst case, you ran a free audit on your business.' },
    { q: 'What if my data is sensitive?', a: 'It stays in your systems. We do not host your data and we do not train on it. Every agent action is logged in an audit trail you own. SOC 2-aligned controls are the default. If you need a BAA or stricter contractual terms, we sign them.' },
    { q: 'What size business is this for?', a: 'Most clients run between $1M and $50M in annual revenue with a team of five to eighty people. Under $1M the leverage is usually not there yet. Over $50M the engagement looks different — talk to us.' },
  ];
  const [open, setOpen] = React.useState(0);
  return (
    <HkSection id="faq" bg="var(--hk-ink-950)">
      <div className="hk-faq-grid">
        <div>
          <HkEyebrow>FAQ</HkEyebrow>
          <h2 style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(32px, 3.4vw, 44px)', letterSpacing: '-0.03em', lineHeight: 1.05, color: 'var(--hk-fg-1)', margin: '16px 0 24px', textWrap: 'balance' }}>
            Common questions,<br/>straight answers.
          </h2>
          <p style={{ color: 'var(--hk-fg-3)', fontSize: 15, lineHeight: 1.55 }}>
            Still stuck? Book a 15-minute call with our team. If we cannot save you the $100K, we will tell you on the call.
          </p>
        </div>
        <div>
          {qs.map((it, i) => (
            <div key={i} className="hk-faq-row" style={{ borderTop: '1px solid var(--hk-ink-800)', padding: '22px 0' }}>
              <button onClick={() => setOpen(open === i ? -1 : i)} className="hk-faq-btn" style={{ width: '100%', background: 'transparent', border: 0, padding: 0, cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 20, textAlign: 'left' }}>
                <span className="hk-faq-q" style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 600, fontSize: 20, color: 'var(--hk-fg-1)', letterSpacing: '-0.01em' }}>{it.q}</span>
                <span className="hk-faq-plus" style={{ width: 32, height: 32, borderRadius: '50%', border: '1px solid var(--hk-ink-600)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: 'var(--hk-grn-400)', transform: open === i ? 'rotate(45deg)' : 'none', flexShrink: 0 }}>
                  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><path d="M12 5v14M5 12h14"/></svg>
                </span>
              </button>
              <div style={{ maxHeight: open === i ? 240 : 0, overflow: 'hidden', transition: 'max-height 320ms cubic-bezier(0.16,1,0.3,1), margin-top 320ms', marginTop: open === i ? 14 : 0 }}>
                <p style={{ color: 'var(--hk-fg-3)', fontSize: 15, lineHeight: 1.6, margin: 0, maxWidth: 720 }}>{it.a}</p>
              </div>
            </div>
          ))}
          <div style={{ borderTop: '1px solid var(--hk-ink-800)' }}/>
        </div>
      </div>
      <style>{`
        #hk-root .hk-faq-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 72px; }
        @media (max-width: 900px) { #hk-root .hk-faq-grid { grid-template-columns: 1fr; gap: 40px; } }
        #hk-root .hk-faq-btn:hover .hk-faq-q { color: var(--hk-grn-200); }
        #hk-root .hk-faq-btn:hover .hk-faq-plus { border-color: var(--hk-grn-400); background: rgba(16,185,129,0.12); }
        #hk-root .hk-faq-q, #hk-root .hk-faq-plus { transition: all 200ms ease; }
      `}</style>
    </HkSection>
  );
};

// ===== ApplyFunnel =====
const APPLY_STEPS = [
  { id: 'website',    type: 'url',      label: 'What is the business URL?', sub: 'So our team can read your stack before the audit call.', placeholder: 'https://yourcompany.com' },
  { id: 'revenue',    type: 'radio',    label: 'What is your monthly revenue?', sub: 'Helps us scope the leak before we walk your books.', options: ['Under $100K', '$100K to $250K', '$250K to $500K', '$500K to $1M', '$1M to $3M', '$3M+'] },
  { id: 'bottleneck', type: 'textarea', label: 'Where do you already see the leak?', sub: 'Two or three sentences. Be specific — this is what we attack first.', placeholder: 'e.g. We have eleven SaaS subscriptions nobody owns, our ad spend has no tracking, and the AR clerk is months behind...' },
  { id: 'contact',    type: 'contact',  label: 'Where should we send the audit?', sub: 'Last step. We will text and email confirmation as soon as your audit is booked.' },
];

const ApplyFunnel = ({ hidden }) => {
  const [step, setStep] = React.useState(0);
  const [data, setData] = React.useState({ website: '', revenue: '', bottleneck: '', name: '', email: '', phone: '' });
  const [submitting, setSubmitting] = React.useState(false);
  const [submitted, setSubmitted] = React.useState(false);
  const [error, setError] = React.useState(null);
  const current = APPLY_STEPS[step];
  const total = APPLY_STEPS.length;
  const isLast = step === total - 1;
  const progress = ((step + (submitted ? 1 : 0)) / total) * 100;
  const stepValid = () => {
    if (current.type === 'url') {
      const v = (data.website || '').trim();
      // Accept "domain.tld", "www.domain.tld", "https://domain.tld", etc.
      return /^(https?:\/\/)?([a-z0-9-]+\.)+[a-z]{2,}(\/.*)?$/i.test(v);
    }
    if (current.type === 'radio')    return !!data[current.id];
    if (current.type === 'textarea') return data[current.id] && data[current.id].trim().length >= 8;
    if (current.type === 'contact')  return data.name.trim().length >= 2 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data.email) && data.phone.trim().length >= 7;
    return true;
  };
  const next = (e) => {
    if (e) e.preventDefault();
    if (!stepValid()) return;
    if (isLast) { handleSubmit(); return; }
    setStep(step + 1);
  };
  const back = () => { if (step > 0) setStep(step - 1); };
  const handleSubmit = async () => {
    setSubmitting(true); setError(null);
    const normalizedWebsite = /^https?:\/\//i.test(data.website) ? data.website : `https://${data.website}`;
    const payload = { ...data, website: normalizedWebsite, ...(hidden || {}), source: typeof window !== 'undefined' ? window.location.hostname : '', submitted_at: new Date().toISOString() };
    try {
      if (APPLY_WEBHOOK_URL) {
        const res = await fetch(APPLY_WEBHOOK_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) });
        if (!res.ok) throw new Error('Submit failed (' + res.status + ')');
      } else {
        console.log('[100kSaved demo] submission (not stored):', payload);
        await new Promise(r => setTimeout(r, 500));
      }
      setSubmitted(true);
      if (APPLY_REDIRECT_URL) {
        const params = new URLSearchParams({ name: data.name, email: data.email, phone: data.phone, website: normalizedWebsite });
        setTimeout(() => { window.location.href = APPLY_REDIRECT_URL + '?' + params.toString(); }, 1200);
      }
    } catch (err) {
      setError(err.message || 'Something went wrong. Try again or email hello@100ksaved.com.');
    } finally {
      setSubmitting(false);
    }
  };
  React.useEffect(() => {
    const onKey = (e) => {
      if (e.key === 'Enter' && current.type !== 'textarea' && !submitted) { next(); }
      if (e.key === 'Enter' && current.type === 'textarea' && (e.metaKey || e.ctrlKey)) { next(); }
    };
    window.addEventListener('keydown', onKey);
    return () => window.removeEventListener('keydown', onKey);
  }, [step, data, submitted]);
  const inputBase = { width: '100%', background: 'rgba(3,8,6,0.7)', border: '1px solid var(--hk-ink-700)', borderRadius: 14, padding: '18px 20px', color: 'var(--hk-fg-1)', fontSize: 18, fontFamily: 'var(--hk-font-body)', outline: 'none', transition: 'all 180ms' };
  if (submitted) {
    return (
      <div style={{ padding: 'clamp(40px, 6vw, 80px) clamp(24px, 4vw, 44px)', textAlign: 'center', minHeight: 560, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
        <div style={{ width: 72, height: 72, borderRadius: '50%', background: 'linear-gradient(135deg, rgba(245,177,73,0.18), rgba(245,177,73,0.04))', border: '1px solid rgba(245,177,73,0.4)', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', marginBottom: 24, boxShadow: '0 0 32px rgba(245,177,73,0.25)' }}>
          <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="var(--hk-accent-amber)" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 8v5"/><circle cx="12" cy="16.5" r="1" fill="var(--hk-accent-amber)"/></svg>
        </div>
        <div style={{ fontFamily: 'var(--hk-font-mono)', fontSize: 10, letterSpacing: '0.18em', textTransform: 'uppercase', color: 'var(--hk-accent-amber)', fontWeight: 700, marginBottom: 16 }}>Demo site</div>
        <h3 style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(26px, 3vw, 38px)', color: 'var(--hk-fg-1)', margin: '0 0 16px', letterSpacing: '-0.02em', textWrap: 'balance', maxWidth: 540 }}>
          This is a test website. Nothing was sent.
        </h3>
        <p style={{ color: 'var(--hk-fg-2)', fontSize: 16, lineHeight: 1.6, maxWidth: 520, margin: '0 0 22px' }}>
          Your submission was not stored, no team is reviewing it, and no one will reach out. 100kSaved is a structural prototype — the offer copy, agents, and guarantee are illustrative, not an active service.
        </p>
        <p style={{ color: 'var(--hk-fg-3)', fontSize: 14, lineHeight: 1.55, maxWidth: 520, margin: 0 }}>
          Built as a single-file React app to demonstrate a high-ticket-services landing pattern. No backend, no CRM, no email triggers.
        </p>
      </div>
    );
  }
  return (
    <div className="hk-funnel" style={{ padding: 'clamp(28px, 4vw, 44px)', minHeight: 560, display: 'flex', flexDirection: 'column' }}>
      <style>{`
        #hk-root .hk-funnel input:focus, #hk-root .hk-funnel textarea:focus { border-color: var(--hk-grn-400) !important; box-shadow: 0 0 0 4px rgba(16,185,129,0.16) !important; background: rgba(3,8,6,0.9) !important; }
        #hk-root .hk-funnel input::placeholder, #hk-root .hk-funnel textarea::placeholder { color: var(--hk-fg-4); }
        #hk-root .hk-funnel-radio { display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: rgba(3,8,6,0.5); border: 1px solid var(--hk-ink-700); border-radius: 14px; cursor: pointer; transition: all 200ms cubic-bezier(0.16,1,0.3,1); }
        #hk-root .hk-funnel-radio:hover { border-color: rgba(16,185,129,0.5); background: rgba(16,185,129,0.06); transform: translateY(-1px); }
        #hk-root .hk-funnel-radio.is-checked { border-color: var(--hk-grn-400); background: linear-gradient(135deg, rgba(16,185,129,0.14), rgba(4,120,87,0.04)); box-shadow: 0 0 0 1px rgba(16,185,129,0.3), 0 0 24px rgba(16,185,129,0.18); }
        #hk-root .hk-funnel-radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--hk-ink-600); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; transition: all 200ms; }
        #hk-root .hk-funnel-radio.is-checked .hk-funnel-radio-dot { border-color: var(--hk-grn-400); background: var(--hk-grn-500); box-shadow: 0 0 12px rgba(16,185,129,0.5); }
        #hk-root .hk-funnel-radio.is-checked .hk-funnel-radio-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
        #hk-root .hk-funnel-radio-label { color: var(--hk-fg-1); font-size: 16px; font-weight: 500; }
        #hk-root .hk-funnel-fade { animation: hkFunnelFade 360ms cubic-bezier(0.16,1,0.3,1) both; }
        @keyframes hkFunnelFade { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
        #hk-root .hk-funnel-bar { height: 4px; background: var(--hk-ink-800); border-radius: 999px; overflow: hidden; }
        #hk-root .hk-funnel-bar-fill { height: 100%; background: linear-gradient(90deg, var(--hk-grn-500), var(--hk-grn-300)); border-radius: 999px; transition: width 360ms cubic-bezier(0.16,1,0.3,1); box-shadow: 0 0 12px rgba(16,185,129,0.5); }
      `}</style>
      <div style={{ marginBottom: 22 }}>
        <div className="hk-funnel-bar"><div className="hk-funnel-bar-fill" style={{ width: progress + '%' }}/></div>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginTop: 10 }}>
          <span style={{ fontFamily: 'var(--hk-font-mono)', fontSize: 11, letterSpacing: '0.14em', textTransform: 'uppercase', color: 'var(--hk-grn-300)', fontWeight: 600 }}>Question {step + 1} of {total}</span>
          {step > 0 && (
            <button onClick={back} type="button" style={{ background: 'transparent', border: 0, color: 'var(--hk-fg-3)', fontFamily: 'var(--hk-font-body)', fontSize: 12, cursor: 'pointer', display: 'inline-flex', alignItems: 'center', gap: 4, padding: 0 }}>
              <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><path d="M19 12H5M11 6l-6 6 6 6"/></svg>
              Back
            </button>
          )}
        </div>
      </div>
      <form key={current.id} className="hk-funnel-fade" onSubmit={next} style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
        <h3 style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(22px, 2.6vw, 32px)', letterSpacing: '-0.022em', lineHeight: 1.18, color: 'var(--hk-fg-1)', margin: '0 0 10px', textWrap: 'balance' }}>{current.label}</h3>
        <p style={{ color: 'var(--hk-fg-3)', fontSize: 15, lineHeight: 1.55, margin: '0 0 24px', maxWidth: 580 }}>{current.sub}</p>
        <div style={{ flex: 1 }}>
          {current.type === 'url' && (
            <input autoFocus type="url" inputMode="url" value={data.website} placeholder={current.placeholder}
              onChange={(e) => setData({ ...data, website: e.target.value })} style={inputBase}/>
          )}
          {current.type === 'textarea' && (
            <textarea autoFocus value={data[current.id]} placeholder={current.placeholder}
              onChange={(e) => setData({ ...data, [current.id]: e.target.value })}
              style={{ ...inputBase, minHeight: 160, resize: 'vertical', fontSize: 16, lineHeight: 1.55 }}/>
          )}
          {current.type === 'radio' && (
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 10 }}>
              {current.options.map(opt => (
                <div key={opt} className={`hk-funnel-radio ${data[current.id] === opt ? 'is-checked' : ''}`}
                  onClick={() => { setData({ ...data, [current.id]: opt }); setTimeout(next, 280); }}
                  role="button" tabIndex={0}>
                  <span className="hk-funnel-radio-dot" aria-hidden="true"/>
                  <span className="hk-funnel-radio-label">{opt}</span>
                </div>
              ))}
            </div>
          )}
          {current.type === 'contact' && (
            <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
              <input autoFocus type="text" placeholder="Full name" value={data.name}
                onChange={(e) => setData({ ...data, name: e.target.value })} style={inputBase}/>
              <input type="email" inputMode="email" placeholder="Email" value={data.email}
                onChange={(e) => setData({ ...data, email: e.target.value })} style={inputBase}/>
              <input type="tel" inputMode="tel" placeholder="Phone (include country code)" value={data.phone}
                onChange={(e) => setData({ ...data, phone: e.target.value })} style={inputBase}/>
            </div>
          )}
        </div>
        {error && <div style={{ marginTop: 16, padding: '12px 16px', background: 'rgba(233,61,61,0.08)', border: '1px solid rgba(233,61,61,0.35)', borderRadius: 10, color: '#FF9B9B', fontSize: 13 }}>{error}</div>}
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12, marginTop: 28, paddingTop: 20, borderTop: '1px solid var(--hk-ink-800)' }}>
          <span style={{ fontFamily: 'var(--hk-font-mono)', fontSize: 11, color: 'var(--hk-fg-4)', letterSpacing: '0.06em' }}>
            {current.type === 'textarea' ? 'cmd + Enter to continue' : current.type === 'radio' ? '' : 'Press Enter'}
          </span>
          <HkButton size="lg" variant="primary" type="submit" disabled={!stepValid() || submitting} style={!stepValid() || submitting ? { opacity: 0.5, cursor: 'not-allowed' } : {}}>
            {submitting ? 'Submitting…' : isLast ? 'Submit application' : 'Continue'}
            {!submitting && <HkArrow/>}
          </HkButton>
        </div>
      </form>
    </div>
  );
};

// ===== VslAndApply =====
const VslAndApply = () => (
  <section id="apply" style={{ padding: 'clamp(56px, 7vw, 88px) 20px clamp(64px, 8vw, 96px)', background: 'var(--hk-ink-950)', position: 'relative' }}>
    <div style={{ position: 'absolute', inset: 0, background: 'var(--hk-grad-hero)', pointerEvents: 'none' }}/>
    <div style={{ maxWidth: 880, margin: '0 auto', position: 'relative', zIndex: 2 }}>
      <div style={{ textAlign: 'center', marginBottom: 28 }}>
        <HkEyebrow>Apply</HkEyebrow>
        <h3 style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(28px, 3vw, 44px)', letterSpacing: '-0.025em', lineHeight: 1.08, color: 'var(--hk-fg-1)', margin: '14px 0 10px' }}>
          Get your $100K savings audit.
        </h3>
        <p style={{ color: 'var(--hk-fg-3)', fontSize: 15, margin: 0 }}>
          Four quick questions. If we are a fit, we will book the audit call inside 24 hours.
        </p>
      </div>
      <div style={{ background: 'linear-gradient(180deg, rgba(18,38,32,0.9), rgba(10,24,18,0.9))', border: '1px solid var(--hk-ink-700)', borderRadius: 24, padding: 4, boxShadow: 'var(--hk-glow-soft), inset 0 1px 0 rgba(255,255,255,0.06)', overflow: 'hidden' }}>
        <ApplyFunnel/>
      </div>
    </div>
  </section>
);

// ===== YouTubeSection (placeholder until VSLs recorded) =====
const YOUTUBE_VIDEOS = [
  { id: 'PLACEHOLDER_1', t: '0', title: 'Live audit: where the $100K hides', blurb: 'A real $4M services business opens their books. We map every line that can be cut, ranked by speed-to-savings.', tag: 'Audit' },
  { id: 'PLACEHOLDER_2', t: '0', title: 'How the agents get wired in', blurb: 'Walkthrough of the first thirty days of a build. Which agents go first, and which savings show up before the build is even finished.', tag: 'Build' },
  { id: 'PLACEHOLDER_3', t: '0', title: 'Twelve months in: the savings curve', blurb: 'Line-by-line breakdown of where the $100K landed in a real engagement. Subscriptions, ad waste, payroll, vendor renegs — itemized.', tag: 'Results' },
];

const YouTubeSection = () => (
  <HkSection bg="var(--hk-ink-1000)">
    <style>{`
      #hk-root .hk-yt-head { max-width: 820px; margin: 0 auto 48px; text-align: center; }
      #hk-root .hk-yt-title { font-family: var(--hk-font-display); font-weight: 700; font-size: clamp(32px, 4vw, 52px); letter-spacing: -0.03em; line-height: 1.03; color: var(--hk-fg-1); margin: 18px 0 16px; text-wrap: balance; }
      #hk-root .hk-yt-sub { color: var(--hk-fg-3); font-size: 15px; line-height: 1.55; margin: 0 0 10px; }
      #hk-root .hk-yt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
      @media (max-width: 980px) { #hk-root .hk-yt-grid { grid-template-columns: 1fr; max-width: 640px; margin: 0 auto; } }
      #hk-root .hk-yt-card { background: var(--hk-ink-900); border: 1px solid var(--hk-ink-700); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; transition: all 300ms cubic-bezier(0.16,1,0.3,1); }
      #hk-root .hk-yt-card:hover { transform: translateY(-3px); border-color: rgba(16,185,129,0.45); box-shadow: 0 22px 48px -20px rgba(0,0,0,0.6); }
      #hk-root .hk-yt-thumb { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #0F1B14, #1A2E22); overflow: hidden; display: grid; place-items: center; }
      #hk-root .hk-yt-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 999px; background: rgba(16,185,129,0.92); display: flex; align-items: center; justify-content: center; box-shadow: 0 12px 32px -6px rgba(16,185,129,0.55); z-index: 2; }
      #hk-root .hk-yt-tag { position: absolute; top: 12px; left: 12px; z-index: 2; padding: 5px 10px; border-radius: 999px; background: rgba(5,16,11,0.7); border: 1px solid rgba(255,255,255,0.1); color: var(--hk-fg-1); font-family: var(--hk-font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; }
      #hk-root .hk-yt-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
      #hk-root .hk-yt-card-title { font-family: var(--hk-font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; line-height: 1.2; color: var(--hk-fg-1); margin: 0; }
      #hk-root .hk-yt-blurb { color: var(--hk-fg-3); font-size: 13.5px; line-height: 1.5; margin: 0; flex: 1; }
      #hk-root .hk-yt-meta { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--hk-ink-700); color: var(--hk-fg-4); font-size: 12px; }
    `}</style>
    <div className="hk-yt-head">
      <HkEyebrow>From the founder</HkEyebrow>
      <h2 className="hk-yt-title">
        Watch real businesses get <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>audited line by line</span>.
      </h2>
      <p className="hk-yt-sub">Real P&Ls. Real cuts. Real numbers. Recordings coming soon.</p>
    </div>
    <div className="hk-yt-grid">
      {YOUTUBE_VIDEOS.map(v => (
        <div key={v.id} className="hk-yt-card">
          <div className="hk-yt-thumb">
            <span className="hk-yt-tag">{v.tag}</span>
            <div className="hk-yt-play" aria-hidden="true">
              <svg width="22" height="22" viewBox="0 0 24 24" fill="#030806"><path d="M8 5v14l11-7z"/></svg>
            </div>
          </div>
          <div className="hk-yt-body">
            <h3 className="hk-yt-card-title">{v.title}</h3>
            <p className="hk-yt-blurb">{v.blurb}</p>
            <div className="hk-yt-meta">
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 6 }}>Coming soon</span>
              <span style={{ fontFamily: 'var(--hk-font-mono)', color: 'var(--hk-fg-4)' }}>id: {v.id}</span>
            </div>
          </div>
        </div>
      ))}
    </div>
  </HkSection>
);

// ===== FinalCTA + Footer =====
// One continuous emerald gradient flows from the bottom of FinalCTA, through the
// section, and bleeds into the footer — no visible seam, no horizontal crop.
const FinalCTA = () => (
  <section style={{ padding: 'clamp(96px, 10vw, 140px) 20px clamp(80px, 9vw, 120px)', background: 'var(--hk-ink-1000)', position: 'relative', overflow: 'hidden' }}>
    <div aria-hidden="true" style={{
      position: 'absolute',
      left: 0, right: 0, bottom: 0,
      height: '95%',
      background: 'radial-gradient(ellipse 90% 100% at 50% 110%, rgba(16,185,129,0.45) 0%, rgba(16,185,129,0.26) 22%, rgba(16,185,129,0.12) 42%, rgba(16,185,129,0.04) 62%, transparent 82%)',
      pointerEvents: 'none',
      zIndex: 1,
    }}/>
    <div style={{ maxWidth: 760, margin: '0 auto', textAlign: 'center', position: 'relative', zIndex: 2 }}>
      <div style={{ marginBottom: 24 }}><HkBadge tone="grn" dot>Engagements opening this quarter</HkBadge></div>
      <h2 style={{ fontFamily: 'var(--hk-font-display)', fontWeight: 700, fontSize: 'clamp(44px, 6vw, 88px)', letterSpacing: '-0.035em', lineHeight: 1, color: 'var(--hk-fg-1)', margin: '0 0 24px' }}>
        Find your <span className="hk-serif" style={{ color: 'var(--hk-grn-300)' }}>$100,000</span> in sixty minutes.
      </h2>
      <p style={{ color: 'var(--hk-fg-3)', fontSize: 18, margin: '0 0 36px' }}>
        Four questions. A 60-minute working session. If we cannot pull $100K from your P&L, we will tell you on the call.
      </p>
      <div style={{ display: 'flex', gap: 12, justifyContent: 'center', flexWrap: 'wrap' }}>
        <HkButton size="lg" variant="primary" onClick={() => document.getElementById('apply')?.scrollIntoView({ behavior: 'smooth', block: 'start' })}>Book the audit <HkArrow/></HkButton>
        <HkButton size="lg" variant="secondary" onClick={() => (window.location.href = BOOKING_URL)}>Talk to a strategist</HkButton>
      </div>
    </div>
  </section>
);

const Footer = () => (
  <footer style={{ padding: '52px 24px 36px', background: 'var(--hk-ink-1000)', position: 'relative', overflow: 'hidden' }}>
    <div aria-hidden="true" style={{
      position: 'absolute',
      left: 0, right: 0, top: 0, bottom: 0,
      background: 'linear-gradient(180deg, rgba(16,185,129,0.18) 0%, rgba(16,185,129,0.10) 45%, rgba(16,185,129,0.04) 80%, transparent 100%)',
      pointerEvents: 'none',
      zIndex: 1,
    }}/>
    <div style={{ maxWidth: 1240, margin: '0 auto', display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', flexWrap: 'wrap', gap: 24, position: 'relative', zIndex: 2 }}>
      <Wordmark size={26}/>
      <div style={{ fontSize: 11, color: 'var(--hk-fg-4)', maxWidth: 720, lineHeight: 1.5, textAlign: 'right' }}>
        © {new Date().getFullYear()} 100ksaved.com — All Rights Reserved. This site is not affiliated with Meta, Google, or YouTube.
      </div>
    </div>
  </footer>
);

// ===== MainSite =====
const MainSite = () => (
  <React.Fragment>
    <Hero/>
    <ProofStrip/>
    <OfferStack/>
    <AgentMap/>
    <AgentShowcase/>
    <GuaranteeBlock/>
    <FAQ/>
    <VslAndApply/>
    <FinalCTA/>
  </React.Fragment>
);

// ===== App root =====
const App = () => {
  React.useEffect(() => {
    if ('scrollRestoration' in window.history) {
      window.history.scrollRestoration = 'manual';
    }
    window.scrollTo(0, 0);
  }, []);
  return (
    <React.Fragment>
      <HkGlobalStyles/>
      <Nav/>
      <MainSite/>
      <Footer/>
    </React.Fragment>
  );
};

ReactDOM.createRoot(document.getElementById('hk-root')).render(<App/>);
