/* ============================================================
   Einstein Fugentechnik — Website content & data layer
   Bilingual DE/EN. All copy lives here so it can be translated
   centrally and handed to a CMS / Supabase later.
   tr(lang, value) resolves a {de,en} field; plain strings pass
   through untouched.
   ============================================================ */
(function () {
  const tr = (lang, v) =>
    v && typeof v === 'object' && ('de' in v || 'en' in v) ? (v[lang] ?? v.de) : v;
  window.tr = tr;

  /* ---- UI strings / navigation ---- */
  const ui = {
    nav: {
      home: { de: 'Start', en: 'Home' },
      system: { de: 'Verbundsystem', en: 'The System' },
      products: { de: 'Produkte', en: 'Products' },
      projects: { de: 'Objekte', en: 'Projects' },
      contact: { de: 'Kontakt', en: 'Contact' },
    },
    cta: {
      partner: { de: 'Ansprechpartner finden', en: 'Find a partner' },
      system: { de: 'System ansehen', en: 'Explore the system' },
      more: { de: 'Mehr erfahren', en: 'Learn more' },
      contact: { de: 'Anfrage senden', en: 'Send enquiry' },
      allProjects: { de: 'Alle Objekte', en: 'All projects' },
      moderator: { de: 'Redaktion', en: 'Editor' },
    },
    footer: {
      tagline: {
        de: 'EINSTEIN®-Fugentechnik — Verbundpflaster, das Verkehr trägt.',
        en: 'EINSTEIN® joint technology — interlocking paving built to carry traffic.',
      },
      partnersTitle: { de: 'Lizenzpartner', en: 'Licence partners' },
      company: 'Inventions',
      rights: { de: 'Alle Rechte vorbehalten.', en: 'All rights reserved.' },
      imprint: { de: 'Impressum', en: 'Imprint' },
      privacy: { de: 'Datenschutz', en: 'Privacy' },
    },
  };

  /* ---- Hero (three switchable variants share copy) ---- */
  const hero = {
    eyebrow: { de: 'Betonpflaster-System', en: 'Interlocking paving system' },
    headline: { de: 'Beständig und belastbar.', en: 'Durable and load-bearing.' },
    headlineAlt: { de: 'Fugentechnik, die Verkehr trägt.', en: 'Joint technology that carries traffic.' },
    lead: {
      de: 'Das EINSTEIN®-System hat mit seiner intelligenten, variantenreichen Fugentechnik die Pflastertechnik im Straßenbau revolutioniert.',
      en: 'With its intelligent, variant-rich joint technology, the EINSTEIN® system has redefined interlocking paving in road construction.',
    },
    proof: {
      de: 'Im Auftrag des Bundesministeriums für Verkehr und digitale Infrastruktur (BMVI) getestet — bestes Ergebnis bei Horizontallasten.',
      en: 'Tested on behalf of the German Federal Ministry of Transport and Digital Infrastructure (BMVI) — the best result against horizontal loads.',
    },
  };

  /* ---- Hero slideshow imagery (real EINSTEIN installations) ---- */
  const heroImages = [
    { src: 'assets/hero-yard-truck.jpg', alt: { de: 'Schwerlastverkehr auf EINSTEIN-Pflaster', en: 'Heavy goods traffic on EINSTEIN paving' } },
    { src: 'assets/hero-plaza-terrace.jpg', alt: { de: 'Terrassierte Platzanlage in Verbundbauweise', en: 'Terraced public square in interlocking construction' } },
    { src: 'assets/hero-plaza-people.jpg', alt: { de: 'Innenstadtplatz Döppersberg in EINSTEIN-Pflaster', en: 'Döppersberg city plaza paved with EINSTEIN' } },
    { src: 'assets/hero-plaza-square.jpg', alt: { de: 'Öffentlicher Freiraum mit Sitzstufen in EINSTEIN-Pflaster', en: 'Public open space with seating steps in EINSTEIN paving' } },
  ];

  /* ---- Claims (home strip) ---- */
  const claims = [
    {
      icon: 'layers',
      title: { de: 'Vollverbund', en: 'Full bond' },
      body: {
        de: 'Kein flächiger oder linearer Kontakt zwischen den Steinen — der D-Punkt-Verbund verzahnt die Fläche.',
        en: 'No flat or linear contact between stones — the D-point bond interlocks the whole surface.',
      },
    },
    {
      icon: 'truck',
      title: { de: 'Schwerlast bis Bk 3,2', en: 'Heavy load up to Bk 3.2' },
      body: {
        de: 'Sehr wirksame Verschiebesicherung. Geeignet für hoch belastete Verkehrsflächen.',
        en: 'Highly effective shift protection. Suitable for heavily loaded traffic areas.',
      },
    },
    {
      icon: 'rain',
      title: { de: 'Versickerung', en: 'Infiltration' },
      body: {
        de: 'Wasserführende Kanäle in der Fuge — hohe Versickerungsleistung, ökologisch und nachhaltig.',
        en: 'Water-carrying channels in the joint — high infiltration, ecological and sustainable.',
      },
    },
    {
      icon: 'shield-check',
      title: { de: 'Patentiert bis 2040', en: 'Patented to 2040' },
      body: {
        de: 'Weltweiter PCT-Patentschutz. Regional an führende Betonwerke lizenziert.',
        en: 'Worldwide PCT patent protection. Licensed regionally to leading concrete-paver makers.',
      },
    },
  ];

  /* ---- Verbundsystem page ---- */
  const system = {
    eyebrow: { de: 'Das Verbundsystem', en: 'The interlocking system' },
    title: { de: 'Ein System, das neue Maßstäbe setzt.', en: 'A system that sets a new standard.' },
    lead: { de: 'Präzise Fugen, räumliche Verzahnung und geprüfte Stabilität — die Technik im Stein, die Verkehrsflächen dauerhaft tragfähig hält.', en: 'Precise joints, three-dimensional interlock and proven stability — the engineering inside the stone that keeps surfaces load-bearing for the long term.' },
    intro: [
      {
        de: 'Unser Verbundsystem entstand aus der Herausforderung, Pflasterflächen widerstandsfähiger und langlebiger zu gestalten.',
        en: 'Our interlocking system was born from the challenge of making paved surfaces more resilient and more durable.',
      },
      {
        de: 'Im Gegensatz zu herkömmlichen Systemen bietet das Einstein-System durch präzise Fugenbreiten und innovative Distanzhalter optimalen Schutz vor Kantenabplatzungen und Verschiebungen — selbst unter hohen Belastungen.',
        en: 'Unlike conventional systems, the EINSTEIN system uses precise joint widths and innovative spacers to protect against edge spalling and displacement — even under heavy loads.',
      },
      {
        de: 'Das Ergebnis: weniger Wartung, höhere Stabilität und ein umweltfreundliches System, das Verkehrsflächen dauerhaft schützt.',
        en: 'The result: less maintenance, greater stability and an environmentally friendly system that protects traffic areas for the long term.',
      },
    ],
    features: [
      {
        icon: 'grid-3x3',
        title: { de: 'Präzise Fugenbreite', en: 'Precise joint width' },
        body: {
          de: 'Distanz- und Verbundelemente garantieren stets richtliniengemäße Fugenbreiten für normgerechte Fugenfüllung.',
          en: 'Spacer and bond elements guarantee standards-compliant joint widths for correct joint filling.',
        },
      },
      {
        icon: 'layers',
        title: { de: 'D-Punkt-Vollverbund', en: 'D-point full bond' },
        body: {
          de: 'Die Steine verzahnen sich räumlich. Schäden durch nicht fachgerechte Fugenausprägung gehören der Vergangenheit an.',
          en: 'Stones interlock three-dimensionally. Damage from improper joints is a thing of the past.',
        },
      },
      {
        icon: 'droplets',
        title: { de: 'Entwässerung in der Fuge', en: 'Drainage in the joint' },
        body: {
          de: 'Wasserführende Kanäle leiten Niederschlag gezielt ab und erhöhen die Versickerungsleistung der Fläche.',
          en: 'Water-carrying channels drain rainfall in a controlled way and raise the surface\u2019s infiltration capacity.',
        },
      },
    ],
    blocks: [
      {
        id: 'verbund',
        img: 'assets/sys-stein-schnitt.png',
        layout: 'right',
        title: { de: 'Kraftschlüssige Verbindung für dauerhafte Flächen', en: 'A force-locked bond for lasting surfaces' },
        body: {
          de: 'Paarweise angeordnete Verbundelemente — zylindrische und konische — erzeugen mit ihrer durchdachten Geometrie einen allseitigen Vollverbund, der Verschiebungen selbst unter hoher Belastung verhindert. Die punktuelle Kraftübertragung bewahrt die Elastizität an der Oberfläche und verhindert Pflasterschäden durch Verschiebung. Auch Kantenabplatzungen wird vorgebeugt.',
          en: 'Paired interlocking elements — cylindrical and conical — form an all-round full bond through their considered geometry, preventing displacement even under heavy load. The point-by-point force transfer preserves elasticity at the surface and prevents paving damage from shifting. Edge spalling is avoided too.',
        },
      },
      {
        id: 'abstand',
        img: 'assets/sys-ansichten.png',
        layout: 'wide',
        title: { de: 'Ein sicherer Abstand, ein starker Verbund', en: 'A safe gap, a strong bond' },
        body: {
          de: 'Jeder Stein hat integrierte Distanz- und Verbundelemente, die automatisch die richtige Fugenbreite einstellen. Der kleine Abstandshalter am unteren Steinrand schafft einen definierten Fugenraum von 3–5 mm und verhindert einen kritischen Betonkontakt von Stein zu Stein. So kann die Fuge ihre Funktion als elastischer Puffer voll entfalten.',
          en: 'Every stone has integrated spacer and bond elements that set the correct joint width automatically. The small spacer at the lower edge creates a defined joint space of 3–5 mm and prevents critical concrete-to-concrete contact between stones — so the joint can fully act as an elastic buffer.',
        },
        stat: { value: '3–5', unit: 'mm', note: { de: 'definierter Fugenraum', en: 'defined joint space' } },
      },
      {
        id: 'fuge',
        img: 'assets/sys-kammer.png',
        layout: 'left',
        title: { de: 'Raum für dauerhafte Fugenfüllung', en: 'Room for lasting joint filling' },
        body: {
          de: 'Die Kammern zwischen den Verbundelementen bieten ein einstellbares Fugenvolumen von bis zu 75 %. Splitt oder Brechsand verzahnen sich darin zuverlässig, sodass das Fugenmaterial dauerhaft im Verbund bleibt und einer Auswaschung entgegenwirkt.',
          en: 'The chambers between the bond elements provide an adjustable joint volume of up to 75 %. Grit or crushed sand interlocks reliably inside them, so the joint material stays bonded for the long term and resists wash-out.',
        },
        stat: { value: '75', unit: '%', note: { de: 'einstellbares Fugenvolumen', en: 'adjustable joint volume' } },
      },
      {
        id: 'verlegung',
        layout: 'text',
        title: { de: 'Schnelle und wirtschaftliche Verlegung', en: 'Fast, economical installation' },
        body: {
          de: 'Durch die automatische Positionierung der Steine im Raster gelingen Verlegemuster und Kreisformen unkompliziert. Einzelne Steine lassen sich bei Bedarf austauschen, ohne umliegendes Material zu verschieben. Das reduziert Verlegezeiten und verringert den Aufwand bei Reparaturen.',
          en: 'Because the stones position themselves automatically in the grid, laying patterns and circular forms are straightforward. Individual stones can be replaced when needed without disturbing the surrounding material — cutting laying times and reducing the effort for repairs.',
        },
      },
    ],
    versatility: {
      title: { de: 'Vielseitigkeit in Form und Format', en: 'Versatility in form and format' },
      body: {
        de: 'Das Einstein-System ist kompatibel mit verschiedensten Pflastertypen — von Rechteckpflaster über großformatige Platten bis zu Segmentbogenpflaster. Unabhängig vom Design bietet es die gleichen funktionalen Vorteile: exakte Fugenbreiten, dauerhafte Stabilität und eine klare Fugenoptik.',
        en: 'The EINSTEIN system is compatible with a wide range of paving types — from rectangular pavers and large-format slabs to segmental-arch paving. Whatever the design, it delivers the same functional benefits: exact joint widths, lasting stability and a clean joint appearance.',
      },
      cta: { de: 'Erhalten Sie hier einen Einblick in die Vielfalt der Produkte', en: 'See the full variety of products here' },
    },
  };

  /* ---- Proof (TU Dresden / BMVI) — lives on the system page ---- */
  const proof = {
    eyebrow: { de: 'Versuchsreihe & Nachweis', en: 'Test series & evidence' },
    title: { de: 'Mit Abstand am besten.', en: 'The best by a wide margin.' },
    lead: {
      de: 'Unabhängige Untersuchung der GWT-TUD GmbH unter Prof. Dr.-Ing. habil. Frohmut Wellner, TU Dresden (18.11.2019): Pflasterdecken mit EINSTEIN²-Fugentechnik im Maßstab 1:1 unter zyklischer Dauerbelastung.',
      en: 'Independent study by GWT-TUD GmbH under Prof. Dr.-Ing. habil. Frohmut Wellner, TU Dresden (18 Nov 2019): EINSTEIN² paved surfaces at 1:1 scale under cyclic, sustained loading.',
    },
    stats: [
      {
        label: { de: 'Hält dem Härtetest stand', en: 'Withstands the endurance test' },
        value: '1 Mio.',
        unit: { de: 'Lastwechsel', en: 'load cycles' },
        note: { de: 'zyklische Dauerbelastung im Maßstab 1:1 — ohne Schaden', en: 'cyclic sustained loading at 1:1 scale — without damage' },
      },
      {
        label: { de: 'EINSTEIN® bewegt sich kaum', en: 'EINSTEIN® barely moves' },
        value: '0,12',
        unit: 'mm',
        note: { de: 'max. seitliche Verformung — Bestwert aller geprüften Steine', en: 'max. lateral deformation — best of all tested stones' },
      },
      {
        label: { de: 'Andere Steine: bis 16× mehr', en: 'Other stones: up to 16× more' },
        value: '1,91',
        unit: 'mm',
        note: { de: 'max. Verformung herkömmlicher Steinformen im selben Test', en: 'max. deformation of conventional stone forms in the same test' },
      },
      {
        label: { de: 'Bleibt, wo er liegt', en: 'Stays exactly in place' },
        value: '≈ 0',
        unit: 'mm',
        note: { de: 'bleibende Verschiebung nach Entlastung', en: 'residual displacement after unloading' },
      },
    ],
    attest: {
      label: { de: 'Geprüft im Auftrag des', en: 'Tested on behalf of the' },
      name: {
        de: 'Bundesministeriums für Verkehr und digitale Infrastruktur (BMVI)',
        en: 'German Federal Ministry of Transport and Digital Infrastructure (BMVI)',
      },
      sub: {
        de: 'gegen Horizontallasten — bestes Ergebnis aller geprüften Steinformen.',
        en: 'against horizontal loads — the best result of all tested stone forms.',
      },
    },
    source: {
      de: 'Quelle: „Untersuchungen zum Verhalten von Pflasterdecken mit Einstein²", GWT-TUD GmbH / Prof. Wellner, TU Dresden, 2019. Zusätzlich im Auftrag des Bundesministeriums für Verkehr und digitale Infrastruktur (BMVI) gegen Horizontallasten geprüft.',
      en: 'Source: “Investigations into the behaviour of paved surfaces with Einstein²”, GWT-TUD GmbH / Prof. Wellner, TU Dresden, 2019. Additionally tested against horizontal loads on behalf of the German Federal Ministry of Transport and Digital Infrastructure (BMVI).',
    },
  };

  /* ---- Products (3 active) ---- */
  const PR = 'https://inventions-industriedesign.com/wp-content/uploads/2025/11/';
  const products = [
    {
      id: 'segmentbogen',
      name: 'Segmentbogen',
      img: PR + 'segmentbogen-fg-scaled.png',
      tags: [
        { de: 'Höchste Stabilität', en: 'Highest stability' },
        { de: 'Klassische Optik', en: 'Classic look' },
      ],
      desc: {
        de: 'Bogenförmige Verlegung aus dem historischen Straßenbau — nimmt Scherkräfte auf und verteilt Lasten gleichmäßig. Klassische Optik, höchste Stabilität, einfache Verlegung.',
        en: 'Arch-laid paving from historic road building — absorbs shear forces and spreads loads evenly. Classic look, highest stability, simple laying.',
      },
    },
    {
      id: 'diverse-formate',
      name: { de: 'Diverse Formate', en: 'Various formats' },
      img: PR + 'diverse-fg2-scaled.png',
      tags: [
        { de: 'Viele Verbände', en: 'Many bond patterns' },
        { de: 'Linear bis versetzt', en: 'Linear to offset' },
      ],
      desc: {
        de: 'Rechteckformate für klare, geordnete Flächen — in vielen Verbänden verlegbar, von linear bis versetzt. Der präzise Fugenverbund erhöht die Belastbarkeit.',
        en: 'Rectangular formats for clean, ordered surfaces — laid in many bonds, from linear to offset. The precise joint bond raises load capacity.',
      },
    },
    {
      id: 'trecona',
      name: 'Trecona®',
      img: PR + 'Trecona-fg-scaled.png',
      tags: [
        { de: 'Rinnenstein', en: 'Channel stone' },
        { de: 'Rechts-/Linkskurven', en: 'Left & right curves' },
      ],
      desc: {
        de: 'Rinnenstein für präzise, langlebige Entwässerung — linear sowie in Rechts- und Linkskurven verlegbar. Hohe Formstabilität auch bei starker Belastung.',
        en: 'Channel stone for precise, durable drainage — laid linearly and in left/right curves. High dimensional stability even under heavy load.',
      },
    },
  ];

  const productsIntro = {
    de: 'Die EINSTEIN®-Produktlinie bietet eine breite Palette an Formaten, Oberflächen und Farben. Trotz unterschiedlicher Erscheinungsbilder verfügen alle Varianten über den Vollverbund mit D-Punkt.',
    en: 'The EINSTEIN® product line offers a broad palette of formats, surfaces and colours. Despite their different looks, all variants share the full bond with D-point.',
  };

  /* ---- Project categories (4) ---- */
  const categories = [
    {
      id: 'commercial',
      title: { de: 'Gewerbliche Objekte', en: 'Commercial projects' },
      blurb: {
        de: 'Belastbare Pflastersysteme für Gewerbe- und Industrieflächen.',
        en: 'Load-bearing paving for commercial and industrial areas.',
      },
      img: 'assets/obj-commercial-yard.jpg',
    },
    {
      id: 'development',
      title: { de: 'Erschließungsobjekte', en: 'Development projects' },
      blurb: {
        de: 'Funktionale Pflaster für Neubau- und Erschließungsflächen.',
        en: 'Functional paving for new-build and development areas.',
      },
      img: 'assets/obj-erschliessung-quartier.jpg',
    },
    {
      id: 'public',
      title: { de: 'Öffentliche Objekte', en: 'Public projects' },
      blurb: {
        de: 'Beständige Lösungen für öffentliche Plätze und Verkehrswege.',
        en: 'Durable solutions for public squares and traffic routes.',
      },
      img: 'assets/obj-public-eurobahn.jpg',
    },
    {
      id: 'restoration',
      title: { de: 'Ortskernsanierungen', en: 'Town-centre restoration' },
      blurb: {
        de: 'Pflastersysteme zur Aufwertung historischer Stadtkerne.',
        en: 'Paving systems that upgrade historic town centres.',
      },
      img: 'assets/obj-ortskern-platz.jpg',
    },
  ];

  /* ---- Project reports (loaded from reports-data.js -> window.SITE_REPORTS) ---- */
  const reports = window.SITE_REPORTS || [];

  /* ---- Licence partners (9) ---- */
  const partners = [
    {
      id: 'uhl', name: 'Hermann Uhl KG Ortenau', country: 'DE', flag: '🇩🇪',
      addr: ['Am Kieswerk 1–3', '77746 Schutterwald'], plz: '77',
      tel: '+49 781 508-0', web: 'uhl.de', map: { x: 22, y: 76 },
    },
    {
      id: 'berding', name: 'Berding Beton GmbH', country: 'DE', flag: '🇩🇪',
      addr: ['Industriestraße 6', '49439 Steinfeld'], plz: '49',
      tel: '+49 5492 87-0', web: 'berdingbeton.de', map: { x: 30, y: 28 },
    },
    {
      id: 'pfenning', name: 'Betonwerk Pfenning GmbH', country: 'DE', flag: '🇩🇪',
      addr: ['Küblinger Weg 10', '68623 Lampertheim'], plz: '68',
      tel: '+49 6206 94040', web: 'beton-pfenning.de', map: { x: 33, y: 64 },
    },
    {
      id: 'wienerberger', name: 'Wienerberger AG', country: 'AT', flag: '🇦🇹',
      addr: ['Wienerbergstraße 11', '1100 Wien'], plz: null,
      tel: '+43 1 60192-0', web: 'wienerberger.com', map: { x: 88, y: 78 },
    },
    {
      id: 'tschuemperlin', name: 'Tschümperlin AG', country: 'CH', flag: '🇨🇭',
      addr: ['Oberneuhofstrasse 5', '6341 Baar'], plz: null,
      tel: '+41 41 769 59 59', web: 'tschuemperlin-ag.ch', map: { x: 36, y: 92 },
    },
    {
      id: 'unilock', name: 'Unilock Group', country: 'CA', flag: '🇨🇦',
      addr: ['401 The West Mall, Suite 610', 'M9C 5J5 Toronto'], plz: null,
      tel: '+1 800 864 5625', web: 'unilock.com', map: null,
    },
    {
      id: 'roda', name: 'Prefabricados Roda', country: 'ES', flag: '🇪🇸',
      addr: ['Calle Puerta de Cuenca 51', '02630 La Roda, Albacete'], plz: null,
      tel: '+34 967 44 04 03', web: 'prefabricadosroda.com', map: null,
    },
    {
      id: 'ferrari', name: 'Ferrari BK s.r.l.', country: 'IT', flag: '🇮🇹',
      addr: ['Via Santa Caterina 7', '37023 Lugo di Grezzana (VR)'], plz: null,
      tel: '+39 045 880 10 66', web: 'ferraribk.it', map: null,
    },
  ];

  /* Placeholder PLZ → partner mapping (Germany). The client will
     supply the authoritative assignment list; this drives the demo
     PLZ search. Key = first PLZ digit. */
  const plzMap = {
    '0': 'berding', '1': 'berding', '2': 'berding', '3': 'berding',
    '4': 'berding', '5': 'uhl', '6': 'pfenning', '7': 'uhl',
    '8': 'pfenning', '9': 'uhl',
  };

  const contact = {
    eyebrow: { de: 'Kontakt', en: 'Contact' },
    title: { de: 'Finden Sie den passenden Ansprechpartner.', en: 'Find the right contact.' },
    lead: {
      de: 'EINSTEIN®-Produkte erhalten Sie über unsere regionalen Lizenzpartner. Wählen Sie ein Land oder geben Sie Ihre Postleitzahl ein.',
      en: 'EINSTEIN® products are available through our regional licence partners. Choose a country or enter your postcode.',
    },
    plzLabel: { de: 'Postleitzahl (Deutschland)', en: 'Postcode (Germany)' },
    plzPlaceholder: { de: 'z. B. 52062', en: 'e.g. 52062' },
    plzResult: { de: 'Ihr Ansprechpartner', en: 'Your contact' },
    plzNone: { de: 'Bitte gültige deutsche PLZ eingeben.', en: 'Please enter a valid German postcode.' },
    company: {
      name: 'Inventions',
      addr: ['Monheimsallee 75', '52062 Aachen', 'Deutschland'],
      tel: '+49 241 37741',
      mail: 'kontakt@einstein-pflaster.de',
    },
  };

  /* ---- Licensee logos for the marquee (best version of each) ---- */
  const logoStrip = [
    { id: 'unilock', name: 'Unilock', src: 'assets/logos/unilock.png' },
    { id: 'uhl', name: 'Hermann Uhl', src: 'assets/logos/uhl.png' },
    { id: 'tschuemperlin', name: 'Tschümperlin', src: 'assets/logos/tschuemperlin.png' },
    { id: 'wienerberger', name: 'Wienerberger', src: 'assets/logos/wienerberger.png' },
    { id: 'roda', name: 'Prefabricados Roda', src: 'assets/logos/roda.png' },
    { id: 'ferrari', name: 'Ferrari BK', src: 'assets/logos/ferrari-bk.png' },
    { id: 'berding', name: 'Berding Beton', src: 'assets/logos/berding.png' },
    { id: 'pfenning', name: 'Beton Pfenning', src: 'assets/logos/pfenning.png' },
  ];

  window.SITE = {
    ui, hero, heroImages, claims, system, proof,
    products, productsIntro, categories, reports,
    partners, plzMap, contact, logoStrip,
  };
})();
