// strings-legal.jsx — bilingual block-level document model for legal pages.
// Doc = { title, subtitle, sections: [ { heading, blocks: [ {p:"…"} | {ul:["…",…]} ] } ] }
// de left EMPTY (skeleton) → renderer falls back to en. Translator fills de with formal-Sie prose.
//
// Non-flattenable inline JSX notes (reported):
// • Terms §9 "Governing Law": the EU ODR URL is a real <a href="https://ec.europa.eu/consumers/odr">
//   link, kept via the inline-segment block form {p:[ "…", {href,text}, "…" ]} (rendered by
//   legal-pages.jsx renderInline). Translators: preserve this segment shape when filling `de`.
// • Terms §10 "Contact", Privacy §1 "Data Controller", Privacy §11 "Contact & Data Subject Requests",
//   Imprint "Service Provider", Imprint "Contact": these sections contained styled address-card
//   <div> blocks. The address text is preserved verbatim as {p:"…"} blocks; the card styling
//   is rendered by the LegalDocView address-card renderer via {card:[…]} blocks.
// • Imprint "VAT Identification Number": <strong>DE356252858</strong> — bold dropped; text preserved.
// • Imprint "Online Dispute Resolution": the ODR URL is a real <a> link via the same
//   inline-segment {p:[{href,text}]} block form.

const LEGAL_DOCS = {
  terms: {
    en: {
      title: "Terms & Conditions",
      subtitle: "Please read these terms carefully before using OttoKlar. By accessing or using our service you agree to be bound by them.",
      sections: [
        {
          heading: "1. Scope and Acceptance",
          blocks: [
            { p: "These Terms & Conditions (\"Terms\") govern the access to and use of the OttoKlar platform (\"Service\"), operated by Artificient Mobility Intelligence GmbH, Jülicher Str. 209 Q-S, 52070 Aachen, Germany (\"we\", \"us\", or \"our\")." },
            { p: "By accessing or using the Service — including through our website, web application, or any API — you confirm that you have read, understood, and agree to be bound by these Terms, together with our Privacy Policy. If you do not agree, you must not use the Service." },
            { p: "We reserve the right to update these Terms at any time. Continued use of the Service after any change constitutes acceptance of the revised Terms. We will notify users of material changes via email or a prominent notice on the platform." },
          ],
        },
        {
          heading: "2. Description of Service",
          blocks: [
            { p: "OttoKlar provides an AI-powered car damage assessment service. Users upload photographs of vehicle damage and receive an automated estimate of likely repair costs, along with general repair guidance and, where available, referrals to vetted automotive workshops (\"Meisterbetriebe\") in our partner network." },
            { p: "The Service is designed to assist users in understanding the scope and approximate cost of repair work. It does not constitute a legally binding repair offer, insurance assessment, or official appraisal (Gutachten) of any kind." },
            { p: "Availability of workshop matching is currently limited to Hamburg, Berlin, Munich, Cologne, Frankfurt, and Stuttgart. Coverage is extended on a rolling basis." },
          ],
        },
        {
          heading: "3. Accuracy of Estimates",
          blocks: [
            { p: "Cost estimates produced by the Service are generated by machine-learning models trained on historical repair data, parts catalogues (including DAT and Audatex reference data), and regional labour rate benchmarks. They are indicative only." },
            { p: "Actual repair costs may differ materially from our estimates due to factors including but not limited to:" },
            { ul: [
              "Hidden or structural damage not visible in photographs",
              "Variations in parts availability and regional workshop pricing",
              "Insurance surcharges, deductibles, or policy exclusions",
              "Vehicle-specific configurations or non-standard modifications",
              "Labour rate changes after the date of estimate",
            ] },
            { p: "We make no warranty, express or implied, that any estimate reflects the price a user will ultimately pay. Users should obtain binding quotes directly from workshops before authorising any repair work." },
          ],
        },
        {
          heading: "4. User Obligations",
          blocks: [
            { p: "You agree to use the Service only for lawful purposes and in a manner consistent with these Terms. In particular, you must not:" },
            { ul: [
              "Upload images that depict third parties without their consent",
              "Submit false, misleading, or fabricated damage photographs",
              "Attempt to reverse-engineer, scrape, or systematically extract data from the Service",
              "Use the Service to support fraudulent insurance claims or misrepresentation",
              "Circumvent any access controls, rate limits, or security measures",
              "Resell or sublicense access to the Service without our prior written consent",
            ] },
            { p: "You are solely responsible for the accuracy and legality of any content you submit. We reserve the right to suspend or terminate access for any user who violates these obligations." },
          ],
        },
        {
          heading: "5. Intellectual Property",
          blocks: [
            { p: "All content, software, algorithms, design, text, and data comprising the Service are the exclusive property of Artificient Mobility Intelligence GmbH or its licensors and are protected by applicable intellectual property laws." },
            { p: "Nothing in these Terms grants you any ownership right or licence in the Service beyond the limited, non-exclusive, non-transferable right to use it for its intended purpose during the term of your access." },
            { p: "By submitting photographs or other content to the Service, you grant us a non-exclusive, worldwide, royalty-free licence to use such content solely for the purpose of providing and improving the Service, including model training, subject to your rights under our Privacy Policy." },
          ],
        },
        {
          heading: "6. Limitation of Liability",
          blocks: [
            { p: "To the fullest extent permitted by applicable law, Artificient Mobility Intelligence GmbH shall not be liable for any indirect, incidental, special, consequential, or punitive damages arising out of or related to your use of, or inability to use, the Service — including loss of profits, data, goodwill, or business opportunities." },
            { p: "Our aggregate liability for any claims arising under or in connection with these Terms shall not exceed the greater of (a) the total fees paid by you to us in the twelve months preceding the claim or (b) €50." },
            { p: "Nothing in these Terms limits liability for death or personal injury caused by negligence, fraud, or any other liability that cannot lawfully be excluded." },
          ],
        },
        {
          heading: "7. Service Availability",
          blocks: [
            { p: "We aim to provide a reliable service but do not guarantee uninterrupted or error-free availability. The Service may be temporarily unavailable due to maintenance, infrastructure updates, or circumstances beyond our control." },
            { p: "We reserve the right to modify, suspend, or discontinue any feature of the Service at any time with reasonable notice where practicable." },
          ],
        },
        {
          heading: "8. Third-Party Links and Partners",
          blocks: [
            { p: "The Service may display or link to third-party workshops, products, or websites. We do not endorse and are not responsible for the content, pricing, or conduct of any third party. Any engagement with a partner workshop is a separate contract between you and that workshop." },
          ],
        },
        {
          heading: "9. Governing Law and Jurisdiction",
          blocks: [
            { p: "These Terms are governed by the laws of the Federal Republic of Germany, excluding its conflict-of-laws provisions and the UN Convention on Contracts for the International Sale of Goods (CISG)." },
            { p: "Any disputes arising out of or in connection with these Terms shall be subject to the exclusive jurisdiction of the courts of Aachen, Germany, to the extent permitted by applicable law. Consumers within the EU retain the right to bring proceedings in the courts of their country of domicile." },
            { p: ["The European Commission's Online Dispute Resolution platform is available at ", { href: "https://ec.europa.eu/consumers/odr", text: "ec.europa.eu/consumers/odr" }, ". We are not obliged to participate in alternative dispute resolution proceedings but will consider doing so on a case-by-case basis."] },
          ],
        },
        {
          heading: "10. Contact",
          blocks: [
            { p: "Questions regarding these Terms may be directed to:" },
            { card: [
              "Artificient Mobility Intelligence GmbH",
              "Jülicher Str. 209 Q-S · 52070 Aachen · Germany",
              "E-mail: hello@ottoklar.com",
            ] },
          ],
        },
      ],
    },
    de: { title: "", subtitle: "", sections: [] },
  },

  privacy: {
    en: {
      title: "Privacy Policy",
      subtitle: "We take your privacy seriously. This policy explains what personal data we collect, why we collect it, and your rights under the GDPR.",
      sections: [
        {
          heading: "1. Data Controller",
          blocks: [
            { p: "The data controller responsible for processing your personal data is:" },
            { card: [
              "Artificient Mobility Intelligence GmbH",
              "Jülicher Str. 209 Q-S · 52070 Aachen · Germany",
              "E-mail: hello@ottoklar.com",
            ] },
          ],
        },
        {
          heading: "2. What Data We Collect",
          blocks: [
            { p: "We collect and process the following categories of personal data:" },
            { ul: [
              "Vehicle photographs you upload (including any EXIF metadata embedded in the image files)",
              "Vehicle details you provide: make, model, year of manufacture",
              "Your postal code (used to calibrate regional labour rates and identify nearby workshops)",
              "Technical data automatically collected during use: IP address, browser type and version, device type, pages visited, timestamps",
              "Communications you send us via contact forms or e-mail",
            ] },
            { p: "We do not require account registration for basic use of the Service. We do not intentionally collect sensitive personal data (Article 9 GDPR) and ask that you not include such information in any photographs or messages you submit." },
          ],
        },
        {
          heading: "3. How We Use Your Data",
          blocks: [
            { p: "We process your personal data for the following purposes:" },
            { ul: [
              "Providing the damage assessment and cost estimation service you requested",
              "Matching your vehicle and damage profile to relevant workshops in our network",
              "Improving the accuracy of our AI models using anonymised and aggregated damage data",
              "Operating, maintaining, and securing the platform",
              "Responding to support enquiries and legal requests",
              "Complying with applicable legal obligations",
            ] },
            { p: "We do not use your data for automated profiling that produces legal or similarly significant effects, nor do we sell your data to third parties for marketing purposes." },
          ],
        },
        {
          heading: "4. Legal Basis for Processing",
          blocks: [
            { p: "We process your personal data under the following legal bases pursuant to Article 6 GDPR:" },
            { ul: [
              "Art. 6(1)(b) — performance of a contract: processing your photographs and vehicle data to provide the estimation service you requested",
              "Art. 6(1)(f) — legitimate interests: processing technical and usage data to secure and improve the Service, and to detect and prevent fraud",
              "Art. 6(1)(c) — legal obligation: retaining certain records as required by German commercial and tax law",
              "Art. 6(1)(a) — consent: where we ask for your agreement before optional processing, such as marketing communications (you may withdraw consent at any time)",
            ] },
          ],
        },
        {
          heading: "5. Data Retention",
          blocks: [
            { p: "We retain personal data only as long as necessary for the purposes described above:" },
            { ul: [
              "Uploaded photographs: deleted automatically after 90 days, or immediately upon request",
              "Anonymised damage embeddings used for model training: retained indefinitely (no longer personal data)",
              "Technical logs: deleted after 30 days",
              "Support communications: retained for 3 years after the last contact",
              "Financial records: retained for 10 years as required by § 257 HGB and § 147 AO",
            ] },
          ],
        },
        {
          heading: "6. Your Rights Under the GDPR",
          blocks: [
            { p: "As a data subject, you have the following rights, which you may exercise at any time by contacting us at hello@ottoklar.com:" },
            { ul: [
              "Right of access (Art. 15): to receive a copy of the personal data we hold about you",
              "Right to rectification (Art. 16): to correct inaccurate or incomplete data",
              "Right to erasure (Art. 17): to request deletion of your data ('right to be forgotten')",
              "Right to restriction (Art. 18): to limit how we process your data in certain circumstances",
              "Right to data portability (Art. 20): to receive your data in a structured, machine-readable format",
              "Right to object (Art. 21): to object to processing based on legitimate interests",
              "Right to withdraw consent: where processing is consent-based, you may withdraw at any time without affecting prior processing",
            ] },
            { p: "You also have the right to lodge a complaint with the supervisory authority for data protection in your EU member state. In Germany, the competent authority is the Landesbeauftragte für Datenschutz und Informationsfreiheit Nordrhein-Westfalen (LDI NRW), based in Düsseldorf." },
          ],
        },
        {
          heading: "7. International Data Transfers",
          blocks: [
            { p: "All personal data you submit is processed on servers located within the European Economic Area (EEA). We do not transfer personal data to third countries unless adequate safeguards are in place in accordance with Chapter V GDPR." },
            { p: "Where we engage sub-processors located outside the EEA (e.g. for analytics or infrastructure monitoring), we ensure such transfers are covered by Standard Contractual Clauses (SCCs) approved by the European Commission or another appropriate transfer mechanism." },
          ],
        },
        {
          heading: "8. Analytics, Cookies and Tracking",
          blocks: [
            { p: "We use Google Analytics 4, a web analytics service provided by Google LLC, 1600 Amphitheatre Parkway, Mountain View, CA 94043, USA (measurement ID: G-252RMYTMXN). Google Analytics uses cookies — small text files stored on your device — to help us understand how visitors use our website." },
            { p: "Google Analytics collects the following categories of data:" },
            { ul: [
              "Anonymised IP address (IP anonymisation is enabled; full IP addresses are not stored)",
              "Pages visited, navigation paths, and scroll depth",
              "Session duration, bounce rate, and conversion events",
              "Browser type, device type, screen resolution, and operating system",
              "Approximate geographic location at country and city level, derived from the anonymised IP",
              "Referral source (e.g. search engine, direct, social media)",
            ] },
            { p: "Legal basis: We process this analytics data on the basis of our legitimate interests pursuant to Art. 6(1)(f) GDPR — our interest in understanding how visitors interact with the Service so we can improve it. You may object to this processing at any time by using the opt-out mechanisms described below." },
            { p: "International data transfer: Google LLC is headquartered in the United States. Data collected by Google Analytics is transferred to and processed on Google servers in the USA. This transfer is carried out on the basis of the EU Standard Contractual Clauses (SCCs) approved by the European Commission and, where applicable, Google's certification under the EU-U.S. Data Privacy Framework. Google's privacy policy is available at policies.google.com/privacy." },
            { p: "Retention: Google Analytics data is retained for 14 months (the GA4 default), after which it is automatically deleted." },
            { p: "Opt-out: You may prevent Google Analytics from collecting your data by installing the Google Analytics Opt-out Browser Add-on available at tools.google.com/dlpage/gaoptout. You may also configure your browser to block or delete cookies, or use a privacy-focused browser extension. Note that opting out may affect the functionality of some features." },
            { p: "Beyond Google Analytics, we do not deploy advertising, remarketing, or social-media tracking cookies, and no third-party advertising pixels are embedded on our pages." },
          ],
        },
        {
          heading: "9. Third-Party Service Providers",
          blocks: [
            { p: "We engage carefully selected sub-processors to help us operate the Service. All sub-processors are bound by data processing agreements and may only process your data on our documented instructions. Our current sub-processors include categories such as:" },
            { ul: [
              "Cloud infrastructure providers (EU-based hosting and storage)",
              "AI model inference infrastructure (EEA-only endpoints)",
              "Error monitoring and logging services",
              "Transactional e-mail delivery",
              "Web analytics (Google LLC, USA — Google Analytics 4; see Section 8)",
            ] },
            { p: "An up-to-date list of sub-processors is available upon request at hello@ottoklar.com." },
          ],
        },
        {
          heading: "10. Changes to This Policy",
          blocks: [
            { p: "We may update this Privacy Policy from time to time to reflect changes in our practices or applicable law. The \"Effective\" date at the top of this page indicates when the policy was last revised." },
            { p: "Where changes are material, we will notify you by e-mail (if you have provided one) or through a notice prominently displayed within the Service at least 14 days before the change takes effect." },
          ],
        },
        {
          heading: "11. Contact & Data Subject Requests",
          blocks: [
            { p: "For any questions, requests, or complaints relating to this Privacy Policy or your personal data, please contact our Data Protection Officer:" },
            { card: [
              "Data Protection Officer",
              "Artificient Mobility Intelligence GmbH",
              "Jülicher Str. 209 Q-S · 52070 Aachen · Germany",
              "E-mail: hello@ottoklar.com",
            ] },
            { p: "We will respond to all data subject requests within 30 days of receipt, as required by Article 12 GDPR." },
          ],
        },
      ],
    },
    de: { title: "", subtitle: "", sections: [] },
  },

  imprint: {
    en: {
      title: "Imprint",
      subtitle: "Mandatory disclosure pursuant to § 5 TMG (Telemediengesetz) and § 55 RStV (Rundfunkstaatsvertrag).",
      sections: [
        {
          heading: "Service Provider",
          blocks: [
            { card: [
              "Artificient Mobility Intelligence GmbH",
              "Jülicher Str. 209 Q-S",
              "52070 Aachen",
              "Germany",
            ] },
          ],
        },
        {
          heading: "Contact",
          blocks: [
            { card: [
              "E-mail: hello@ottoklar.com",
            ] },
          ],
        },
        {
          heading: "Managing Director",
          blocks: [
            { p: "Lining Wang" },
          ],
        },
        {
          heading: "Commercial Register",
          blocks: [
            { p: "Registered at the Local Court of Aachen (Amtsgericht Aachen)" },
            { p: "Register number: HRB 26031" },
          ],
        },
        {
          heading: "VAT Identification Number",
          blocks: [
            { p: "Pursuant to § 27a of the German Value Added Tax Act (Umsatzsteuergesetz):" },
            { p: "DE356252858" },
          ],
        },
        {
          heading: "Responsible for Editorial Content",
          blocks: [
            { p: "Pursuant to § 55 Abs. 2 RStV:" },
            { p: "Lining Wang, Jülicher Str. 209 Q-S, 52070 Aachen, Germany" },
          ],
        },
        {
          heading: "Online Dispute Resolution",
          blocks: [
            { p: "The European Commission provides an online dispute resolution (ODR) platform for consumers, accessible at:" },
            { p: [{ href: "https://ec.europa.eu/consumers/odr", text: "ec.europa.eu/consumers/odr" }] },
            { p: "We are neither obligated nor willing to participate in consumer arbitration procedures before a consumer arbitration board." },
          ],
        },
        {
          heading: "Liability for Content",
          blocks: [
            { p: "The content of this website has been prepared with the utmost care. However, we cannot guarantee the accuracy, completeness, or timeliness of the information provided. As a service provider, we are responsible for our own content on these pages in accordance with § 7 Abs. 1 TMG under general law. According to §§ 8 to 10 TMG, however, we are not obligated as a service provider to monitor transmitted or stored third-party information or to investigate circumstances that indicate illegal activity." },
            { p: "Obligations to remove or block the use of information under general law remain unaffected. Any liability in this respect is only possible from the point in time at which we become aware of a specific legal violation. As soon as we become aware of such infringements, we will remove the content in question immediately." },
          ],
        },
        {
          heading: "Liability for Links",
          blocks: [
            { p: "Our website may contain links to external third-party websites over whose content we have no control. We therefore cannot accept any liability for such external content. The respective provider or operator of the pages is always responsible for the content of the linked pages. The linked pages were checked for possible legal violations at the time of linking. Illegal content was not recognisable at the time of linking." },
            { p: "A permanent content control of the linked pages is not reasonable without concrete evidence of an infringement. As soon as we become aware of legal violations, we will remove such links immediately." },
          ],
        },
        {
          heading: "Copyright",
          blocks: [
            { p: "The content and works created by the site operators on these pages are subject to German copyright law. Duplication, processing, distribution, and any form of commercialisation of such material beyond the scope of copyright law requires the prior written consent of the respective author or creator. Downloads and copies of these pages are only permitted for private, non-commercial use." },
            { p: "Where content on this site was not created by the operator, the copyrights of third parties are respected. In particular, third-party content is identified as such. Should you nonetheless become aware of a copyright infringement, please inform us accordingly. As soon as we become aware of legal violations, we will remove such content immediately." },
          ],
        },
      ],
    },
    de: { title: "", subtitle: "", sections: [] },
  },
};

function legalDoc(key) {
  const pair = LEGAL_DOCS[key] || {};
  const de = pair.de || {};
  const useDe = getLang() === "de" && de.sections && de.sections.length > 0;
  return useDe ? de : (pair.en || { title: "", subtitle: "", sections: [] });
}

registerStrings("Legal", {
  eyebrow: { en: "Legal", de: "Rechtliches" },
  back:    { en: "Back",  de: "Zurück" },
});

Object.assign(window, { LEGAL_DOCS, legalDoc });
