/* usovo vs ElevenLabs — SEO landing page targeting "cheapest voice generation" / "local voice generation" */
const DS = window.UsovoDesignSystem_db7cfc || {};
const { PillButton, Eyebrow, SectionHeader, FAQItem, CheckRow } = DS;
const IMG = p => `/assets/images/${p}`;
const DOWNLOAD_URL = '/download';

function Nav() {
  return (
    <nav className="usovo-nav" style={{ position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '16px 40px' }}>
      <a href="/" style={{ fontSize: 24, fontWeight: 500, letterSpacing: '-0.02em' }}>usovo</a>
      <div className="usovo-nav-links" style={{ position: 'absolute', left: '50%', top: '50%', transform: 'translate(-50%,-50%)', display: 'flex', gap: 32, fontSize: 18, opacity: 0.5 }}>
        <a href="/#studios">Studios</a><a href="/#local">Why local</a><a href="/#pricing">Pricing</a><a href="/#faq">FAQ</a>
      </div>
      <div style={{ display: 'flex', gap: 24, alignItems: 'center' }}>
        <a href="/#pricing" style={{ fontSize: 18, opacity: 0.5 }}>Sign in</a>
        <a href={DOWNLOAD_URL} title="Download for Mac" style={{ fontFamily: 'inherit', width: 48, height: 48, display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#000', color: '#FFF', border: '1px solid #000', borderRadius: '50%', cursor: 'pointer', fontSize: 22, lineHeight: 1, padding: 0 }}><span style={{ transform: 'translateY(3px)' }}>↓</span></a>
      </div>
    </nav>
  );
}

function Hero() {
  return (
    <header className="usovo-hero" style={{ padding: '40px 40px 0', textAlign: 'center' }}>
      <h1 className="usovo-hero-title" style={{ fontSize: 88, lineHeight: 0.95, fontWeight: 500, letterSpacing: '-0.03em', margin: '0 auto', maxWidth: '15ch' }}>Local voice generation. <em style={{ fontWeight: 400 }}>Unlimited</em>, for a flat $4/mo.</h1>
      <p className="usovo-hero-lede" style={{ fontSize: 22, lineHeight: 1.4, letterSpacing: '-0.01em', margin: '24px auto 0', opacity: 0.65, maxWidth: '52ch' }}>Traditional AI voice labs meter every character you generate. usovo runs voice generation locally on your Mac, so the cost isn't metered at all — it's the cheapest voice generation gets, because nothing is being rented.</p>
      <div className="usovo-hero-actions" style={{ display: 'flex', gap: 16, marginTop: 32, justifyContent: 'center' }}>
        <PillButton variant="dark" href={DOWNLOAD_URL}>Download for Mac</PillButton>
        <PillButton variant="outline" onClick={() => document.getElementById('compare').scrollIntoView({ behavior: 'smooth' })}>See the comparison</PillButton>
      </div>
    </header>
  );
}

function CompareTable() {
  const rows = [
    ['Pricing model', 'Flat monthly fee', 'Metered by character/credit'],
    ['Cheapest paid plan', '$4/mo — unlimited', '$6/mo — capped allowance'],
    ['121,000 characters of speech', 'Included (unlimited)', '≈ $22/mo (Creator plan)'],
    ['Where voice is generated', 'Your Mac, offline', 'ElevenLabs’ cloud'],
    ['Voice cloning', 'Included, never uploaded', 'Extra credits, uploaded to cloud'],
    ['Works with no internet', 'Yes', 'No'],
    ['Overage if you go over', 'Nothing — it’s local', 'Pay-per-character billing'],
  ];
  return (
    <section id="compare" className="usovo-section usovo-compare" style={{ padding: '112px 40px 0' }}>
      <SectionHeader align="center" eyebrow="Side by side" title="Why usovo is the cheapest voice generation" lede="Same 121,000-character month, two very different bills." />
      <div className="usovo-compare-box" style={{ background: '#FAF5F0', borderRadius: 32, padding: '16px 40px', maxWidth: 936, margin: '56px auto 0' }}>
        <div className="usovo-compare-head" style={{ display: 'grid', gridTemplateColumns: '1fr 200px 200px', gap: '0 24px', padding: '16px 0', borderBottom: '1px solid #E9E2D6', fontSize: 12, letterSpacing: '0.02em', textTransform: 'uppercase', opacity: 0.45 }}><span></span><span>usovo</span><span>ElevenLabs</span></div>
        {rows.map(([label, us, them]) => (
          <div key={label} className="usovo-compare-row" style={{ display: 'grid', gridTemplateColumns: '1fr 200px 200px', gap: '0 24px', padding: '16px 0', borderBottom: '1px solid #E9E2D6', fontSize: 17, alignItems: 'baseline' }}>
            <span>{label}</span><span style={{ color: '#5B6E2C', fontWeight: 500 }}>{us}</span><span style={{ opacity: 0.45 }}>{them}</span>
          </div>
        ))}
      </div>
      <p style={{ fontSize: 13, opacity: 0.4, textAlign: 'center', margin: '16px auto 0', maxWidth: 936 }}>ElevenLabs figures are its published plan pricing and standard-model credit rates as of August 2026 and may change — check elevenlabs.io/pricing for current rates.</p>
    </section>
  );
}

function WhyCheaper() {
  const cells = [
    ['No cloud, no per-character bill', 'ElevenLabs charges by the credit because every voice is generated on their servers. usovo generates on your Mac, so there’s no server cost to pass on to you.'],
    ['Unlimited is the plan, not an add-on', 'Flat $4/mo covers speech, voice cloning and long-form audio without a credit meter running underneath it.'],
    ['Voice cloning without the upload', 'Cloning a voice locally means your sample never leaves your disk — and there’s no separate cloning credit cost either.'],
    ['Works offline, so nothing throttles', 'Queue a night of generation and it just runs. No rate limit tied to your plan tier.'],
  ];
  return (
    <section className="usovo-section" style={{ padding: '128px 40px 0' }}>
      <div className="usovo-whylocal-grid" style={{ display: 'grid', gridTemplateColumns: '5fr 7fr', gap: 80 }}>
        <div>
          <Eyebrow>How it stays cheap</Eyebrow>
          <h2 style={{ fontSize: 56, lineHeight: 0.95, fontWeight: 500, letterSpacing: '-0.03em', margin: '24px 0 0' }}>Local voice generation removes the bill, not just shrinks it.</h2>
        </div>
        <div className="usovo-whylocal-cells" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '40px 48px' }}>
          {cells.map(([h, b]) => (
            <div key={h} style={{ borderTop: '1px solid #E2E2E2', paddingTop: 24 }}>
              <h3 style={{ fontSize: 22, fontWeight: 500, letterSpacing: '-0.02em', margin: 0 }}>{h}</h3>
              <p style={{ fontSize: 15, lineHeight: 1.4, opacity: 0.6, margin: '8px 0 0' }}>{b}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function DarkCTA() {
  return (
    <section className="usovo-darkcta" style={{ margin: '128px 16px 0', position: 'relative', overflow: 'hidden', borderRadius: 32 }}>
      <img className="usovo-darkcta-img" src={IMG('car-field.png')} alt="Painting: a blue car in a field of flowers" style={{ display: 'block', width: '100%', height: 480, objectFit: 'cover', objectPosition: '50% 62%', filter: 'brightness(0.6)' }} />
      <div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', textAlign: 'center', padding: '0 40px' }}>
        <h2 className="usovo-darkcta-title" style={{ fontSize: 72, lineHeight: 0.9, fontWeight: 500, letterSpacing: '-0.03em', color: '#FCFAF7', margin: 0 }}>Stop renting your voice.</h2>
        <p style={{ fontSize: 18, color: 'rgba(252,250,247,0.8)', margin: '16px 0 0', maxWidth: '42ch' }}>Free tier is unlimited. Studio is $4/mo, flat, forever.</p>
        <div style={{ display: 'flex', gap: 16, marginTop: 32 }}>
          <PillButton variant="paper" href={DOWNLOAD_URL}>Download for Mac — Apple silicon</PillButton>
        </div>
      </div>
    </section>
  );
}

const FAQS = [
  ['Is usovo actually cheaper than ElevenLabs?', 'Yes. usovo’s Studio plan is a flat $4/mo with unlimited generation. ElevenLabs bills by character/credit — a comparable month of speech (roughly 121,000 characters) runs about $22/mo on ElevenLabs’ Creator plan, and more if you go over.'],
  ['What does "local voice generation" mean?', 'Every model runs on your own Mac — nothing is uploaded to a server to be processed. That’s what removes the per-character billing: there’s no cloud compute cost to meter.'],
  ['Does usovo work without an internet connection?', 'Yes, fully offline once the models are downloaded. ElevenLabs requires a connection because generation happens on its servers.'],
  ['Is voice cloning included?', 'Voice cloning is included on usovo’s Studio plan with no extra credits, and the sample never leaves your disk. ElevenLabs charges cloning against your credit balance.'],
  ['Is there a free plan?', 'Yes — usovo’s Free plan is unlimited speech and sound effects, forever, no credit card. ElevenLabs’ free plan caps out at 10,000 characters/month.'],
];

function FAQ() {
  return (
    <section id="faq" className="usovo-section" style={{ padding: '128px 40px' }}>
      <div className="usovo-faq-grid" style={{ display: 'grid', gridTemplateColumns: '5fr 7fr', gap: 80 }}>
        <div>
          <Eyebrow>FAQ</Eyebrow>
          <h2 style={{ fontSize: 56, lineHeight: 0.95, fontWeight: 500, letterSpacing: '-0.03em', margin: '24px 0 0' }}>Cost questions, answered</h2>
        </div>
        <div>{FAQS.map(([q, a], i) => <FAQItem key={q} q={q} a={a} defaultOpen={i === 0} />)}</div>
      </div>
    </section>
  );
}

function Footer() {
  return (
    <footer className="usovo-footer" style={{ background: '#161A0A', color: 'rgba(252,250,247,0.6)', position: 'relative', overflow: 'hidden', borderRadius: 32, margin: 16 }}>
      <div className="usovo-footer-inner" style={{ padding: '64px 40px' }}>
        <h2 className="usovo-footer-title" style={{ fontSize: 56, lineHeight: 0.9, fontWeight: 500, letterSpacing: '-0.03em', color: '#FCFAF7', margin: 0 }}>Own. Use.<br />usovo.</h2>
        <p style={{ fontSize: 15, margin: '32px 0 0' }}><a href="/" style={{ color: 'rgba(252,250,247,0.6)' }}>&larr; Back to usovo.in</a></p>
      </div>
    </footer>
  );
}

function VsElevenLabs() {
  return (
    <div data-screen-label="usovo vs ElevenLabs" className="usovo-page" style={{ width: 1440, margin: '0 auto', background: '#FCFAF7' }}>
      <Nav />
      <Hero />
      <CompareTable />
      <WhyCheaper />
      <DarkCTA />
      <FAQ />
      <Footer />
    </div>
  );
}
window.VsElevenLabs = VsElevenLabs;
