/* =====================================================================
   1,000 VIRAL HOOKS — interactive app
===================================================================== */

const { useState, useEffect, useRef, useMemo, useCallback } = React;

/* ── Category metadata ─────────────────────────────────────────────── */
const CATS = [
  {
    id: 'EDUCATIONAL',
    icon: '🎓',
    label: 'Educational',
    desc: 'Teach something specific. The most versatile and reusable category — works in every niche, every platform.',
    inspo: { text: '"This represents your # before, during, and after #" — one of the most saved formats on Instagram. Visualise progress in 3 stages.', link: 'https://www.instagram.com/p/C-ta_pvhfvK/' }
  },
  {
    id: 'STORYTELLING',
    icon: '📖',
    label: 'Storytelling',
    desc: 'Personal story hooks drive the highest watch-time of any category. Make them feel like they walked in on a conversation.',
    inspo: { text: '"I started my [business] when I was [age] with [starting amount]" — grabs instantly because it implies a journey worth watching to the end.', link: 'https://www.instagram.com/p/C9GHw6MO48j/' }
  },
  {
    id: 'MYTH BUSTING',
    icon: '💥',
    label: 'Myth Busting',
    desc: 'Challenge a belief everyone holds. Gets comments from both people who agree and people who don\'t. Maximum controversy, minimum effort.',
    inspo: { text: '"[item] [fact], [opposite item] [similar fact]" — the contrast format. Gets shared because people can\'t believe it.', link: 'https://www.instagram.com/reel/C_bBILMsNzh/' }
  },
  {
    id: 'COMPARISON',
    icon: '⚖️',
    label: 'Comparison',
    desc: 'This vs that. Instantly triggers opinion and debate. Viewers watch to the end to see which one wins.',
    inspo: { text: '"This [noun] and this [noun] have the same amount of [noun]" — comparison hooks make people stop because they feel like a quiz.', link: 'https://www.instagram.com/fitfoodieliving/reel/DBHpSdgRdvh/' }
  },
  {
    id: 'AUTHORITY',
    icon: '🏆',
    label: 'Authority',
    desc: 'Lead with a result. Your proof is the hook. These build credibility faster than any other hook type.',
    inspo: { text: '"My [before state] used to look like this and now they look like this" — transformation hooks are the gold standard for authority builders.', link: 'https://www.instagram.com/reel/DE7cjKBNcY4/' }
  },
  {
    id: 'DAY IN THE LIFE',
    icon: '📅',
    label: 'Day in the Life',
    desc: 'Aspirational and relatable at once. Works especially well for personal brands — people want to see the life behind the content.',
    inspo: { text: '"We all have the same 24 hours in a day — here I am putting my 24 hours to work." The guilt trip that actually works.', link: 'https://www.instagram.com/reel/DAq-UDcITU5/' }
  },
  {
    id: 'RANDOM',
    icon: '⚡',
    label: 'Random / Pattern Interrupt',
    desc: 'Completely unexpected hooks that stop the scroll through pure confusion or curiosity. High risk, very high reward.',
    inspo: { text: '"You\'re losing your boyfriend/girlfriend this week to [event/hobby]" — pattern interrupt. Nobody expects it. Everyone watches.', link: 'https://www.instagram.com/p/C_d78KaSl4e/' }
  },
];

/* ── Niche fill data ───────────────────────────────────────────────── */
const NICHES = [
  {
    id: 'fitness', label: 'Fitness', emoji: '🏋️',
    action: 'train consistently',
    item: 'a workout plan',
    noun: 'nutrition',
    result: 'lose body fat',
    dream_result: 'your dream physique',
    pain_point: 'stuck at the same weight for months',
    target_audience: 'fitness beginners',
    thing: 'training',
    skill: 'discipline',
    before_state: 'overweight and out of shape',
    after_state: 'lean and fit',
    time: '90 days',
    age: '30',
    number: '10',
    goal: 'build muscle',
    industry: 'fitness',
    title: 'personal trainer',
    person: 'client',
    location: 'the gym',
    business: 'fitness coaching business',
    event: 'a bulk phase',
    option1: 'cardio',
    option2: 'weight training',
    fact: 'burns 300 calories an hour',
    quote: '"Just start, even when you don\'t feel like it."',
    transformation: 'physique',
    activity: 'working out',
  },
  {
    id: 'trading', label: 'Trading', emoji: '📈',
    action: 'enter a trade',
    item: 'a high-probability setup',
    noun: 'a setup',
    result: 'make consistent profits',
    dream_result: 'financial freedom through trading',
    pain_point: 'blowing your account on bad trades',
    target_audience: 'retail traders',
    thing: 'a trading strategy',
    skill: 'risk management',
    before_state: 'losing money every month',
    after_state: 'consistently profitable',
    time: '6 months',
    age: '25',
    number: '3',
    goal: 'trade profitably',
    industry: 'trading',
    title: 'trader',
    person: 'mentor',
    location: 'the charts',
    business: 'trading account',
    event: 'a losing streak',
    option1: 'technical analysis',
    option2: 'price action',
    fact: 'has a 70% win rate',
    quote: '"The market will teach you discipline one way or another."',
    transformation: 'account balance',
    activity: 'entering a trade',
  },
  {
    id: 'business', label: 'Business', emoji: '💼',
    action: 'close a deal',
    item: 'a proven offer',
    noun: 'an offer',
    result: 'hit $10K/month',
    dream_result: 'a profitable, scalable business',
    pain_point: 'working 80 hours a week with no traction',
    target_audience: 'entrepreneurs and founders',
    thing: 'offer creation',
    skill: 'sales',
    before_state: 'stuck at $0',
    after_state: 'making consistent $10K months',
    time: '60 days',
    age: '28',
    number: '5',
    goal: 'build a 6-figure business',
    industry: 'business',
    title: 'entrepreneur',
    person: 'client',
    location: 'a sales call',
    business: 'agency',
    event: 'a slow month',
    option1: 'freelancing',
    option2: 'productized service',
    fact: 'converts at 40%',
    quote: '"Build the business you wish existed."',
    transformation: 'revenue',
    activity: 'scaling up',
  },
  {
    id: 'realestate', label: 'Real Estate', emoji: '🏠',
    action: 'analyse a deal',
    item: 'a rental property',
    noun: 'a deal',
    result: 'build passive income',
    dream_result: 'a portfolio of cash-flowing properties',
    pain_point: 'overpaying for a bad deal',
    target_audience: 'first-time property investors',
    thing: 'property analysis',
    skill: 'deal sourcing',
    before_state: 'renting with no equity',
    after_state: 'owning income-producing assets',
    time: '12 months',
    age: '32',
    number: '3',
    goal: 'buy your first investment property',
    industry: 'real estate',
    title: 'real estate investor',
    person: 'seller',
    location: 'an open house',
    business: 'property portfolio',
    event: 'a market downturn',
    option1: 'buying to live in',
    option2: 'buying to rent out',
    fact: 'cash flows $500/month',
    quote: '"The best time to buy real estate was yesterday."',
    transformation: 'property',
    activity: 'a renovation',
  },
  {
    id: 'mindset', label: 'Mindset', emoji: '🧠',
    action: 'build a daily routine',
    item: 'a morning habit',
    noun: 'discipline',
    result: 'transform your life',
    dream_result: 'the life you actually want',
    pain_point: 'feeling stuck and unmotivated',
    target_audience: 'people working on personal growth',
    thing: 'self-discipline',
    skill: 'consistency',
    before_state: 'stuck in a cycle of procrastination',
    after_state: 'living with purpose and clarity',
    time: '30 days',
    age: '26',
    number: '5',
    goal: 'become the best version of yourself',
    industry: 'self-development',
    title: 'coach',
    person: 'mentor',
    location: 'a quiet morning',
    business: 'personal development journey',
    event: 'a setback',
    option1: 'motivation',
    option2: 'discipline',
    fact: 'rewires your brain in 21 days',
    quote: '"We are what we repeatedly do."',
    transformation: 'mindset',
    activity: 'starting a new habit',
  },
  {
    id: 'food', label: 'Food', emoji: '🍳',
    action: 'cook from scratch',
    item: 'a healthy recipe',
    noun: 'a recipe',
    result: 'eat better without spending more',
    dream_result: 'a healthy lifestyle that actually sticks',
    pain_point: 'spending $200/week on takeout',
    target_audience: 'busy people who want to eat better',
    thing: 'meal prep',
    skill: 'cooking',
    before_state: 'ordering food every night',
    after_state: 'cooking healthy meals in under 20 minutes',
    time: '1 week',
    age: '29',
    number: '5',
    goal: 'eat healthier on a budget',
    industry: 'food and lifestyle',
    title: 'home cook',
    person: 'foodie',
    location: 'your kitchen',
    business: 'food blog',
    event: 'a dinner party',
    option1: 'meal prep',
    option2: 'eating out',
    fact: 'costs $2 per serving',
    quote: '"You are what you eat."',
    transformation: 'meal',
    activity: 'meal prep',
  },
];

/* ── Smart fill function ────────────────────────────────────────────── */
function fillHook(template, niche) {
  let t = template;
  const n = niche;

  const replacements = [
    // New specific fields first
    [/\[your transformation\]/gi,         n.transformation],
    [/\[your activity\]/gi,               n.activity],

    // Compound placeholders (most specific first to avoid partial matches)
    [/\[your action\/item\]/gi,           n.item],
    [/\[your item\/action\]/gi,           n.item],
    [/\[your item\/result\]/gi,           n.result],
    [/\[your object\/item\]/gi,           n.item],
    [/\[your product\/service\]/gi,       n.item],
    [/\[your event\/hobby\]/gi,           n.event],
    [/\[your event\/item\/result\]/gi,    n.item],
    [/\[your event\/location\]/gi,        n.location],
    [/\[your location\/place\]/gi,        n.location],
    [/\[your skill\/niche\]/gi,           n.industry],
    [/\[your industry\/niche\]/gi,        n.industry],
    [/\[your niche\/industry\]/gi,        n.industry],
    [/\[your person\/persons\]/gi,        `your community`],
    [/\[your trait\/traits\]/gi,          `expensive and unnecessary`],
    [/\[your age group or range\]/gi,     `your 20s or 30s`],
    [/\[your age group\]/gi,              `your 20s`],
    [/\[your age range\]/gi,              `your late 20s or early 30s`],
    [/\[your # of [^\]]+\]/gi,            n.dream_result],

    // Dream result (before singular)
    [/\[your dream results\]/gi,          n.dream_result],
    [/\[your dream result\]/gi,           n.dream_result],
    [/\[your dream goal\]/gi,             n.dream_result],

    // States
    [/\[your before state\]/gi,           n.before_state],
    [/\[your current state\]/gi,          n.before_state],
    [/\[your after state\]/gi,            n.after_state],

    // Core single placeholders
    [/\[your mind blowing method\]/gi,    `in a way most people overlook`],
    [/\[your pain point\]/gi,             n.pain_point],
    [/\[your target audience\]/gi,        n.target_audience],
    [/\[your action\]/gi,                 n.action],
    [/\[your result\]/gi,                 n.result],
    [/\[your item\]/gi,                   n.item],
    [/\[your noun\]/gi,                   n.noun],
    [/\[your thing\]/gi,                  n.thing],
    [/\[your skill\]/gi,                  n.skill],
    [/\[your industry\]/gi,               n.industry],
    [/\[your niche\]/gi,                  n.industry],
    [/\[your goal\]/gi,                   n.goal],
    [/\[your title\]/gi,                  n.title],
    [/\[your label\]/gi,                  n.title],
    [/\[your occupation\]/gi,             n.title],
    [/\[your job title\]/gi,              n.title],
    [/\[your description\]/gi,            `dedicated ${n.title}`],
    [/\[your person\]/gi,                 n.person],
    [/\[your persons\]/gi,                `people around you`],
    [/\[your location\]/gi,               n.location],
    [/\[your business\]/gi,               n.business],
    [/\[your event\]/gi,                  n.event],
    [/\[your option #1\]/gi,              n.option1],
    [/\[your option #2\]/gi,              n.option2],
    [/\[your fact\]/gi,                   n.fact],
    [/\[your similar fact\]/gi,           n.fact],
    [/\[your complete opposite item\]/gi, n.option2],
    [/\[your quote\]/gi,                  n.quote],
    [/\[your adjective\]/gi,              `experienced`],
    [/\[your trait\]/gi,                  `successful`],
    [/\[your starting amount\]/gi,        `very little money`],
    [/\[your \$\]/gi,                     `very little money`],
    [/\[your time frame\]/gi,             n.time],
    [/\[your period of time\]/gi,         n.time],
    [/\[your weeks\]/gi,                  `12 weeks`],
    [/\[your age\]/gi,                    n.age],
    [/\[your #\]/gi,                      n.number],
    [/\[your large number\]/gi,           `millions`],
    [/\[your random action\]/gi,          `reacting to ${n.item}`],
    [/\[your scenario\]/gi,               `you only have 30 days`],
    [/\[your product\]/gi,                n.item],
    [/\[your guilty pleasure\]/gi,        `doing it the easy way`],
    [/\[your common belief\]/gi,          `the conventional wisdom`],
    [/\[your avenue\]/gi,                 `consistency and the right strategy`],
    [/\[your work\]/gi,                   `content`],
    [/\[your state\]/gi,                  n.before_state],
    // Year placeholders
    [/\[your current year\]/gi,           `2026`],
    [/\[your last year\]/gi,              `2025`],
    [/\[your year\]/gi,                   `2026`],
    // Age shorthand
    [/your 20's, 30's, 40's, 50's, 60's, etc/gi, `20s, 30s, or 40s`],
    // Bare # = a count number (NOT a niche metric — use n.number via [your #] above)
    [/#/g,                                `3`],
  ];

  for (const [pattern, value] of replacements) {
    t = t.replace(pattern, value);
  }
  return t;
}

/* ── Per-page size ─────────────────────────────────────────────────── */
const PAGE_SIZE = 50;

/* ── Copy helper ───────────────────────────────────────────────────── */
function copyText(text) {
  navigator.clipboard.writeText(text).catch(() => {
    const ta = document.createElement('textarea');
    ta.value = text;
    document.body.appendChild(ta);
    ta.select();
    document.execCommand('copy');
    document.body.removeChild(ta);
  });
}

/* ── Highlight match ───────────────────────────────────────────────── */
function Highlighted({ text, query }) {
  if (!query) return <span>{text}</span>;
  const escaped = query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  const parts = text.split(new RegExp(`(${escaped})`, 'gi'));
  return (
    <span>
      {parts.map((p, i) =>
        p.toLowerCase() === query.toLowerCase()
          ? <mark key={i}>{p}</mark>
          : p
      )}
    </span>
  );
}

/* ── Single hook card ──────────────────────────────────────────────── */
function HookCard({ hook, idx, query }) {
  const [copied, setCopied] = useState(false);
  const [showEx, setShowEx] = useState(false);

  const doCopy = () => {
    copyText(hook.t);
    setCopied(true);
    setTimeout(() => setCopied(false), 2000);
  };

  return (
    <div className={'hook-card' + (showEx ? ' is-open' : '')}>
      {/* Row 1: number + text */}
      <div className="hook-card-top">
        <span className="hook-card-num">{idx}</span>
        <span className="hook-card-text">
          <Highlighted text={hook.t} query={query} />
        </span>
      </div>
      {/* Row 2: action buttons — always below, full width */}
      <div className="hook-card-actions">
        <button
          className={'btn-copy' + (copied ? ' copied' : '')}
          onClick={doCopy}
        >
          {copied ? '✓ Copied' : 'Copy'}
        </button>
        {hook.l && (
          <a
            className="btn-inspo"
            href={hook.l}
            target="_blank"
            rel="noopener noreferrer"
          >
            Inspo ↗
          </a>
        )}
        <button
          className={'btn-ex' + (showEx ? ' is-open' : '')}
          onClick={() => setShowEx(v => !v)}
        >
          {showEx ? 'Hide Examples' : 'See Examples'}
        </button>
      </div>

      {showEx && (
        <div className="examples-panel">
          <div className="examples-label">↳ Niche Examples</div>
          <div className="examples-grid">
            {NICHES.map(niche => (
              <div className="example-row" key={niche.id}>
                <span className="example-niche">
                  <span className="example-niche-emoji">{niche.emoji}</span>
                  {niche.label}
                </span>
                <span className="example-text">{fillHook(hook.t, niche)}</span>
              </div>
            ))}
          </div>
        </div>
      )}
    </div>
  );
}

/* ── Inspo banner for category ─────────────────────────────────────── */
function InspoBanner({ catId }) {
  const cat = CATS.find(c => c.id === catId);
  if (!cat) return null;
  return (
    <div className="inspo-banner">
      <span className="inspo-banner-icon">✦</span>
      <div>
        <div className="inspo-banner-label">Inspo Hook</div>
        <div className="inspo-banner-text">{cat.inspo.text}</div>
        {cat.inspo.link && (
          <a className="inspo-link" href={cat.inspo.link} target="_blank" rel="noopener noreferrer">
            See real example on Instagram ↗
          </a>
        )}
      </div>
    </div>
  );
}

/* ── Main App ──────────────────────────────────────────────────────── */
function App() {
  const [activeCat, setActiveCat] = useState('ALL');
  const [query, setQuery] = useState('');
  const [page, setPage] = useState(1);
  const mainRef = useRef(null);

  // Build flat list of all hooks with category tag
  const allHooks = useMemo(() => {
    const out = [];
    for (const cat of CATS) {
      const hooks = HOOKS_DATA[cat.id] || [];
      hooks.forEach(h => out.push({ ...h, cat: cat.id }));
    }
    return out;
  }, []);

  const totalAll = allHooks.length;

  // Filter by category + search
  const filtered = useMemo(() => {
    let list = activeCat === 'ALL' ? allHooks : allHooks.filter(h => h.cat === activeCat);
    if (query.trim()) {
      const q = query.toLowerCase();
      list = list.filter(h => h.t.toLowerCase().includes(q));
    }
    return list;
  }, [allHooks, activeCat, query]);

  const totalPages = Math.ceil(filtered.length / PAGE_SIZE);
  const pageHooks = filtered.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);

  const switchCat = useCallback((id) => {
    setActiveCat(id);
    setPage(1);
  }, []);

  const switchPage = (p) => {
    setPage(p);
    window.scrollTo({ top: mainRef.current?.offsetTop - 130 || 0, behavior: 'smooth' });
  };

  // Reset page on filter/search change
  useEffect(() => { setPage(1); }, [query, activeCat]);

  // Reveal animation
  useEffect(() => {
    const els = document.querySelectorAll('[data-reveal]');
    const obs = new IntersectionObserver(
      entries => entries.forEach(e => e.isIntersecting && e.target.classList.add('is-visible')),
      { threshold: 0.1 }
    );
    els.forEach(el => obs.observe(el));
    return () => obs.disconnect();
  }, []);

  const activeCatMeta = CATS.find(c => c.id === activeCat);
  const showingFrom = (page - 1) * PAGE_SIZE + 1;
  const showingTo = Math.min(page * PAGE_SIZE, filtered.length);

  // Build page numbers
  const pageNums = [];
  if (totalPages <= 7) {
    for (let i = 1; i <= totalPages; i++) pageNums.push(i);
  } else {
    pageNums.push(1);
    if (page > 3) pageNums.push('...');
    for (let i = Math.max(2, page - 1); i <= Math.min(totalPages - 1, page + 1); i++) pageNums.push(i);
    if (page < totalPages - 2) pageNums.push('...');
    pageNums.push(totalPages);
  }

  return (
    <div>
      {/* Top bar */}
      <header className="topbar">
        <a href="https://www.orcalynx.com/" className="topbar-brand">
          <span className="topbar-brand-dot" />
          <span>@Marketing.Shekhar</span>
        </a>
        <div className="topbar-search">
          <span className="topbar-search-icon">🔍</span>
          <input
            className="topbar-search-input"
            type="text"
            placeholder="Search hooks…"
            value={query}
            onChange={e => setQuery(e.target.value)}
          />
        </div>
        <span className="topbar-count">{totalAll.toLocaleString()} hooks</span>
      </header>

      {/* Hero */}
      <div className="hero" data-reveal>
        <div className="hero-tag">✦ Free Resource by Orcalynx</div>
        <h1 className="hero-title">
          1,000+ <em>Viral Hooks</em><br />
          for short-form content.
        </h1>
        <p className="hero-sub">
          Every hook template is a proven format from real viral content — with niche examples for Fitness, Trading, Business, Real Estate, Mindset, and Food. Copy, adapt, and post.
        </p>
        <div className="hero-stats">
          {[
            [totalAll.toLocaleString(), 'Hook Templates'],
            ['7', 'Categories'],
            ['6', 'Niche Examples'],
            ['1K+', 'Inspo Links'],
          ].map(([num, label]) => (
            <div className="hero-stat" key={label}>
              <div className="hero-stat-num">{num}</div>
              <div className="hero-stat-label">{label}</div>
            </div>
          ))}
        </div>
        <div className="hero-sig">
          <div className="hero-sig-av">S</div>
          <span>Shekhar Shrestha · Orcalynx · 2026</span>
        </div>
      </div>

      {/* Hero CTA strip */}
      <div className="hero-cta-strip">
        <a className="btn-primary" href="https://www.orcalynx.com/book" target="_blank" rel="noopener">
          Book a Free Call →
        </a>
        <a className="btn-ghost" href="https://wa.me/9779811015121" target="_blank" rel="noopener">
          💬 WhatsApp Me
        </a>
        <span className="hero-cta-sep" />
        <a className="hero-cta-link" href="https://www.orcalynx.com/" target="_blank" rel="noopener">orcalynx.com ↗</a>
        <a className="hero-cta-link" href="https://www.orcalynx.com/results" target="_blank" rel="noopener">Client Results ↗</a>
        <a className="hero-cta-link" href="https://www.orcalynx.com/playbook" target="_blank" rel="noopener">Instagram Playbook ↗</a>
        <a className="hero-cta-link" href="https://www.orcalynx.com/content-guide" target="_blank" rel="noopener">Content Formula ↗</a>
      </div>

      {/* Category tabs */}
      <nav className="cat-tabs">
        <button
          className={'cat-tab' + (activeCat === 'ALL' ? ' is-on' : '')}
          onClick={() => switchCat('ALL')}
        >
          All Hooks
          <span className="cat-tab-count">{totalAll}</span>
        </button>
        {CATS.map(c => {
          const count = (HOOKS_DATA[c.id] || []).length;
          return (
            <button
              key={c.id}
              className={'cat-tab' + (activeCat === c.id ? ' is-on' : '')}
              onClick={() => switchCat(c.id)}
            >
              {c.icon} {c.label}
              <span className="cat-tab-count">{count}</span>
            </button>
          );
        })}
      </nav>

      {/* Main content */}
      <main className="main" ref={mainRef}>

        {/* Category header */}
        <div className="section-head" data-reveal>
          <div className="section-eyebrow">
            {activeCat === 'ALL' ? 'All Categories' : activeCatMeta?.label}
          </div>
          <h2 className="section-title">
            {activeCat === 'ALL'
              ? <>The full <em>hook library</em></>
              : <>{activeCatMeta?.icon} <em>{activeCatMeta?.label}</em> Hooks</>
            }
          </h2>
          <p className="section-desc">
            {activeCat === 'ALL'
              ? 'All 1,000+ hook templates across every category. Use the tabs above to filter by type, or search for a specific format.'
              : activeCatMeta?.desc
            }
          </p>
          {filtered.length > 0 && (
            <div className="section-count">
              {query ? `${filtered.length} matching "${query}"` : `${filtered.length} hooks`}
              {filtered.length > PAGE_SIZE && ` · showing ${showingFrom}–${showingTo}`}
            </div>
          )}
        </div>

        {/* Inspo banner (single category only) */}
        {activeCat !== 'ALL' && !query && <InspoBanner catId={activeCat} />}

        {/* Hook list */}
        {pageHooks.length > 0 ? (
          <div className="hooks-list">
            {pageHooks.map((hook, i) => (
              <HookCard
                key={hook.t.slice(0, 40) + i}
                hook={hook}
                idx={(page - 1) * PAGE_SIZE + i + 1}
                query={query}
              />
            ))}
          </div>
        ) : (
          <div className="empty">
            <div className="empty-icon">🔍</div>
            <div className="empty-title">No hooks found</div>
            <div className="empty-sub">Try a different search term or category</div>
          </div>
        )}

        {/* Pagination */}
        {totalPages > 1 && (
          <div className="pagination">
            <button className="page-btn" onClick={() => switchPage(page - 1)} disabled={page === 1}>‹</button>
            {pageNums.map((p, i) =>
              p === '...'
                ? <span key={'e' + i} className="page-info">…</span>
                : (
                  <button
                    key={p}
                    className={'page-btn' + (p === page ? ' is-on' : '')}
                    onClick={() => switchPage(p)}
                  >{p}</button>
                )
            )}
            <button className="page-btn" onClick={() => switchPage(page + 1)} disabled={page === totalPages}>›</button>
          </div>
        )}

        {/* CTA */}
        <div className="cta-section" data-reveal>
          <div className="cta-tag">✦ Want the full system?</div>
          <h3 className="cta-title">Hooks are step one.<br/><em>Let's build the whole machine.</em></h3>
          <p className="cta-sub">
            We handle scripts, editing, posting, and growth strategy — done for you every month. Founders, coaches, and traders who want a premium personal brand without spending hours on content.
          </p>
          <div className="cta-btns">
            <a className="btn-primary" href="https://www.orcalynx.com/book" target="_blank" rel="noopener">
              Book a Free Strategy Call →
            </a>
            <a className="btn-ghost" href="https://wa.me/9779811015121" target="_blank" rel="noopener">
              💬 WhatsApp
            </a>
          </div>
          <div className="cta-links">
            <a className="cta-pill" href="https://www.orcalynx.com/" target="_blank" rel="noopener">orcalynx.com ↗</a>
            <a className="cta-pill" href="https://www.orcalynx.com/results" target="_blank" rel="noopener">Client Results ↗</a>
            <a className="cta-pill" href="https://www.orcalynx.com/playbook" target="_blank" rel="noopener">Instagram Playbook ↗</a>
            <a className="cta-pill" href="https://www.orcalynx.com/content-guide" target="_blank" rel="noopener">Content Formula ↗</a>
          </div>
        </div>
      </main>
    </div>
  );
}

const root = ReactDOM.createRoot(document.getElementById('app'));
root.render(<App />);
