// i18n — translations + Context

const TRANSLATIONS = {
  en: {
    // Nav
    navPractice: "The practice",
    navStory:    "Our story",
    navStories:  "Testimonials",
    navPricing:  "Pricing",
    navDownload: "Download",
    navManifestToday: "Start manifesting today",
    navWebApp: "Web app",
    modalClose: "Close",
    modalKicker: "Choose your Lumgoals space",
    modalTitle: "Start manifesting today.",
    modalBody: "Download the app or open the web app to continue your practice from anywhere.",
    modalAppStore: "Download on the App Store",
    modalPlayStore: "Download on Google Play",
    modalWebApp: "Open Web app",

    // Hero
    heroTitleA: "Become the",
    heroTitleB: "person",
    heroTitleC: "your future self",
    heroTitleD: "is proud of.",
    heroBody:   "Lumgoals is the celestial companion for manifesting your dreams. Set intentions, journal twice a day, and watch your goals unfold — gently, with focus and intention.",
    heroCtaPrimary:   "Start Manifesting",
    heroCtaSecondary: "Watch the journey",
    heroAffirmLabel:  "AFFIRMATION",
    heroAffirmText:   "Abundance flows to me effortlessly.",
    heroStreak:       "DAY STREAK",

    // Problem
    problemTitleA: "You don't have a goal problem.",
    problemTitleB: "You have a",
    problemTitleC: "continuity",
    problemTitleD: "problem.",
    problemSub:    "Manifestation isn't magic alone. It's daily, gentle return to who you're becoming. The apps you've tried treat you like a productivity machine. You're not.",
    p1Title: "Goals feel out of reach",
    p1Body:  "You wrote them down in January. By February, they were a graveyard of good intentions buried in Notes.app.",
    p2Title: "Mindset slips by Wednesday",
    p2Body:  "Monday's affirmations dissolved by mid-week. The doubt voice is louder. The dream feels smaller.",
    p3Title: "Journaling feels like homework",
    p3Body:  "Blank page. Blinking cursor. You want to reflect — but you don't want another empty container to fill.",
    p4Title: "Affirmations feel hollow",
    p4Body:  "Repeating 'I am abundant' to a bathroom mirror feels performative. You want something that actually shifts you.",

    // How it works
    howTitleA: "A practice so simple,",
    howTitleB: "you'll actually keep it.",
    howSub:    "Four small acts, woven into your day. Each one tiny enough to do on the bus, big enough to rewire your relationship to what's possible.",
    s1Title: "Set your manifestation",
    s1Body:  "Write the dream in your own words. Lumgoals turns it into a daily ritual — not a checklist.",
    s2Title: "Visualize each morning",
    s2Body:  "Open the app, see your vision board, breathe with your intention. 90 seconds is enough.",
    s3Title: "Journal sunrise & sunset",
    s3Body:  "Gentle prompts. Morning intentions and evening reflections — two bookends to your day.",
    s4Title: "Check in with your mood",
    s4Body:  "Track how the practice is reshaping you. See patterns. Honor the seasons of your soul.",

    // Mood section
    moodTitleA: "Every emotion",
    moodTitleB: "is a portal.",
    moodSub:    "Joy, anger, melancholy, calm — none of them are obstacles to your manifestation. They're data. Lumgoals helps you tune into how you actually feel, every day, so you can manifest from a place that's real.",
    moodHappy:   "Hopeful",
    moodHappyD:  "The day you say yes to yourself.",
    moodMeh:     "Neutral",
    moodMehD:    "Steady ground. A good place to plant.",
    moodSad:     "Low",
    moodSadD:    "Tender hours. Honored, never rushed.",
    moodMad:     "Angry",
    moodMadD:    "Fire that points at what matters.",
    moodFootnote:"Tap a mood, write a line, watch the patterns. No streaks broken. No guilt.",

    // Testimonials
    testTitleA: "A growing chorus,",
    testTitleB: "becoming.",
    t1Quote: "I've kept a 142-day streak. That's the longest I've kept anything in my adult life. The morning ritual changed how I show up to my own day.",
    t1Name:  "Maya R.",
    t1Role:  "Writer · Brooklyn, NY",
    t2Quote: "Lumgoals is the first app that didn't make me feel behind. It reads me like my best friend — but with better metaphors.",
    t2Name:  "Sasha L.",
    t2Role:  "Founder, ceramics studio · Lisbon",
    t3Quote: "I manifested the apartment. Not because the app is magic, but because it kept me believing for the 8 months it took to find it.",
    t3Name:  "Jordan T.",
    t3Role:  "Therapist · Toronto",

    // Founder
    founderTitleA: "Manifestation lives",
    founderTitleB: "in the action.",
    founderP1: "I'm Jahz — designer, artist, and a true believer that manifestation isn't wishful thinking. It's action. It's listening to your intuition until it becomes loud enough to follow.",
    founderP2: "Things don't arrive because you ask. They arrive because you fulfill the mental steps — clearing doubt, holding the vision, taking the small daily acts that say to the universe: I'm ready. Lumgoals is exactly that. A focused manifestation practice, in your pocket.",
    founderP3Quote: "We are all magic. We all connect with something greater that lets us be free — but only when we leave doubt behind and focus, fully, on what we want.",
    founderRole: "Founder · Designer · Artist",
    founderSignoff: "With love and a little starlight,",
    founderName: "Jahz",

    // CTA
    ctaTitleA: "Start with 7 days of full access.",
    ctaTitleB: "",
    ctaBody:   "Explore every Lumgoals Premium feature for free. After your trial, continue for $4.99/month or save with the annual plan at $49.99/year.",
    ctaFootnote: "Cancel anytime · Available in English & Español",

    // Footer
    footTagline: "A celestial companion for manifesting your dreams, journaling your becoming, and trusting your own light.",
    footColA: "Lumgoals",  footAlinks: ["What is manifestation","The Lumgoals practice","Pricing","Gift a year","Updates"],
    footColB: "Resources", footBlinks: ["Practice library","Press kit","Help center"],
    footColC: "Company",   footClinks: ["Contact"],
    footColD: "Legal",     footDlinks: ["Privacy","Terms","Cookies","Accessibility","Your data"],
    footContactLink: "Contact",
    footCopy:    "© 2026 Lumgoals · Made with starlight",
    footQuote:   "✦ You are the universe, becoming aware of itself.",

    // CTA badges + theme/lang
    badgeDownloadOn:  "Download on the",
    badgeAppStore:    "App Store",
    badgeGetItOn:     "Get it on",
    badgeGooglePlay:  "Google Play",
  },

  es: {
    navPractice: "La práctica",
    navStory:    "Nuestra historia",
    navStories:  "Testimonios",
    navPricing:  "Precios",
    navDownload: "Descargar",
    navManifestToday: "Empieza a manifestar hoy",
    navWebApp: "Web app",
    modalClose: "Cerrar",
    modalKicker: "Elige tu espacio Lumgoals",
    modalTitle: "Empieza a manifestar hoy.",
    modalBody: "Descarga la app o abre la web app para continuar tu práctica desde donde estés.",
    modalAppStore: "Descargar en App Store",
    modalPlayStore: "Descargar en Google Play",
    modalWebApp: "Abrir Web app",

    heroTitleA: "Conviértete en la",
    heroTitleB: "persona",
    heroTitleC: "que tu yo del futuro",
    heroTitleD: "admirará.",
    heroBody:   "Lumgoals es tu compañero celestial para manifestar tus sueños. Define tus intenciones, escribe en tu diario mañana y noche, y mira cómo tus metas se despliegan — con calma, foco e intención.",
    heroCtaPrimary:   "Comenzar a manifestar",
    heroCtaSecondary: "Ver el viaje",
    heroAffirmLabel:  "AFIRMACIÓN",
    heroAffirmText:   "La abundancia fluye hacia mí sin esfuerzo.",
    heroStreak:       "DÍAS SEGUIDOS",

    problemTitleA: "No tienes un problema de metas.",
    problemTitleB: "Tienes un problema de",
    problemTitleC: "continuidad",
    problemTitleD: ".",
    problemSub:    "Manifestar no es solo magia. Es el regreso suave y diario a quien estás convirtiéndote. Las apps que has probado te tratan como una máquina de productividad. No lo eres.",
    p1Title: "Las metas se sienten lejanas",
    p1Body:  "Las escribiste en enero. En febrero ya eran un cementerio de buenas intenciones enterradas en la app de notas.",
    p2Title: "La mentalidad se cae el miércoles",
    p2Body:  "Las afirmaciones del lunes se disuelven a mitad de semana. La voz de la duda suena más fuerte. El sueño se siente más pequeño.",
    p3Title: "Escribir se siente como tarea",
    p3Body:  "Página en blanco. Cursor parpadeando. Quieres reflexionar — pero no quieres otro contenedor vacío que llenar.",
    p4Title: "Las afirmaciones suenan huecas",
    p4Body:  "Repetir 'soy abundante' frente al espejo se siente falso. Quieres algo que de verdad te mueva.",

    howTitleA: "Una práctica tan simple,",
    howTitleB: "que de verdad la sostendrás.",
    howSub:    "Cuatro pequeños actos, tejidos en tu día. Cada uno lo bastante chiquito para hacerlo en el bus, lo bastante grande para reconfigurar tu relación con lo posible.",
    s1Title: "Define tu manifestación",
    s1Body:  "Escribe el sueño con tus propias palabras. Lumgoals lo convierte en un ritual diario — no en una lista.",
    s2Title: "Visualiza cada mañana",
    s2Body:  "Abre la app, mira tu vision board, respira con tu intención. 90 segundos son suficientes.",
    s3Title: "Diario al amanecer y al atardecer",
    s3Body:  "Prompts suaves. Intenciones de la mañana y reflexiones de la noche — dos extremos para tu día.",
    s4Title: "Reconoce tu estado de ánimo",
    s4Body:  "Observa cómo la práctica te transforma. Ve patrones. Honra las estaciones de tu alma.",

    // Mood section
    moodTitleA: "Cada emoción",
    moodTitleB: "es un portal.",
    moodSub:    "Alegría, enojo, melancolía, calma — ninguna es un obstáculo para tu manifestación. Son información. Lumgoals te ayuda a sintonizarte con cómo te sientes en realidad, todos los días, para que manifiestes desde un lugar verdadero.",
    moodHappy:   "Esperanzada",
    moodHappyD:  "El día que te dices que sí.",
    moodMeh:     "Neutral",
    moodMehD:    "Tierra firme. Buen lugar para sembrar.",
    moodSad:     "Baja",
    moodSadD:    "Horas tiernas. Honradas, nunca apuradas.",
    moodMad:     "Enojada",
    moodMadD:    "Fuego que señala lo que importa.",
    moodFootnote:"Toca un estado, escribe una línea, observa los patrones. Sin rachas rotas. Sin culpa.",

    testTitleA: "Un coro creciente,",
    testTitleB: "convirtiéndose.",
    t1Quote: "Llevo 142 días seguidos. Es lo más largo que he sostenido en mi vida adulta. El ritual de la mañana cambió cómo me presento a mi propio día.",
    t1Name:  "Maya R.",
    t1Role:  "Escritora · Brooklyn, NY",
    t2Quote: "Lumgoals es la primera app que no me hizo sentir atrás. Me lee como mi mejor amiga — pero con mejores metáforas.",
    t2Name:  "Sasha L.",
    t2Role:  "Fundadora, taller de cerámica · Lisboa",
    t3Quote: "Manifesté el apartamento. No porque la app sea mágica, sino porque me sostuvo creyendo durante los 8 meses que tardé en encontrarlo.",
    t3Name:  "Jordan T.",
    t3Role:  "Terapeuta · Toronto",

    founderTitleA: "La manifestación vive",
    founderTitleB: "en el accionar.",
    founderP1: "Soy Jahz — diseñadora, artista y fiel creyente de que manifestar no es solo desear. Es accionar. Es escuchar tu intuición hasta que se vuelva tan clara que la sigas.",
    founderP2: "Las cosas no llegan porque las pides. Llegan porque cumples los pasos mentales — soltar la duda, sostener la visión, hacer los pequeños actos diarios que le dicen al universo: estoy lista. Lumgoals es exactamente eso. Una práctica de manifestación enfocada, en tu bolsillo.",
    founderP3Quote: "Todos somos magia. Todos conectamos con algo superior que nos permite ser libres — pero solo cuando dejamos atrás las dudas y nos concentramos, totalmente, en lo que queremos.",
    founderRole: "Fundadora · Diseñadora · Artista",
    founderSignoff: "Con amor y un poquito de luz de estrellas,",
    founderName: "Jahz",

    ctaTitleA: "Empieza con 7 días de acceso completo.",
    ctaTitleB: "",
    ctaBody:   "Explora todas las funciones de Lumgoals Premium gratis. Después de la prueba, continúa por $4.99 al mes o ahorra con el plan anual de $49.99 al año.",
    ctaFootnote: "Cancela cuando quieras · Disponible en Inglés y Español",

    footTagline: "Un compañero celestial para manifestar tus sueños, escribir tu evolución y confiar en tu propia luz.",
    footColA: "Lumgoals",   footAlinks: ["Qué es manifestar","La práctica Lumgoals","Precios","Regala un año","Novedades"],
    footColB: "Recursos",   footBlinks: ["Biblioteca de práctica","Kit de prensa","Centro de ayuda"],
    footColC: "Compañía",   footClinks: ["Contacto"],
    footColD: "Legal",      footDlinks: ["Privacidad","Términos","Cookies","Accesibilidad","Tus datos"],
    footContactLink: "Contacto",
    footCopy:    "© 2026 Lumgoals · Hecho con luz de estrellas",
    footQuote:   "✦ Eres el universo, tomando consciencia de sí mismo.",

    badgeDownloadOn:  "Descarga en",
    badgeAppStore:    "App Store",
    badgeGetItOn:     "Disponible en",
    badgeGooglePlay:  "Google Play",
  },
};

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

function I18nProvider({ children }) {
  const [lang, setLang] = React.useState("en");
  const t = React.useMemo(
    () => k => (TRANSLATIONS[lang] && TRANSLATIONS[lang][k]) ?? TRANSLATIONS.en[k] ?? k,
    [lang]
  );
  return (
    <I18nContext.Provider value={{ lang, setLang, t }}>
      {children}
    </I18nContext.Provider>
  );
}

function useT() { return React.useContext(I18nContext).t; }
function useLang() { return React.useContext(I18nContext); }

// ─── THEME ────────────────────────────────────────────────────
const ThemeContext = React.createContext({ theme: "light", setTheme: () => {} });

function ThemeProvider({ children }) {
  const [theme, setTheme] = React.useState("light");
  React.useEffect(() => {
    document.body.setAttribute("data-theme", theme);
  }, [theme]);
  return (
    <ThemeContext.Provider value={{ theme, setTheme }}>
      {children}
    </ThemeContext.Provider>
  );
}
function useTheme() { return React.useContext(ThemeContext); }

Object.assign(window, { I18nProvider, useT, useLang, ThemeProvider, useTheme });
