/* bloo.app — Public adaptive installation and workflow guide. */
(function () {
const { Button, Badge, Card, Alert, Tag } = window.BlooAppDesignSystem_ab7292;
const { PRODUCT, LINKS, Icons, S, trackEvent } = window.Site;
const { useT } = window.I18n;
const { IconArrow, IconCheck, IconCode } = Icons;

const D = {
  hero: { background: 'linear-gradient(180deg, var(--blue-50) 0%, var(--surface-card) 100%)', paddingTop: 68, paddingBottom: 62 },
  inner: { display: 'flex', flexDirection: 'column', gap: 17, alignItems: 'flex-start', maxWidth: 780 },
  h1: { fontFamily: 'var(--font-display)', fontWeight: 500, fontSize: 48, lineHeight: 1.08, letterSpacing: '-.03em', color: 'var(--text-strong)', margin: 0 },
  lede: { fontSize: 18, lineHeight: 1.55, color: 'var(--text-body)', maxWidth: 650, margin: 0 },
  steps: { display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 16 },
  grid2: { display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 20 },
  command: { display: 'inline-flex', fontFamily: 'var(--font-mono)', fontSize: 13, padding: '5px 9px', background: 'var(--surface-inverse)', color: 'rgba(255,255,255,.86)', borderRadius: 'var(--radius-xs)' },
  list: { listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: 11 },
};

function Hero() {
  const { t } = useT();
  React.useEffect(() => { trackEvent('view_docs'); }, []);
  return <section style={D.hero}><div style={{ ...S.container, ...D.inner }} className="site-container"><Badge tone="brand" dot>{t(PRODUCT.stageLabel.en, PRODUCT.stageLabel.pt)} · {PRODUCT.version}</Badge><h1 style={D.h1} className="site-h1-hero">{t('Install once. Let the repository determine what applies.', 'Instale uma vez. Deixe o repositório determinar o que se aplica.')}</h1><p style={D.lede}>{t('The adaptive installer inspects the project, shows its evidence and uncertainties, and writes a local review profile only after approval.', 'O instalador adaptativo inspeciona o projeto, mostra suas evidências e incertezas e grava um perfil local de revisão somente após aprovação.')}</p><div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}><Button as="a" href="product-ai-code-review.html#cohort" trailingIcon={<IconArrow />} onClick={() => trackEvent('join_beta', { from: 'docs' })}>{t('Join the founding cohort', 'Participar da coorte fundadora')}</Button><Button as="a" href="benchmark.html" variant="secondary">{t('Validation status', 'Status da validação')}</Button></div></div></section>;
}

function Quickstart() {
  const { t } = useT();
  const steps = [
    [t('Open the project', 'Abra o projeto'), t('Use Claude Code, Cursor, or Copilot agent mode at the repository root.', 'Use Claude Code, Cursor ou o modo agente do Copilot na raiz do repositório.')],
    [t('Paste INSTALL.md', 'Cole o INSTALL.md'), t('Paste the purchased or free starter installer exactly as provided.', 'Cole o instalador do produto adquirido ou do starter gratuito exatamente como fornecido.')],
    [t('Review the preview', 'Revise a prévia'), t('Confirm tools, packages, versions, adapters, risk zones, and uncertain inferences.', 'Confirme ferramentas, pacotes, versões, adaptadores, zonas de risco e inferências incertas.')],
    [t('Run the doctor', 'Rode o diagnóstico'), t('Use /bloo-doctor, then commit the installed policy for the team.', 'Use /bloo-doctor e depois faça commit da política instalada para o time.')],
  ];
  return <section style={S.section}><div style={S.container} className="site-container"><div style={S.sectionHead}><span style={S.eyebrow}>{t('QUICKSTART', 'INÍCIO RÁPIDO')}</span><h2 style={S.h2}>{t('Four steps to a repository profile.', 'Quatro passos para um perfil do repositório.')}</h2></div><div style={D.steps} className="site-grid-4">{steps.map(([title, body], i) => <Card key={title} padding="lg"><span style={{ fontFamily: 'var(--font-mono)', color: 'var(--brand)', fontSize: 12 }}>0{i + 1}</span><h3 style={{ ...S.h3, marginTop: 9 }}>{title}</h3><p style={{ ...S.cardBody, marginTop: 7 }}>{body}</p></Card>)}</div></div></section>;
}

function Preview() {
  const { t } = useT();
  const checks = [t('Workspace and package boundaries', 'Limites de workspace e pacotes'), t('Framework and major-version evidence', 'Evidência de framework e versão principal'), t('Linters, tests, CI, and generated paths', 'Linters, testes, CI e caminhos gerados'), t('Architecture evidence, hot paths, and risk zones', 'Evidências de arquitetura, caminhos críticos e zonas de risco'), t('Files to add, preserve, migrate, or remove', 'Arquivos a adicionar, preservar, migrar ou remover')];
  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, ...D.grid2 }} className="site-container site-grid-2"><div><span style={S.eyebrow}>{t('INSTALLATION PREVIEW', 'PRÉVIA DA INSTALAÇÃO')}</span><h2 style={{ ...S.h2, marginTop: 12 }}>{t('Inspect first. Write second.', 'Inspecione primeiro. Grave depois.')}</h2><p style={{ ...S.sectionSub, marginTop: 14 }}>{t('React and Flutter are not inferred from TSX or Dart alone. The preview names the evidence behind each adapter and asks before acting on uncertainty.', 'React e Flutter não são inferidos apenas por TSX ou Dart. A prévia informa a evidência por trás de cada adaptador e pergunta antes de agir sobre incertezas.')}</p></div><Card variant="raised" padding="lg"><ul style={D.list}>{checks.map((item) => <li key={item} style={{ display: 'flex', gap: 11, color: 'var(--text-body)', fontSize: 14.5 }}><span style={S.checkDot}><IconCheck size={13} /></span>{item}</li>)}</ul></Card></div></section>;
}

function InstalledShape() {
  const { t } = useT();
  const files = [['.bloo/kernel/', t('Stable review and lifecycle contracts', 'Contratos estáveis de revisão e ciclo de vida')], ['.bloo/references/', t('Generic references plus confirmed adapters only', 'Referências genéricas mais adaptadores confirmados')], ['.bloo/profile.yml', t('Generated packages, versions, risks, and evidence', 'Pacotes, versões, riscos e evidências gerados')], ['.bloo/conventions.md', t('Human-owned architecture and team policy', 'Arquitetura e política do time controladas por humanos')], ['.bloo/waivers.yml', t('Optional path-scoped, expiring deviations', 'Exceções opcionais por caminho e com expiração')], ['.bloo/install-manifest.json', t('Owned files, hashes, tools, adapters, and sources', 'Arquivos controlados, hashes, ferramentas, adaptadores e fontes')]];
  return <section style={S.section}><div style={S.container} className="site-container"><div style={S.sectionHead}><span style={S.eyebrow}>{t('WHAT GETS INSTALLED', 'O QUE É INSTALADO')}</span><h2 style={S.h2}>{t('One neutral policy layer, thin tool wrappers.', 'Uma camada neutra de política, wrappers finos por ferramenta.')}</h2></div><div style={{ ...D.grid2, maxWidth: 900, margin: '0 auto' }} className="site-grid-2">{files.map(([path, body]) => <Card key={path} padding="lg"><span style={D.command}>{path}</span><p style={{ ...S.cardBody, marginTop: 10 }}>{body}</p></Card>)}</div></div></section>;
}

function DailyUse() {
  const { t } = useT();
  const commands = [
    ['/code-review', t('Scope the diff, route the minimum applicable passes, merge duplicates, and report coverage.', 'Delimita o diff, roteia os passes mínimos aplicáveis, combina duplicados e informa cobertura.')],
    ['/review-the-review', t('Score routing, evidence, severity, duplication, unsupported claims, and verdict quality.', 'Avalia roteamento, evidência, severidade, duplicação, alegações sem suporte e qualidade do veredito.')],
    ['/refresh-conventions', t('Refresh the generated profile and propose convention updates without overwriting human policy.', 'Atualiza o perfil gerado e propõe mudanças nas convenções sem sobrescrever a política humana.')],
    ['/customize-review', t('Record team policy, severity decisions, and narrow waivers with owner and expiry.', 'Registra política do time, decisões de severidade e exceções estreitas com responsável e expiração.')],
    ['/update-bloo-pack', t('Preview owned-file changes, migrations, source freshness, and safe removals before updating.', 'Mostra mudanças em arquivos controlados, migrações, atualização das fontes e remoções seguras antes de atualizar.')],
    ['/bloo-doctor', t('Read-only diagnosis for wrappers, adapters, source pins, drift, and smoke behavior.', 'Diagnóstico somente leitura de wrappers, adaptadores, fontes fixadas, drift e comportamento do smoke test.')],
  ];
  return <section style={{ ...S.section, background: 'var(--surface-sunken)', borderTop: '1px solid var(--border-subtle)' }}><div style={S.container} className="site-container"><div style={S.sectionHead}><span style={S.eyebrow}>{t('DAILY WORKFLOW', 'FLUXO DIÁRIO')}</span><h2 style={S.h2}>{t('One review command; explicit lifecycle commands.', 'Um comando de revisão; comandos explícitos de ciclo de vida.')}</h2></div><div style={{ ...D.grid2, maxWidth: 940, margin: '0 auto' }} className="site-grid-2">{commands.map(([command, body]) => <Card key={command} padding="lg"><span style={D.command}>{command}</span><p style={{ ...S.cardBody, marginTop: 10 }}>{body}</p></Card>)}</div></div></section>;
}

function Boundaries() {
  const { t } = useT();
  return <section style={S.section}><div style={S.container} className="site-container"><div style={{ maxWidth: 860, margin: '0 auto' }}><Alert tone="info" title={t('Preview boundaries', 'Limites do preview')}>{t('Automated structure and offline installation simulation pass. Repeated live-tool benchmark runs and ten real-PR calibrations remain pending. Results vary by model, context, tool, and repository. bloo does not receive reviewed code; the selected AI provider’s terms apply.', 'A estrutura automatizada e a simulação offline de instalação foram aprovadas. Rodadas repetidas nas ferramentas e dez calibrações em PRs reais ainda estão pendentes. Os resultados variam por modelo, contexto, ferramenta e repositório. A bloo não recebe o código revisado; aplicam-se os termos do provedor de IA escolhido.')}</Alert><div style={{ display: 'flex', gap: 12, justifyContent: 'center', flexWrap: 'wrap', marginTop: 24 }}><Button as="a" href="benchmark.html" trailingIcon={<IconArrow />}>{t('Read validation status', 'Ler o status da validação')}</Button><Button as="a" href="license.html" variant="secondary">{t('License & updates', 'Licença e atualizações')}</Button></div></div></div></section>;
}

function DocsContent() { return <><Hero /><Quickstart /><Preview /><InstalledShape /><DailyUse /><Boundaries /></>; }
window.Pages = window.Pages || {};
window.Pages.docs = { Content: DocsContent, label: 'Docs' };
})();
