// Direction A — Editorial Black
// Swiss editorial. Oversized type. Black on off-white with electric blue accent.
const { useState, useEffect, useRef } = React;

const A_BLUE = '#3A6BFF';
const A_INK = '#0a0a0a';
const A_PAPER = '#f5f3ee';
const A_LINE = 'rgba(10,10,10,0.12)';

// ---------- Reusable bits ----------
function ASmallCaps({ children, style }) {
  return <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 12, letterSpacing: '0.16em', textTransform: 'uppercase', ...style }}>{children}</span>;
}

function AMarquee({ items, speed = 40, accent }) {
  const content = (
    <div style={{ display: 'flex', gap: 64, paddingRight: 64, alignItems: 'center', flexShrink: 0 }}>
      {items.map((t, i) => (
        <span key={i} style={{ display: 'flex', alignItems: 'center', gap: 64, fontFamily: 'Inter Tight', fontWeight: 600, fontSize: 96, letterSpacing: '-0.04em', whiteSpace: 'nowrap', color: accent ? A_BLUE : A_INK }}>
          {t}
          <span style={{ width: 18, height: 18, borderRadius: '50%', background: accent ? A_BLUE : A_INK, flexShrink: 0 }}></span>
        </span>
      ))}
    </div>
  );
  return (
    <div style={{ overflow: 'hidden', width: '100%', display: 'flex' }}>
      <div style={{ display: 'flex', animation: `a-marquee ${speed}s linear infinite` }}>
        {content}{content}
      </div>
    </div>
  );
}

// ---------- Sections ----------
function ANav() {
  return (
    <div style={{ position: 'absolute', top: 0, left: 0, right: 0, zIndex: 10, padding: '32px 56px', display: 'flex', alignItems: 'center', justifyContent: 'space-between', mixBlendMode: 'difference', color: '#fff' }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
        <img src="assets/logo.svg" alt="Checkmate" style={{ height: 44, filter: 'invert(1)', display: 'block' }} />
      </div>
      <div style={{ display: 'flex', gap: 40, fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', marginLeft: 80 }}>
        <span><a href="services.html" style={{color:'inherit',textDecoration:'none'}}>Services</a></span><span><a href="process.html" style={{color:'inherit',textDecoration:'none'}}>Process</a></span><span><a href="team.html" style={{color:'inherit',textDecoration:'none'}}>Team</a></span>
      </div>
      <div style={{ display: 'flex', alignItems: 'center', gap: 16, fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase' }}>
        <button onClick={() => document.getElementById('contact')?.scrollIntoView({behavior:'smooth'})} style={{ background: '#fff', color: A_INK, border: 'none', padding: '12px 20px', fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', cursor: 'pointer', borderRadius: 999 }}>Schedule a call →</button>
      </div>
    </div>
  );
}

// 3D rotating KING — real WebGL via Three.js (LatheGeometry + cross finial)
// Tumbles on X and Y like a planet. Crisp at any angle.
function AKnight3D() {
  const mountRef = useRef(null);
  const [hovered, setHovered] = useState(false);
  const hoverRef = useRef(false);
  const targetRef = useRef({ x: 0, y: 0 });

  useEffect(() => {
    const THREE = window.THREE;
    if (!THREE) return;
    const mount = mountRef.current;
    if (!mount) return;

    const W = 420, H = 520;
    const scene = new THREE.Scene();
    const camera = new THREE.PerspectiveCamera(35, W / H, 0.1, 1000);
    camera.position.set(0, 1.0, 9);
    camera.lookAt(0, 0.3, 0);

    const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
    renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
    renderer.setSize(W, H);
    renderer.setClearColor(0x000000, 0);
    mount.appendChild(renderer.domElement);

    // Lights
    scene.add(new THREE.AmbientLight(0xffffff, 0.55));
    const key = new THREE.DirectionalLight(0xffffff, 1.2);
    key.position.set(3, 5, 4); scene.add(key);
    const rim = new THREE.DirectionalLight(0x3A6BFF, 0.7);
    rim.position.set(-4, 2, -3); scene.add(rim);
    const fill = new THREE.DirectionalLight(0xffffff, 0.3);
    fill.position.set(-2, 1, 4); scene.add(fill);

    // King silhouette profile — (x = radius, y = height) points for LatheGeometry
    // Centered around y=0; total height ~3.6 units
    const profile = [
      [0.001, -1.8],
      [0.85, -1.8],
      [0.85, -1.72],
      [0.78, -1.66],
      [0.55, -1.58],
      [0.5, -1.5],
      [0.4, -1.35],
      [0.32, -1.15],
      [0.3, -0.9],
      [0.38, -0.78],
      [0.4, -0.7],
      [0.36, -0.62],
      [0.32, -0.4],
      [0.32, -0.15],
      [0.45, 0.0],
      [0.6, 0.18],
      [0.68, 0.4],
      [0.68, 0.62],
      [0.62, 0.78],
      [0.7, 0.85],
      [0.74, 0.92],
      [0.7, 0.98],
      [0.34, 1.05],
      [0.3, 1.15],
      [0.4, 1.22],
      [0.4, 1.3],
      [0.001, 1.3],
    ];
    const points = profile.map(p => new THREE.Vector2(p[0], p[1]));
    const lathe = new THREE.LatheGeometry(points, 96);
    lathe.computeVertexNormals();

    const mat = new THREE.MeshStandardMaterial({
      color: 0x0a0a0a,
      metalness: 0.35,
      roughness: 0.42,
    });
    const king = new THREE.Mesh(lathe, mat);
    scene.add(king);

    // Cross finial: vertical bar + horizontal bar
    const crossMat = new THREE.MeshStandardMaterial({ color: 0x0a0a0a, metalness: 0.4, roughness: 0.4 });
    const vBar = new THREE.Mesh(new THREE.BoxGeometry(0.16, 0.52, 0.16), crossMat);
    vBar.position.y = 1.55;
    scene.add(vBar);
    const hBar = new THREE.Mesh(new THREE.BoxGeometry(0.42, 0.16, 0.16), crossMat);
    hBar.position.y = 1.62;
    scene.add(hBar);

    // Group everything so we can rotate as one
    const group = new THREE.Group();
    group.add(king); group.add(vBar); group.add(hBar);
    // re-parent
    scene.remove(king); scene.remove(vBar); scene.remove(hBar);
    group.add(king); group.add(vBar); group.add(hBar);
    scene.add(group);

    // Floor shadow plane (subtle)
    const shadowGeo = new THREE.CircleGeometry(1.2, 32);
    const shadowMat = new THREE.MeshBasicMaterial({ color: 0x0a0a0a, transparent: true, opacity: 0.18 });
    const shadow = new THREE.Mesh(shadowGeo, shadowMat);
    shadow.rotation.x = -Math.PI / 2;
    shadow.position.y = -1.81;
    scene.add(shadow);

    // Animate
    let rx = 0, ry = 0;
    const onMove = (e) => {
      const rect = renderer.domElement.getBoundingClientRect();
      const px = (e.clientX - rect.left) / rect.width - 0.5;
      const py = (e.clientY - rect.top) / rect.height - 0.5;
      targetRef.current = { x: py * 1.2, y: px * 2.0 };
    };
    const onEnter = () => { hoverRef.current = true; setHovered(true); };
    const onLeave = () => { hoverRef.current = false; setHovered(false); targetRef.current = { x: 0, y: 0 }; };
    mount.addEventListener('mousemove', onMove);
    mount.addEventListener('mouseenter', onEnter);
    mount.addEventListener('mouseleave', onLeave);

    let raf;
    const clock = new THREE.Clock();
    const tick = () => {
      const dt = clock.getDelta();
      if (hoverRef.current) {
        // Hover: ease toward cursor target on top of slow tumble
        rx += (targetRef.current.x - rx) * 0.08;
        ry += (targetRef.current.y - ry) * 0.08;
        group.rotation.x = rx;
        group.rotation.y += dt * 0.5 + (ry - group.rotation.y) * 0.05;
      } else {
        // Idle: tumble like a planet — both axes drift
        group.rotation.y += dt * 0.6;
        group.rotation.x += dt * 0.18;
        // gently ease back x toward natural cycle if it accumulates
      }
      renderer.render(scene, camera);
      raf = requestAnimationFrame(tick);
    };
    tick();

    return () => {
      cancelAnimationFrame(raf);
      mount.removeEventListener('mousemove', onMove);
      mount.removeEventListener('mouseenter', onEnter);
      mount.removeEventListener('mouseleave', onLeave);
      renderer.dispose();
      lathe.dispose();
      mat.dispose();
      crossMat.dispose();
      if (mount.contains(renderer.domElement)) mount.removeChild(renderer.domElement);
    };
  }, []);

  return (
    <div style={{ width: 420, height: 520, position: 'relative', cursor: 'grab' }}>
      <div ref={mountRef} style={{ width: 420, height: 520 }} />
      <div style={{
        position: 'absolute', bottom: 4, left: '50%', transform: 'translateX(-50%)',
        fontFamily: 'JetBrains Mono', fontSize: 10, letterSpacing: '0.2em', textTransform: 'uppercase',
        color: 'rgba(10,10,10,0.4)', whiteSpace: 'nowrap',
        opacity: hovered ? 0 : 1, transition: 'opacity 0.3s',
      }}>
        ◐ Hover to spin · The King
      </div>
    </div>
  );
}

function AHero() {
  return (
    <section style={{ background: A_PAPER, color: A_INK, padding: '160px 56px 80px', position: 'relative', minHeight: 900, overflow: 'hidden' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 80 }}>
        <ASmallCaps>(001) — Performance marketing, London</ASmallCaps>
      </div>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr auto', gap: 40, alignItems: 'center' }}>
        <h1 style={{ fontFamily: 'Inter Tight', fontWeight: 600, fontSize: 168, lineHeight: 0.92, letterSpacing: '-0.05em', margin: 0, textWrap: 'pretty' }}>
          High-intent,<br/>high-net-worth<br/><span style={{ fontFamily: 'Instrument Serif', fontStyle: 'italic', fontWeight: 400 }}>leads </span>— ready to close.
        </h1>
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
          <AKnight3D />
        </div>
      </div>
      <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', marginTop: 80 }}>
        <div style={{ maxWidth: 520, fontSize: 20, lineHeight: 1.45, color: '#333' }}>
          AI-powered lead generation for alternative investment firms and wealth managers. Performance-built funnels, conversion-first creative, predictable pipeline. <strong style={{ color: A_INK }}>If we don't deliver, you don't pay.</strong>
        </div>
        <div style={{ display: 'flex', gap: 16 }}>
          <button onClick={() => document.getElementById('contact')?.scrollIntoView({behavior:'smooth'})} style={{ background: A_INK, color: '#fff', border: 'none', padding: '20px 28px', fontFamily: 'JetBrains Mono', fontSize: 13, letterSpacing: '0.12em', textTransform: 'uppercase', cursor: 'pointer', borderRadius: 999, display: 'flex', alignItems: 'center', gap: 12 }}>
            Free strategy call · £1,000 value
            <span style={{ width: 8, height: 8, borderRadius: '50%', background: A_BLUE }}></span>
          </button>
          <a href="process.html" style={{ background: 'transparent', color: A_INK, border: `1px solid ${A_INK}`, padding: '20px 28px', fontFamily: 'JetBrains Mono', fontSize: 13, letterSpacing: '0.12em', textTransform: 'uppercase', cursor: 'pointer', borderRadius: 999, textDecoration: 'none' }}>The Process</a>
        </div>
      </div>
    </section>
  );
}

function AStats() {
  const stats = [
    { v: 'No win,', l: 'No fee. Performance-based partnerships only — if we don\u2019t deliver, you don\u2019t pay.' },
    { v: '£1,000', l: 'Strategy call value — yours free, no obligation, no sales pitch.' },
    { v: 'HNW', l: 'High-intent, high-net-worth leads engineered for high-ticket close rates.' },
    { v: 'AI-led', l: 'Data-backed targeting and creative testing built around predictable pipeline.' },
  ];
  return (
    <section style={{ background: A_INK, color: A_PAPER, padding: '120px 56px', position: 'relative' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 80 }}>
        <ASmallCaps style={{ color: A_PAPER }}>(002) — The Checkmate offer</ASmallCaps>
        <ASmallCaps style={{ color: A_PAPER, opacity: 0.5 }}>Performance-built · Risk-free</ASmallCaps>
      </div>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 40, borderTop: `1px solid rgba(245,243,238,0.2)`, paddingTop: 40 }}>
        {stats.map((s, i) => (
          <div key={i} style={{ borderRight: i < 3 ? `1px solid rgba(245,243,238,0.2)` : 'none', paddingRight: 24 }}>
            <div style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 88, letterSpacing: '-0.04em', lineHeight: 1, marginBottom: 24, color: i === 0 ? A_BLUE : A_PAPER }}>{s.v}</div>
            <div style={{ fontSize: 14, color: 'rgba(245,243,238,0.6)', maxWidth: 200 }}>{s.l}</div>
          </div>
        ))}
      </div>
    </section>
  );
}

function AServices() {
  const services = [
    { n: '01', t: 'Meta Ads', d: 'Bespoke Facebook and Instagram campaigns. Audience research, segmentation and creative iteration that turns scrollers into qualified leads.', specs: 'Facebook · Instagram · Reels' },
    { n: '02', t: 'Google Ads', d: 'Search, Display and Performance Max account architecture. Strategic precision placing your spend where intent lives.', specs: 'Search · Display · Pmax' },
    { n: '03', t: 'LinkedIn Ads', d: 'B2B lead generation for capital markets, family offices and wealth advisors. Targeting decision-makers, not job titles.', specs: 'Sponsored · InMail · ABM' },
    { n: '04', t: 'Funnel Builder', d: 'Conversion-engineered funnels and landing systems. Every step instrumented, every drop-off addressed, every lead tracked.', specs: 'Multi-step · CRM · Tracking' },
    { n: '05', t: 'Web Design', d: 'High-performing, mobile-first websites built as your most powerful sales tool. Lightning-fast, scalable, future-proof.', specs: 'Webflow · WordPress · Custom' },
    { n: '06', t: 'SEO', d: 'Strategic organic visibility for high-intent search. Technical, content and authority — engineered to rank and convert.', specs: 'Technical · Content · Local' },
  ];
  return (
    <section style={{ background: A_PAPER, color: A_INK, padding: '160px 56px' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 80 }}>
        <ASmallCaps>(003) — What we do</ASmallCaps>
        <ASmallCaps>Four services. One operating system.</ASmallCaps>
      </div>
      <h2 style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 120, letterSpacing: '-0.04em', lineHeight: 0.95, margin: '0 0 100px', maxWidth: 1100 }}>
        Six services. <span style={{ fontFamily: 'Instrument Serif', fontStyle: 'italic', fontWeight: 400 }}>One </span>operating system.
      </h2>
      <div>
        {services.map((s, i) => (
          <div key={i} style={{ borderTop: `1px solid ${A_LINE}`, padding: '40px 0', display: 'grid', gridTemplateColumns: '80px 1fr 1fr 200px', gap: 40, alignItems: 'baseline', cursor: 'pointer' }}>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 13, color: '#999' }}>{s.n}</div>
            <div style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 56, letterSpacing: '-0.03em', lineHeight: 1 }}>{s.t}</div>
            <div style={{ fontSize: 17, color: '#333', lineHeight: 1.4, maxWidth: 360 }}>{s.d}</div>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 11, letterSpacing: '0.1em', textTransform: 'uppercase', color: '#666', textAlign: 'right' }}>{s.specs}</div>
          </div>
        ))}
        <div style={{ borderTop: `1px solid ${A_LINE}`, borderBottom: `1px solid ${A_LINE}`, padding: '40px 0' }}></div>
      </div>
    </section>
  );
}

function AMarqueeBand() {
  return (
    <section style={{ background: A_INK, color: A_PAPER, padding: '60px 0', overflow: 'hidden' }}>
      <AMarquee items={['No win, no fee', 'High-intent leads', 'No win, no fee', 'High-intent leads']} speed={50} />
    </section>
  );
}

function AWork() {
  const sectors = [
    { n: '01', cat: 'Alternative Investments', client: 'Cask Whisky', metric: 'Maturing single-malt portfolios', sub: 'High-net-worth investors seeking tangible, appreciating spirits assets.', tone: '#3d2818', accent: '#c89a5b' },
    { n: '02', cat: 'Alternative Investments', client: 'Fine Art', metric: 'Blue-chip & emerging markets', sub: 'Curated acquisitions across post-war, contemporary and digital editions.', tone: '#1f1f1f', accent: '#e8e0d0' },
    { n: '03', cat: 'Alternative Investments', client: 'Gold & Bullion', metric: 'Physical and allocated', sub: 'Sovereign-grade hedging products for portfolio diversification.', tone: '#3a2e0f', accent: '#d4a13a' },
    { n: '04', cat: 'Capital Markets', client: 'Private Equity', metric: 'LP & GP acquisition', sub: 'Capital-raise campaigns for funds, deal flow and accredited investor lists.', tone: '#0e2a3d', accent: '#3A6BFF' },
    { n: '05', cat: 'Capital Markets', client: 'Wealth Management', metric: 'IFAs, RIAs & family offices', sub: 'Discretionary mandates and advisory pipelines built on intent-led search.', tone: '#1a3a8a', accent: '#9ec0ff' },
    { n: '06', cat: 'Capital Markets', client: 'Real Estate', metric: 'Commercial & private resi', sub: 'Off-market deal flow, fund subscriptions and high-ticket lead generation.', tone: '#2d1a1f', accent: '#e8a5a5' },
  ];
  return (
    <section style={{ background: A_PAPER, color: A_INK, padding: '160px 56px' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 40 }}>
        <ASmallCaps>(004) — Verticals we serve</ASmallCaps>
        <ASmallCaps>Six verticals · One playbook</ASmallCaps>
      </div>
      <h2 style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 120, letterSpacing: '-0.04em', lineHeight: 0.95, margin: '0 0 80px', maxWidth: 1200 }}>
        Built for <span style={{ fontFamily: 'Instrument Serif', fontStyle: 'italic', fontWeight: 400 }}>high-ticket </span>verticals.
      </h2>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 24 }}>
        {sectors.map((c, i) => (
          <div key={i} style={{ background: '#fff', border: `1px solid ${A_LINE}`, transition: 'transform 0.4s cubic-bezier(.2,.8,.2,1)', cursor: 'pointer' }}
            onMouseEnter={(e) => e.currentTarget.style.transform = 'translateY(-6px)'}
            onMouseLeave={(e) => e.currentTarget.style.transform = 'translateY(0)'}
          >
            <div style={{ aspectRatio: '4/5', background: c.tone, position: 'relative', overflow: 'hidden' }}>
              <svg width="100%" height="100%" style={{ position: 'absolute', inset: 0, opacity: 0.18 }}>
                <defs>
                  <pattern id={`a-stripe-${i}`} width="10" height="10" patternUnits="userSpaceOnUse">
                    <line x1="0" y1="0" x2="0" y2="10" stroke={c.accent} strokeWidth="1"/>
                  </pattern>
                </defs>
                <rect width="100%" height="100%" fill={`url(#a-stripe-${i})`} />
              </svg>
              <div style={{ position: 'absolute', top: 24, left: 24, right: 24, display: 'flex', justifyContent: 'space-between', color: '#fff', fontFamily: 'JetBrains Mono', fontSize: 11, letterSpacing: '0.12em', textTransform: 'uppercase' }}>
                <span>{c.n} / {c.cat}</span>
                <span>↗</span>
              </div>
              <div style={{ position: 'absolute', bottom: 32, left: 32, right: 32, color: '#fff' }}>
                <div style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 46, letterSpacing: '-0.03em', lineHeight: 1.05, color: c.accent, textWrap: 'balance' }}>{c.client}</div>
                <div style={{ fontSize: 14, marginTop: 16, opacity: 0.85 }}>{c.metric}</div>
              </div>
            </div>
            <div style={{ padding: '24px' }}>
              <div style={{ fontSize: 15, lineHeight: 1.5, color: '#333' }}>{c.sub}</div>
            </div>
          </div>
        ))}
      </div>
    </section>
  );
}

function AProcess() {
  const steps = [
    { n: '01', t: 'Strategy Call', d: 'Free strategy session worth £1,000. We diagnose your funnel, identify the biggest leverage points and map the opportunity — no sales pitch, no obligation.' },
    { n: '02', t: 'Build', d: 'Account architecture, tracking, creative and landing systems. Performance-built funnels and conversion-first creative — the plumbing before the campaigns.' },
    { n: '03', t: 'Deploy', d: 'Live campaigns across Meta, Google and LinkedIn. AI-powered targeting, weekly creative iteration, transparent reporting straight to your inbox.' },
    { n: '04', t: 'Scale', d: 'Once we hit your CPL targets, we compound. Lower CAC, higher LTV, predictable pipeline — and if we don\u2019t deliver, you don\u2019t pay.' },
  ];
  return (
    <section style={{ background: A_BLUE, color: '#fff', padding: '160px 56px' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 80 }}>
        <ASmallCaps>(005) — How we work</ASmallCaps>
        <ASmallCaps>4 phases / 90 days to compound</ASmallCaps>
      </div>
      <h2 style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 120, letterSpacing: '-0.04em', lineHeight: 0.95, margin: '0 0 100px', maxWidth: 1000 }}>
        A system, <span style={{ fontFamily: 'Instrument Serif', fontStyle: 'italic', fontWeight: 400 }}>not </span>a guess.
      </h2>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 32 }}>
        {steps.map((s, i) => (
          <div key={i} style={{ borderTop: '1px solid rgba(255,255,255,0.3)', paddingTop: 24 }}>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', marginBottom: 60 }}>{s.n}</div>
            <div style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 44, letterSpacing: '-0.02em', marginBottom: 24 }}>{s.t}</div>
            <div style={{ fontSize: 15, lineHeight: 1.5, opacity: 0.9 }}>{s.d}</div>
          </div>
        ))}
      </div>
    </section>
  );
}

function ATestimonial() {
  return (
    <section style={{ background: A_PAPER, color: A_INK, padding: '160px 56px' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 60 }}>
        <ASmallCaps>(006) — Verified on Trustpilot</ASmallCaps>
        <ASmallCaps>★★★★★ · Industry-leading</ASmallCaps>
      </div>
      <blockquote style={{ fontFamily: 'Instrument Serif', fontStyle: 'italic', fontSize: 88, fontWeight: 400, letterSpacing: '-0.02em', lineHeight: 1.05, margin: '0 0 60px', maxWidth: 1280, textWrap: 'balance' }}>
        “Professional from start to finish, outperformed what we expected. A reliable lead source — consistent, easy to work with, and we’d definitely use them again.”
      </blockquote>
      <div style={{ display: 'flex', gap: 24, alignItems: 'center' }}>
        <div style={{ width: 56, height: 56, borderRadius: '50%', background: A_INK, color: A_PAPER, display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'Inter Tight', fontWeight: 600 }}>★</div>
        <div>
          <div style={{ fontWeight: 600, fontSize: 18 }}>Verified Checkmate clients</div>
          <div style={{ fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.1em', textTransform: 'uppercase', color: '#666', marginTop: 4 }}>Trustpilot · Reviews aggregated</div>
        </div>
      </div>
    </section>
  );
}

function ATeam() {
  const team = [
    { initials: 'AR', name: 'Alfie Rowland', role: 'CEO & Founder', bio: 'Sets the playbook for every Checkmate engagement. Built the agency from a single laptop into a six-vertical performance studio for alternative investments.' },
    { initials: 'AG', name: 'Ash Greaves', role: 'Creative Director', bio: 'Concepts, scripts and the scroll-stopping creative that earns the click in the first second. Owns the brand language across every channel we run.' },
    { initials: 'CB', name: 'Cam Bennett', role: 'Sales Director', bio: 'Your first conversation and last line of accountability. Closes the gap between what the funnel promises and what the boardroom needs.' },
  ];
  return (
    <section style={{ background: A_PAPER, color: A_INK, padding: '160px 56px' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 40 }}>
        <ASmallCaps>(007) — The team</ASmallCaps>
        <ASmallCaps>Operators, not account managers</ASmallCaps>
      </div>
      <h2 style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 120, letterSpacing: '-0.04em', lineHeight: 0.95, margin: '0 0 80px', maxWidth: 1200 }}>
        Senior <span style={{ fontFamily: 'Instrument Serif', fontStyle: 'italic', fontWeight: 400 }}>operators </span>on every account.
      </h2>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 1, background: A_LINE, border: `1px solid ${A_LINE}` }}>
        {team.map((m, i) => (
          <div key={i} style={{ background: '#fff', padding: '48px 36px', minHeight: 360, display: 'flex', flexDirection: 'column', justifyContent: 'space-between' }}>
            <div style={{ width: 72, height: 72, borderRadius: '50%', background: A_INK, color: A_PAPER, display: 'flex', alignItems: 'center', justifyContent: 'center', fontFamily: 'Inter Tight', fontWeight: 600, fontSize: 22, letterSpacing: '0.04em' }}>{m.initials}</div>
            <div>
              <div style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 28, letterSpacing: '-0.02em', marginBottom: 4 }}>{m.name}</div>
              <div style={{ fontFamily: 'JetBrains Mono', fontSize: 11, letterSpacing: '0.12em', textTransform: 'uppercase', color: '#666', marginBottom: 16 }}>{m.role}</div>
              <div style={{ fontSize: 15, lineHeight: 1.5, color: '#333' }}>{m.bio}</div>
            </div>
          </div>
        ))}
      </div>
      <div style={{ marginTop: 24, fontFamily: 'JetBrains Mono', fontSize: 11, letterSpacing: '0.1em', textTransform: 'uppercase', color: '#666' }}>
        <a href="team.html" style={{ color: A_INK }}>Meet the full team →</a>
      </div>
    </section>
  );
}

function ANews() {
  const items = [
    { date: 'Apr 2026', tag: 'Case Study', title: 'How a cask whisky operator hit 4× ROAS in 60 days', read: '6 min read' },
    { date: 'Mar 2026', tag: 'Insight', title: 'The death of the broad-match keyword (and what replaces it)', read: '4 min read' },
    { date: 'Feb 2026', tag: 'Playbook', title: 'A Meta Ads creative system for high-ticket investments', read: '8 min read' },
  ];
  return (
    <section style={{ background: A_INK, color: A_PAPER, padding: '160px 56px' }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 60 }}>
        <ASmallCaps style={{ color: A_PAPER }}>(008) — News &amp; insights</ASmallCaps>
        <ASmallCaps style={{ color: A_PAPER, opacity: 0.5 }}>The Checkmate journal</ASmallCaps>
      </div>
      <div>
        {items.map((it, i) => (
          <div key={i} style={{ borderTop: '1px solid rgba(255,255,255,0.15)', padding: '32px 0', display: 'grid', gridTemplateColumns: '120px 140px 1fr 140px', gap: 40, alignItems: 'baseline', cursor: 'pointer' }}>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', opacity: 0.6 }}>{it.date}</div>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 11, letterSpacing: '0.12em', textTransform: 'uppercase', color: A_BLUE }}>{it.tag}</div>
            <div style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 32, letterSpacing: '-0.02em', lineHeight: 1.15 }}>{it.title}</div>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 11, letterSpacing: '0.12em', textTransform: 'uppercase', opacity: 0.5, textAlign: 'right' }}>{it.read} ↗</div>
          </div>
        ))}
        <div style={{ borderTop: '1px solid rgba(255,255,255,0.15)' }}></div>
      </div>
    </section>
  );
}

const ZAPIER_WEBHOOK = 'https://hooks.zapier.com/hooks/catch/17006718/4yiu5ss/';

function AQualifier() {
  const [step, setStep] = useState(1);
  const [data, setData] = useState({ service: '', spend: '', timeline: '', name: '', email: '', company: '' });
  const [submitting, setSubmitting] = useState(false);
  const [sent, setSent] = useState(false);
  const [error, setError] = useState('');
  const services = ['Lead Generation', 'Paid Search', 'Paid Social', 'Web Design', 'Full mix'];
  const spends = ['<£10k/mo', '£10–25k', '£25–75k', '£75k+'];
  const timelines = ['ASAP', '<30 days', '60–90 days', 'Exploring'];

  async function submitLead(payload) {
    setSubmitting(true);
    setError('');
    try {
      await fetch(ZAPIER_WEBHOOK, {
        method: 'POST',
        mode: 'no-cors',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
          ...payload,
          source: 'tcmg.uk',
          page: window.location.href,
          referrer: document.referrer || 'direct',
          submitted_at: new Date().toISOString(),
        }),
      });
      setSent(true);
    } catch (e) {
      setError('Could not send — please email connect@tcmg.uk');
    } finally {
      setSubmitting(false);
    }
  }

  return (
    <section id="contact" style={{ background: A_INK, color: A_PAPER, padding: '160px 56px', scrollMarginTop: 24 }}>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 60 }}>
        <ASmallCaps style={{ color: A_PAPER }}>(007) — Start the conversation</ASmallCaps>
        <ASmallCaps style={{ color: A_PAPER, opacity: 0.5 }}>Step {step} of 4</ASmallCaps>
      </div>
      <div style={{ display: 'grid', gridTemplateColumns: '1.2fr 1fr', gap: 80, alignItems: 'start' }}>
        <h2 style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 120, letterSpacing: '-0.04em', lineHeight: 0.95, margin: 0 }}>
          Tell us where you<br/>want to <span style={{ fontFamily: 'Instrument Serif', fontStyle: 'italic', fontWeight: 400 }}>be </span>in 90 days.
        </h2>
        <div style={{ background: '#141414', padding: 40, borderRadius: 4, border: '1px solid rgba(255,255,255,0.1)' }}>
          <div style={{ display: 'flex', gap: 8, marginBottom: 32 }}>
            {[1,2,3,4].map(i => (
              <div key={i} style={{ flex: 1, height: 3, background: i <= step ? A_BLUE : 'rgba(255,255,255,0.15)' }}></div>
            ))}
          </div>
          {step === 1 && <>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', opacity: 0.6, marginBottom: 20 }}>What do you need?</div>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
              {services.map(s => (
                <button key={s} onClick={() => { setData({...data, service: s}); setStep(2); }} style={{ textAlign: 'left', padding: '18px 20px', background: data.service === s ? A_BLUE : 'transparent', border: '1px solid rgba(255,255,255,0.15)', color: '#fff', fontFamily: 'inherit', fontSize: 17, cursor: 'pointer', borderRadius: 2, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
                  {s} <span style={{ opacity: 0.4 }}>→</span>
                </button>
              ))}
            </div>
          </>}
          {step === 2 && <>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', opacity: 0.6, marginBottom: 20 }}>Monthly media spend?</div>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }}>
              {spends.map(s => (
                <button key={s} onClick={() => { setData({...data, spend: s}); setStep(3); }} style={{ padding: '24px 20px', background: 'transparent', border: '1px solid rgba(255,255,255,0.15)', color: '#fff', fontFamily: 'inherit', fontSize: 18, cursor: 'pointer', borderRadius: 2 }}>{s}</button>
              ))}
            </div>
          </>}
          {step === 3 && <>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', opacity: 0.6, marginBottom: 20 }}>Timeline?</div>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }}>
              {timelines.map(s => (
                <button key={s} onClick={() => { setData({...data, timeline: s}); setStep(4); }} style={{ padding: '24px 20px', background: 'transparent', border: '1px solid rgba(255,255,255,0.15)', color: '#fff', fontFamily: 'inherit', fontSize: 18, cursor: 'pointer', borderRadius: 2 }}>{s}</button>
              ))}
            </div>
          </>}
          {step === 4 && !sent && <>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', opacity: 0.6, marginBottom: 20 }}>Last bit — your details</div>
            <input value={data.name} onChange={(e) => setData({...data, name: e.target.value})} placeholder="Name" style={{ width: '100%', padding: 18, background: 'transparent', border: '1px solid rgba(255,255,255,0.15)', color: '#fff', fontFamily: 'inherit', fontSize: 17, marginBottom: 8, borderRadius: 2 }} />
            <input value={data.email} onChange={(e) => setData({...data, email: e.target.value})} placeholder="Work email" type="email" style={{ width: '100%', padding: 18, background: 'transparent', border: '1px solid rgba(255,255,255,0.15)', color: '#fff', fontFamily: 'inherit', fontSize: 17, marginBottom: 8, borderRadius: 2 }} />
            <input value={data.company} onChange={(e) => setData({...data, company: e.target.value})} placeholder="Company" style={{ width: '100%', padding: 18, background: 'transparent', border: '1px solid rgba(255,255,255,0.15)', color: '#fff', fontFamily: 'inherit', fontSize: 17, marginBottom: 16, borderRadius: 2 }} />
            <button
              disabled={submitting || !data.name || !data.email}
              onClick={() => submitLead(data)}
              style={{ width: '100%', padding: 20, background: (submitting || !data.name || !data.email) ? 'rgba(58,107,255,0.5)' : A_BLUE, color: '#fff', border: 'none', fontFamily: 'JetBrains Mono', fontSize: 13, letterSpacing: '0.12em', textTransform: 'uppercase', cursor: (submitting || !data.name || !data.email) ? 'not-allowed' : 'pointer', borderRadius: 2 }}>
              {submitting ? 'Sending…' : 'Send & book a call →'}
            </button>
            {error && <div style={{ marginTop: 16, fontSize: 13, color: '#ff7a7a' }}>{error}</div>}
          </>}
          {sent && <>
            <div style={{ fontFamily: 'JetBrains Mono', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', opacity: 0.6, marginBottom: 20 }}>Received ✓</div>
            <div style={{ fontFamily: 'Instrument Serif', fontStyle: 'italic', fontSize: 36, lineHeight: 1.2, marginBottom: 16 }}>Thanks, {data.name.split(' ')[0] || 'there'}.</div>
            <div style={{ fontSize: 15, lineHeight: 1.55, opacity: 0.85 }}>We've got your details. Expect an email from <span style={{ color: A_BLUE }}>connect@tcmg.uk</span> within one working day to lock the call.</div>
          </>}
        </div>
      </div>
    </section>
  );
}

function AFooter() {
  return (
    <footer style={{ background: A_INK, color: A_PAPER, padding: '120px 56px 40px', borderTop: '1px solid rgba(255,255,255,0.1)' }}>
      <div style={{ fontFamily: 'Inter Tight', fontWeight: 500, fontSize: 200, letterSpacing: '-0.05em', lineHeight: 0.9, marginBottom: 80 }}>
        Your move.<span style={{ color: A_BLUE }}>_</span>
      </div>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 40, borderTop: '1px solid rgba(255,255,255,0.15)', paddingTop: 40 }}>
        <div>
          <ASmallCaps style={{ color: 'rgba(245,243,238,0.5)' }}>Studio</ASmallCaps>
          <div style={{ marginTop: 16, fontSize: 16, lineHeight: 1.6 }}>The Checkmate Marketing Group<br/>United Kingdom</div>
        </div>
        <div>
          <ASmallCaps style={{ color: 'rgba(245,243,238,0.5)' }}>Contact</ASmallCaps>
          <div style={{ marginTop: 16, fontSize: 16, lineHeight: 1.6 }}>connect@tcmg.uk<br/>tcmg.uk</div>
        </div>
        <div>
          <ASmallCaps style={{ color: 'rgba(245,243,238,0.5)' }}>Sitemap</ASmallCaps>
          <div style={{ marginTop: 16, fontSize: 16, lineHeight: 1.6 }}>Services / Process<br/>Team / Contact</div>
        </div>
        <div>
          <ASmallCaps style={{ color: 'rgba(245,243,238,0.5)' }}>Social</ASmallCaps>
          <div style={{ marginTop: 16, fontSize: 16, lineHeight: 1.6 }}>LinkedIn · Instagram<br/>Trustpilot</div>
        </div>
      </div>
      <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 80, fontFamily: 'JetBrains Mono', fontSize: 11, letterSpacing: '0.1em', textTransform: 'uppercase', opacity: 0.5 }}>
        <span>© 2026 Checkmate Marketing Ltd · Reg. 11258499</span>
        <span>Made in the UK</span>
      </div>
    </footer>
  );
}

function DirectionA() {
  return (
    <div style={{ position: 'relative', background: A_PAPER, fontFamily: 'Inter Tight' }}>
      <style>{`
        @keyframes a-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
      `}</style>
      <ANav />
      <AHero />
      <AMarqueeBand />
      <AStats />
      <AServices />
      <AWork />
      <AProcess />
      <ATestimonial />
      <ATeam />
      <AQualifier />
      <AFooter />
    </div>
  );
}

window.DirectionA = DirectionA;
