// ============================================================
// i18n.jsx — Language context + EN/HI translations
// ============================================================

const TRANSLATIONS = {
  en: {
    // Nav
    nav_products: 'Products',
    nav_approach: 'Our Approach',
    nav_quiz: 'Doshas & Quiz',
    nav_faq: 'FAQ',
    nav_signin: 'Sign in',

    // Footer
    footer_tagline: 'Real Ayurveda.\nRooted in your Prakriti.',
    footer_tagline_sub: 'Prakriti Wellness will never advertise. Our work speaks. Your hair will too.',
    footer_apply: 'Apply for access',
    footer_learn: 'Learn',
    footer_approach: 'Approach',
    footer_research: 'Research',
    footer_faq: 'FAQ',
    footer_prakriti: 'Prakriti',
    footer_quiz: 'Diagnostic Quiz',
    footer_access: 'Access',
    footer_waitlist: 'Waitlist',
    footer_circle: 'Prakriti Circle',
    footer_contact: 'Contact',
    footer_copy: '© 2026 Prakriti Wellness · Bareilly, India',
    footer_copy_sub: 'Real Ayurveda. Rooted in your Prakriti.',

    // Home hero
    hero_eyebrow: "India's first Prakriti-first wellness brand",
    hero_h1_1: 'Real Ayurveda.',
    hero_h1_2: 'Rooted in Your',
    hero_h1_em: 'Prakriti.',
    hero_desc_1: "Your hair type isn't male or female.",
    hero_desc_2: 'We build for that.',
    hero_cta_primary: 'Discover your Prakriti',
    hero_cta_secondary: 'Learn the approach',
    hero_badge: 'Waitlist-only. No ads. No mass products.',
    hero_pillar1_label: 'Rooted in',
    hero_pillar1_sub: 'Ayurveda',
    hero_pillar2_label: 'Prakriti',
    hero_pillar2_sub: 'First',
    hero_pillar3_label: 'Results from',
    hero_pillar3_sub: 'Balance',
    hero_trust1_title: 'Ancient wisdom',
    hero_trust1_sub: 'Timeless. Trusted. Tested.',
    hero_trust2_title: 'Modern understanding',
    hero_trust2_sub: 'Research-backed. Rooted in science.',
    hero_trust3_title: 'Personalized for you',
    hero_trust3_sub: 'Your Prakriti. Your prescription.',
    hero_trust4_title: 'Made in India',
    hero_trust4_sub: 'Proudly. Ethically. Consciously.',

    // Problem section
    problem_eyebrow: 'THE PROBLEM',
    problem_h2: 'Every brand knows your gender.\nNone of them know your Prakriti.',
    problem_p1: "The wellness industry was built on a gender-based framework — men's shampoo, women's oil. But Ayurveda has never categorised people this way.",
    problem_p2: 'Your hair type is not determined by gender. It is determined by your body constitution — your',

    problem_card1_h: 'Gender Based',
    problem_card1_p: 'Your shampoo was made for your gender, not your body. A Vata woman and a Pitta woman are in the same aisle — but they have',
    problem_card1_em: 'nothing in common.',
    problem_card2_h: 'Short Term Fix. Long Term Harm.',
    problem_card2_p: 'It stops your dandruff. Then brings it back stronger. Symptoms suppressed, root cause ignored. Condition',
    problem_card2_em: 'worsens over time.',
    problem_card3_h: 'Generic and Toxic.',
    problem_card3_p: 'One formula. Millions of people. Zero personalization. Sulfates, silicones, synthetic fragrance — built for shelf life,',
    problem_card3_em: 'not your health.',

    // Prakriti principle
    principle_eyebrow: 'THE PRAKRITI PRINCIPLE',
    principle_h2: 'You are not random.\nYour body follows\na pattern.',
    principle_italic: 'And that pattern\ndecides everything.',
    principle_p1: 'Ayurveda calls it —',
    principle_p2: 'Your unique mind-body blueprint shapes your hair, skin, digestion, energy and more.',
    principle_cta: 'Find your type in 60 seconds →',
    principle_badge: '🌿 Personalized insights. Ancient wisdom. Real results.',
    principle_bottom1: "You don't have random problems.",
    principle_bottom2: 'You have a predictable pattern.',

    // Dosha cards
    vata_element: 'Air + Space dominant',
    vata_personality: 'You are fast. Creative. Always thinking.',
    vata_body: 'But your body dries before it settles.',
    vata_hair: 'Hair becomes weak, brittle, unpredictable.',
    pitta_element: 'Fire dominant',
    pitta_personality: 'You are intense. Driven. Sharp.',
    pitta_body: 'But your body overheats under pressure.',
    pitta_hair: 'Hair burns out faster than it should.',
    kapha_element: 'Earth + Water dominant',
    kapha_personality: 'You are calm. Stable. Grounded.',
    kapha_body: 'But your body holds on too much.',
    kapha_hair: 'Oil builds, scalp suffocates.',

    // Quiz CTA section
    quiz_cta_discover: 'Discover yours →',
    quiz_trust1_label: '3 Minutes',
    quiz_trust1_sub: 'Assessment',
    quiz_trust2_label: 'Rooted in',
    quiz_trust2_sub: 'Ayurveda',
    quiz_trust3_label: '100% Free',
    quiz_trust3_sub: '& Private',

    // Quiz page
    quiz_intro_pill: 'Prakriti Diagnostic',
    quiz_intro_h1: 'Discover your Prakriti',
    quiz_intro_h1_em: 'in 2 minutes.',
    quiz_intro_desc: '9 questions about your hair, body, and lifestyle. We identify the root cause first — then tell you which system fits your Prakriti.',
    quiz_intro_btn: 'Start the diagnostic',
    quiz_intro_time: 'Under 2 minutes',

    quiz_header: 'Prakriti · Hair & Scalp Diagnostic',
    quiz_restart: 'Restart',
    quiz_who_prakriti: 'Prakriti',
    quiz_who_thinking: 'Prakriti · thinking',
    quiz_who_you: 'You',

    // Quiz result
    result_pill: 'Your Result',
    result_your_prakriti: 'Your Prakriti',
    result_distribution: 'Your Prakriti distribution',
    result_dual_note: 'Most people have a dual Prakriti (e.g. Vata-Pitta). Your dominant type determines the primary direction of treatment.',
    result_root_eyebrow: 'Root cause',
    result_root_title: 'Why this is your',
    result_root_title2: 'pattern.',
    result_common_in: 'Common in',
    result_kit_ready: 'is ready.',
    result_kit_launches: 'Kit launches',
    result_available_pill: 'Accepting applications',
    result_launches_pill: 'Launches',
    result_kits_limit: 'Only 150 kits per month. Confirmed',
    result_kits_limit2: 'Prakriti types receive priority consideration.',
    result_waitlist_msg: 'Join the waitlist — you will be personally notified when it launches.',
    result_apply: 'Apply for access',
    result_join_waitlist: 'Join the waitlist',
    result_read_about: 'Read about',
    result_retake: 'Retake the diagnostic',
    result_not_right: 'Result does not feel right?',
    result_retake_btn: 'Retake the diagnostic →',

    // Contact capture
    contact_pill: 'One last step',
    contact_h2_1: 'Enter your details to',
    contact_h2_2: 'join the',
    contact_h2_3: 'waitlist.',
    contact_sub: 'We will get back to you.',
    contact_name: 'Name',
    contact_email: 'Email',
    contact_whatsapp: 'WhatsApp number',
    contact_name_ph: 'Your name',
    contact_email_ph: 'Email address',
    contact_submit: 'Submit →',
    contact_sending: 'Sending…',
    contact_error: 'Something went wrong. Please try again.',
    contact_retake: 'Retake the diagnostic',
    contact_done_title: "We've received your details",
    contact_done_sub: 'We will get back to you.',
    contact_read: 'Read about',
    contact_retake2: 'Retake quiz',
    err_required: 'Required',
    err_email: 'Enter a valid email',
    err_phone: 'Enter a valid number',

    // FAQ page
    faq_pill: 'FAQ',
    faq_h1: 'Questions',
    faq_h1_em: 'we hear often.',
    faq_desc: 'If your question is not here, reach out on WhatsApp. A real person will respond within 7 days.',
    faq_still: 'Still have questions?',
    faq_still_sub: 'Ask us directly on WhatsApp. A real person will respond — within 7 days.',
    faq_apply: 'Apply for access →',
    faq_discover: 'Discover your Prakriti',

    // Research page
    research_pill: 'Research Library',
    research_h1: 'Every claim',
    research_h1_em: 'has a source.',
    research_desc: '18+ peer-reviewed citations, classical texts, two months of founder testing, and doctor validation. Judge for yourself.',
    research_footer: 'Research-backed. Founder-tested. Prakriti-filtered.',
    research_discover: 'Discover your Prakriti →',
  },

  hi: {
    // Nav
    nav_products: 'उत्पाद',
    nav_approach: 'हमारा दृष्टिकोण',
    nav_quiz: 'दोष और प्रश्नोत्तरी',
    nav_faq: 'सामान्य प्रश्न',
    nav_signin: 'साइन इन',

    // Footer
    footer_tagline: 'असली आयुर्वेद।\nआपकी प्रकृति के अनुसार।',
    footer_tagline_sub: 'Prakriti Wellness कभी विज्ञापन नहीं देगा। हमारा काम बोलता है। आपके बाल भी बोलेंगे।',
    footer_apply: 'Access के लिए आवेदन करें',
    footer_learn: 'जानें',
    footer_approach: 'Approach',
    footer_research: 'Research',
    footer_faq: 'FAQ',
    footer_prakriti: 'Prakriti',
    footer_quiz: 'Diagnostic Quiz',
    footer_access: 'Access',
    footer_waitlist: 'Waitlist',
    footer_circle: 'Prakriti Circle',
    footer_contact: 'Contact',
    footer_copy: '© 2026 Prakriti Wellness · Bareilly, India',
    footer_copy_sub: 'असली आयुर्वेद। आपकी प्रकृति के अनुसार।',

    // Home hero
    hero_eyebrow: 'भारत का पहला प्रकृति-आधारित वेलनेस ब्रांड',
    hero_h1_1: 'असली आयुर्वेद।',
    hero_h1_2: 'आपकी',
    hero_h1_em: 'प्रकृति के अनुसार।',
    hero_desc_1: 'आपके बालों का प्रकार पुरुष या महिला नहीं होता।',
    hero_desc_2: 'वो वात, पित्त या कफ होता है — हम उसी के लिए बनाते हैं।',
    hero_cta_primary: 'अपनी प्रकृति जानें',
    hero_cta_secondary: 'हमारा नज़रिया जानें',
    hero_badge: 'सिर्फ वेटलिस्ट। कोई विज्ञापन नहीं। कोई मास प्रोडक्ट नहीं।',
    hero_pillar1_label: 'आधार',
    hero_pillar1_sub: 'आयुर्वेद',
    hero_pillar2_label: 'प्रकृति',
    hero_pillar2_sub: 'पहले',
    hero_pillar3_label: 'नतीजे',
    hero_pillar3_sub: 'संतुलन से',
    hero_trust1_title: 'प्राचीन ज्ञान',
    hero_trust1_sub: 'सनातन। भरोसेमंद। परखा हुआ।',
    hero_trust2_title: 'आधुनिक समझ',
    hero_trust2_sub: 'शोध-आधारित। विज्ञान से जुड़ा।',
    hero_trust3_title: 'आपके लिए ख़ास',
    hero_trust3_sub: 'आपकी प्रकृति। आपका इलाज।',
    hero_trust4_title: 'भारत में बना',
    hero_trust4_sub: 'गर्व से। ईमानदारी से। जागरूकता से।',

    // Problem section
    problem_eyebrow: 'समस्या',
    problem_h2: 'हर ब्रांड आपका जेंडर जानता है।\nआपकी प्रकृति कोई नहीं जानता।',
    problem_p1: 'वेलनेस इंडस्ट्री जेंडर के आधार पर बनी है — पुरुषों का शैम्पू, महिलाओं का तेल। लेकिन आयुर्वेद ने कभी लोगों को इस नज़रिए से नहीं देखा।',
    problem_p2: 'आपके बालों का प्रकार जेंडर से नहीं, बल्कि आपकी शारीरिक संरचना से तय होता है — यानी आपकी',
    problem_card1_h: 'जेंडर-आधारित',
    problem_card1_p: 'आपका शैम्पू आपका जेंडर देखकर बना है, आपका शरीर नहीं। वात और पित्त प्रकृति वाले एक ही शेल्फ पर खड़े हैं — पर उनमें',
    problem_card1_em: 'कोई समानता नहीं।',
    problem_card2_h: 'अभी राहत। बाद में नुकसान।',
    problem_card2_p: 'रूसी रुकती है, फिर और ताकत से वापस आती है। लक्षण दब जाते हैं, जड़ अनदेखी रहती है। तकलीफ',
    problem_card2_em: 'वक्त के साथ बढ़ती जाती है।',
    problem_card3_h: 'एक जैसा। नुकसानदेह।',
    problem_card3_p: 'एक फॉर्मूला। करोड़ों लोग। ज़ीरो व्यक्तिगत देखभाल। सल्फेट, सिलिकॉन, आर्टिफिशियल खुशबू — शेल्फ लाइफ के लिए,',
    problem_card3_em: 'आपकी सेहत के लिए नहीं।',

    // Prakriti principle
    principle_eyebrow: 'प्रकृति सिद्धांत',
    principle_h2: 'आप अलग हैं।\nआपका शरीर एक\nख़ास पैटर्न पर चलता है।',
    principle_italic: 'और वही पैटर्न\nसब कुछ तय करता है।',
    principle_p1: 'आयुर्वेद इसे कहता है —',
    principle_p2: 'आपका अपना मन-शरीर का नक्शा — जो आपके बाल, त्वचा, पाचन, ऊर्जा सब को आकार देता है।',
    principle_cta: '60 सेकंड में अपना प्रकार जानें →',
    principle_badge: '🌿 व्यक्तिगत जानकारी। प्राचीन ज्ञान। असली नतीजे।',
    principle_bottom1: 'आपकी समस्याएं अचानक नहीं आईं।',
    principle_bottom2: 'आपका एक पैटर्न है — जो पहचाना जा सकता है।',

    // Dosha cards
    vata_element: 'वायु + आकाश प्रधान',
    vata_personality: 'आप तेज़ हैं। क्रिएटिव। दिमाग हमेशा चलता रहता है।',
    vata_body: 'पर शरीर टिकने से पहले ही सूखने लगता है।',
    vata_hair: 'बाल कमज़ोर, रूखे और बेकाबू हो जाते हैं।',
    pitta_element: 'अग्नि प्रधान',
    pitta_personality: 'आप तीव्र हैं। महत्वाकांक्षी। तेज़-तर्रार।',
    pitta_body: 'पर शरीर दबाव में जल्दी गर्म हो जाता है।',
    pitta_hair: 'बाल उम्र से पहले झड़ने लगते हैं।',
    kapha_element: 'पृथ्वी + जल प्रधान',
    kapha_personality: 'आप शांत हैं। स्थिर। ज़मीन से जुड़े।',
    kapha_body: 'पर शरीर सब कुछ रोककर रखता है।',
    kapha_hair: 'तेल जमता है, स्कैल्प दम घुटता है।',

    // Quiz CTA
    quiz_cta_discover: 'अपनी प्रकृति जानें →',
    quiz_trust1_label: '3 मिनट',
    quiz_trust1_sub: 'मूल्यांकन',
    quiz_trust2_label: 'जड़ें',
    quiz_trust2_sub: 'आयुर्वेद में',
    quiz_trust3_label: '100% मुफ़्त',
    quiz_trust3_sub: 'और निजी',

    // Quiz page
    quiz_intro_pill: 'प्रकृति निदान',
    quiz_intro_h1: 'अपनी प्रकृति जानें',
    quiz_intro_h1_em: '2 मिनट में।',
    quiz_intro_desc: 'अपने बाल, शरीर और जीवनशैली के बारे में 9 प्रश्न। हम पहले मूल कारण की पहचान करते हैं — फिर बताते हैं कि कौन सी प्रणाली आपकी प्रकृति के अनुकूल है।',
    quiz_intro_btn: 'निदान शुरू करें',
    quiz_intro_time: '2 मिनट से कम',

    quiz_header: 'प्रकृति · बाल और स्कैल्प निदान',
    quiz_restart: 'फिर से शुरू करें',
    quiz_who_prakriti: 'प्रकृति',
    quiz_who_thinking: 'प्रकृति · सोच रही है',
    quiz_who_you: 'आप',

    // Quiz result
    result_pill: 'आपका परिणाम',
    result_your_prakriti: 'आपकी प्रकृति',
    result_distribution: 'आपका प्रकृति वितरण',
    result_dual_note: 'अधिकांश लोगों की दोहरी प्रकृति होती है (जैसे वात-पित्त)। आपका प्रमुख प्रकार उपचार की प्राथमिक दिशा निर्धारित करता है।',
    result_root_eyebrow: 'मूल कारण',
    result_root_title: 'यह आपका',
    result_root_title2: 'पैटर्न क्यों है।',
    result_common_in: 'में सामान्य',
    result_kit_ready: 'तैयार है।',
    result_kit_launches: 'किट लॉन्च होगी',
    result_available_pill: 'आवेदन स्वीकार हो रहे हैं',
    result_launches_pill: 'लॉन्च',
    result_kits_limit: 'प्रति माह केवल 150 किट। पुष्टि किए गए',
    result_kits_limit2: 'प्रकृति प्रकारों को प्राथमिकता दी जाती है।',
    result_waitlist_msg: 'प्रतीक्षा सूची में शामिल हों — लॉन्च होने पर आपको व्यक्तिगत रूप से सूचित किया जाएगा।',
    result_apply: 'एक्सेस के लिए आवेदन करें',
    result_join_waitlist: 'प्रतीक्षा सूची में शामिल हों',
    result_read_about: 'पढ़ें',
    result_retake: 'निदान फिर से लें',
    result_not_right: 'परिणाम सही नहीं लग रहा?',
    result_retake_btn: 'निदान फिर से लें →',

    // Contact capture
    contact_pill: 'आखिरी कदम',
    contact_h2_1: 'विवरण दर्ज करें और',
    contact_h2_2: '',
    contact_h2_3: 'प्रतीक्षा सूची में शामिल हों।',
    contact_sub: 'हम जल्द वापस आएंगे।',
    contact_name: 'नाम',
    contact_email: 'ईमेल',
    contact_whatsapp: 'WhatsApp नंबर',
    contact_name_ph: 'आपका नाम',
    contact_email_ph: 'ईमेल पता',
    contact_submit: 'जमा करें →',
    contact_sending: 'भेजा जा रहा है…',
    contact_error: 'कुछ गलत हुआ। कृपया पुनः प्रयास करें।',
    contact_retake: 'निदान फिर से लें',
    contact_done_title: 'हमें आपका विवरण मिल गया',
    contact_done_sub: 'हम जल्द वापस आएंगे।',
    contact_read: 'पढ़ें',
    contact_retake2: 'प्रश्नोत्तरी फिर से लें',
    err_required: 'आवश्यक है',
    err_email: 'वैध ईमेल दर्ज करें',
    err_phone: 'वैध नंबर दर्ज करें',

    // FAQ page
    faq_pill: 'सामान्य प्रश्न',
    faq_h1: 'प्रश्न',
    faq_h1_em: 'जो हम अक्सर सुनते हैं।',
    faq_desc: 'यदि आपका प्रश्न यहाँ नहीं है, तो WhatsApp पर संपर्क करें। एक वास्तविक व्यक्ति 7 दिनों के भीतर जवाब देगा।',
    faq_still: 'अभी भी प्रश्न हैं?',
    faq_still_sub: 'WhatsApp पर सीधे पूछें। एक वास्तविक व्यक्ति — 7 दिनों के भीतर जवाब देगा।',
    faq_apply: 'एक्सेस के लिए आवेदन करें →',
    faq_discover: 'अपनी प्रकृति जानें',

    // Research page
    research_pill: 'शोध पुस्तकालय',
    research_h1: 'हर दावे का',
    research_h1_em: 'स्रोत है।',
    research_desc: '18+ सहकर्मी-समीक्षित उद्धरण, शास्त्रीय ग्रंथ, दो महीने का संस्थापक परीक्षण और डॉक्टर सत्यापन। स्वयं निर्णय करें।',
    research_footer: 'शोध-समर्थित। संस्थापक-परीक्षित। प्रकृति-फ़िल्टर्ड।',
    research_discover: 'अपनी प्रकृति जानें →',
  },
};

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

function LangProvider({ children }) {
  const [lang, setLang] = React.useState(() => {
    try { return localStorage.getItem('pw-lang') || 'en'; } catch { return 'en'; }
  });

  React.useEffect(() => {
    try { localStorage.setItem('pw-lang', lang); } catch {}
  }, [lang]);

  const t = (key) => TRANSLATIONS[lang]?.[key] ?? TRANSLATIONS.en[key] ?? key;

  return React.createElement(LangContext.Provider, { value: { lang, t, setLang } }, children);
}

function useLang() {
  return React.useContext(LangContext);
}

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