/* bloo.app — Adaptive Code Review product funnel. */
(function () {
const { Button, Badge, Card, Tag, Alert } = window.BlooAppDesignSystem_ab7292;
const { PRODUCT, REGION, LINKS, EXT, Icons, S, routeHref, trackEvent, getAttribution } = window.Site;
const { useT } = window.I18n;
const { IconCode, IconLayers, IconUsers, IconTarget, IconCheck, IconSpark, IconTrendUp, IconArrow } = Icons;

const P = {
  hero: { background: 'linear-gradient(180deg, var(--blue-50) 0%, var(--surface-card) 100%)', paddingTop: 70, paddingBottom: 80 },
  heroInner: { display: 'flex', flexDirection: 'column', gap: 18, alignItems: 'flex-start', maxWidth: 820 },
  h1: { fontFamily: 'var(--font-display)', fontWeight: 500, fontSize: 54, lineHeight: 1.06, letterSpacing: '-.03em', color: 'var(--text-strong)', margin: 0, textWrap: 'balance' },
  lede: { fontSize: 19, lineHeight: 1.58, color: 'var(--text-body)', maxWidth: 680, margin: 0 },
  trust: { fontSize: 13.5, lineHeight: 1.55, color: 'var(--text-muted)', maxWidth: 680, margin: 0 },
  grid5: { display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gap: 14 },
  grid3: { display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 20 },
  grid2: { display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 20 },
  split: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 42, alignItems: 'start' },
  mono: { fontFamily: 'var(--font-mono)', fontSize: 11, letterSpacing: '.09em', color: 'var(--text-subtle)', textTransform: 'uppercase' },
  list: { listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: 12 },
  code: { background: 'var(--surface-inverse)', color: 'rgba(255,255,255,.84)', padding: '18px 20px', borderRadius: 'var(--radius-md)', fontFamily: 'var(--font-mono)', fontSize: 12.5, lineHeight: 1.7, overflowX: 'auto', margin: 0 },
  finding: { display: 'grid', gridTemplateColumns: '132px 1fr', gap: 16, alignItems: 'baseline' },
  price: { fontFamily: 'var(--font-display)', fontWeight: 600, fontSize: 42, letterSpacing: '-.02em', color: 'var(--text-strong)' },
  cohort: { maxWidth: 860, margin: '0 auto', display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 20 },
};

function cohortMailto(t) {
  const subject = encodeURIComponent(t(`Founding cohort — ${PRODUCT.name}`, `Coorte fundadora — ${PRODUCT.name}`));
  const body = encodeURIComponent(t(
    'Hi Bruno,\n\nTeam size:\nAI tool (Claude, Cursor, or Copilot):\nTypical stack:\nCan the team test on real pull requests?\nInterested as: research partner / paid pilot\n\nAnything else:',
    'Oi Bruno,\n\nTamanho do time:\nFerramenta de IA (Claude, Cursor ou Copilot):\nStack principal:\nO time pode testar em pull requests reais?\nInteresse como: parceiro de pesquisa / piloto pago\n\nMais algum contexto:'
  ));
  return `mailto:${LINKS.companyEmail}?subject=${subject}&body=${body}`;
}

function CheckoutReturnBanner() {
  const { t } = useT();
  const [visible, setVisible] = React.useState(false);
  React.useEffect(() => {
    const params = new URLSearchParams(window.location.search);
    if (params.get('checkout') === 'success') {
      setVisible(true);
      trackEvent('checkout_returned', { plan: params.get('plan') === 'pilot' ? 'pilot' : 'license', market: REGION.market });
    }
  }, []);
  if (!visible) return null;
  return (
    <section style={{ ...S.section, paddingTop: 24, paddingBottom: 0 }}>
      <div style={S.container} className="site-container">
        <Alert tone="success" title={t('Checkout submitted', 'Checkout enviado')}>
          {t('Stripe is the source of truth for the payment. Access is delivered only after Stripe confirms payment, including delayed methods such as Pix when available. Check your email, then use the installation guide. If access does not arrive after confirmation, contact Bruno directly.', 'A Stripe é a fonte de verdade do pagamento. O acesso só é entregue depois que a Stripe confirma o pagamento, inclusive em métodos com confirmação posterior, como Pix quando disponível. Confira seu e-mail e depois use o guia de instalação. Se o acesso não chegar após a confirmação, fale diretamente com Bruno.')}
        </Alert>
      </div>
    </section>
  );
}

function BuyButton({ plan = 'pilot', children }) {
  const { t, locale } = useT();
  const market = REGION.market;
  const [loading, setLoading] = React.useState(false);
  const [error, setError] = React.useState(null);
  React.useEffect(() => {
    function reset() { setLoading(false); }
    window.addEventListener('pageshow', reset);
    return () => window.removeEventListener('pageshow', reset);
  }, []);
  async function buy() {
    setLoading(true); setError(null);
    const participant_type = plan === 'pilot' ? 'pilot_customer' : 'standard_customer';
    const currency = plan === 'pilot' ? PRODUCT.pilotPricing[market]?.currency : undefined;
    trackEvent('start_checkout', { plan, participant_type, market, currency });
    try {
      const res = await fetch(LINKS.checkoutApi, {
        method: 'POST', headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ plan, market, locale, attribution: getAttribution() }),
      });
      const data = await res.json().catch(() => ({}));
      if (!res.ok || !data.url) throw new Error(data.error || t('Checkout unavailable', 'Checkout indisponível'));
      window.location.href = data.url;
    } catch (err) {
      setLoading(false); setError(err.message || t('Checkout failed', 'Falha no checkout'));
    }
  }
  return <><Button as="button" type="button" size="lg" block trailingIcon={<IconArrow />} disabled={loading} onClick={buy}>{loading ? t('Redirecting…', 'Redirecionando…') : children}</Button>{error && <p style={{ color: 'var(--red-600)', fontSize: 13, margin: '8px 0 0' }}>{error}. <a href={`mailto:${LINKS.companyEmail}`} style={{ color: 'inherit' }}>{t('Contact Bruno', 'Falar com Bruno')}</a></p>}</>;
}

function PublicOfferButton({ from, size = 'lg' }) {
  const { t } = useT();
  const standardOfferOpen = PRODUCT.stage === 'stable' && PRODUCT.publicOffer === 'standard' && PRODUCT.productionValidated;
  if (!standardOfferOpen) {
    return <Button as="a" href={cohortMailto(t)} size={size} trailingIcon={<IconArrow />} onClick={() => trackEvent('beta_application', { from })}>{t('Join the founding cohort', 'Participar da coorte fundadora')}</Button>;
  }
  return <BuyButton plan="license">{t(`Get the system — $${PRODUCT.standardPriceUsd}`, `Obter o sistema — US$ ${PRODUCT.standardPriceUsd}`)}</BuyButton>;
}

function FreeButton({ from, variant = 'secondary' }) {
  const { t } = useT();
  const href = PRODUCT.freeRepoLive ? LINKS.freeRepo : routeHref('benchmark');
  return <Button as="a" href={href} {...(PRODUCT.freeRepoLive ? EXT : {})} variant={variant} size="lg" onClick={() => trackEvent(PRODUCT.freeRepoLive ? 'click_free_repo' : 'click_benchmark', { from })}>{PRODUCT.freeRepoLive ? t('Try the adaptive starter', 'Testar o starter adaptativo') : t('See validation status', 'Ver status da validação')}</Button>;
}

function Hero() {
  const { t } = useT();
  React.useEffect(() => { trackEvent('view_product'); }, []);
  return (
    <section style={P.hero}>
      <div style={{ ...S.container, ...P.heroInner }} className="site-container">
        <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
          <Badge tone="brand" dot>{t(PRODUCT.stageLabel.en, PRODUCT.stageLabel.pt)}</Badge>
          <Badge>{PRODUCT.version}</Badge>
        </div>
        <h1 style={P.h1} className="site-h1-hero">{t('Repository-aware AI code review for the tools your team already uses.', 'Code review com IA consciente do repositório, nas ferramentas que seu time já usa.')}</h1>
        <p style={P.lede}>{t('Install once. bloo profiles the repository, activates only the guidance the stack supports, routes each diff by risk, and makes high-severity findings prove their case—inside Claude, Cursor, or Copilot.', 'Instale uma vez. A bloo mapeia o repositório, ativa apenas as orientações suportadas pela stack, roteia cada diff pelo risco e exige que achados de alta severidade provem o caso — dentro do Claude, Cursor ou Copilot.')}</p>
        <div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', marginTop: 4 }}>
          <PublicOfferButton from="product_hero" />
          <FreeButton from="product_hero" />
        </div>
        <p style={P.trust}>{t('Adaptive preview · one-time team license after validation · 12 months of updates included · bloo does not receive or process your source code', 'Preview adaptativo · licença única para o time após a validação · 12 meses de atualizações inclusos · a bloo não recebe nem processa seu código-fonte')}</p>
        <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}><Tag>Claude</Tag><Tag>Cursor</Tag><Tag>GitHub Copilot</Tag></div>
      </div>
    </section>
  );
}

function Flow() {
  const { t } = useT();
  const steps = [
    [t('Inspect', 'Inspecionar'), t('Read workspaces, manifests, versions, linters, tests, CI, and architecture evidence.', 'Ler workspaces, manifests, versões, linters, testes, CI e evidências de arquitetura.')],
    [t('Preview', 'Prévia'), t('Show detected packages, adapters, risk zones, and uncertain inferences before writing.', 'Mostrar pacotes, adaptadores, zonas de risco e inferências incertas antes de gravar.')],
    [t('Profile', 'Mapear'), t('Create the local repository profile, policy, source pins, and ownership manifest.', 'Criar o perfil local do repositório, a política, as fontes fixadas e o manifesto de propriedade.')],
    [t('Route', 'Rotear'), t('Map the changed paths and risk signals to the minimum applicable review passes.', 'Mapear caminhos alterados e sinais de risco para os passes mínimos aplicáveis.')],
    [t('Verify', 'Verificar'), t('Return deduplicated findings with evidence, confidence, a fix, and a test.', 'Retornar achados deduplicados com evidência, confiança, correção e teste.')],
  ];
  return (
    <section style={S.section}>
      <div style={S.container} className="site-container">
        <div style={S.sectionHead}>
          <span style={S.eyebrow}>{t('HOW IT WORKS', 'COMO FUNCIONA')}</span>
          <h2 style={S.h2}>{t('The repository shapes the review before the diff is judged.', 'O repositório molda a revisão antes que o diff seja julgado.')}</h2>
          <p style={S.sectionSub}>{t('No framework adapter is installed merely because a file extension looks familiar. Uncertain architecture and stack inferences stay visible for confirmation.', 'Nenhum adaptador de framework é instalado apenas porque uma extensão de arquivo parece familiar. Inferências incertas de arquitetura e stack ficam visíveis para confirmação.')}</p>
        </div>
        <div style={P.grid5} className="product-flow-grid">
          {steps.map(([title, body], i) => (
            <Card key={title} padding="lg" style={{ display: 'flex', flexDirection: 'column', gap: 9 }}>
              <span style={P.mono}>0{i + 1}</span><h3 style={{ ...S.h3, fontSize: 18 }}>{title}</h3><p style={S.cardBody}>{body}</p>
            </Card>
          ))}
        </div>
      </div>
    </section>
  );
}

function Architecture() {
  const { t } = useT();
  const layers = [
    [<IconTarget />, t('Stable kernel', 'Kernel estável'), t('Correctness, severity, risk routing, evidence requirements, and the review contract.', 'Corretude, severidade, roteamento de risco, requisitos de evidência e contrato da revisão.')],
    [<IconLayers />, t('Relevant adapters', 'Adaptadores relevantes'), t('React and Flutter guidance installs only for packages confirmed by manifests or source evidence.', 'Orientações de React e Flutter são instaladas apenas em pacotes confirmados por manifests ou código-fonte.')],
    [<IconUsers />, t('Repository policy', 'Política do repositório'), t('Human-owned conventions, architecture decisions, risk zones, hot paths, exclusions, and narrow waivers.', 'Convenções do time, decisões de arquitetura, zonas de risco, caminhos críticos, exclusões e exceções estreitas.')],
  ];
  return (
    <section style={{ ...S.section, background: 'var(--surface-sunken)', borderTop: '1px solid var(--border-subtle)', borderBottom: '1px solid var(--border-subtle)' }}>
      <div style={S.container} className="site-container">
        <div style={S.sectionHead}>
          <span style={S.eyebrow}>{t('THREE LAYERS', 'TRÊS CAMADAS')}</span>
          <h2 style={S.h2}>{t('A general standard, adapted to one repository.', 'Um padrão geral, adaptado a um repositório.')}</h2>
        </div>
        <div style={P.grid3} className="site-grid-3">
          {layers.map(([icon, title, body]) => (
            <Card key={title} variant="raised" padding="lg" style={{ display: 'flex', flexDirection: 'column', gap: 13 }}><span style={S.serviceIcon}>{icon}</span><h3 style={S.h3}>{title}</h3><p style={S.cardBody}>{body}</p></Card>
          ))}
        </div>
      </div>
    </section>
  );
}

function FindingContract() {
  const { t } = useT();
  const fields = [
    [t('LOCATION', 'LOCALIZAÇÃO'), 'routes/invoices.ts:42'],
    [t('FAILURE SCENARIO', 'CENÁRIO DE FALHA'), t('A signed-in user can request another account’s invoice ID and receive its billing data.', 'Um usuário autenticado pode solicitar o ID da fatura de outra conta e receber seus dados de cobrança.')],
    [t('CODE EVIDENCE', 'EVIDÊNCIA NO CÓDIGO'), 'findById(req.params.id) has no account or ownership predicate.'],
    [t('SPECIFIC FIX', 'CORREÇÃO ESPECÍFICA'), t('Query by both invoice ID and authenticated account ID; return 404 when no owned row exists.', 'Consulte pelo ID da fatura e pelo ID da conta autenticada; retorne 404 quando não houver registro pertencente à conta.')],
    [t('VERIFY', 'VERIFICAR'), t('Add a cross-account request test plus the owned-invoice success case.', 'Adicione um teste de acesso entre contas e o caso de sucesso da fatura pertencente à conta.')],
  ];
  return (
    <section style={S.section}>
      <div style={{ ...S.container, ...P.split }} className="site-container site-grid-2">
        <div style={{ display: 'flex', flexDirection: 'column', gap: 15 }}>
          <span style={S.eyebrow}>{t('HIGHER-TRUST FINDINGS', 'ACHADOS MAIS CONFIÁVEIS')}</span>
          <h2 style={S.h2}>{t('A serious finding has to prove its case.', 'Um achado sério precisa provar seu caso.')}</h2>
          <p style={S.sectionSub}>{t('Every BLOCKER or SHOULD-FIX must name the location, concrete failure, code evidence, specific fix, verification, basis, and confidence. Unsupported severity is itself a review-quality failure.', 'Todo BLOCKER ou SHOULD-FIX precisa informar localização, falha concreta, evidência no código, correção específica, verificação, base e confiança. Severidade sem suporte é uma falha de qualidade da própria revisão.')}</p>
          <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}><Tag>{t('Basis: security invariant', 'Base: invariante de segurança')}</Tag><Tag>{t('Confidence: high', 'Confiança: alta')}</Tag></div>
        </div>
        <Card variant="raised" padding="lg" style={{ display: 'flex', flexDirection: 'column', gap: 13 }}>
          <div style={{ display: 'flex', justifyContent: 'space-between', gap: 10, flexWrap: 'wrap' }}><Badge tone="danger">BLOCKER</Badge><span style={P.mono}>SEC-OWNERSHIP-01</span></div>
          <h3 style={S.h3}>{t('Invoice lookup crosses account boundaries', 'Consulta de fatura atravessa limites de conta')}</h3>
          {fields.map(([label, value]) => <div key={label} style={P.finding} className="finding-row"><span style={P.mono}>{label}</span><span style={{ fontSize: 14, lineHeight: 1.5, color: 'var(--text-body)' }}>{value}</span></div>)}
        </Card>
      </div>
    </section>
  );
}

function Included() {
  const { t } = useT();
  const items = [
    t('Adaptive installer with package-scoped preview', 'Instalador adaptativo com prévia por pacote'),
    t('Neutral .bloo kernel and references shared across tools', 'Kernel e referências neutros em .bloo compartilhados entre ferramentas'),
    t('Automatic correctness, security, API, accessibility, performance, architecture, UI, and large-change routing', 'Roteamento automático de corretude, segurança, API, acessibilidade, performance, arquitetura, UI e mudanças grandes'),
    t('Conditional React and Flutter adapters', 'Adaptadores condicionais de React e Flutter'),
    t('Local conventions, severity policy, and scoped expiring waivers', 'Convenções locais, política de severidade e exceções limitadas com expiração'),
    t('/review-the-review quality calibration', 'Calibração de qualidade com /review-the-review'),
    t('/bloo-doctor installation and drift diagnostic', 'Diagnóstico de instalação e drift com /bloo-doctor'),
    t('Preview-first, manifest-aware updates', 'Atualizações com prévia e consciência do manifesto'),
  ];
  return (
    <section style={{ ...S.section, background: 'var(--surface-sunken)', borderTop: '1px solid var(--border-subtle)', borderBottom: '1px solid var(--border-subtle)' }}>
      <div style={S.container} className="site-container">
        <div style={S.sectionHead}><span style={S.eyebrow}>{t('WHAT THE SYSTEM INCLUDES', 'O QUE O SISTEMA INCLUI')}</span><h2 style={S.h2}>{t('Repository policy, review logic, and lifecycle—not ten loose prompts.', 'Política do repositório, lógica de revisão e ciclo de vida — não dez prompts soltos.')}</h2></div>
        <div style={{ ...P.grid2, maxWidth: 900, margin: '0 auto' }} className="site-grid-2">
          {items.map((item) => <Card key={item} padding="lg" style={{ display: 'flex', gap: 12, alignItems: 'flex-start' }}><span style={S.checkDot}><IconCheck size={13} /></span><p style={{ ...S.cardBody, flex: 1 }}>{item}</p></Card>)}
        </div>
      </div>
    </section>
  );
}

function Validation() {
  const { t } = useT();
  const v = PRODUCT.validation;
  const rows = [
    [t('Seeded defective fixtures', 'Fixtures com defeitos plantados'), String(v.defectiveFixtures), t('Structure validated; repeated live-tool scoring pending.', 'Estrutura validada; pontuação repetida nas ferramentas ainda pendente.')],
    [t('Clean fixtures', 'Fixtures limpos'), String(v.cleanFixtures), t('Used to measure false positives.', 'Usados para medir falsos positivos.')],
    [t('Install/update cases', 'Casos de instalação/atualização'), String(v.installCases), t('Offline simulation passes.', 'Simulação offline aprovada.')],
    [t('Real PR calibration', 'Calibração em PRs reais'), t('0 / 10 complete', '0 / 10 concluídos'), t('Human scoring is still required.', 'A avaliação humana ainda é necessária.')],
  ];
  return (
    <section style={S.section}>
      <div style={S.container} className="site-container">
        <div style={S.sectionHead}><span style={S.eyebrow}>{t('VALIDATION STATUS', 'STATUS DA VALIDAÇÃO')}</span><h2 style={S.h2}>{t('The preview is useful before it is proven—and labeled accordingly.', 'O preview é útil antes de estar comprovado — e está rotulado de acordo.')}</h2><p style={S.sectionSub}>{t('Automated structure and installation simulation pass. Repeated Claude, Cursor, and Copilot runs plus ten real-PR calibrations remain open before stable promotion.', 'A estrutura automatizada e a simulação de instalação foram aprovadas. Rodadas repetidas no Claude, Cursor e Copilot, além de dez calibrações em PRs reais, continuam pendentes antes da promoção estável.')}</p></div>
        <div style={{ maxWidth: 880, margin: '0 auto', display: 'flex', flexDirection: 'column', gap: 12 }}>
          {rows.map(([label, value, note]) => <Card key={label} padding="lg"><div style={{ display: 'grid', gridTemplateColumns: '1.2fr .5fr 1.3fr', gap: 18, alignItems: 'center' }} className="validation-row"><strong style={{ color: 'var(--text-strong)' }}>{label}</strong><span style={{ fontFamily: 'var(--font-mono)', color: 'var(--brand)' }}>{value}</span><span style={{ color: 'var(--text-muted)', fontSize: 14 }}>{note}</span></div></Card>)}
        </div>
        <div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', justifyContent: 'center', marginTop: 28 }}><Button as="a" href={routeHref('benchmark')} trailingIcon={<IconArrow />} onClick={() => trackEvent('click_benchmark', { from: 'product_validation' })}>{t('Read the benchmark methodology', 'Ler a metodologia do benchmark')}</Button><FreeButton from="product_validation" /></div>
      </div>
    </section>
  );
}

function Cohort() {
  const { t } = useT();
  const params = new URLSearchParams(window.location.search);
  const isPrivatePilot = params.get('pilot') === '1';
  const market = REGION.market;
  const selectedPricing = PRODUCT.pilotPricing[market];
  return (
    <section id="cohort" style={{ ...S.section, background: 'var(--surface-sunken)', borderTop: '1px solid var(--border-subtle)' }}>
      <div style={S.container} className="site-container">
        <div style={S.sectionHead}><Badge tone="brand" dot>{t(PRODUCT.stageLabel.en, PRODUCT.stageLabel.pt)}</Badge><h2 style={S.h2}>{t('Help calibrate the system on real pull requests.', 'Ajude a calibrar o sistema em pull requests reais.')}</h2><p style={S.sectionSub}>{t('The founding cohort keeps research participation and commercial demand separate. Both programs receive founder-assisted onboarding; neither is described as production validation.', 'A coorte fundadora mantém participação em pesquisa e demanda comercial separadas. Os dois programas recebem onboarding assistido pelo fundador; nenhum é descrito como validação para produção.')}</p></div>
        <div style={P.cohort} className="site-grid-2">
          <Card variant="raised" padding="lg" style={{ display: 'flex', flexDirection: 'column', gap: 15 }}>
            <Badge style={{ alignSelf: 'flex-start' }}>{t('3 RESEARCH TEAMS', '3 TIMES DE PESQUISA')}</Badge>
            <h3 style={{ ...S.h3, fontSize: 24 }}>{t('Compensated research partner', 'Parceiro de pesquisa remunerada')}</h3>
            <p style={S.cardBody}>{t('Free access for 60 days plus a completion stipend for five real pull requests, short use notes, and two feedback conversations. Compensation never depends on praise or publication permission.', 'Acesso gratuito por 60 dias mais uma ajuda de custo após cinco pull requests reais, notas curtas de uso e duas conversas de feedback. A remuneração nunca depende de elogio ou autorização para publicação.')}</p>
            <Button as="a" href={cohortMailto(t)} variant="secondary" block onClick={() => trackEvent('beta_application', { participant_type: 'research_partner' })}>{t('Apply as a research partner', 'Candidatar-se como parceiro de pesquisa')}</Button>
          </Card>
          <Card variant="raised" padding="lg" style={{ display: 'flex', flexDirection: 'column', gap: 15 }}>
            <Badge tone="brand" dot style={{ alignSelf: 'flex-start' }}>{t(`${PRODUCT.pilotCapacity} PAID PILOT TEAMS`, `${PRODUCT.pilotCapacity} TIMES DE PILOTO PAGO`)}</Badge>
            <h3 style={{ ...S.h3, fontSize: 24 }}>{t('Early customer pilot', 'Piloto para clientes iniciais')}</h3>
            <div><span style={P.price}>{selectedPricing.display}</span> <span style={{ color: 'var(--text-muted)' }}>{t('one time', 'pagamento único')}</span></div>
            <p style={S.cardBody}>{t('Permanent team license for the purchased version, 12 months of updates and support, direct onboarding, founder access, and a 14-day refund window. No research workload or testimonial obligation.', 'Licença permanente para a versão adquirida, 12 meses de atualizações e suporte, onboarding direto, acesso ao fundador e janela de reembolso de 14 dias. Sem carga de pesquisa ou obrigação de depoimento.')}</p>
            {isPrivatePilot ? (
              <BuyButton plan="pilot">{market === 'br' ? t('Buy in Brazil — R$ 799', 'Comprar no Brasil — R$ 799') : t('Buy internationally — US$ 149', 'Comprar internacionalmente — US$ 149')}</BuyButton>
            ) : (
              <Button as="a" href={cohortMailto(t)} block onClick={() => trackEvent('beta_application', { participant_type: 'pilot_customer' })}>{t('Ask about a pilot place', 'Perguntar sobre uma vaga de piloto')}</Button>
            )}
          </Card>
        </div>
        <p style={{ textAlign: 'center', color: 'var(--text-subtle)', fontSize: 13, margin: '22px auto 0', maxWidth: 720 }}>
          {t('The public stable license remains blocked during beta. Regional pricing will be announced after validation.', 'A licença estável pública continua bloqueada durante o beta. Preços regionais serão anunciados após a validação.')}
        </p>
      </div>
    </section>
  );
}

function Boundaries() {
  const { t } = useT();
  return (
    <section style={S.section}>
      <div style={S.container} className="site-container"><div style={S.sectionHead}><span style={S.eyebrow}>{t('CLEAR BOUNDARIES', 'LIMITES CLAROS')}</span><h2 style={S.h2}>{t('A review system, not another autonomous PR bot.', 'Um sistema de revisão, não mais um bot autônomo de PR.')}</h2></div><div style={P.grid3} className="site-grid-3">
        <Card padding="lg"><h3 style={S.h3}>{t('Local-first', 'Local-first')}</h3><p style={{ ...S.cardBody, marginTop: 10 }}>{t('bloo does not receive the code. Reviews run through the AI provider the team already selected; that provider’s terms still apply.', 'A bloo não recebe o código. As revisões rodam pelo provedor de IA já escolhido pelo time; os termos desse provedor continuam valendo.')}</p></Card>
        <Card padding="lg"><h3 style={S.h3}>{t('Advisory by default', 'Consultivo por padrão')}</h3><p style={{ ...S.cardBody, marginTop: 10 }}>{t('The system does not replace tests, static analysis, security review, product judgment, or human approval.', 'O sistema não substitui testes, análise estática, revisão de segurança, julgamento de produto ou aprovação humana.')}</p></Card>
        <Card padding="lg"><h3 style={S.h3}>{t('Team-owned policy', 'Política controlada pelo time')}</h3><p style={{ ...S.cardBody, marginTop: 10 }}>{t('Conventions and narrow waivers stay in the repository. Updates preview changes and preserve human-owned policy.', 'Convenções e exceções estreitas ficam no repositório. Atualizações mostram a prévia e preservam a política controlada por humanos.')}</p></Card>
      </div></div>
    </section>
  );
}

function Final() {
  const { t } = useT();
  return <section style={{ background: 'var(--surface-inverse)', padding: 'var(--space-21) 0' }}><div style={{ ...S.container, textAlign: 'center', display: 'flex', flexDirection: 'column', gap: 18, alignItems: 'center' }} className="site-container"><IconTrendUp size={30} /><h2 style={{ ...S.h2, color: 'var(--text-onbrand)', maxWidth: 680 }}>{t('Make the repository part of the review standard.', 'Faça do repositório parte do padrão de revisão.')}</h2><p style={{ fontSize: 17, color: 'rgba(255,255,255,.74)', maxWidth: 580, lineHeight: 1.55, margin: 0 }}>{t('Join the founding cohort, inspect the validation method, or try the adaptive starter in your own repository.', 'Participe da coorte fundadora, examine o método de validação ou teste o starter adaptativo no seu próprio repositório.')}</p><div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', justifyContent: 'center' }}><PublicOfferButton from="product_final" /><Button as="a" href={routeHref('benchmark')} size="lg" variant="secondary" style={{ background: 'transparent', borderColor: 'rgba(255,255,255,.3)', color: 'var(--text-onbrand)' }}>{t('Validation status', 'Status da validação')}</Button></div></div></section>;
}

function ProductContent() { return <><CheckoutReturnBanner /><Hero /><Flow /><Architecture /><FindingContract /><Included /><Validation /><Cohort /><Boundaries /><Final /></>; }
window.Pages = window.Pages || {};
window.Pages['ai-code-review'] = { Content: ProductContent, label: 'AI Code Review' };
})();
