// Scout vs LinkedIn Recruiter — shared content for the "cancel LinkedIn"
// narrative. Exposes:
//   - fireConfetti(x, y) — tiny canvas-free confetti util
//   - ScoutVsLinkedIn     — full-width side-by-side comparison section
//   - CancelLinkedInToy   — interactive widget: seats stepper → click → confetti
//   - VariantI            — a dedicated page organised around the cancel
//                           narrative.

/* ============================================================
   Confetti — appends DOM particles with WebAnimations, cleans up.
   ============================================================ */
function fireConfetti(originX, originY, opts = {}) {
  const colors = opts.colors || ['#FF6A3D', '#0009B6', '#22C55E', '#F5B544', '#FFFFFF', '#0084FF'];
  const N = opts.count || 160;
  const spread = opts.spread || 1;
  for (let i = 0; i < N; i++) {
    const el = document.createElement('div');
    const size = 6 + Math.random() * 10;
    const isSquare = Math.random() > 0.5;
    el.style.cssText = `
      position: fixed;
      top: ${originY}px;
      left: ${originX}px;
      width: ${size}px;
      height: ${size * (isSquare ? 0.45 : 1)}px;
      background: ${colors[i % colors.length]};
      border-radius: ${isSquare ? '2px' : '50%'};
      pointer-events: none;
      z-index: 99999;
      will-change: transform, opacity;
    `;
    document.body.appendChild(el);

    const angle = -Math.PI / 2 + (Math.random() - 0.5) * Math.PI * 1.1 * spread;
    const vel = 380 + Math.random() * 700;
    const vx = Math.cos(angle) * vel;
    const vy = Math.sin(angle) * vel;
    const rot = (Math.random() - 0.5) * 1440;
    const drift = (Math.random() - 0.5) * 200;
    const dur = 1600 + Math.random() * 1400;

    el.animate(
      [
        { transform: 'translate(-50%, -50%) rotate(0)', opacity: 1 },
        { transform: `translate(${vx + drift}px, ${vy + 900}px) rotate(${rot}deg)`, opacity: 1, offset: 0.85 },
        { transform: `translate(${vx + drift}px, ${vy + 1100}px) rotate(${rot}deg)`, opacity: 0 },
      ],
      { duration: dur, easing: 'cubic-bezier(.18, .7, .4, 1)', fill: 'forwards' }
    );
    setTimeout(() => el.remove(), dur + 100);
  }
}

/* ============================================================
   ScoutVsLinkedIn — comparison section (full-width)
   ============================================================ */
function ScoutVsLinkedIn({ theme = 'light', showCTA = true }) {
  const dark = theme === 'dark';

  const bg    = dark ? '#050A1F' : '#fff';
  const ink   = dark ? '#fff' : 'var(--cal-ink)';
  const body  = dark ? 'rgba(255,255,255,0.78)' : 'var(--cal-body)';
  const muted = dark ? 'rgba(255,255,255,0.55)' : 'var(--cal-muted)';
  const line  = dark ? 'rgba(255,255,255,0.1)'  : 'var(--cal-line)';
  const softBg = dark ? 'rgba(255,255,255,0.03)' : 'var(--cal-bg-soft)';

  // Feature comparisons — same labels both sides, different answers
  const features = [
    { label: 'Brief format',        li: 'Boolean strings',              sc: 'Plain English' },
    { label: 'Profile index',       li: 'LinkedIn only',                 sc: '2.4B profiles, cross-platform' },
    { label: 'Searches per month',  li: '~1,000',                        sc: 'Unlimited' },
    { label: 'Outreach drafting',   li: 'You write every InMail',        sc: 'Drafted per candidate' },
    { label: 'Response tracking',   li: 'Copy-paste into your ATS',      sc: 'Auto-threaded to the record' },
  ];

  return (
    <section id="scout-vs-linkedin" data-screen-label="Scout vs LinkedIn" className="cal-section" style={{
      padding: '120px 72px', background: bg, color: ink,
      position: 'relative', overflow: 'hidden',
    }}>
      {dark && <div className="cal-noise" />}

      <div className="cal-container" style={{ position: 'relative' }}>
        {/* Headline row — matches the rest of the page */}
        <div style={{
          display: 'grid', gridTemplateColumns: '1fr 1.4fr', gap: 64,
          alignItems: 'end', marginBottom: 48,
        }}>
          <div>
            <div className="cal-eyebrow" style={{ marginBottom: 18 }}>
              <span className="dot" /> The LinkedIn bill
            </div>
            <h2 style={{ color: ink, margin: 0 }}>
              Cancel LinkedIn Recruiter. <span style={{ color: 'var(--cal-accent)' }}>Keep the money.</span>
            </h2>
          </div>
          <p className="lede" style={{ color: body }}>
            Scout — the AI sourcing engine included with every Caliber seat — takes briefs in plain English and reads 2.4 billion public profiles. LinkedIn Recruiter charges NZ$12,000 a seat to write boolean strings.
          </p>
        </div>

        {/* Two side-by-side cards — upright, grid-aligned */}
        <div style={{
          display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24,
          marginBottom: 32,
        }}>
          {/* ---------- LinkedIn card ---------- */}
          <div style={{
            background: softBg,
            border: `1px solid ${line}`,
            borderRadius: 18, padding: '28px 28px 24px',
            display: 'flex', flexDirection: 'column',
          }}>
            {/* Header */}
            <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 24 }}>
              <div style={{
                width: 36, height: 36, borderRadius: 8, background: '#0A66C2', color: '#fff',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                fontWeight: 700, fontSize: 17, fontFamily: 'Arial, sans-serif',
              }}>in</div>
              <div>
                <div style={{ fontSize: 15, fontWeight: 600, color: ink }}>LinkedIn Recruiter</div>
                <div style={{ fontSize: 12, color: muted }}>Recruiter Corporate</div>
              </div>
              <div style={{
                marginLeft: 'auto', textAlign: 'right',
              }}>
                <div style={{
                  fontSize: 22, fontWeight: 500, letterSpacing: '-0.02em',
                  color: ink, fontFeatureSettings: '"tnum"', lineHeight: 1,
                }}>
                  NZ$12,000
                </div>
                <div style={{ fontSize: 11, color: muted, marginTop: 2 }}>per seat, per year</div>
              </div>
            </div>

            {/* The pain — a boolean string */}
            <div style={{
              background: dark ? 'rgba(0,0,0,0.3)' : '#fff',
              border: `1px solid ${dark ? 'rgba(255,255,255,0.08)' : '#E5E7EB'}`,
              borderRadius: 10, padding: 14,
              fontFamily: 'ui-monospace, "SF Mono", Menlo, monospace',
              fontSize: 12, lineHeight: 1.55,
              color: dark ? 'rgba(255,255,255,0.75)' : '#24292F',
              marginBottom: 20,
            }}>
              <div style={{
                fontSize: 10, color: muted,
                letterSpacing: '0.08em', textTransform: 'uppercase', marginBottom: 8,
                fontFamily: 'var(--cal-font)',
              }}>
                Keywords (Boolean)
              </div>
              <div>
                <span style={{ color: '#CF222E' }}>(</span>"React" <span style={{ color: '#CF222E' }}>OR</span> "ReactJS"<span style={{ color: '#CF222E' }}>)</span> <span style={{ color: '#CF222E' }}>AND</span> <span style={{ color: '#CF222E' }}>(</span>"Senior" <span style={{ color: '#CF222E' }}>OR</span> "Lead"<span style={{ color: '#CF222E' }}>)</span> <span style={{ color: '#CF222E' }}>AND</span> "Auckland" <span style={{ color: '#CF222E' }}>NOT</span> "junior"
              </div>
            </div>

            {/* Feature list */}
            <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
              {features.map(f => (
                <div key={f.label} style={{
                  display: 'grid', gridTemplateColumns: '1fr auto',
                  gap: 12, fontSize: 13, alignItems: 'baseline',
                }}>
                  <span style={{ color: muted }}>{f.label}</span>
                  <span style={{ color: body, fontWeight: 500, textAlign: 'right' }}>{f.li}</span>
                </div>
              ))}
            </div>
          </div>

          {/* ---------- Scout card ---------- */}
          <div style={{
            background: 'var(--cal-blue-ink)',
            borderRadius: 18, padding: '28px 28px 24px',
            color: '#fff', position: 'relative',
            boxShadow: dark
              ? '0 40px 80px -30px rgba(0,9,182,0.6)'
              : '0 30px 60px -24px rgba(0,9,182,0.28)',
            display: 'flex', flexDirection: 'column',
          }}>
            {/* Header */}
            <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 24 }}>
              <div style={{
                width: 36, height: 36, borderRadius: 8,
                background: 'rgba(255,255,255,0.15)',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              }}>
                <CalStar size={20} grad={false} style={{ color: '#fff' }} />
              </div>
              <div>
                <div style={{ fontSize: 15, fontWeight: 600 }}>Scout</div>
                <div style={{ fontSize: 12, color: 'rgba(255,255,255,0.7)' }}>AI sourcing in Caliber</div>
              </div>
              <div style={{ marginLeft: 'auto', textAlign: 'right' }}>
                <div style={{
                  fontSize: 22, fontWeight: 500, letterSpacing: '-0.02em',
                  color: '#fff', lineHeight: 1,
                }}>
                  Included
                </div>
                <div style={{ fontSize: 11, color: 'rgba(255,255,255,0.7)', marginTop: 2 }}>
                  in every seat
                </div>
              </div>
            </div>

            {/* The win — plain English brief */}
            <div style={{
              background: 'rgba(255,255,255,0.08)',
              border: '1px solid rgba(255,255,255,0.12)',
              borderRadius: 10, padding: 14,
              fontSize: 14.5, lineHeight: 1.5,
              marginBottom: 20,
            }}>
              <div style={{
                fontSize: 10, color: 'rgba(255,255,255,0.55)',
                letterSpacing: '0.08em', textTransform: 'uppercase', marginBottom: 8,
              }}>
                Brief (plain English)
              </div>
              <div>
                &ldquo;Senior accountant in Auckland with Xero experience.&rdquo;
              </div>
            </div>

            {/* Feature list */}
            <div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
              {features.map(f => (
                <div key={f.label} style={{
                  display: 'grid', gridTemplateColumns: '1fr auto',
                  gap: 12, fontSize: 13, alignItems: 'baseline',
                }}>
                  <span style={{ color: 'rgba(255,255,255,0.6)' }}>{f.label}</span>
                  <span style={{ color: '#fff', fontWeight: 500, textAlign: 'right' }}>{f.sc}</span>
                </div>
              ))}
            </div>
          </div>
        </div>

        {/* Savings bar — quiet, one row */}
        <div style={{
          border: `1px solid ${line}`,
          borderRadius: 14, padding: '18px 24px',
          background: dark ? 'rgba(255,255,255,0.03)' : '#fff',
          display: 'grid',
          gridTemplateColumns: 'auto 1fr auto auto auto',
          gap: 24, alignItems: 'center',
        }}>
          <div style={{ fontSize: 13, color: muted, letterSpacing: '0.04em' }}>
            Typical 5-seat agency
          </div>
          <div style={{ height: 1, background: line }} />
          <div style={{ textAlign: 'right' }}>
            <div style={{ fontSize: 10, color: muted, letterSpacing: '0.08em', textTransform: 'uppercase', marginBottom: 2 }}>
              LinkedIn Recruiter
            </div>
            <div style={{
              fontSize: 18, fontWeight: 500, letterSpacing: '-0.02em',
              color: muted, textDecoration: 'line-through', fontFeatureSettings: '"tnum"',
            }}>
              NZ$60,000 / yr
            </div>
          </div>
          <div style={{ color: muted, fontSize: 16 }}>→</div>
          <div style={{ textAlign: 'right' }}>
            <div style={{ fontSize: 10, color: muted, letterSpacing: '0.08em', textTransform: 'uppercase', marginBottom: 2 }}>
              With Scout included
            </div>
            <div style={{
              fontSize: 18, fontWeight: 600, letterSpacing: '-0.02em',
              color: 'var(--cal-accent)', fontFeatureSettings: '"tnum"',
              display: 'inline-flex', alignItems: 'baseline', gap: 8,
            }}>
              NZ$0
              <span style={{
                fontSize: 11, fontWeight: 600, letterSpacing: '0.06em',
                background: 'var(--cal-accent)', color: '#fff',
                padding: '3px 9px', borderRadius: 999, textTransform: 'uppercase',
              }}>
                Save NZ$60k
              </span>
            </div>
          </div>
        </div>

        {showCTA && (
          <div style={{ marginTop: 40, textAlign: 'center' }}>
            <button className="cal-btn cal-btn--blue" style={{ padding: '14px 24px', fontSize: 15 }}
              onClick={(e) => {
                const r = e.currentTarget.getBoundingClientRect();
                fireConfetti(r.left + r.width / 2, r.top + r.height / 2, { count: 140 });
              }}>
              See Scout in the live demo {Icon.arrowR({ size: 13, color: '#fff' })}
            </button>
            <div style={{ fontSize: 12, color: muted, marginTop: 12 }}>
              Sources: LinkedIn Recruiter Corporate list pricing (AUS/NZ, 2025). Scout is included in every Caliber seat.
            </div>
          </div>
        )}
      </div>
    </section>
  );
}

/* ============================================================
   CancelLinkedInToy — interactive seats stepper → cancel → confetti
   ============================================================ */
function CancelLinkedInToy() {
  const [seats, setSeats] = React.useState(5);
  const [state, setState] = React.useState('idle'); // idle | shredding | done
  const [shreddedCount, setShreddedCount] = React.useState(0);
  const containerRef = React.useRef(null);
  const perSeat = 12000;
  const total = seats * perSeat;

  const cancel = () => {
    if (state !== 'idle') return;
    setState('shredding');
    setShreddedCount(0);

    // Shred each line item with a small stagger
    let i = 0;
    const interval = setInterval(() => {
      i++;
      setShreddedCount(i);
      if (i >= seats) {
        clearInterval(interval);
        // final confetti burst from the middle of the widget
        setTimeout(() => {
          setState('done');
          if (containerRef.current) {
            const r = containerRef.current.getBoundingClientRect();
            fireConfetti(r.left + r.width / 2, r.top + r.height * 0.4, { count: 220 });
          }
        }, 260);
      }
    }, 200);
  };

  const reset = () => {
    setState('idle');
    setShreddedCount(0);
  };

  const fmt = n => n.toLocaleString('en-NZ');

  return (
    <div ref={containerRef} style={{
      background: '#fff', borderRadius: 24, padding: 32,
      boxShadow: '0 40px 80px -30px rgba(0,20,80,0.25), 0 8px 20px rgba(0,20,80,0.08)',
      border: '1px solid var(--cal-line)',
      position: 'relative', overflow: 'hidden',
      maxWidth: 680, margin: '0 auto',
    }}>
      {/* Faux LinkedIn Recruiter billing header */}
      <div style={{
        display: 'flex', alignItems: 'center', gap: 12, paddingBottom: 20,
        borderBottom: '1px solid var(--cal-line-2)', marginBottom: 20,
      }}>
        <div style={{
          width: 40, height: 40, borderRadius: 8,
          background: '#0A66C2', color: '#fff',
          display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
          fontWeight: 700, fontSize: 18, fontFamily: 'Arial, sans-serif',
        }}>in</div>
        <div style={{ flex: 1 }}>
          <div style={{ fontSize: 13, color: 'var(--cal-muted)' }}>Annual invoice · Recruiter Corporate</div>
          <div style={{ fontSize: 16, fontWeight: 600 }}>LinkedIn Talent Solutions</div>
        </div>
        <div style={{ textAlign: 'right' }}>
          <div style={{ fontSize: 11, color: 'var(--cal-muted)', letterSpacing: '0.08em', textTransform: 'uppercase' }}>Due</div>
          <div style={{ fontSize: 13, fontWeight: 500 }}>Jan 15</div>
        </div>
      </div>

      {/* Seats stepper */}
      <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 18 }}>
        <div>
          <div style={{ fontSize: 11, color: 'var(--cal-muted)', letterSpacing: '0.08em', textTransform: 'uppercase', marginBottom: 6 }}>
            Your seats
          </div>
          <div style={{ fontSize: 13, color: 'var(--cal-body)' }}>How many Recruiter seats do you have?</div>
        </div>
        <div style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
          <button onClick={() => state === 'idle' && setSeats(s => Math.max(1, s - 1))}
            disabled={state !== 'idle'}
            style={{
              width: 36, height: 36, borderRadius: 999, border: '1px solid var(--cal-line)',
              background: '#fff', fontSize: 18, cursor: state === 'idle' ? 'pointer' : 'not-allowed',
              color: 'var(--cal-ink)', opacity: state === 'idle' ? 1 : 0.4,
            }}>−</button>
          <div style={{
            minWidth: 48, textAlign: 'center', fontSize: 22, fontWeight: 600, letterSpacing: '-0.02em',
            fontFeatureSettings: '"tnum"', fontVariantNumeric: 'tabular-nums',
          }}>{seats}</div>
          <button onClick={() => state === 'idle' && setSeats(s => Math.min(20, s + 1))}
            disabled={state !== 'idle'}
            style={{
              width: 36, height: 36, borderRadius: 999, border: '1px solid var(--cal-line)',
              background: '#fff', fontSize: 18, cursor: state === 'idle' ? 'pointer' : 'not-allowed',
              color: 'var(--cal-ink)', opacity: state === 'idle' ? 1 : 0.4,
            }}>+</button>
        </div>
      </div>

      {/* Line items */}
      <div style={{
        background: 'var(--cal-bg-soft)', borderRadius: 14, padding: 18,
        marginBottom: 20, maxHeight: 280, overflow: 'auto',
      }}>
        {Array.from({ length: seats }).map((_, i) => {
          const isShredded = i < shreddedCount;
          return (
            <div key={i} style={{
              display: 'flex', alignItems: 'center', justifyContent: 'space-between',
              padding: '10px 0',
              borderBottom: i < seats - 1 ? '1px dashed rgba(0,0,0,0.08)' : 'none',
              opacity: isShredded ? 0.35 : 1,
              transition: 'opacity .3s',
              position: 'relative',
            }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
                <span style={{
                  width: 22, height: 22, borderRadius: 999,
                  background: isShredded ? '#DCFCE7' : '#EFF6FF',
                  color: isShredded ? '#16A34A' : '#0A66C2',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                  fontSize: 11, fontWeight: 600,
                }}>
                  {isShredded ? '✓' : i + 1}
                </span>
                <span style={{
                  fontSize: 13.5, color: 'var(--cal-ink)',
                  textDecoration: isShredded ? 'line-through' : 'none',
                  textDecorationColor: 'rgba(220,38,38,0.7)',
                  textDecorationThickness: '2px',
                  transition: 'all .3s',
                }}>
                  Recruiter Corporate · seat {i + 1}
                </span>
              </div>
              <div style={{
                fontSize: 14, fontWeight: 500, fontFeatureSettings: '"tnum"',
                textDecoration: isShredded ? 'line-through' : 'none',
                textDecorationColor: 'rgba(220,38,38,0.7)',
                textDecorationThickness: '2px',
                color: isShredded ? 'var(--cal-muted)' : 'var(--cal-ink)',
                transition: 'all .3s',
              }}>
                NZ${fmt(perSeat)}
              </div>
              {isShredded && (
                <div style={{
                  position: 'absolute', right: 0, top: '50%',
                  transform: 'translate(100%, -50%)',
                  animation: 'cal-bob 1.5s ease-out',
                  color: '#16A34A', fontSize: 11, fontWeight: 600, whiteSpace: 'nowrap',
                }}>cancelled ✓</div>
              )}
            </div>
          );
        })}
      </div>

      {/* Total + action */}
      <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 20 }}>
        <div>
          <div style={{ fontSize: 12, color: 'var(--cal-muted)', letterSpacing: '0.06em', textTransform: 'uppercase', marginBottom: 4 }}>
            {state === 'done' ? 'You just saved' : 'Annual total'}
          </div>
          <div style={{
            fontSize: 36, fontWeight: 500, letterSpacing: '-0.025em', lineHeight: 1,
            color: state === 'done' ? '#16A34A' : 'var(--cal-ink)',
            fontFeatureSettings: '"tnum"',
          }}>
            NZ${fmt(total)}
          </div>
          <div style={{ fontSize: 12, color: 'var(--cal-muted)', marginTop: 4 }}>
            {state === 'done'
              ? `Next year. And the year after. Forever.`
              : `${seats} seat${seats === 1 ? '' : 's'} × NZ$${fmt(perSeat)}/yr`}
          </div>
        </div>
        {state !== 'done' ? (
          <button onClick={cancel} disabled={state !== 'idle'} style={{
            padding: '16px 22px', borderRadius: 14,
            background: state === 'shredding' ? '#9CA3AF' : '#DC2626',
            color: '#fff', border: 'none', fontSize: 15, fontWeight: 600,
            fontFamily: 'inherit', cursor: state === 'idle' ? 'pointer' : 'not-allowed',
            display: 'inline-flex', alignItems: 'center', gap: 10,
            boxShadow: state === 'idle' ? '0 10px 24px -8px rgba(220,38,38,0.5)' : 'none',
            transition: 'background .2s, transform .1s',
          }}
            onMouseDown={e => e.currentTarget.style.transform = 'scale(0.97)'}
            onMouseUp={e => e.currentTarget.style.transform = 'scale(1)'}
            onMouseLeave={e => e.currentTarget.style.transform = 'scale(1)'}
          >
            {state === 'shredding' ? (
              <>
                <span style={{ display: 'inline-block', animation: 'cal-star-spin 0.8s linear infinite', width: 14, height: 14,
                  border: '2px solid rgba(255,255,255,0.5)', borderTopColor: '#fff', borderRadius: 999 }} />
                Cancelling {shreddedCount}/{seats}…
              </>
            ) : (
              <>Cancel {seats} seat{seats === 1 ? '' : 's'} →</>
            )}
          </button>
        ) : (
          <button onClick={reset} style={{
            padding: '16px 22px', borderRadius: 14,
            background: '#fff', color: 'var(--cal-ink)', border: '1px solid var(--cal-line)',
            fontSize: 15, fontWeight: 600, fontFamily: 'inherit', cursor: 'pointer',
            display: 'inline-flex', alignItems: 'center', gap: 8,
          }}>
            ↺ Do it again
          </button>
        )}
      </div>

      {/* Success banner */}
      {state === 'done' && (
        <div style={{
          background: 'linear-gradient(135deg, #ECFDF5 0%, #DCFCE7 100%)',
          border: '1px solid rgba(22,163,74,0.25)',
          borderRadius: 14, padding: '14px 18px',
          display: 'flex', alignItems: 'center', gap: 14,
          animation: 'cal-fade-up 0.4s both',
        }}>
          <div style={{
            width: 40, height: 40, borderRadius: 999,
            background: '#16A34A', color: '#fff',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            flexShrink: 0,
          }}>{Icon.check({ size: 20, color: '#fff' })}</div>
          <div style={{ flex: 1 }}>
            <div style={{ fontSize: 14.5, fontWeight: 600, color: '#065F46' }}>
              Seats cancelled. That&rsquo;s a wrap.
            </div>
            <div style={{ fontSize: 12.5, color: '#047857', marginTop: 2 }}>
              Scout does the same sourcing, better — included in your Caliber seat. Try it in the demo below.
            </div>
          </div>
          <button style={{
            padding: '10px 16px', borderRadius: 10,
            background: 'var(--cal-blue-ink)', color: '#fff', border: 'none',
            fontSize: 13, fontWeight: 600, cursor: 'pointer', whiteSpace: 'nowrap',
          }}>Open Scout →</button>
        </div>
      )}

      {/* Footnote */}
      <div style={{ fontSize: 11, color: 'var(--cal-muted)', marginTop: 14, textAlign: 'center' }}>
        Based on LinkedIn Recruiter Corporate list pricing · AU/NZ, 2025.
      </div>
    </div>
  );
}

/* Small keyframe we use here */
(() => {
  if (document.getElementById('cal-scout-kf')) return;
  const s = document.createElement('style');
  s.id = 'cal-scout-kf';
  s.textContent = `
    @keyframes cal-fade-up {
      from { opacity: 0; transform: translateY(8px); }
      to { opacity: 1; transform: translateY(0); }
    }
  `;
  document.head.appendChild(s);
})();

/* ============================================================
   VariantI — "Cancel LinkedIn Recruiter" page
   ============================================================ */
function VariantI() {
  return (
    <div className="cal-page">
      <ScrollProgress color="var(--cal-accent)" />
      <Nav ctaLabel="Book a demo" />

      {/* HERO — tabloid-style type, the toy is the hero's right side */}
      <section style={{
        padding: '48px 72px 80px', position: 'relative', overflow: 'hidden',
        background: 'linear-gradient(180deg, #FFF7ED 0%, #FFFBF3 50%, #fff 100%)',
      }}>
        {/* Giant faint "CANCEL" behind */}
        <div aria-hidden style={{
          position: 'absolute', left: -40, top: 80, right: -40,
          fontSize: 'clamp(180px, 26vw, 420px)', fontWeight: 300, letterSpacing: '-0.06em',
          color: 'rgba(220,38,38,0.04)', lineHeight: 0.8, pointerEvents: 'none', whiteSpace: 'nowrap',
          fontFamily: 'var(--cal-serif)', fontStyle: 'italic',
        }}>cancel.</div>

        <div className="cal-container" style={{ position: 'relative', display: 'grid', gridTemplateColumns: '1.1fr 1fr', gap: 64, alignItems: 'center' }}>
          <div>
            <div className="cal-eyebrow" style={{
              marginBottom: 24,
              background: '#FEE2E2', color: '#991B1B',
              border: '1px solid rgba(220,38,38,0.2)',
            }}>
              <span className="dot" style={{ background: '#DC2626' }} /> A public service announcement
            </div>
            <h1 style={{
              fontSize: 'clamp(56px, 7.5vw, 120px)', fontWeight: 400,
              letterSpacing: '-0.04em', lineHeight: 0.94,
              margin: '0 0 24px',
            }}>
              Cancel<br/>
              LinkedIn<br/>
              <span style={{
                fontFamily: 'var(--cal-serif)', fontStyle: 'italic',
                color: 'var(--cal-accent)', fontWeight: 400,
              }}>Recruiter.</span>
            </h1>
            <p style={{ fontSize: 21, lineHeight: 1.5, color: 'var(--cal-body)', maxWidth: 520, margin: '0 0 28px' }}>
              NZ$12,000 per seat, per year, to write boolean strings. Scout does the same job better — and it&rsquo;s included with Caliber. Try cancelling yours, right here. →
            </p>
            <div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
              <button className="cal-btn cal-btn--accent" style={{ padding: '14px 22px', fontSize: 15 }}
                onClick={(e) => {
                  const r = e.currentTarget.getBoundingClientRect();
                  fireConfetti(r.left + r.width / 2, r.top, { count: 180 });
                  document.getElementById('toy')?.scrollIntoView({ behavior: 'smooth', block: 'center' });
                }}>
                Cancel your seats →
              </button>
              <button className="cal-btn cal-btn--ghost" style={{ padding: '14px 22px', fontSize: 15 }}>
                See the math
              </button>
            </div>
            <div style={{
              marginTop: 32, paddingTop: 20, borderTop: '1px solid rgba(0,0,0,0.1)',
              display: 'flex', gap: 40, fontSize: 13, color: 'var(--cal-muted)',
            }}>
              <div>
                <div style={{ fontSize: 28, fontWeight: 500, color: 'var(--cal-ink)', letterSpacing: '-0.02em', lineHeight: 1 }}>
                  NZ$60k
                </div>
                <div style={{ marginTop: 4 }}>saved on a 5-seat agency</div>
              </div>
              <div>
                <div style={{ fontSize: 28, fontWeight: 500, color: 'var(--cal-ink)', letterSpacing: '-0.02em', lineHeight: 1 }}>
                  2.4B
                </div>
                <div style={{ marginTop: 4 }}>profiles Scout indexes</div>
              </div>
              <div>
                <div style={{ fontSize: 28, fontWeight: 500, color: 'var(--cal-ink)', letterSpacing: '-0.02em', lineHeight: 1 }}>
                  0
                </div>
                <div style={{ marginTop: 4 }}>boolean strings needed</div>
              </div>
            </div>
          </div>
          <div id="toy" style={{ position: 'relative' }}>
            <div style={{
              position: 'absolute', top: -18, left: -14, zIndex: 3,
              background: 'var(--cal-accent)', color: '#fff',
              padding: '8px 14px', borderRadius: 999, fontSize: 12, fontWeight: 500,
              transform: 'rotate(-4deg)', animation: 'cal-bob 4s ease-in-out infinite',
              boxShadow: '0 10px 22px -8px rgba(255,106,61,0.5)',
            }}>
              ✨ actually works · try it
            </div>
            <CancelLinkedInToy />
          </div>
        </div>
      </section>

      <LogoTicker />

      {/* The comparison */}
      <ScoutVsLinkedIn theme="light" showCTA={false} />

      {/* What Scout looks like in practice */}
      <section style={{ padding: '120px 72px', background: 'var(--cal-bg-soft)' }}>
        <div className="cal-container">
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 56, alignItems: 'center', marginBottom: 48 }}>
            <div>
              <div className="cal-eyebrow" style={{ marginBottom: 18 }}><span className="dot" /> Same brief, two tools</div>
              <h2>The difference in one screenshot.</h2>
            </div>
            <p className="lede">Here&rsquo;s the exact same search, both ways. On the left, LinkedIn Recruiter&rsquo;s boolean builder. On the right, Scout.</p>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 24 }}>
            {/* LinkedIn side */}
            <div style={{
              background: '#F3F6F9', borderRadius: 18, padding: 24,
              border: '1px solid #E5E7EB', position: 'relative',
            }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 18 }}>
                <div style={{
                  width: 28, height: 28, borderRadius: 6, background: '#0A66C2',
                  color: '#fff', display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                  fontWeight: 700, fontSize: 14, fontFamily: 'Arial, sans-serif',
                }}>in</div>
                <div style={{ fontSize: 13.5, fontWeight: 600 }}>LinkedIn Recruiter · Boolean</div>
              </div>
              <div style={{
                background: '#fff', border: '1px solid #D0D7DE', borderRadius: 8, padding: 14,
                fontFamily: 'ui-monospace, "SF Mono", Menlo, monospace', fontSize: 13, lineHeight: 1.55,
                color: '#24292F', minHeight: 180, marginBottom: 16,
              }}>
                <div style={{ color: '#6E7781', fontSize: 11, marginBottom: 8 }}>Keywords (Boolean)</div>
                <div>
                  <span style={{ color: '#CF222E' }}>(</span>"React" <span style={{ color: '#CF222E' }}>OR</span> "ReactJS" <span style={{ color: '#CF222E' }}>OR</span> "React.js"<span style={{ color: '#CF222E' }}>)</span> <span style={{ color: '#CF222E' }}>AND</span> <span style={{ color: '#CF222E' }}>(</span>"Senior" <span style={{ color: '#CF222E' }}>OR</span> "Lead" <span style={{ color: '#CF222E' }}>OR</span> "Staff"<span style={{ color: '#CF222E' }}>)</span> <span style={{ color: '#CF222E' }}>AND</span> <span style={{ color: '#CF222E' }}>(</span>"Auckland" <span style={{ color: '#CF222E' }}>OR</span> "New Zealand" <span style={{ color: '#CF222E' }}>OR</span> "NZ"<span style={{ color: '#CF222E' }}>)</span> <span style={{ color: '#CF222E' }}>NOT</span> <span style={{ color: '#CF222E' }}>(</span>"junior" <span style={{ color: '#CF222E' }}>OR</span> "graduate"<span style={{ color: '#CF222E' }}>)</span>
                </div>
              </div>
              <div style={{ display: 'flex', gap: 10, fontSize: 11, color: '#57606A' }}>
                <span>Location: Auckland Region</span>
                <span>·</span>
                <span>Years: 5+</span>
                <span>·</span>
                <span>Open to work: Yes</span>
              </div>
              <div style={{
                marginTop: 14, padding: '8px 12px', background: '#FFF3D9', borderRadius: 6,
                fontSize: 12, color: '#6F4E00', border: '1px solid #F2CC6B',
              }}>
                ⚠ Used 847 of 1,000 monthly recruiter searches
              </div>
            </div>

            {/* Scout side */}
            <div style={{
              background: 'var(--cal-blue-ink)', borderRadius: 18, padding: 24,
              color: '#fff', position: 'relative',
              boxShadow: '0 30px 60px -30px rgba(0,9,182,0.4)',
            }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 18 }}>
                <div style={{
                  width: 28, height: 28, borderRadius: 6, background: 'rgba(255,255,255,0.15)',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                }}>
                  <CalStar size={16} grad={false} style={{ color: '#fff' }} />
                </div>
                <div style={{ fontSize: 13.5, fontWeight: 600 }}>Scout · plain English</div>
                <span style={{
                  fontSize: 10.5, fontWeight: 600, padding: '2px 8px', borderRadius: 999,
                  background: 'var(--cal-accent)', color: '#fff', marginLeft: 'auto',
                }}>INCLUDED</span>
              </div>
              <div style={{
                background: 'rgba(255,255,255,0.08)', borderRadius: 8, padding: 18,
                fontSize: 17, lineHeight: 1.5, minHeight: 180, marginBottom: 16,
                display: 'flex', alignItems: 'center',
              }}>
                <div>
                  "Senior accountant in Auckland with Xero experience."
                  <span className="cal-blink" style={{ color: 'var(--cal-accent)', marginLeft: 4 }}>|</span>
                </div>
              </div>
              <div style={{ display: 'flex', gap: 10, fontSize: 11, opacity: 0.7 }}>
                <span>2.4B profiles scanned</span>
                <span>·</span>
                <span>under 15 seconds</span>
                <span>·</span>
                <span>1,025 matches ranked</span>
              </div>
              <div style={{
                marginTop: 14, padding: '8px 12px', background: 'rgba(34,197,94,0.15)', borderRadius: 6,
                fontSize: 12, border: '1px solid rgba(34,197,94,0.3)',
              }}>
                ✓ Unlimited searches. No monthly cap.
              </div>
            </div>
          </div>
        </div>
      </section>

      {/* The live demo */}
      <LiveDemo
        eyebrow="Try Scout yourself"
        title={<>Brief it. <span style={{ fontFamily: 'var(--cal-serif)', fontStyle: 'italic', color: 'var(--cal-blue-ink)' }}>Watch it work.</span></>}
        sub="The real Caliber with a fictional agency pre-loaded. Open Scout from the left sidebar and type the role you're actually trying to fill."
      />

      {/* FAQ-lite / objections */}
      <section className="cal-section" style={{ padding: '120px 72px' }}>
        <div className="cal-container">
          <div style={{ maxWidth: 760, marginBottom: 48 }}>
            <div className="cal-eyebrow" style={{ marginBottom: 18 }}><span className="dot" /> "But what about…"</div>
            <h2>Yeah, we&rsquo;ve heard all the objections.</h2>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 20 }}>
            {[
              { q: '"We need LinkedIn for InMails."', a: 'Scout drafts outreach and sends via email, SMS, or WhatsApp — where candidates actually reply. LinkedIn response rates are 14% on average. Multi-channel Caliber outreach averages 41%.' },
              { q: '"Our clients ask for LinkedIn profiles."', a: 'Every Scout match links to the original public LinkedIn profile. You share the link. You just didn\'t pay NZ$12k/seat to find it.' },
              { q: '"We\'re mid-contract with LinkedIn."', a: 'When you switch to Caliber, our migration team buys out what\'s left on your LinkedIn Recruiter term, up to NZ$15k per seat.' },
              { q: '"Does Scout actually work?"', a: 'Scroll up. Cancel some seats. Then scroll further and try Scout in the live demo — using your own brief. We\'ll wait.' },
            ].map(o => (
              <div key={o.q} style={{
                background: 'var(--cal-bg-soft)', borderRadius: 18, padding: 24,
              }}>
                <div style={{ fontSize: 17, fontWeight: 500, marginBottom: 10, letterSpacing: '-0.01em' }}>{o.q}</div>
                <div style={{ fontSize: 14.5, color: 'var(--cal-body)', lineHeight: 1.55 }}>{o.a}</div>
              </div>
            ))}
          </div>
        </div>
      </section>

      <section className="cal-section" id="pricing" style={{ padding: '100px 72px', background: 'var(--cal-bg-soft)' }}>
        <div className="cal-container">
          <div style={{ textAlign: 'center', marginBottom: 48 }}>
            <div className="cal-eyebrow" style={{ marginBottom: 16 }}><span className="dot" /> Pricing</div>
            <h2 style={{ margin: '0 0 12px' }}>Caliber · still cheaper than LinkedIn alone.</h2>
          </div>
          <Pricing />
        </div>
      </section>

      <section className="cal-section" style={{ padding: '0 72px 120px' }}>
        <div className="cal-container">
          <CTABand
            title="Cancel the subscription. Place better candidates."
            sub="30 minutes with a specialist. We'll buy out your LinkedIn Recruiter term and have you running Scout before month-end."
            primary="Book a demo"
            secondary="Keep playing with the toy above"
          />
        </div>
      </section>

      <Footer />
    </div>
  );
}

Object.assign(window, { fireConfetti, ScoutVsLinkedIn, CancelLinkedInToy, VariantI });
