/* ============================================================
   i18n — EN (default) / IT / RU  · plain, grounded copy
   window.I18N + window.LangProvider + window.useT
   ============================================================ */
const { createContext, useContext, useState, useEffect } = React;

const I18N = {
  en: {
    code: "EN",
    nav: { problem: "Problem", process: "Work", about: "About", why: "Why us", contact: "Free audit", cta: "Book a call" },
    hero: {
      tag: ["Reputation Management Agency", "Est. 2010"],
      h1a: "We remove", h1b: "negative results", h1c: "from search.",
      trust: "",
      sub: "Reviews, articles, forum threads, search suggestions. If it's damaging and it's online, we work to get it down.",
      cta1: "Book a free call",
      cta2: "Free analysis",
      b_conf: "Confidential", b_reply: "Reply in 4h", b_legal: "Lawyers on the team",
      promo: {
        eyebrow: "Where to start",
        title: "Want to clear your online reputation?",
        em: "We can help.",
        sub: "Tell us what's showing up. We'll tell you what can come down, how long it takes, and what it costs — before you commit to anything.",
        points: ["Free, confidential audit", "Plain answer within 4 working hours", "Lawyers and removal specialists in-house"],
        cta: "Get my free audit",
      },
    },
    strip: ["Hacking", "Trustpilot", "Google reviews", "Search suggestions", "Right to be forgotten", "Press de-indexing"],
    problem: {
      eyebrow: "Problem",
      title: "Sound familiar?",
      lead: "",
      items: [
        { t: "Bad reviews on Google that cost you bookings" },
        { t: "A search suggestion that pairs your name with the wrong word" },
        { t: "An ex-employee posting about you" },
        { t: "An old article that still ranks first" },
        { t: "A forum thread or Facebook page that won't die down" },
        { t: "Fake accounts left behind by a competitor" },
      ],
      footNum: "10,000",
      footUnit: "items taken down last year",
      footLine: "One is enough to start. We look at it and tell you what can come down.",
      footCta: "Start with an analysis",
    },
    process: {
      eyebrow: "Method",
      title: "What we actually do",
      lead: "You see the plan and the price before anything starts.",
      steps: [
        { n: "01", t: "Analysis", items: [
          ["We list", " what shows up when someone searches your name or company."],
          ["We mark", " what can be removed and what can only be pushed down."],
          ["You get", " the cost and the timeline in writing, before we start."],
        ]},
        { n: "02", t: "Action", items: [
          ["We file", " requests to Google, the hosts and the platforms."],
          ["Legal letters", " go to site owners. Court if it comes to that."],
          ["Anything that won't delete", " gets pushed off the first page."],
        ]},
        { n: "03", t: "Monitoring", items: [
          ["We keep watching", " in case the same content comes back."],
          ["If a new attack starts", " we deal with it."],
          ["A short report", " lands in your inbox each month."],
        ]},
      ],
    },
    about: {
      eyebrow: "About",
      title: "Who we are",
      lead: "RMA. We remove and rebuild what's online about people and companies. We work across Europe and the Gulf.",
      stats: [
        { n: "Free", l: "First audit, no obligation" },
        { n: "4h", l: "Typical reply time" },
        { n: "Legal", l: "Lawyers in-house" },
        { n: "Private", l: "Total confidentiality" },
      ],
      mapNote: "Active worldwide",
    },
    why: {
      eyebrow: "Why us",
      title: "Removing isn't the whole job.",
      lead: "We take things down, then rebuild what people see. The team has lawyers as well as engineers.",
      items: [
        { t: "Lawyers on the team", d: "Defamation and the right to be forgotten are handled in-house." },
        { t: "Fast first look", d: "An audit in 24 hours, a plan within three days of signing." },
        { t: "It stays private", d: "Your name doesn't leave the people working on it." },
        { t: "We rebuild after", d: "Once it's clean, we work on what shows up instead." },
      ],
      shieldBig: "100%", shieldSmall: "Confidential",
    },
    form: {
      eyebrow: "Free audit",
      title: "Find out what's online about you",
      lead: "We look, then send you a plain list with costs. Usually within four working hours.",
      perks: ["Free and confidential", "Costs up front", "Lawyers included", "No long contracts"],
      name: "Name", namePh: "Your name",
      email: "Email", emailPh: "you@company.com",
      phone: "Phone", phonePh: "+39 …",
      need: "What do you need?",
      needOpts: ["Remove a review", "Take down an article", "Fix a search suggestion", "Add positive content", "Something else"],
      submit: "Get my free audit",
      note: "We reply within four working hours.",
      success: "Got it. We'll be in touch within four working hours.",
    },
    footer: {
      tagline: ["We take it down and ", "rebuild", " what's left."],
      payoff: "Reputation work for people and companies.",
      addr: "Address", addrV: "Via Esempio 00, Milano — IT",
      mail: "Mail", tel: "Phone",
      colLinks: "Navigation", colLegal: "Legal",
      privacy: "Privacy Policy", cookie: "Cookie Policy",
      owner: "Owned by", ownerLink: "Attolini Agency",
    },
    cookies: {
      title: "Cookies",
      text: "We use cookies to run the site and understand how it's used. You decide what we keep.",
      accept: "Accept all",
      reject: "Essential only",
      settings: "Settings",
      save: "Save choices",
      necessary: "Essential",
      necessaryNote: "Needed for the site to work. Always on.",
      analytics: "Analytics",
      analyticsNote: "Helps us see which pages get used.",
      marketing: "Marketing",
      marketingNote: "Lets us measure and target our ads.",
      manage: "Cookie settings",
    },
    wa: "WhatsApp",
  },

  it: {
    code: "IT",
    nav: { problem: "Problema", process: "Lavoro", about: "Agenzia", why: "Perché noi", contact: "Audit gratis", cta: "Prenota" },
    hero: {
      tag: ["Reputation Management Agency", "Dal 2010"],
      h1a: "Rimuoviamo i", h1b: "risultati negativi", h1c: "dalla ricerca.",
      trust: "",
      sub: "Recensioni, articoli, discussioni nei forum, suggerimenti di ricerca. Se ti danneggia ed è online, lavoriamo per rimuoverlo.",
      cta1: "Prenota una call",
      cta2: "Analisi gratis",
      b_conf: "Riservato", b_reply: "Risposta in 4h", b_legal: "Avvocati nel team",
      promo: {
        eyebrow: "Da dove iniziare",
        title: "Vuoi ripulire la tua reputazione online?",
        em: "Possiamo aiutarti.",
        sub: "Dicci cosa esce. Ti diciamo cosa si può rimuovere, in quanto tempo e quanto costa — prima che tu prenda qualsiasi impegno.",
        points: ["Audit gratuito e riservato", "Risposta chiara entro 4 ore lavorative", "Avvocati e specialisti di rimozione interni"],
        cta: "Voglio l'audit gratuito",
      },
    },
    strip: ["Hacking", "Trustpilot", "Recensioni Google", "Suggerimenti di ricerca", "Diritto all'oblio", "Deindicizzazione stampa"],
    problem: {
      eyebrow: "Problema",
      title: "Ti suona familiare?",
      lead: "",
      items: [
        { t: "Recensioni negative su Google che ti fanno perdere clienti" },
        { t: "Un suggerimento di ricerca che accosta il tuo nome a una parola sbagliata" },
        { t: "Un ex dipendente che scrive di te" },
        { t: "Un vecchio articolo ancora in prima posizione" },
        { t: "Una discussione o una pagina Facebook che non si placa" },
        { t: "Account falsi lasciati da un concorrente" },
      ],
      footNum: "10.000",
      footUnit: "contenuti rimossi nell'ultimo anno",
      footLine: "Ne basta uno. Lo guardiamo e ti diciamo cosa si può rimuovere.",
      footCta: "Inizia con un'analisi",
    },
    process: {
      eyebrow: "Metodo",
      title: "Cosa facciamo davvero",
      lead: "Vedi il piano e il prezzo prima di iniziare.",
      steps: [
        { n: "01", t: "Analisi", items: [
          ["Elenchiamo", " ciò che esce quando si cerca il tuo nome o l'azienda."],
          ["Segniamo", " cosa si può rimuovere e cosa solo abbassare."],
          ["Costo e tempi", " te li diamo per iscritto, prima di partire."],
        ]},
        { n: "02", t: "Azione", items: [
          ["Inviamo", " le richieste a Google, agli host e alle piattaforme."],
          ["Lettere legali", " ai proprietari dei siti. Tribunale se serve."],
          ["Ciò che non si cancella", " lo spingiamo giù dalla prima pagina."],
        ]},
        { n: "03", t: "Monitoraggio", items: [
          ["Teniamo d'occhio", " che lo stesso contenuto non torni."],
          ["Se parte un nuovo attacco", " ce ne occupiamo."],
          ["Un report breve", " ti arriva ogni mese."],
        ]},
      ],
    },
    about: {
      eyebrow: "Agenzia",
      title: "Chi siamo",
      lead: "RMA. Rimuoviamo e ricostruiamo ciò che è online su persone e aziende. Lavoriamo in Europa e nel Golfo.",
      stats: [
        { n: "Gratis", l: "Primo audit, senza impegno" },
        { n: "4h", l: "Tempo di risposta tipico" },
        { n: "Legale", l: "Avvocati interni" },
        { n: "Riservato", l: "Riservatezza totale" },
      ],
      mapNote: "Attivi nel mondo",
    },
    why: {
      eyebrow: "Perché noi",
      title: "Rimuovere non è tutto il lavoro.",
      lead: "Prima togliamo, poi ricostruiamo quello che la gente vede. Nel team ci sono avvocati oltre ai tecnici.",
      items: [
        { t: "Avvocati nel team", d: "Diffamazione e diritto all'oblio li gestiamo internamente." },
        { t: "Primo sguardo rapido", d: "Audit in 24 ore, piano entro tre giorni dalla firma." },
        { t: "Resta privato", d: "Il tuo nome non esce da chi ci lavora." },
        { t: "Poi ricostruiamo", d: "Quando è pulito, lavoriamo su ciò che appare al suo posto." },
      ],
      shieldBig: "100%", shieldSmall: "Riservato",
    },
    form: {
      eyebrow: "Audit gratuito",
      title: "Scopri cosa c'è online su di te",
      lead: "Guardiamo e ti mandiamo un elenco chiaro con i costi. Di solito entro quattro ore lavorative.",
      perks: ["Gratis e riservato", "Costi subito", "Avvocati inclusi", "Nessun contratto lungo"],
      name: "Nome", namePh: "Il tuo nome",
      email: "Email", emailPh: "tu@azienda.com",
      phone: "Telefono", phonePh: "+39 …",
      need: "Cosa ti serve?",
      needOpts: ["Rimuovere una recensione", "Togliere un articolo", "Sistemare un suggerimento di ricerca", "Aggiungere contenuti positivi", "Altro"],
      submit: "Richiedi l'audit gratuito",
      note: "Rispondiamo entro quattro ore lavorative.",
      success: "Ricevuto. Ti scriviamo entro quattro ore lavorative.",
    },
    footer: {
      tagline: ["Togliamo e ", "ricostruiamo", " quello che resta."],
      payoff: "Gestione della reputazione per persone e aziende.",
      addr: "Indirizzo", addrV: "Via Esempio 00, Milano — IT",
      mail: "Mail", tel: "Telefono",
      colLinks: "Navigazione", colLegal: "Note legali",
      privacy: "Privacy Policy", cookie: "Cookie Policy",
      owner: "Proprietà di", ownerLink: "Attolini Agency",
    },
    cookies: {
      title: "Cookie",
      text: "Usiamo i cookie per far funzionare il sito e capire come viene usato. Decidi tu cosa tenere.",
      accept: "Accetta tutti",
      reject: "Solo essenziali",
      settings: "Impostazioni",
      save: "Salva scelte",
      necessary: "Essenziali",
      necessaryNote: "Servono al funzionamento del sito. Sempre attivi.",
      analytics: "Analitici",
      analyticsNote: "Ci aiutano a vedere quali pagine vengono usate.",
      marketing: "Marketing",
      marketingNote: "Ci permettono di misurare e indirizzare gli annunci.",
      manage: "Impostazioni cookie",
    },
    wa: "WhatsApp",
  },
};

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

function LangProvider({ children }) {
  const [lang, setLangState] = useState(() => {
    const saved = typeof localStorage !== "undefined" && localStorage.getItem("wra_lang");
    return (saved && I18N[saved]) ? saved : "en";
  });
  const setLang = (l) => {
    setLangState(l);
    try { localStorage.setItem("wra_lang", l); } catch (e) {}
    document.documentElement.lang = l;
  };
  useEffect(() => { document.documentElement.lang = lang; }, [lang]);
  return React.createElement(LangContext.Provider, { value: { lang, t: I18N[lang], setLang } }, children);
}
function useT() { return useContext(LangContext); }

Object.assign(window, { I18N, LangContext, LangProvider, useT });
