/* i18n strings + language context */
const I18N = {
  en: {
    nav: { services: "Services", process: "Process", about: "About", faq: "FAQ", hackathon: "Hackathon", cta: "Get started" },
    hero: {
      eyebrow: "Software Studio · AI-Powered Development",
      h1a: "We build the software",
      h1b: "that runs your business.",
      sub: "AdvancedFlow is a software development studio building adaptive websites, custom platforms, automations, and AI agents — engineered to observe, decide, and act on behalf of your business.",
      ctaPrimary: "Start automating",
      ctaSecondary: "See what we build",
      tickLeft: "v.04 — agents online",
      tickMid: "EST. 2024 · ORLANDO, FL",
      tickRight: "SCROLL ↓",
    },
    metrics: {
      eyebrow: "Outcomes",
      h2a: "The numbers ", h2b: "businesses see", h2c: " after deployment.",
      m1: { label: "Efficiency gain", desc: "Less time on repetitive tasks." },
      m2: { label: "Faster shipping", desc: "From scope to live deployment." },
      m3: { label: "Cost reduction", desc: "Across operations and support." },
      m4: { label: "Always-on agents", desc: "Customer support that never sleeps." },
    },
    services: {
      eyebrow: "What we build",
      h2a: "A software studio with ", h2b: "five practices", h2c: ", one operating system.",
      sub: "Pick a discipline to expand. Each one is designed to compound with the others.",
      stage: "[ stage / live preview ]",
      idle: "IDLE",
      list: [
        { title: "Custom Software Development", benefit: "Engineered for your operation, not retrofitted.", desc: "We design, architect, and ship production-grade web platforms, internal tools, and SaaS products. Modern stacks, hardened infrastructure, ownership of the code you depend on.", tags: ["Next.js", "TypeScript", "Postgres", "Cloud-native"] },
        { title: "AI-Powered Web Development", benefit: "Adaptive sites that learn from every visit.", desc: "We build websites that observe user behavior and reshape themselves — content, layout, and CTAs evolve with the data, lifting engagement without manual A/B work.", tags: ["Personalization", "CMS", "A/B auto-tune", "SEO"] },
        { title: "AI Automation Solutions", benefit: "Workflows that execute themselves.", desc: "End-to-end automations that connect your tools, eliminate manual handoffs, and route exceptions intelligently. Cut hours of weekly busywork into seconds of oversight.", tags: ["n8n", "Zapier", "Webhooks", "API design"] },
        { title: "AI Agents", benefit: "Digital teammates that take real action.", desc: "Goal-driven agents that browse, decide, and operate across your stack — not just chatbots. They schedule, dispatch, and close loops on their own.", tags: ["LLM tooling", "RAG", "Vector DB", "Function calling"] },
        { title: "Custom ChatGPTs", benefit: "Your brand's voice, fluent in your data.", desc: "Branded AI models tuned on your knowledge base, voice, and policies — for support, internal answers, and customer-facing experiences that sound like you.", tags: ["Fine-tuning", "RAG", "Voice", "Embeddings"] },
      ],
    },
    process: {
      eyebrow: "Engagement",
      h2a: "From idea to live system in ", h2b: "weeks, not quarters", h2c: ".",
      sub: "A four-phase delivery built around outcomes you can measure — not slide-deck deliverables.",
      steps: [
        { tag: "01 · DISCOVER", title: "Map the work", desc: "We sit with your team, observe real workflows, and identify the highest-leverage automation targets." },
        { tag: "02 · DESIGN", title: "Architect the agent", desc: "We design the data flow, tool access, decision points, and human-in-the-loop checkpoints." },
        { tag: "03 · DEPLOY", title: "Ship in weeks", desc: "Iterative releases with safety rails. Your team sees value before the project is 'finished'." },
        { tag: "04 · EVOLVE", title: "Learn forever", desc: "Agents improve as they run. We tune, expand scope, and stack new capabilities monthly." },
      ],
    },
    about: {
      eyebrow: "The studio",
      h2a: "Built by software engineers tired of ", h2b: "tools that don't talk", h2c: ".",
      sub: "AdvancedFlow is a software development studio working at the seam between traditional engineering and applied AI — for teams that need both, integrated and shipped.",
      visionLabel: "Vision",
      visionH: "A future where your business runs on systems that adapt to it — not the other way around.",
      visionP: "We build AI-powered tools and websites designed to absorb change, optimize cost, and free your team to do the work only humans can.",
      missionLabel: "Mission",
      missionH: "Make advanced AI ordinary — accessible, accountable, and honestly priced.",
      missionP: "To deliver innovative technological solutions that allow every business to harness AI to improve operations and stand out in a crowded digital market.",
      values: [
        { t: "Efficiency", d: "Solutions that compound time savings — every cycle, every quarter." },
        { t: "Transparency", d: "Honest scope, clear pricing, and visibility into how the system actually decides." },
        { t: "Security", d: "Data protection isn't an add-on. It's the floor: SOC-grade controls, GDPR-ready." },
        { t: "Innovation", d: "We track the frontier. New capabilities ship to your stack as soon as they're stable." },
      ],
    },
    industries: {
      eyebrow: "Where we work",
      h2: "Industries we've shipped for.",
      sub: "The patterns of repetitive work look surprisingly similar across sectors. Our playbooks travel well.",
      list: ["Restaurants","Medical Clinics","Beauty & Spa","Auto Repair","Real Estate","Retail","E-commerce","Education","Financial","Insurance","Logistics","Manufacturing","Hospitality","Legal","Marketing","Fitness","Non-profit","Agriculture","Transportation","Telecom"],
    },
    hackathon: {
      eyebrow: "Open call · Solo competition",
      h2a: "The next dev generation. AI-first ", h2b: "by default", h2c: ".",
      sub: "We're scouting solo developers who already think AI-first — devs who prompt before they Google, who orchestrate models like a senior orchestrates a team. Build alone, build fast, get hired.",
      pillDate: "JUNE 2026 · ORLANDO",
      pillSlots: "100 INDIVIDUAL SEATS",
      pillFormat: "REMOTE + IN-PERSON",
      perks: [
        { t: "Cash prizes", d: "Real money for the top solo builders — paid in cash, no equity strings, no vague 'opportunities'." },
        { t: "AI-native judging", d: "We grade on how well you wield AI as a co-developer — speed, taste, and what you ship in 48 hours alone." },
        { t: "Real briefs", d: "You'll build against problems pulled straight from our client backlog. No toy challenges, no fake stakes." },
        { t: "Hire pipeline", d: "Top finishers get fast-tracked to interviews. We're hiring devs who treat AI as their first instrument, not their last." },
      ],
      formTitle: "Reserve your spot",
      formSub: "Solo entries only. Fill it out and we'll send you the WhatsApp group QR right away.",
      f: { name: "Full name", email: "Email", role: "Your role", roleP: "Pick one", stack: "Primary stack", stackP: "Pick your weapon", exp: "Years of experience", expP: "Select", github: "GitHub / portfolio (optional)", terms: "I confirm I'm registering as an individual and accept the rules and code of conduct.", submit: "Get the QR", submitting: "Reserving…" },
      roles: ["Frontend Developer","Backend Developer","Full-stack","Mobile","AI / ML Engineer","Designer","Student","Other"],
      stacks: ["JavaScript / TypeScript","Python","Go","Rust","Java / Kotlin","Swift","PHP","C# / .NET","Other"],
      exps: ["< 1 year","1–3 years","3–5 years","5+ years"],
      successTitle: "You're in.",
      successSub: "Scan the QR with WhatsApp camera or upload it from your gallery to join the group. We'll send pre-event details there.",
      qrFooter: "Scan or upload this QR using the WhatsApp camera to join the group.",
    },
    faq: {
      eyebrow: "Honest answers",
      h2a: "Frequently asked, ", h2b: "plainly answered", h2c: ".",
      list: [
        { q: "How is this different from hiring an agency?", a: "Agencies hand you a finished project. We hand you a system that keeps improving — agents learn, automations adapt, and the value compounds long after launch." },
        { q: "Do I need a technical team to maintain it?", a: "No. Our deliverables include monitoring dashboards, fallback paths, and documented runbooks. You get a partner, not a black box you can't operate." },
        { q: "How long does a typical engagement take?", a: "First measurable value in 2–4 weeks. Full first-phase deployment in 6–10 weeks. Most engagements continue with monthly capability expansions." },
        { q: "What does the pricing look like?", a: "Project-based for the initial build (clear scope, fixed cost), then a monthly partnership for evolution and operations. Transparent, no hidden retainers." },
        { q: "Is my data safe with AI agents?", a: "Yes. We deploy on infrastructure you control where required, scope agent permissions tightly, log every action, and never train shared models on your private data." },
      ],
    },
    cta: {
      eyebrow: "Start here",
      h2a: "Stop running your business ", h2b: "by hand", h2c: ".",
      sub: "Book a 30-minute mapping call. We'll identify three automation opportunities you can ship this quarter — no commitment required.",
      btn: "Book your mapping call",
    },
    footer: {
      h: "Let's Make Your Business Think for Itself",
      p: "Custom software, adaptive websites, automations, and AI agents — engineered by humans who actually ship.",
      tag: "EST. 2024 · ORLANDO, FL",
      build: "Custom Software", studio: "Studio", reach: "Reach us",
      buildLinks: ["Web Platforms","Adaptive Websites","Automations","AI Agents","Custom GPTs"],
      studioLinks: ["About","Process","FAQ","Hackathon","Contact"],
      bottom: "ALL RIGHTS RESERVED",
    },
    getStarted: {
      back: "← Back",
      eyebrow: "Get started",
      h1a: "Tell us about ", h1b: "the work", h1c: " you want to automate.",
      sub: "It takes 60 seconds. We respond within one business day.",
      f: {
        name: "First name", lastname: "Last name", company: "Company name", website: "Company website",
        websiteOpt: "(optional)", email: "Work email",
        service: "Service you're interested in", servicePh: "Pick one",
        industry: "Industry", industryPh: "Pick one",
        challenge: "Main challenge", challengePh: "Pick one",
        terms: "I accept the terms and privacy policy.",
        submit: "Welcome to AdvancedFlow",
        submitting: "Sending…",
      },
      services: ["Custom Software Development","AI-Powered Web Development","AI Automation Solutions","AI Agents","Custom GPTs"],
      industries: ["Restaurants","Medical Clinics","Beauty Salons & Spas","Automotive Repair Shops","Real Estate Agencies","Retail Stores","E-commerce Platforms","Educational Institutions","Financial Services","Insurance Companies","Logistics & Supply Chain","Manufacturing","Hospitality & Hotels","Legal Services","Marketing & Advertising Agencies","Fitness & Wellness Centers","Non-Profit Organizations","Agriculture & Farming","Transportation & Fleet Management","Telecommunications","Other"],
      challenges: ["Optimize Development Time","Optimize Expenses","Automate Customer Service","Position in the Digital World"],
      successT: "Thanks — we got it.",
      successS: "Our team will reach out within one business day to map your first automation opportunity.",
    },
  },
  es: {
    nav: { services: "Servicios", process: "Proceso", about: "Nosotros", faq: "Preguntas", hackathon: "Hackathon", cta: "Empezar" },
    hero: {
      eyebrow: "Estudio de Software · Desarrollo con IA",
      h1a: "Construimos el software",
      h1b: "que mueve tu negocio.",
      sub: "AdvancedFlow es un estudio de desarrollo de software que crea sitios adaptativos, plataformas a medida, automatizaciones y agentes de IA — diseñados para observar, decidir y actuar por tu negocio.",
      ctaPrimary: "Empezar a automatizar",
      ctaSecondary: "Ver lo que construimos",
      tickLeft: "v.04 — agentes activos",
      tickMid: "EST. 2024 · ORLANDO, FL",
      tickRight: "BAJAR ↓",
    },
    metrics: {
      eyebrow: "Resultados",
      h2a: "Los números que ven ", h2b: "los negocios", h2c: " después de implementar.",
      m1: { label: "Más eficiencia", desc: "Menos tiempo en tareas repetitivas." },
      m2: { label: "Entrega más rápida", desc: "Del alcance al despliegue en producción." },
      m3: { label: "Reducción de costos", desc: "En operaciones y soporte." },
      m4: { label: "Agentes 24/7", desc: "Atención al cliente que nunca duerme." },
    },
    services: {
      eyebrow: "Lo que construimos",
      h2a: "Un estudio de software con ", h2b: "cinco prácticas", h2c: ", un solo sistema operativo.",
      sub: "Selecciona una disciplina para expandirla. Cada una está diseñada para potenciar a las demás.",
      stage: "[ escenario / vista en vivo ]",
      idle: "INACTIVO",
      list: [
        { title: "Desarrollo de Software a Medida", benefit: "Diseñado para tu operación, no adaptado.", desc: "Diseñamos, arquitecturamos y desplegamos plataformas web, herramientas internas y productos SaaS de nivel producción. Stacks modernos, infraestructura sólida, propiedad del código.", tags: ["Next.js", "TypeScript", "Postgres", "Cloud-native"] },
        { title: "Desarrollo Web con IA", benefit: "Sitios adaptativos que aprenden de cada visita.", desc: "Construimos sitios que observan el comportamiento del usuario y se reconfiguran solos — contenido, layout y CTAs evolucionan con los datos, sin pruebas A/B manuales.", tags: ["Personalización", "CMS", "A/B auto", "SEO"] },
        { title: "Soluciones de Automatización con IA", benefit: "Flujos de trabajo que se ejecutan solos.", desc: "Automatizaciones de extremo a extremo que conectan tus herramientas, eliminan transferencias manuales y enrutan excepciones inteligentemente. Convierte horas de trabajo en segundos de supervisión.", tags: ["n8n", "Zapier", "Webhooks", "Diseño de API"] },
        { title: "Agentes de IA", benefit: "Compañeros digitales que toman acción real.", desc: "Agentes orientados a metas que navegan, deciden y operan en todo tu stack — no son simples chatbots. Agendan, despachan y cierran ciclos por sí solos.", tags: ["LLM tooling", "RAG", "Vector DB", "Function calling"] },
        { title: "ChatGPTs Personalizados", benefit: "La voz de tu marca, fluida en tus datos.", desc: "Modelos de IA con tu marca, ajustados a tu base de conocimiento, voz y políticas — para soporte, respuestas internas y experiencias al cliente que suenan a ti.", tags: ["Fine-tuning", "RAG", "Voz", "Embeddings"] },
      ],
    },
    process: {
      eyebrow: "Engagement",
      h2a: "De la idea al sistema en producción en ", h2b: "semanas, no trimestres", h2c: ".",
      sub: "Un proceso de cuatro fases construido alrededor de resultados medibles — no entregables de slides.",
      steps: [
        { tag: "01 · DESCUBRIR", title: "Mapear el trabajo", desc: "Nos sentamos con tu equipo, observamos los flujos reales e identificamos los objetivos de mayor apalancamiento." },
        { tag: "02 · DISEÑAR", title: "Arquitectar el agente", desc: "Diseñamos el flujo de datos, accesos a herramientas, puntos de decisión y checkpoints con humano." },
        { tag: "03 · DESPLEGAR", title: "Entrega en semanas", desc: "Releases iterativos con barreras de seguridad. Tu equipo ve valor antes de que el proyecto esté 'terminado'." },
        { tag: "04 · EVOLUCIONAR", title: "Aprender siempre", desc: "Los agentes mejoran mientras corren. Ajustamos, ampliamos alcance y apilamos capacidades cada mes." },
      ],
    },
    about: {
      eyebrow: "El estudio",
      h2a: "Construido por ingenieros cansados de ", h2b: "herramientas que no se hablan", h2c: ".",
      sub: "AdvancedFlow es un estudio de desarrollo de software trabajando en la unión entre ingeniería tradicional e IA aplicada — para equipos que necesitan ambas, integradas y entregadas.",
      visionLabel: "Visión",
      visionH: "Un futuro donde tu negocio corre sobre sistemas que se adaptan a él — no al revés.",
      visionP: "Construimos herramientas y sitios web con IA diseñados para absorber el cambio, optimizar costos y liberar a tu equipo para hacer lo que solo los humanos pueden.",
      missionLabel: "Misión",
      missionH: "Hacer la IA avanzada algo cotidiano — accesible, transparente y con precio honesto.",
      missionP: "Entregar soluciones tecnológicas innovadoras que permitan a cualquier negocio aprovechar la IA para mejorar operaciones y destacarse en un mercado digital saturado.",
      values: [
        { t: "Eficiencia", d: "Soluciones que componen ahorros de tiempo — cada ciclo, cada trimestre." },
        { t: "Transparencia", d: "Alcance honesto, precios claros y visibilidad de cómo decide el sistema." },
        { t: "Seguridad", d: "Proteger los datos no es un extra. Es el piso: controles SOC, listo para GDPR." },
        { t: "Innovación", d: "Seguimos la frontera. Las nuevas capacidades llegan a tu stack apenas son estables." },
      ],
    },
    industries: {
      eyebrow: "Dónde trabajamos",
      h2: "Industrias para las que hemos entregado.",
      sub: "Los patrones de trabajo repetitivo se ven sorprendentemente similares en todos los sectores. Nuestros playbooks viajan bien.",
      list: ["Restaurantes","Clínicas Médicas","Belleza & Spa","Talleres Automotrices","Bienes Raíces","Retail","E-commerce","Educación","Financiero","Seguros","Logística","Manufactura","Hotelería","Legal","Marketing","Fitness","ONG","Agricultura","Transporte","Telecom"],
    },
    hackathon: {
      eyebrow: "Convocatoria abierta · Competencia individual",
      h2a: "La próxima generación de devs. AI-first ", h2b: "por defecto", h2c: ".",
      sub: "Buscamos desarrolladores solos que ya piensan AI-first — devs que escriben prompts antes que googlear, que orquestan modelos como un senior orquesta un equipo. Construye solo, construye rápido, te contratamos.",
      pillDate: "JUNIO 2026 · ORLANDO",
      pillSlots: "100 CUPOS INDIVIDUALES",
      pillFormat: "REMOTO + PRESENCIAL",
      perks: [
        { t: "Premios en efectivo", d: "Dinero real para los mejores builders solos — pagado en efectivo, sin equity, sin 'oportunidades' vagas." },
        { t: "Jurado AI-native", d: "Calificamos qué tan bien usas la IA como co-desarrollador — velocidad, criterio y lo que entregas tú solo en 48 horas." },
        { t: "Briefs reales", d: "Vas a construir contra problemas tomados directamente de nuestro backlog de clientes. Nada de retos de juguete." },
        { t: "Pipeline de hire", d: "Los finalistas pasan a entrevistas fast-track. Contratamos devs que tratan la IA como su primer instrumento, no el último." },
      ],
      formTitle: "Reserva tu lugar",
      formSub: "Solo registros individuales. Llénalo y te enviamos el QR del grupo de WhatsApp al instante.",
      f: { name: "Nombre completo", email: "Email", role: "Tu rol", roleP: "Selecciona", stack: "Stack principal", stackP: "Elige tu arma", exp: "Años de experiencia", expP: "Selecciona", github: "GitHub / portfolio (opcional)", terms: "Confirmo que me registro como individuo y acepto las reglas y el código de conducta.", submit: "Obtener el QR", submitting: "Reservando…" },
      roles: ["Frontend Developer","Backend Developer","Full-stack","Mobile","AI / ML Engineer","Diseñador","Estudiante","Otro"],
      stacks: ["JavaScript / TypeScript","Python","Go","Rust","Java / Kotlin","Swift","PHP","C# / .NET","Otro"],
      exps: ["< 1 año","1–3 años","3–5 años","5+ años"],
      successTitle: "¡Estás dentro!",
      successSub: "Escanea el QR con la cámara de WhatsApp o súbelo desde tu galería para entrar al grupo. Ahí mandaremos los detalles previos al evento.",
      qrFooter: "Escanea o sube este QR desde la cámara de WhatsApp para unirte al grupo.",
    },
    faq: {
      eyebrow: "Respuestas honestas",
      h2a: "Preguntas frecuentes, ", h2b: "respondidas claro", h2c: ".",
      list: [
        { q: "¿En qué se diferencia esto de contratar una agencia?", a: "Las agencias te entregan un proyecto terminado. Nosotros te entregamos un sistema que sigue mejorando — los agentes aprenden, las automatizaciones se adaptan y el valor crece después del lanzamiento." },
        { q: "¿Necesito un equipo técnico para mantenerlo?", a: "No. Los entregables incluyen dashboards de monitoreo, rutas de respaldo y runbooks documentados. Recibes un socio, no una caja negra." },
        { q: "¿Cuánto dura un engagement típico?", a: "Primer valor medible en 2–4 semanas. Despliegue de primera fase en 6–10 semanas. La mayoría continúa con expansiones mensuales." },
        { q: "¿Cómo es el pricing?", a: "Por proyecto para el build inicial (alcance claro, costo fijo), luego una alianza mensual para evolución y operación. Transparente, sin retainers ocultos." },
        { q: "¿Mis datos están seguros con agentes de IA?", a: "Sí. Desplegamos en infraestructura que controlas cuando se requiere, limitamos los permisos del agente, registramos cada acción y nunca entrenamos modelos compartidos con tus datos privados." },
      ],
    },
    cta: {
      eyebrow: "Empieza aquí",
      h2a: "Deja de mover tu negocio ", h2b: "a mano", h2c: ".",
      sub: "Agenda una llamada de 30 minutos. Identificamos tres oportunidades de automatización que puedes desplegar este trimestre — sin compromiso.",
      btn: "Agendar mi llamada",
    },
    footer: {
      h: "Hagamos que tu negocio piense por sí mismo",
      p: "Software a medida, sitios adaptativos, automatizaciones y agentes de IA — hechos por humanos que sí entregan.",
      tag: "EST. 2024 · ORLANDO, FL",
      build: "Software", studio: "Estudio", reach: "Contacto",
      buildLinks: ["Plataformas Web","Sitios Adaptativos","Automatizaciones","Agentes de IA","ChatGPTs Personalizados"],
      studioLinks: ["Nosotros","Proceso","Preguntas","Hackathon","Contacto"],
      bottom: "TODOS LOS DERECHOS RESERVADOS",
    },
    getStarted: {
      back: "← Volver",
      eyebrow: "Empezar",
      h1a: "Cuéntanos sobre ", h1b: "el trabajo", h1c: " que quieres automatizar.",
      sub: "Toma 60 segundos. Respondemos dentro de un día hábil.",
      f: {
        name: "Nombre", lastname: "Apellido", company: "Empresa", website: "Sitio web",
        websiteOpt: "(opcional)", email: "Email de trabajo",
        service: "Servicio de interés", servicePh: "Selecciona",
        industry: "Industria", industryPh: "Selecciona",
        challenge: "Reto principal", challengePh: "Selecciona",
        terms: "Acepto los términos y la política de privacidad.",
        submit: "Bienvenido a AdvancedFlow",
        submitting: "Enviando…",
      },
      services: ["Desarrollo de Software a Medida","Desarrollo Web con IA","Soluciones de Automatización con IA","Agentes de IA","ChatGPTs Personalizados"],
      industries: ["Restaurantes","Clínicas Médicas","Salones de Belleza & Spa","Talleres Automotrices","Bienes Raíces","Retail","E-commerce","Educación","Servicios Financieros","Aseguradoras","Logística & Supply Chain","Manufactura","Hotelería","Servicios Legales","Marketing & Publicidad","Fitness & Wellness","ONG","Agricultura","Transporte & Flotas","Telecomunicaciones","Otro"],
      challenges: ["Optimizar tiempo de desarrollo","Optimizar gastos","Automatizar atención al cliente","Posicionar en el mundo digital"],
      successT: "Listo — recibido.",
      successS: "Nuestro equipo te contactará en un día hábil para mapear tu primera oportunidad de automatización.",
    },
  },
};

const LangContext = React.createContext({ lang: "en", setLang: () => {}, t: I18N.en });

function LangProvider({ children }) {
  const [lang, setLang] = useState(() => localStorage.getItem("af-lang") || "en");
  const set = (l) => { setLang(l); localStorage.setItem("af-lang", l); };
  const value = useMemo(() => ({ lang, setLang: set, t: I18N[lang] }), [lang]);
  return <LangContext.Provider value={value}>{children}</LangContext.Provider>;
}

function useT() { return useContext(LangContext); }

const { useContext } = React;
Object.assign(window, { I18N, LangContext, LangProvider, useT });
