// i18n — single source of truth for JP/EN copy.
// Usage: const { t, lang, setLang } = useI18n(); t('hero.title');
// Lang state lives in localStorage('futo.lang') and is broadcast via 'futo:langchange' event.

const STRINGS = {
  ja: {
    'nav.about': '風都について',
    'nav.business': '事業内容',
    'nav.culture': 'カルチャー',
    'nav.contact': 'お問い合わせ',
    'nav.langSwitch': '日本語',
    'nav.langOther': 'EN',

    'hero.meta.est': '令和4年 創業 / 2022',
    'hero.meta.loc': '東京 · 渋谷',
    'hero.brand': 'FUTO CORPORATION',
    'hero.title': ['技術と文化の', '交差する場所で。'],
    'hero.sub': ['AIによるドキュメント変革から、', '古美術の継承まで。'],
    'hero.scroll': 'スクロール',

    'about.num': '01 — 風都について',
    'about.eyebrow': '風都について',
    'about.title': ['技術で人々の', '生活を豊かにする。'],
    'about.titleSub': '私たちの理念',
    'about.body1': '2022年、東京・渋谷に風都株式会社は生まれました。私たちは技術と文化の交差点に立ち、AIによるドキュメント変革から古美術の継承、そして日々の食卓まで、人々の暮らしを少しだけ豊かにする仕事を続けています。',
    'about.body2': '小さな会社ながら、領域を越えて働くことで、それぞれの仕事に新しい風を吹き込みたいと考えています。',
    'about.caption': '風都本社所蔵 · 仏龕',
    'about.stat.foundedNum': '2022',
    'about.stat.foundedLabel': '設立',
    'about.stat.domainsNum': '07',
    'about.stat.domainsLabel': '事業領域',
    'about.stat.hqNum': '渋谷',
    'about.stat.hqLabel': '本社',
    'about.cta': 'お問い合わせ',

    'profile.num': '02 — 会社概要',
    'profile.eyebrow': '会社概要',
    'profile.title': 'プロフィール',
    'profile.intro': '当社の基本情報をご紹介します。',
    'profile.row.company.label': '会社名',
    'profile.row.company.val': '風都株式会社',
    'profile.row.founded.label': '設立',
    'profile.row.founded.val': '令和4年 7月13日',
    'profile.row.rep.label': '代表者',
    'profile.row.rep.val': 'チェン ズユアン',
    'profile.row.hq.label': '本社',
    'profile.row.hq.val': '東京都渋谷区渋谷 2-9-11',
    'profile.row.hq.sub': '青山シティビル 3F · 〒150-0002',
    'profile.row.tel.label': '電話',
    'profile.row.tel.val': '03-6803-8438',
    'profile.row.tel.sub': '平日 9:00 - 18:00',
    'profile.row.domains.label': '事業領域',
    'profile.row.domains.val': 'IT · 古美術 · 飲食',

    'biz.num': '03 — 事業内容',
    'biz.eyebrow': '事業内容',
    'biz.title': ['八つの仕事、', 'ひとつの理念。'],
    'biz.titleSub': 'ひとつの会社で、領域を越える。',
    'biz.cat.all': '全て',
    'biz.cat.it': 'IT・テクノロジー',
    'biz.cat.culture': '文化・古美術',
    'biz.cat.life': '生活・サービス',
    'biz.flagship': '主力プロダクト',
    'biz.view': '詳細を見る',
    'biz.s.aitranspdf.title': 'AITransPDF',
    'biz.s.aitranspdf.subtitle': 'AIドキュメント翻訳',
    'biz.s.aitranspdf.desc': 'PDFを含む各種ドキュメントを、レイアウトを保持したままAI翻訳。多言語対応で、ビジネスの境界を越える。',
    'biz.s.belindoc.title': 'Belin Doc',
    'biz.s.belindoc.subtitle': '無料・無制限のAI翻訳',
    'biz.s.belindoc.desc': 'トップクラスの大規模モデルを搭載した、無料・無制限のAIドキュメント翻訳ツール。元のレイアウトを完全に保持。登録不要、優れた翻訳品質。',
    'biz.s.sys.title': 'ITシステムの構築・運用',
    'biz.s.sys.subtitle': 'システム & オペレーション',
    'biz.s.sys.desc': 'クライアントの基幹を支えるITインフラの設計・構築・運用までを一貫してご提供。',
    'biz.s.soft.title': 'ソフトウェア開発・販売',
    'biz.s.soft.subtitle': 'ソフトウェア開発',
    'biz.s.soft.desc': '業務効率化ツールから自社プロダクトまで、用途に応じた開発と提供。',
    'biz.s.game.title': 'ゲーム開発・販売',
    'biz.s.game.subtitle': 'ゲーム開発',
    'biz.s.game.desc': 'インタラクティブな体験を、企画から運営までトータルで設計。',
    'biz.s.ec.title': 'Eコマース',
    'biz.s.ec.subtitle': 'Eコマース',
    'biz.s.ec.desc': 'デジタルとリアルの境界を越える、新しい購買体験の設計。',
    'biz.s.antique.title': '古美術商売',
    'biz.s.antique.subtitle': '日本の古美術',
    'biz.s.antique.desc': '仏龕・古刀・香炉・薩摩焼など、由緒正しき古美術品の鑑定・取扱い。',
    'biz.s.food.title': '飲食店運営',
    'biz.s.food.subtitle': 'ホスピタリティ',
    'biz.s.food.desc': '日々の食卓に寄り添う、誠実な味と空間のあるお店づくり。',
    'biz.gallery.eyebrow': '古美術 · 選りすぐりの逸品',
    'biz.gallery.title': '風都が扱う、四つの逸品',

    'cult.num': '04 — カルチャー',
    'cult.eyebrow': 'カルチャー',
    'cult.title': ['技術の裏に、', '人と文化がいる。'],
    'cult.titleSub': '会社をかたちづくるもの。',
    'cult.body': '私たちは技術革新と並行して、企業文化の育成にも力を注いでいます。社員一人ひとりが自分らしくあれる場をつくることで、創造性と生産性は自然に伴走する——そう信じています。',
    'cult.c1.title': '文化芸術サロン',
    'cult.c1.desc': 'お茶会、お香の体験、芸術家による講演やミニコンサート。本社ラウンジは、日常から少し距離を置いて、心を整えるための場所です。',
    'cult.c2.title': '働く環境',
    'cult.c2.desc': 'フレキシブルな勤務体系、創造的な余白、そして個人の関心を尊重する文化。仕事と人生を、対立させない設計。',
    'cult.c3.title': '私たちの取り組み',
    'cult.c3.desc': '環境保護、地域社会への還元、そして持続可能な事業設計。企業活動の総体として、社会に対する責任を果たします。',

    'cta.eyebrow': '— 共に未来へ',
    'cta.title': 'ご相談、お待ちしております。',
    'cta.titleSub': '静かに、確かに。',
    'cta.btn': 'お問い合わせへ',

    'foot.tagline': '技術と文化の交差する場所で、人々の暮らしを少しだけ豊かに。',
    'foot.h.nav': 'ナビゲーション',
    'foot.h.products': 'プロダクト',
    'foot.h.contact': '連絡先',
    'foot.tel': '03-6803-8438',
    'foot.hours': '平日 9:00 – 18:00',
    'foot.copyright': '© 2024 風都株式会社',
    'foot.loc': '東京 · 渋谷',

    'cp.crumb': 'ホーム · / · お問い合わせ',
    'cp.title': 'お問い合わせ',
    'cp.titleSub': '静かに、確かに、ご相談を。',
    'cp.eyebrow': '— ご連絡ください',
    'cp.lead': 'ご依頼・ご質問など、お気軽にお問い合わせください。下記フォーム、または直接ご連絡先までどうぞ。',
    'cp.info.hq': '本社所在地',
    'cp.info.hqVal': '東京都渋谷区渋谷 2-9-11',
    'cp.info.hqSub': '青山シティビル 3F · 〒150-0002',
    'cp.info.tel': '電話',
    'cp.info.telSub': '平日 9:00 – 18:00',
    'cp.info.mail': 'メール',
    'cp.info.mailSub': '24時間受付・2営業日以内に返信',
    'cp.info.founded': '設立',
    'cp.info.foundedVal': '令和4年(2022年) 7月13日',
    'cp.info.foundedSub': '代表 · チェン ズユアン',
    'cp.form.label': 'F-CTC.01 · お問い合わせフォーム',
    'cp.form.title': 'お問い合わせフォーム',
    'cp.form.lead': 'ご相談内容をお書きください。2営業日以内に返信いたします。',
    'cp.form.name': 'お名前',
    'cp.form.namePh': '山田 太郎',
    'cp.form.company': '会社名',
    'cp.form.companyPh': '株式会社○○',
    'cp.form.email': 'メール',
    'cp.form.phone': '電話番号',
    'cp.form.subject': 'ご相談内容',
    'cp.form.subjectPh': '選択してください',
    'cp.form.subOpts': ['AITransPDF について', 'Belin Doc について', 'ITシステム / 開発のご相談', '古美術のお取引', '飲食店事業について', 'その他'],
    'cp.form.message': 'メッセージ',
    'cp.form.messagePh': 'ご相談内容をお聞かせください。',
    'cp.form.required': '* 必須項目です',
    'cp.form.thanks': '送信ありがとうございました。',
    'cp.form.submit': '送信する',
    'cp.map.num': 'F-MAP · アクセス',
    'cp.map.eyebrow': 'アクセス',
    'cp.map.pin': '青山シティビル 3F',
    'cp.map.pinSub': '風都本社',
  },
  en: {
    'nav.about': 'About',
    'nav.business': 'Business',
    'nav.culture': 'Culture',
    'nav.contact': 'Contact',
    'nav.langSwitch': 'English',
    'nav.langOther': 'JP',

    'hero.meta.est': 'EST · 2022',
    'hero.meta.loc': 'SHIBUYA · TOKYO',
    'hero.brand': 'FUTO CORPORATION',
    'hero.title': ['At the intersection of', 'technology and culture.'],
    'hero.sub': ['From reinventing documents with AI', 'to preserving the craft of antiquity.'],
    'hero.scroll': 'Scroll',

    'about.num': '01 — ABOUT',
    'about.eyebrow': 'About Us',
    'about.title': ['Enriching life', 'through technology.'],
    'about.titleSub': 'Our principle',
    'about.body1': 'Founded in 2022 in Shibuya, Tokyo, Futo stands at the intersection of technology and culture — from reinventing documents with AI to preserving the craft of antiquity, and the simple pleasures of a well-set table.',
    'about.body2': 'A small company by design, working across domains so each line of work can carry a fresh wind into the next.',
    'about.caption': 'Futo collection · Buddhist altar',
    'about.stat.foundedNum': '2022',
    'about.stat.foundedLabel': 'Founded',
    'about.stat.domainsNum': '07',
    'about.stat.domainsLabel': 'Domains',
    'about.stat.hqNum': 'Shibuya',
    'about.stat.hqLabel': 'Headquarters',
    'about.cta': 'Get in touch',

    'profile.num': '02 — PROFILE',
    'profile.eyebrow': 'Company Profile',
    'profile.title': 'Company Profile',
    'profile.intro': 'The essentials, on one page.',
    'profile.row.company.label': 'Company',
    'profile.row.company.val': 'Futo Corporation',
    'profile.row.founded.label': 'Founded',
    'profile.row.founded.val': 'July 13, 2022',
    'profile.row.rep.label': 'Representative',
    'profile.row.rep.val': 'Chen Zhiyuan',
    'profile.row.hq.label': 'Headquarters',
    'profile.row.hq.val': '2-9-11 Shibuya, Shibuya-ku, Tokyo',
    'profile.row.hq.sub': 'Aoyama City Bldg. 3F · 150-0002',
    'profile.row.tel.label': 'Phone',
    'profile.row.tel.val': '+81 3-6803-8438',
    'profile.row.tel.sub': 'Weekdays 9:00 – 18:00',
    'profile.row.domains.label': 'Domains',
    'profile.row.domains.val': 'Tech · Antiquity · Hospitality',

    'biz.num': '03 — BUSINESS',
    'biz.eyebrow': 'What we do',
    'biz.title': ['Eight businesses,', 'one principle.'],
    'biz.titleSub': 'One company, working across domains.',
    'biz.cat.all': 'All',
    'biz.cat.it': 'Technology',
    'biz.cat.culture': 'Culture & Antiquity',
    'biz.cat.life': 'Hospitality',
    'biz.flagship': 'FLAGSHIP',
    'biz.view': 'View',
    'biz.s.aitranspdf.title': 'AITransPDF',
    'biz.s.aitranspdf.subtitle': 'AI Document Translation',
    'biz.s.aitranspdf.desc': 'AI translation that preserves document layout — across PDF, Word, and beyond. Built for global business.',
    'biz.s.belindoc.title': 'Belin Doc',
    'biz.s.belindoc.subtitle': 'Free Unlimited AI Translation',
    'biz.s.belindoc.desc': 'A free, unlimited AI document translator powered by top-tier large models. Layout fully preserved. No signup required.',
    'biz.s.sys.title': 'IT Systems & Operations',
    'biz.s.sys.subtitle': 'Systems & Operations',
    'biz.s.sys.desc': 'End-to-end IT infrastructure — from architecture to operations — for the systems that run a business.',
    'biz.s.soft.title': 'Software Development',
    'biz.s.soft.subtitle': 'Software Development',
    'biz.s.soft.desc': 'Custom software, in-house products, and everything in between.',
    'biz.s.game.title': 'Game Development',
    'biz.s.game.subtitle': 'Game Development',
    'biz.s.game.desc': 'Interactive experiences, designed end-to-end — concept, build, operations.',
    'biz.s.ec.title': 'E-commerce',
    'biz.s.ec.subtitle': 'E-commerce',
    'biz.s.ec.desc': 'Commerce that bridges digital and physical, built around the way people actually shop.',
    'biz.s.antique.title': 'Japanese Antiquity',
    'biz.s.antique.subtitle': 'Japanese Antiquity',
    'biz.s.antique.desc': 'Curating Buddhist altars, antique blades, incense burners, and Satsuma ware — pieces with provenance.',
    'biz.s.food.title': 'Restaurant Operations',
    'biz.s.food.subtitle': 'Hospitality',
    'biz.s.food.desc': 'Restaurants built on honest food and considered space.',
    'biz.gallery.eyebrow': 'Antiquity · Selected works',
    'biz.gallery.title': 'Four pieces from the Futo collection',

    'cult.num': '04 — CULTURE',
    'cult.eyebrow': 'Culture',
    'cult.title': ['Behind every technology,', 'people and culture.'],
    'cult.titleSub': 'What shapes the company.',
    'cult.body': 'Alongside technical work, we invest in the company\'s inner life. We believe creativity and productivity follow naturally from a place where each person can be themselves.',
    'cult.c1.title': 'Arts & Culture Salon',
    'cult.c1.desc': 'Tea ceremonies, incense, artist talks and small concerts — the headquarters lounge is a quiet remove from the everyday.',
    'cult.c2.title': 'Workplace',
    'cult.c2.desc': 'Flexible hours, room to think, and a culture that takes personal interests seriously. Work and life, set up not to oppose each other.',
    'cult.c3.title': 'Our Commitment',
    'cult.c3.desc': 'Environmental care, community reinvestment, and a long view on sustainability — responsibility as the sum of how a company acts.',

    'cta.eyebrow': '— Together, forward',
    'cta.title': "Let's build something quietly remarkable.",
    'cta.titleSub': 'Quietly, considered.',
    'cta.btn': 'Get in touch',

    'foot.tagline': 'At the intersection of technology and culture, working to enrich daily life — quietly.',
    'foot.h.nav': 'Navigate',
    'foot.h.products': 'Products',
    'foot.h.contact': 'Contact',
    'foot.tel': '+81 3-6803-8438',
    'foot.hours': 'Weekdays 9:00 – 18:00',
    'foot.copyright': '© 2024 Futo Corporation',
    'foot.loc': 'Shibuya · Tokyo · Japan',

    'cp.crumb': 'HOME · / · CONTACT',
    'cp.title': 'Contact Us',
    'cp.titleSub': 'A quiet, considered conversation.',
    'cp.eyebrow': '— GET IN TOUCH',
    'cp.lead': 'For inquiries, partnerships, or simply to say hello — please use the form below or reach us directly.',
    'cp.info.hq': 'Headquarters',
    'cp.info.hqVal': '2-9-11 Shibuya, Shibuya-ku, Tokyo',
    'cp.info.hqSub': 'Aoyama City Bldg. 3F · 150-0002',
    'cp.info.tel': 'Phone',
    'cp.info.telSub': 'Weekdays 9:00 – 18:00',
    'cp.info.mail': 'Email',
    'cp.info.mailSub': 'Replies within two business days',
    'cp.info.founded': 'Founded',
    'cp.info.foundedVal': 'July 13, 2022',
    'cp.info.foundedSub': 'Representative · Chen Zhiyuan',
    'cp.form.label': 'F-CTC.01 · Inquiry Form',
    'cp.form.title': 'Inquiry Form',
    'cp.form.lead': "Send us a quiet note. We'll reply within two business days.",
    'cp.form.name': 'Name',
    'cp.form.namePh': 'Jane Doe',
    'cp.form.company': 'Company',
    'cp.form.companyPh': 'Company name',
    'cp.form.email': 'Email',
    'cp.form.phone': 'Phone',
    'cp.form.subject': 'Subject',
    'cp.form.subjectPh': 'Please select',
    'cp.form.subOpts': ['About AITransPDF', 'About Belin Doc', 'IT systems / development', 'Antique inquiries', 'Hospitality / restaurants', 'Other'],
    'cp.form.message': 'Message',
    'cp.form.messagePh': 'Tell us a little about what you have in mind.',
    'cp.form.required': '* Required fields',
    'cp.form.thanks': "Thank you — we'll be in touch.",
    'cp.form.submit': 'Send',
    'cp.map.num': 'F-MAP · ACCESS',
    'cp.map.eyebrow': 'Access',
    'cp.map.pin': 'Aoyama City Bldg. 3F',
    'cp.map.pinSub': 'FUTO HQ',
  },
};

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

function I18nProvider({ children }) {
  const [lang, setLangState] = React.useState(() => {
    try { return localStorage.getItem('futo.lang') || 'ja'; } catch (e) { return 'ja'; }
  });
  React.useEffect(() => {
    document.documentElement.lang = lang;
    try { localStorage.setItem('futo.lang', lang); } catch (e) {}
  }, [lang]);
  const setLang = React.useCallback((v) => setLangState(v), []);
  const t = React.useCallback((key) => {
    const dict = STRINGS[lang] || STRINGS.ja;
    if (key in dict) return dict[key];
    return STRINGS.ja[key] !== undefined ? STRINGS.ja[key] : key;
  }, [lang]);
  return React.createElement(I18nCtx.Provider, { value: { lang, setLang, t } }, children);
}

function useI18n() { return React.useContext(I18nCtx); }

window.I18nProvider = I18nProvider;
window.useI18n = useI18n;
