/* ============================================================
   i18n.jsx — language toggle (HE/EN): strings dictionary,
   English content mirror, and the LangProvider/LangToggle.
   Loaded after ui.jsx (reuses its hook consts) and after data.jsx
   (reuses STData for the Hebrew baseline + shared non-text fields).
   ============================================================ */

const STRINGS = {
  he: {
    nav_products: 'הערכות', nav_group: 'רכישה קבוצתית', nav_gallery: 'גלריה', nav_love: 'המלצות', nav_faq: 'שאלות',
    talk_to_us: 'דברו איתנו', talk_to_us_wa: 'דברו איתנו בוואטסאפ',
    menu_aria: 'תפריט', close_aria: 'סגירה',
    wa_greeting: 'היי אריאל, אשמח לשמוע עוד על הערכות של Story Table',
    wa_faq_greeting: 'היי אריאל, יש לי שאלה על הערכות של Story Table',
    wa_notify_greeting: 'היי! אשמח לעדכון כשההגדה של פסח יוצאת 🙌',
    announce: 'משלוח עד הבית ב-35 ₪ · בקנייה מעל 99 ₪ משלוח ב-20 ₪ בלבד · אספקה 3-5 ימי עסקים',

    why_storytable: 'למה Story Table?',
    rating_line: '4.9/5 · נמכרו מעל 10,000 ערכות',
    marquee_words: ['ערכי · ', 'חינוכי · ', 'רב-פעמי · ', 'משפחתי · ', 'מקורי · ', 'חווייתי · '],
    happy_families: 'משפחות מרוצות',

    why_eyebrow: 'למה Story Table', why_title_a: 'לא עוד משחק. ', why_title_em: 'חוויה שמחברת.',
    why_lead: 'אנחנו מייצרים ערכות ומשחקים ערכיים, חינוכיים ומיוחדים — שהופכים את השולחן המשפחתי לרגע שזוכרים.',

    more_details: 'לפרטים נוספים ›', video_word: 'סרטון ', image_word: 'תמונה ',
    coming_soon_stock: 'בקרוב במלאי', notify_me: 'עדכנו אותי!', notify_me_launch: 'עדכנו אותי כשזה יוצא!',
    add_to_cart: 'הוספה לסל',

    products_eyebrow: 'הערכות שלנו', products_title_a: 'בחרו את הערכה ', products_title_em: 'שלכם',
    products_lead: 'כל ערכה מעוצבת בקפידה, איכותית ורב-פעמית — לשימוש חוזר שנה אחר שנה.',
    see_all_kits: (n) => `ערכות נוספות (${n}+)`, see_all_kits_short: 'לכל הערכות',

    magic_eyebrow: 'ראו את הקסם בפעולה', magic_title_a: 'איך ערכה אחת הופכת שולחן ', magic_title_em: 'לחוויה',
    demo_video: 'סרטון הדגמה', play_aria: 'נגן',

    testi_eyebrow: 'המלצות', testi_title_a: 'אלפי משפחות כבר ', testi_title_em: 'התאהבו',
    prev_aria: 'הקודם', next_aria: 'הבא', testimonial_word: 'המלצה ',

    gallery_eyebrow: 'גלריה', gallery_title_a: 'רגעים ', gallery_title_em: 'אמיתיים', gallery_title_b: ' מהשולחן',

    founders_word: 'המייסדים', about_eyebrow: 'הסיפור שלנו', about_title_a: 'משפחה שיוצרת ', about_title_em: 'בשביל משפחות',
    about_p1: 'אריאל ונעמי עמיחי הגו את הרעיון מאחורי Story Table, כשבכל חג חיפשו דרך לשמור על חמשת ילדיהם ערים, פעילים ומחוברים סביב השולחן.',
    about_p2: 'יחד עם רשל — מעצבת תעשייתית ומתכנתת — הם יצאו למסע של רעיונות יצירתיים שהפכו לערכות שמחברות אלפי משפחות לערכים, לתרבות ולסיפור.',
    about_sign: '— אריאל, נעמי ורשל',

    faq_eyebrow: 'שאלות נפוצות', faq_title_a: 'כל מה שרציתם ', faq_title_em: 'לדעת',
    faq_lead_a: 'לא מצאתם תשובה? ', faq_lead_link: 'דברו איתנו בוואטסאפ', faq_lead_dot: '.',

    final_title_a: 'מוכנים להפוך את השולחן ', final_title_em: 'לחוויה', final_title_q: '?',
    final_sub: 'הזמינו עכשיו — משלוח עד הבית ב-35 ₪, ובקנייה מעל 99 ₪ רק 20 ₪.',

    foot_tag: 'משחקים וערכות ערכיים שמחברים משפחות סביב השולחן.',
    foot_nav_h: 'ניווט', foot_contact_h: 'צרו קשר',
    whatsapp_word: 'וואטסאפ', instagram_word: 'אינסטגרם',
    foot_bottom: '© 2026 Story Table · נבנה באהבה',

    thanks_aria: 'תודה', success_title: 'תודה רבה על ההזמנה! 🎉',
    success_lead: 'התשלום התקבל בהצלחה. קיבלתם אישור הזמנה, ואנחנו כבר מתחילים להכין את הערכות שלכם באהבה 💛',
    success_point1: 'אישור וקבלה נשלחו אליכם', success_point2: 'אספקה תוך 3-5 ימי עסקים', success_point3: 'בכל שאלה — אנחנו בוואטסאפ',
    back_to_shop: 'חזרה לחנות',

    cart_title: 'הסל שלי', checkout_title: 'פרטים ותשלום', back_to_cart_aria: 'חזרה לסל',
    ship_win: 'מגיע לך משלוח מוזל — 20 ₪ עד הבית!',
    ship_progress_a: 'עוד ', ship_progress_b: ' ותקבלו משלוח מוזל (20 ₪ במקום 35 ₪)',
    cart_empty: 'הסל ריק עדיין', continue_shopping: 'להמשך הקנייה',
    remove_word: 'הסרה', less_aria: 'פחות', more_aria: 'עוד',
    subtotal_label: 'סה״כ', to_checkout: 'למעבר לתשלום', continue_shopping2: 'המשך קנייה',
    delivery_home: 'משלוח עד הבית', pickup: 'איסוף עצמי', free_word: 'חינם',
    placeholder_name: 'שם פרטי ושם משפחה', name_hint: 'יש להזין שם פרטי ושם משפחה',
    placeholder_phone: 'טלפון נייד', placeholder_email: 'אימייל',
    placeholder_street: 'רחוב ומספר', placeholder_city: 'עיר',
    placeholder_company: 'שם החברה (אופציונלי)', placeholder_tax: 'ח.פ / ע.מ (אופציונלי)',
    marketing_opt: 'אשמח לקבל עדכונים על מבצעים והטבות 💛',
    coupon_toggle: 'יש לך קופון?', coupon_placeholder: 'הזינו קוד קופון',
    coupon_remove_aria: 'הסרת קופון', coupon_apply_aria: 'החל קופון',
    coupon_invalid: 'קוד הקופון אינו תקף', coupon_applied_generic: 'הקופון הוחל בהצלחה',
    coupon_test_applied: 'קוד בדיקה הוחל — סכום לתשלום ₪1',
    subtotal_mid: 'סה״כ ביניים', coupon_discount_label: 'הנחת קופון', total_due: 'סה״כ לתשלום',
    pay_cta: 'לתשלום מאובטח', pay_cta_loading: 'מעבר לתשלום…', back_to_cart: 'חזרה לסל',
    checkout_err_link: 'אופס — לא הצלחנו ליצור קישור תשלום כרגע. נסו שוב, או צרו קשר בוואטסאפ 052-9256476.',
    checkout_err_generic: 'אופס — משהו השתבש במעבר לתשלום. נסו שוב, או צרו קשר בוואטסאפ 052-9256476.',

    a11y_statement: 'הצהרת נגישות',
    skip_link: 'דלגו לתוכן הראשי',
    contact_name: 'אריאל',
  },
  en: {
    nav_products: 'Kits', nav_group: 'Group Purchase', nav_gallery: 'Gallery', nav_love: 'Reviews', nav_faq: 'FAQ',
    talk_to_us: 'Chat with us', talk_to_us_wa: 'Chat with us on WhatsApp',
    menu_aria: 'Menu', close_aria: 'Close',
    wa_greeting: "Hi Ariel, I'd love to hear more about Story Table kits",
    wa_faq_greeting: 'Hi Ariel, I have a question about Story Table kits',
    wa_notify_greeting: "Hi! I'd love an update when the Passover Haggadah launches 🙌",
    announce: 'Home delivery for ₪35 · Orders over ₪99 ship for just ₪20 · Delivery within 3-5 business days',

    why_storytable: 'Why Story Table?',
    rating_line: '4.9/5 · Over 10,000 kits sold',
    marquee_words: ['Values-driven · ', 'Educational · ', 'Reusable · ', 'Family · ', 'Original · ', 'Immersive · '],
    happy_families: 'Happy families',

    why_eyebrow: 'Why Story Table', why_title_a: 'Not just another toy. ', why_title_em: 'An experience that connects.',
    why_lead: 'We create values-driven, educational, one-of-a-kind kits and games — turning the family table into a moment you remember.',

    more_details: 'More details ›', video_word: 'Video ', image_word: 'Image ',
    coming_soon_stock: 'Coming soon', notify_me: 'Notify me!', notify_me_launch: 'Notify me when it launches!',
    add_to_cart: 'Add to cart',

    products_eyebrow: 'Our Kits', products_title_a: 'Choose your ', products_title_em: 'perfect kit',
    products_lead: 'Every kit is carefully designed, high-quality and reusable — made to come out again, year after year.',
    see_all_kits: (n) => `See all kits (${n}+)`, see_all_kits_short: 'See all kits',

    magic_eyebrow: 'See the magic in action', magic_title_a: 'How one kit turns a table ', magic_title_em: 'into an experience',
    demo_video: 'Demo video', play_aria: 'Play',

    testi_eyebrow: 'Reviews', testi_title_a: 'Thousands of families are ', testi_title_em: 'already in love',
    prev_aria: 'Previous', next_aria: 'Next', testimonial_word: 'Review ',

    gallery_eyebrow: 'Gallery', gallery_title_a: '', gallery_title_em: 'Real', gallery_title_b: ' moments from the table',

    founders_word: 'The founders', about_eyebrow: 'Our story', about_title_a: 'A family creating ', about_title_em: 'for families',
    about_p1: 'Ariel and Noami Amichai came up with the idea behind Story Table, after searching every holiday for a way to keep their five kids awake, engaged and connected around the table.',
    about_p2: 'Together with Rachel — an industrial designer and developer — they set out on a journey of creative ideas that became kits connecting thousands of families to values, culture and story.',
    about_sign: '— Ariel, Noami & Rachel',

    faq_eyebrow: 'Frequently asked questions', faq_title_a: 'Everything you wanted ', faq_title_em: 'to know',
    faq_lead_a: "Didn't find your answer? ", faq_lead_link: 'Chat with us on WhatsApp', faq_lead_dot: '.',

    final_title_a: 'Ready to turn your table ', final_title_em: 'into an experience', final_title_q: '?',
    final_sub: 'Order now — home delivery for ₪35, or just ₪20 on orders over ₪99.',

    foot_tag: 'Values-driven games and kits that bring families together around the table.',
    foot_nav_h: 'Navigate', foot_contact_h: 'Contact us',
    whatsapp_word: 'WhatsApp', instagram_word: 'Instagram',
    foot_bottom: '© 2026 Story Table · Made with love',

    thanks_aria: 'Thank you', success_title: 'Thank you so much for your order! 🎉',
    success_lead: "Your payment went through. You'll receive an order confirmation, and we're already preparing your kits with love 💛",
    success_point1: 'Confirmation and receipt have been sent to you', success_point2: 'Delivery within 3-5 business days', success_point3: "Any questions — we're on WhatsApp",
    back_to_shop: 'Back to shop',

    cart_title: 'My cart', checkout_title: 'Details & payment', back_to_cart_aria: 'Back to cart',
    ship_win: "You've earned discounted delivery — ₪20 to your door!",
    ship_progress_a: 'Just ', ship_progress_b: ' more for discounted delivery (₪20 instead of ₪35)',
    cart_empty: 'Your cart is empty', continue_shopping: 'Continue shopping',
    remove_word: 'Remove', less_aria: 'Less', more_aria: 'More',
    subtotal_label: 'Total', to_checkout: 'Proceed to checkout', continue_shopping2: 'Continue shopping',
    delivery_home: 'Home delivery', pickup: 'Self pickup', free_word: 'Free',
    placeholder_name: 'First and last name', name_hint: 'Please enter first and last name',
    placeholder_phone: 'Mobile phone', placeholder_email: 'Email',
    placeholder_street: 'Street and number', placeholder_city: 'City',
    placeholder_company: 'Company name (optional)', placeholder_tax: 'Business ID (optional)',
    marketing_opt: "I'd love to receive updates on deals and perks 💛",
    coupon_toggle: 'Have a coupon?', coupon_placeholder: 'Enter coupon code',
    coupon_remove_aria: 'Remove coupon', coupon_apply_aria: 'Apply coupon',
    coupon_invalid: 'This coupon code is invalid', coupon_applied_generic: 'Coupon applied successfully',
    coupon_test_applied: 'Test code applied — total due ₪1',
    subtotal_mid: 'Subtotal', coupon_discount_label: 'Coupon discount', total_due: 'Total due',
    pay_cta: 'Secure checkout', pay_cta_loading: 'Redirecting to payment…', back_to_cart: 'Back to cart',
    checkout_err_link: "Oops — we couldn't create a payment link right now. Please try again, or reach us on WhatsApp 052-9256476.",
    checkout_err_generic: 'Oops — something went wrong during checkout. Please try again, or reach us on WhatsApp 052-9256476.',

    a11y_statement: 'Accessibility statement',
    skip_link: 'Skip to main content',
    contact_name: 'Ariel',
  },
};
window.STRINGS = STRINGS;

/* ---------- English mirror of data.jsx content ----------
   Only text fields are overridden; ids, prices, images and other
   non-text fields are spread in from the Hebrew source so media and
   pricing never drift between languages. */
const DATA_EN = {
  PRODUCTS: {
    panim: {
      ...STData.PRODUCTS.panim,
      name: 'The Faces Book', sub: 'A little gnome in the Land of Faces',
      badge: 'New · Launching now',
      bookQuote: 'Little Gnome, in the Land of Faces,\nWanted to explore new places',
      desc: 'Join him on a rhyming quest\nTo discover faces and senses best\nEach page reveals a special part\nTo feel, to sense, to understand the heart',
      blurb: "A heartwarming rhyming children's book that takes little ones on a journey of discovery through faces and senses — page by page, feature by feature.",
      bullets: ['A rhyming book for discovering faces and senses', 'A multi-sensory experience — feel and understand', 'Perfect for little ones'],
    },
    heroes: {
      ...STData.PRODUCTS.heroes,
      name: 'The Heroes', sub: 'Pop-up kit · Heritage heroes', badge: 'Five stories',
      lead: 'Five hero stories in one kit!',
      blurb: 'David and Goliath, Judah the Maccabee and more heroes come to life on the table. The heroic stories of the Jewish people in one stunning pop-up kit.',
      bullets: ['5 hero stories', 'A mini comic for every story', 'Reusable — a special way to learn heritage'],
      details: [
        { type: 'ul', items: ['David and Goliath', 'Samson and Delilah', 'The Story of the Maccabees', 'Bar Kochba', 'Yael and Sisera'] },
        { type: 'p', text: 'Comes with a mini comic that tells the story and sets the mood!' },
        { type: 'p', text: 'A special way to learn the stories of our heritage.' },
      ],
    },
    noah: {
      ...STData.PRODUCTS.noah,
      name: "Noah's Ark", sub: 'Pop-up kit', badge: "A little ones' favorite",
      blurb: 'The beloved story of Noah, the ark and the animals — a stunning 3D display that turns every bedtime story into an experience.',
      bullets: ['Ark and animals in 3D', 'Perfect for little ones', 'High quality and reusable'],
    },
    cards: {
      ...STData.PRODUCTS.cards,
      name: '10 Plagues Card Deck', sub: 'Card deck — 5 games in one', badge: 'New! ✨',
      lead: 'One card deck — 5 fun, original games that get the whole family into the holiday spirit!',
      blurb: 'Learn the names and order of the plagues, spark creativity and acting skills, and enjoy quality time full of laughter, movement and thinking.',
      bullets: ['5 games in one deck', 'Perfect for the seder table', 'Friendly price — ₪15'],
      details: [
        { type: 'h', text: "Inside you'll find:" },
        { type: 'ul', items: [
          'War — the classic duel, special edition',
          'Plagues memory game',
          'Egyptian charades',
          'Passover challenge cards',
          'Order of the plagues',
        ] },
        { type: 'p', text: 'The perfect holiday gift — family values and a shared experience. Bulk discounts available.' },
      ],
    },
    soldier: {
      ...STData.PRODUCTS.soldier,
      name: 'My Soldier', sub: 'Craft, coloring & play kit', badge: 'A moving gift',
      lead: 'A craft kit that helps children understand, feel and connect to the world of the army — through play and creativity.',
      blurb: "A kit for designing, coloring and playing with Israel's heroes — soldiers, men and women. A moving way to connect kids with the values of courage and giving.",
      bullets: ['Premium craft pages', 'Soldier and IDF-emblem stickers', 'Suitable for ages 4–9'],
      details: [
        { type: 'p', text: 'Every child has a soldier they know and love — a father, mother, sister, uncle, or a neighbor from the block.' },
        { type: 'p', text: 'Whether in mandatory, career, or reserve service — that soldier is a hero in their heart.' },
        { type: 'p', text: 'This kit helps children understand, feel and connect to the world of the army — through play, creativity and imagination.' },
        { type: 'h', text: "What's in the kit?" },
        { type: 'ul', items: ['Premium craft pages', 'Colorful stickers of soldiers and IDF emblems', 'A values-based activity connecting conversation, play and Israeli identity'] },
        { type: 'p', text: 'Through the kit, children get to know the world of soldiers up close, learn about mission, responsibility and contribution — and express their feelings in a fun way that sparks conversation at home and in class.' },
        { type: 'h', text: 'Who is it for?' },
        { type: 'ul', items: [
          'Children ages 4–9 — boys and girls alike',
          'Families with soldiers in the IDF — mandatory, career, or reserve service',
          'Kids whose sibling, parent, or family member is about to enlist',
          'Preschools, elementary classrooms and educational settings — as a values-based, experiential activity',
          'Employee committees, municipalities and organizations — as a moving gift for reservist families',
          'A meaningful gift for Independence Day, Family Day, holidays, birthdays or graduation parties',
        ] },
      ],
    },
    exodus: {
      ...STData.PRODUCTS.exodus,
      name: 'Exodus from Egypt', sub: 'Pop-up kit for the seder night', badge: 'Over 10K sold 🔥',
      blurb: 'A beautifully designed seder-table display that tells the story of the Exodus — immersive and engaging for the whole family.',
      bullets: ['Sturdy laminated cardboard', 'Includes a discussion & activity sheet', 'Reusable — year after year'],
      details: [
        { type: 'p', text: 'A beautifully designed seder-table display that tells the story of the Exodus — immersive and engaging for the whole family.' },
        { type: 'ul', items: ['Sturdy laminated cardboard', 'Includes a discussion & activity sheet', 'Reusable — year after year'] },
      ],
    },
    plagues: {
      ...STData.PRODUCTS.plagues,
      name: 'The Ten Plagues', sub: 'Pop-up kit for the seder night', badge: "Kids' favorite",
      lead: 'Design your seder table with the story of the Ten Plagues!',
      blurb: 'The Ten Plagues come to life on the table — a fun, memorable way to connect kids to the holiday story.',
      bullets: ['Colorful pop-up figures', 'Includes a deck of game cards', 'Reusable — year after year'],
      details: [
        { type: 'p', text: "The Israelites toil in hard labor; baby Moses in his basket is taken in by Pharaoh's daughter Batya into the palace." },
        { type: 'p', text: 'When he grows up, he comes with Aaron before Pharaoh and brings down 10 plagues!' },
        { type: 'p', text: 'Blood, frogs, lice, wild beasts, pestilence, boils, hail, locusts, darkness and the death of the firstborn!!' },
        { type: 'ul', items: ['Includes a deck of holiday-themed game cards!'] },
      ],
    },
    hagada: {
      ...STData.PRODUCTS.hagada,
      name: 'Passover Haggadah', sub: "With Story Table's characters", badge: 'Coming soon!',
      lead: 'The Haggadah the whole family is waiting for — coming soon! 🎉',
      blurb: "A Passover Haggadah with Story Table's beloved characters — woven with riddles, jokes and activities for the whole family.",
      bullets: ["Story Table's beloved characters", 'Riddles and activities for the whole family', 'Coming soon — worth the wait!'],
      details: [
        { type: 'p', text: "The full Haggadah, with Story Table's familiar characters you've already met at the seder table — and now on the page too." },
        { type: 'p', text: 'Woven through the Haggadah are riddles, jokes and family activities — so everyone stays engaged, laughs together, and ends the seder with a smile.' },
        { type: 'p', text: "A little taste of what's waiting for you:" },
        { type: 'ul', items: ['למה האפיקומן לא מחפש את עצמו? כי הוא מצא! 😄', 'בפסח אני לא אנטיפתי... אני פשוט אנטי-פת 🫓'] },
        { type: 'p', text: "The Haggadah is still on its way — message us on WhatsApp and we'll let you know the moment it's out!" },
        { type: 'h', text: 'Note: the Haggadah is written in Hebrew.' },
      ],
    },
    chametzNotes: {
      ...STData.PRODUCTS.chametzNotes,
      name: '"Passover Ready!" - Chametz Cabinet Labels', sub: 'Fun labels for cabinets & drawers before Passover', badge: 'Coming soon!',
      blurb: "20 funny labels to stick on your chametz cabinets before Passover. Each card has a witty line and a colorful illustration, so no one in the family accidentally opens the wrong cabinet. Also makes a cute little holiday gift.",
      details: [
        { type: 'p', text: "20 funny labels to stick on your chametz cabinets before Passover. Each card has a witty line and a colorful illustration, so no one in the family accidentally opens the wrong cabinet. Also makes a cute little holiday gift." },
        { type: 'h', text: 'Note: the text on these cards is in Hebrew.' },
      ],
    },
    full: {
      ...STData.PRODUCTS.full,
      name: 'Full Seder Bundle', sub: 'Exodus + The Ten Plagues', badge: 'Best value',
      blurb: 'The complete bundle: both Exodus and The Ten Plagues — the whole seder story on the table, at a great price.',
      bullets: ['2 kits in one bundle', '4 activities for kids', 'The perfect gift'],
    },
  },
  CAMPAIGNS: {
    panim: {
      ...STData.CAMPAIGNS.panim,
      label: 'The Faces Book', kicker: 'New · Launching now',
      heroTitle: 'Games that connect\nkids to values',
      heroSub: 'While screens pull us apart, we bring us together. At Story Table we create values-driven, educational, one-of-a-kind games and kits that turn every moment around the table into an experience. Our newest: The Faces Book.',
      primaryCta: 'I want The Faces Book',
    },
    heroes: {
      ...STData.CAMPAIGNS.heroes,
      label: 'The Heroes', kicker: 'Bible heroes come to life',
      heroTitle: 'Turn the story\ninto an adventure',
      heroSub: 'The Heroes — a pop-up kit that brings David and Goliath, Judah the Maccabee and the heroes of Israel to the family table. Story, play and values in one experience.',
      primaryCta: 'I want a kit',
    },
    pesach: {
      ...STData.CAMPAIGNS.pesach,
      label: 'Passover', kicker: 'Ahead of seder night',
      heroTitle: 'Turn your seder table\ninto an unforgettable experience',
      heroSub: 'Colorful pop-up kits that bring the story of the Exodus and the Ten Plagues to life. The kids will take part, get excited, and remember — next year too.',
      primaryCta: 'Get the kit',
    },
    noah: {
      ...STData.CAMPAIGNS.noah,
      label: "Noah's Ark", kicker: "The little ones' favorite story",
      heroTitle: "Noah's Ark\ncomes to life",
      heroSub: 'Noah, the ark, and all the animals — a stunning 3D display that turns every story into an experience. Perfect for little ones and the whole family.',
      primaryCta: 'I want a kit',
    },
    soldier: {
      ...STData.CAMPAIGNS.soldier,
      label: 'My Soldier', kicker: 'Heroes of Israel',
      heroTitle: 'My Soldier —\na real hero',
      heroSub: 'A craft, coloring and play kit featuring soldiers, men and women. A moving way to connect kids to courage, giving and love of the land.',
      primaryCta: 'I want a kit',
    },
  },
  VALUES: [
    { ic: 'spark', t: 'Values-driven & educational', d: "Every kit is built to connect kids to values, culture and meaningful conversation — not just another one-time toy." },
    { ic: 'family', t: 'The whole family joins in', d: 'From the littlest ones to grandma — everyone around the table, telling stories, playing and getting excited together.' },
    { ic: 'shield', t: 'High quality & reusable', d: 'Dense cardboard with a durable laminate coating. Lasts and gets used again, year after year.' },
    { ic: 'gift', t: 'A gift they remember', d: "Arrives beautifully packaged — an original, moving gift that won't end up in a drawer." },
  ],
  TRUST: [
    { n: '10K+', l: 'Kits sold' },
    { n: '4.9', l: 'Customer rating' },
    { n: '3-5', l: 'Day delivery' },
    { n: '100%', l: 'Satisfaction guaranteed' },
  ],
  TESTIMONIALS: [
    { q: "The kids didn't stop playing with the figures all evening! They finally listened to the whole story.", n: 'Michal K.', c: 'Tel Aviv' },
    { q: 'We bought the full bundle and it was worth every penny. Our guests were just as excited as the kids.', n: 'David R.', c: 'Jerusalem' },
    { q: "The quality is amazing! We spilled wine on the kit and it just wiped off. We've already saved it for next year.", n: 'Ronit S.', c: 'Haifa' },
  ],
  FAQS: [
    { q: 'What is the delivery time?', a: '3-5 business days, straight to your door.' },
    { q: 'Do you deliver all over Israel?', a: 'Absolutely :) Home delivery costs ₪35. On orders over ₪99 — discounted delivery for just ₪20.' },
    { q: 'What is it made of?', a: 'Dense cardboard, illustrated on both sides, with a laminate coating for maximum protection against water (or wine 😜).' },
    { q: 'What age is it suitable for?', a: 'Ages 4 and up — and fun for the whole family, adults included.' },
    { q: 'Buying in bulk?', a: "Get in touch and we'll put together a great deal for you." },
    { q: 'Shipping feels pricey...', a: 'You can get a neighbor interested and split the shipping — the cost is the same for one kit or several.' },
  ],
};

const DATA_HE = {
  PRODUCTS: STData.PRODUCTS, CAMPAIGNS: STData.CAMPAIGNS, VALUES: STData.VALUES,
  TRUST: STData.TRUST, TESTIMONIALS: STData.TESTIMONIALS, FAQS: STData.FAQS,
};

function applyLangData(lang) {
  const src = lang === 'en' ? DATA_EN : DATA_HE;
  STData.PRODUCTS = src.PRODUCTS;
  STData.CAMPAIGNS = src.CAMPAIGNS;
  STData.VALUES = src.VALUES;
  STData.TRUST = src.TRUST;
  STData.TESTIMONIALS = src.TESTIMONIALS;
  STData.FAQS = src.FAQS;
  window.L = STRINGS[lang];
  window.LANG = lang;
}

/* ---------- Language context ---------- */
const LangCtx = createContext(null);
window.LangCtx = LangCtx;
window.useLang = () => useContext(LangCtx);

function initialLang() {
  try {
    const q = new URLSearchParams(location.search).get('lang');
    return q === 'en' ? 'en' : 'he';
  } catch (e) { return 'he'; }
}

function LangProvider({ children }) {
  const [lang, setLangState] = useState(initialLang);
  applyLangData(lang); // synchronous — runs before children render this pass
  useEffect(() => {
    document.documentElement.lang = lang;
    document.documentElement.dir = lang === 'en' ? 'ltr' : 'rtl';
    try {
      const url = new URL(location.href);
      url.searchParams.set('lang', lang);
      history.replaceState(null, '', url);
    } catch (e) {}
  }, [lang]);
  const setLang = (l) => setLangState(l === 'en' ? 'en' : 'he');
  const val = { lang, setLang, L: STRINGS[lang] };
  return <LangCtx.Provider value={val}>{children}</LangCtx.Provider>;
}
window.LangProvider = LangProvider;

function LangToggle({ className }) {
  const { lang, setLang } = window.useLang();
  return (
    <div className={'lang-toggle' + (className ? ' ' + className : '')} role="group" aria-label="Language / שפה">
      <button type="button" className={lang === 'he' ? 'on' : ''} onClick={() => setLang('he')} aria-pressed={lang === 'he'}>עב</button>
      <button type="button" className={lang === 'en' ? 'on' : ''} onClick={() => setLang('en')} aria-pressed={lang === 'en'}>EN</button>
    </div>
  );
}
window.LangToggle = LangToggle;
