// Generic service page template — content driven by props
const SERVICE_PAGES = {
  performance: {
    eyebrow: 'PRESTATION · 02',
    title: 'Amélioration\nPerformance',
    accent: 'performance',
    intro: "Diagnostic complet, déploiement d'outils lean et instauration d'un management visuel : nous transformons la performance opérationnelle en avantage compétitif mesurable et durable.",
    bg: (typeof window!=='undefined' && window.__resources && window.__resources.perfBg) || 'assets/perf-bg.png',
    pillars: [
      { num: '01', title: 'Diagnostic flash', desc: 'Cartographie de la chaîne de valeur, lecture KPI et identification des 3 leviers à fort impact.' },
      { num: '02', title: 'Management visuel', desc: 'Tableaux d\u2019animation, rituels courts, indicateurs partagés — la performance devient lisible.' },
      { num: '03', title: 'Outils Lean', desc: 'SMED, VSM, OEE — la boîte à outils Lean adaptée à votre maturité et à vos contraintes terrain.' },
      { num: '04', title: 'Coaching équipe', desc: 'Animation, mentoring, montée en autonomie : vos managers prennent le relais.' },
      { num: '05', title: 'Mesure d\u2019impact', desc: 'KPI avant / après, tableau de bord et reporting mensuel pour démontrer le ROI.' },
      { num: '06', title: 'Pérennisation', desc: 'Routines, audits flash et plan de progrès continu — la performance qui dure.' },
    ],
    ctas: [
      { value: '−32%', label: 'Gaspillage moyen évité' },
      { value: '+24%', label: 'Productivité gagnée' },
      { value: '< 90j', label: 'Premiers résultats' },
    ],
  },
  continu: {
    eyebrow: 'PRESTATION · 03',
    title: 'Amélioration\nContinue',
    accent: 'continu',
    intro: 'Une démarche structurée pour ancrer le progrès dans la durée — 5S, Kaizen, résolution de problèmes, QVCT — embarquant vos équipes au-delà du projet ponctuel. Parce que soigner les systèmes, c\'est aussi soigner les personnes.',
    bg: (typeof window!=='undefined' && window.__resources && window.__resources.equipBg) || 'assets/equipment-bg.jpg',
    pillars: [
      { num: '01', title: '5S', desc: 'Trier, ranger, nettoyer, standardiser, suivre — les fondations d\u2019un atelier performant.' },
      { num: '02', title: 'Kaizen', desc: 'Ateliers courts, équipes autonomes, gains rapides. Le progrès incrémental qui s\u2019accumule.' },
      { num: '03', title: 'Résolution de problèmes', desc: 'PDCA, Ishikawa, 5 Pourquoi. La cause racine, pas le symptôme.' },
      { num: '04', title: 'Standards', desc: 'Modes opératoires visuels, audits flash, montée en compétence par le standard.' },
      { num: '05', title: 'Animation managériale', desc: 'Rituels courts, tableaux SQCDP, AIC — le management qui pilote la performance.' },
      { num: '06', title: 'QVCT', desc: 'Qualité de Vie au Travail par le lean : identifier ce qui épuise vraiment les équipes, traiter les causes — pas seulement les symptômes.' },
    ],
    ctas: [
      { value: '5S', label: 'Standard atteint' },
      { value: '+12', label: 'Idées par mois / équipe' },
      { value: '100%', label: 'Équipes impliquées' },
    ],
  },
  amenagement: {
    eyebrow: 'PRESTATION · 04',
    title: 'Aménagement\nd\u2019atelier',
    accent: 'amenagement',
    intro: "Repenser l'implantation de votre atelier, fluidifier les flux de production, réduire les manutentions inutiles. Diagramme spaghetti, VSM flux matière, plan 2D (3D si besoin) — on mesure les déplacements réels avant de proposer une nouvelle implantation. L'objectif : un atelier que vos équipes comprennent et peuvent faire évoluer.",
    bg: (typeof window!=='undefined' && window.__resources && window.__resources.perfBg) || 'assets/perf-bg.png',
    pillars: [
      { num: '01', title: 'Analyse des flux', desc: 'Diagramme spaghetti, étude des trajets opérateurs et matières — voir l\u2019invisible.' },
      { num: '02', title: 'Implantation', desc: 'Layout 2D / 3D optimisé, scénarios comparés, simulation des flux cibles.' },
      { num: '03', title: 'Ergonomie', desc: 'Postes adaptés, hauteurs, gestes répétitifs — la performance passe par l\u2019humain.' },
      { num: '04', title: 'Cellule de production', desc: 'U-shape, ligne, îlot autonome — la bonne forme selon votre process.' },
      { num: '05', title: 'Logistique interne', desc: 'Kanban, gares, supermarchés — l\u2019approvisionnement qui ne fait pas attendre.' },
      { num: '06', title: 'Mise en œuvre', desc: 'Pilotage chantier, planning, conduite du changement — du plan au sol béton.' },
    ],
    ctas: [
      { value: '2D/3D', label: 'Plans livrés' },
      { value: 'Terrain', label: 'Mesures réelles' },
      { value: '8 sem.', label: 'Délai type projet' },
    ],
  },
  equipement: {
    eyebrow: 'PRESTATION · 05',
    title: 'Équipement\nIndustriel',
    accent: 'equipement',
    intro: "Consultant équipement industriel pour PME. Du cahier des charges machine au choix du bon fournisseur, de l'intégration à la TPM — nous accompagnons toutes les étapes pour que votre équipement produise à plein régime dès le premier jour.",
    bg: (typeof window!=='undefined' && window.__resources && window.__resources.equipBg) || 'assets/equipment-bg.jpg',
    pillars: [
      { num: '01', title: 'Cahier des charges', desc: 'Spécifications fonctionnelles, contraintes process, critères de choix — bien définir, c\u2019est déjà choisir.' },
      { num: '02', title: 'Sourcing & comparatif', desc: 'Identification des fournisseurs, comparatif technique, négociation — votre intérêt d\u2019abord.' },
      { num: '03', title: 'Intégration', desc: 'Pilotage projet, coordination, raccordements, IT/OT, mise en route progressive.' },
      { num: '04', title: 'Formation', desc: 'Opérateurs, techniciens, managers — chacun monté à son niveau d\u2019autonomie.' },
      { num: '05', title: 'TPM', desc: 'Maintenance autonome, préventive, prédictive. L\u2019équipement qui ne tombe pas en panne.' },
      { num: '06', title: 'Coaching maintenance', desc: 'Accompagnement de vos techniciens : standards, méthode, troubleshooting.' },
    ],
    ctas: [
      { value: 'CDC', label: 'Avant tout achat' },
      { value: 'Méca·Élec', label: 'Diagnostic complet' },
      { value: 'TPM', label: 'Après installation' },
    ],
  },
  competences: {
    eyebrow: 'PRESTATION · 06',
    title: 'Développement\ndes compétences',
    accent: 'competences',
    intro: "Un atelier ne performe pas sans ses équipes. Nous formons, mentorons et accompagnons vos opérateurs, techniciens et managers — par la pratique, par le terrain.",
    bg: (typeof window!=='undefined' && window.__resources && window.__resources.perfBg) || 'assets/perf-bg.png',
    pillars: [
      { num: '01', title: 'Diagnostic compétences', desc: 'Matrice de polyvalence, écarts, plan de développement individualisé.' },
      { num: '02', title: 'Formation terrain', desc: 'Pas de salle de classe : on apprend en faisant, encadré par un formateur expérimenté.' },
      { num: '03', title: 'Mentoring', desc: 'Un accompagnement long, ciblé, mesurable — pour les rôles clés.' },
      { num: '04', title: 'Standards visuels', desc: 'Fiches de travail, standards de poste, modes opératoires — la transmission du savoir-faire par la clarté.' },
      { num: '05', title: 'Animation managériale', desc: 'Vos managers apprennent à animer, à coacher, à faire grandir leurs équipes.' },
      { num: '06', title: 'Évaluation', desc: 'Validation des acquis, reconnaissance, parcours de progression — la motivation par le concret.' },
    ],
    ctas: [
      { value: 'QRQC', label: 'Méthode diagnostic' },
      { value: 'Terrain', label: 'Formation en atelier' },
      { value: 'Lean', label: 'Méthodes certifiées' },
    ],
  },
  outils: {
    eyebrow: 'PRESTATION · 07',
    title: 'Automatisation\n& Outils numériques',
    accent: 'outils',
    intro: "Vos logiciels ne se parlent pas ? Vous ressaisissez les mêmes données partout ? On cartographie vos process, on choisit le bon outil avec vous — sans commission —, on le connecte à votre existant et on forme vos équipes. La donnée circule toute seule.",
    bg: (typeof window!=='undefined' && window.__resources && window.__resources.perfBg) || 'assets/perf-bg.png',
    pillars: [
      { num: '01', title: 'Diagnostic des process', desc: "On cartographie vos flux : prod, admin, commerce. On liste ce qui est saisi deux fois, ce qui manque, ce qui coince — ordonnancement, bons de livraison, banque d'heures." },
      { num: '02', title: 'Cahier des charges', desc: "On formalise vos besoins en langage métier — pas en jargon IT. Ordonnancement, facturation automatique, gestion du personnel, expéditions. Prêt pour mise en concurrence." },
      { num: '03', title: 'Paramétrage outils', desc: "ERP (EBP), GMAO, planif (Cadulis), planning RH (SKELLO), formulaires terrain (Kizeo). Adapté à votre métier, pas à un standard." },
      { num: '04', title: 'Automatisation métier', desc: "OCR sur bons de livraison, scripts qui trient les mails, qui préparent les rapports d'intervention. La machine fait, vous validez." },
      { num: '05', title: 'Python sur mesure', desc: "Développement de scripts de planification atelier à partir des datas de l'ERP, simulations, optimisation des charges." },
      { num: '06', title: 'Transmission', desc: "Documentation, formation de votre référent interne, support 3 mois. Vous n'êtes pas otage du prestataire." },
    ],
    ctas: [
      { value: '0', label: 'Commission perçue — conseil neutre' },
      { value: '−80%', label: 'Ressaisies après déploiement' },
      { value: '6', label: 'Phases de A à Z' },
    ],
  },
  domaines: {
    eyebrow: 'PRESTATION \xb7 06',
    title: 'Diagnostic\nde situation',
    accent: 'domaines',
    isOverview: true,
    intro: "Avant d'intervenir, on regarde. VSM, Swimlane, analyse de flux — on rend visible ce qui \xe9puise vraiment vos \xe9quipes et o\xf9 se perdent vos performances.",
    bg: null,
    pillars: [
      { num: '01', title: 'VSM', desc: "Cartographie de la cha\xeene de valeur du client \xe0 la livraison. R\xe9v\xe8le les gaspillages et temps d'attente cach\xe9s." },
      { num: '02', title: 'Swimlane', desc: 'Diagramme de responsabilit\xe9s inter-\xe9quipes. Fait appara\xeetre les frictions de coordination et zones grises.' },
      { num: '03', title: 'Analyse de flux', desc: 'Mesure la charge r\xe9elle vs per\xe7ue. Quantifie ce qui existe vraiment dans vos process.' },
      { num: '04', title: 'Diagnostic flash', desc: '2h sur site avec vos \xe9quipes. Restitution imm\xe9diate le jour m\xeame. Z\xe9ro engagement.' },
      { num: '05', title: 'QVCT', desc: 'Identifier ce qui \xe9puise vraiment les \xe9quipes. Traiter les causes syst\xe8mes — pas seulement les sympt\xf4mes.' },
      { num: '06', title: "Plan d'action", desc: "3 leviers prioritaires chiffr\xe9s, actionnables dans les 90 jours. Concret, pas un rapport au fond d'un tiroir." },
    ],
    ctas: [
      { value: '2h', label: 'Diagnostic flash' },
      { value: '3', label: 'Leviers identifiés' },
      { value: 'J+0', label: 'Restitution immédiate' },
    ],
  },
  diagnostic: {
    eyebrow: 'PRESTATION · 06',
    title: 'Diagnostic\nde situation',
    accent: 'diagnostic',
    intro: "Avant d'intervenir, on regarde. VSM, Swimlane, analyse de flux — on rend visible ce qui épuise vraiment vos équipes et où se perdent vos performances.",
    bg: null,
    pillars: [
      { num: '01', title: 'VSM', desc: "Cartographie de la chaîne de valeur du client à la livraison. Révèle les gaspillages et temps d'attente cachés." },
      { num: '02', title: 'Swimlane', desc: 'Diagramme de responsabilités inter-équipes. Fait apparaître les frictions de coordination et zones grises.' },
      { num: '03', title: 'Analyse de flux', desc: 'Mesure la charge réelle vs perçue. Quantifie ce qui existe vraiment dans vos process.' },
      { num: '04', title: 'Diagnostic flash', desc: '2h sur site avec vos équipes. Restitution immédiate le jour même. Zéro engagement.' },
      { num: '05', title: 'QVCT', desc: 'Identifier ce qui épuise vraiment les équipes. Traiter les causes systèmes — pas seulement les symptômes.' },
      { num: '06', title: "Plan d'action", desc: "3 leviers prioritaires chiffrés, actionnables dans les 90 jours. Concret, pas un rapport au fond d'un tiroir." },
    ],
    ctas: [
      { value: '2h', label: 'Diagnostic flash' },
      { value: '3', label: 'Leviers identifiés' },
      { value: 'J+0', label: 'Restitution immédiate' },
    ],
    pdfUrl: 'assets/flyer-swimlane-diagnostic.pdf',
  },
};

// ====== Cas clients concrets — page IA & Outils numériques ======
const CAS_CLIENTS = [
  {
    id: 'doubles-saisies',
    num: '01',
    secteur: 'Multi-secteurs',
    client: 'PME industrielle / Artisan / Services terrain',
    titre: 'Supprimer les doubles saisies',
    sousTitre: 'Diagnostic process · Choix du bon outil · Déploiement',
    probleme: "Données saisies 2 à 3 fois dans des outils qui ne se parlent pas. Commandes dans un fichier, bons de livraison à la main, facturation ressaisie en compta. Heures supplémentaires et banque d'heures gérées sur papier. Ordonnancement sur tableau blanc. Personne ne sait où est la bonne info. En Vendée comme partout en Pays de la Loire, ce problème de logiciels qui ne se parlent pas coûte des heures chaque semaine.",
    solution: "Cartographie complète des process (prod, admin, commerce) pour supprimer les saisies en double. Diagnostic des irritants : bons de livraison, facturation automatique, planification des interventions, banque d'heures. Rédaction du cahier des charges logiciel en langage métier — pas en jargon IT. Consultation des éditeurs et intégrateurs : conseil neutre, pas de commission sur la vente du logiciel. On vous accompagne de A à Z pour changer de logiciel de gestion : déploiement, formation des équipes, suivi J+30 et J+90.",
    stack: ['Diagnostic process', 'Cahier des charges', 'Choix logiciel', 'Déploiement'],
    resultats: [
      { value: '1 seule', label: 'Saisie par donnée' },
      { value: '−80%', label: 'Ressaisies manuelles' },
      { value: 'J+90', label: 'Autonomie équipes' },
    ],
    color: 'var(--electric)',
  },
  {
    id: 'cadulis',
    num: '02',
    secteur: 'Services terrain',
    client: 'Entreprise de maintenance itinérante',
    titre: 'Déploiement Cadulis',
    sousTitre: 'Planification & dispatch des interventions',
    probleme: 'Planning manuel sur Excel, surcharge opératrice d\'accueil, impossibilité de gérer les urgences et les retards en temps réel. Perte de chiffre d\'affaires par créneau non optimisé.',
    solution: 'Paramétrage complet de Cadulis (types d\'interventions, techniciens, zones, priorités). Création des workflows d\'affectation automatique. Connexion EBP pour le suivi facturation. Formation équipe.',
    stack: ['Cadulis', 'EBP', 'API REST', 'Formation'],
    resultats: [
      { value: '−65%', label: 'Temps planning / jour' },
      { value: '+22%', label: 'Créneaux remplis' },
      { value: '8h', label: 'De la commande à la planif' },
    ],
    color: 'var(--electric)',
    download: { url: 'assets/offre-cadulis.pdf', label: 'Télécharger l\'offre Cadulis' },
  },
  {
    id: 'sadev',
    num: '03',
    secteur: 'Industrie',
    client: 'SADEV',
    titre: 'Ordonnancement atelier',
    sousTitre: 'Planning de production connecté à l\'ERP',
    probleme: 'Ordonnancement fait manuellement à la main sur tableau blanc. Données de charge extraites de l\'ERP sans consolidation. Délais non respectés, charge machine déséquilibrée.',
    solution: 'Développement Python d\'un moteur d\'ordonnancement alimenté par les OF de l\'ERP. Visualisation GANTT interactive, simulation de scénarios de charge, alerte sur goulots.',
    stack: ['Python', 'EBP', 'Pandas', 'Plotly'],
    resultats: [
      { value: '−40%', label: 'Retards livraison' },
      { value: '2h', label: 'Planning hebdo (vs ½ journée)' },
      { value: 'Temps réel', label: 'Visibilité charge' },
    ],
    color: 'var(--deep)',
  },
  {
    id: 'ocr',
    num: '04',
    secteur: 'Agriculture',
    client: 'Exploitation agricole',
    titre: 'Agent OCR — Bons de livraison',
    sousTitre: 'Lecture automatique + saisie comptable',
    probleme: 'Traitement manuel de dizaines de bons de livraison papier par semaine. Ressaisie dans le logiciel comptable = 3–4 h/semaine de travail non productif, erreurs fréquentes.',
    solution: 'Agent Python avec OCR (Vision IA) qui lit les BL photographiés ou scannés, extrait les données structurées (fournisseur, produits, quantités, prix) et pré-remplit les écritures dans Pennylane. Validation humaine en un clic.',
    stack: ['Python', 'OCR', 'Claude API', 'Pennylane'],
    resultats: [
      { value: '−90%', label: 'Saisie manuelle' },
      { value: '3 min', label: 'Par bon (vs 15 min)' },
      { value: '< 2j', label: 'Délai comptabilisation' },
    ],
    color: 'var(--electric)',
  },
  {
    id: 'pennylane',
    num: '05',
    secteur: 'PME multi-secteurs',
    client: 'Plusieurs clients',
    titre: 'Connecteur EBP ↔ Pennylane',
    sousTitre: 'Synchronisation ERP & comptabilité cloud',
    probleme: 'Double saisie entre EBP (facturation, devis, stock) et Pennylane (comptabilité, trésorerie). Risque d\'erreur, perte de temps, données décalées.',
    solution: 'Connecteur Python qui synchronise en temps réel les factures, avoirs et règlements entre EBP et Pennylane via leurs API respectives. Réconciliation automatique, alertes sur anomalies.',
    stack: ['Python', 'EBP API', 'Pennylane API', 'Webhook'],
    resultats: [
      { value: '0', label: 'Double saisie' },
      { value: 'J+0', label: 'Synchronisation comptable' },
      { value: '~6h', label: 'Gagnées / mois (moyen)' },
    ],
    color: 'var(--deep)',
  },
];

const TECH_LOGOS = [
  { name: 'Cadulis',    desc: 'Planning & dispatch',      color: '#2563eb', logos: [{ src: 'cadulis.png' }] },
  { name: 'Kizeo',      desc: 'Forms & terrain',          color: '#ea580c', logos: [{ src: 'kizeo-logo.svg' }] },
  { name: 'SKELLO',     desc: 'Planning équipes',         color: '#7c3aed', logos: [{ src: 'Skello logo.svg' }] },
  { name: 'EBP',        desc: 'ERP & facturation',        color: '#1e40af', logos: [{ src: 'Logo-EBP-2024-RVB-grand.png' }] },
  { name: 'Pennylane',  desc: 'Comptabilité cloud',       color: '#16a34a', logos: [{ src: 'pennylane.webp' }] },
  { name: 'Python',     desc: 'Automatisation',           color: '#f59e0b', logos: [{ src: 'Python-logo.png' }] },
  { name: 'OCR/Vision', desc: 'Google Vision · Python',  color: '#0891b2', logos: [{ src: 'Logo_Google.png', h: 26 }, { src: 'Python-logo.png' }] },
  { name: 'REST API',   desc: 'Claude · Python',         color: '#64748b', logos: [{ src: 'claude-logo.png' }, { src: 'Python-logo.png' }] },
];

function OutilsPage({ navigate }) {
  return (
    <main className="page-enter">

      {/* S0 — Hero + Stack technique intégré */}
      <section style={{ position: 'relative', paddingTop: 120, paddingBottom: 64, overflow: 'hidden' }}>
        <div className="bg-stars"></div>
        <div className="bg-grid"></div>
        <div className="bg-glow" style={{ left: '60%', top: '-10%', background: 'radial-gradient(closest-side, rgba(94,76,255,0.25), transparent 70%)' }}></div>
        <div className="container" style={{ position: 'relative', zIndex: 2 }}>
          <Reveal><Eyebrow>PRESTATION · 07 · AUTOMATISATION & OUTILS NUMÉRIQUES</Eyebrow></Reveal>
          <Reveal>
            <h1 className="display display-xl" style={{ margin: '24px 0 24px', maxWidth: 980 }}>
              Ce qu&rsquo;on a <span className="italic-accent">construit</span><br />
              pour qui, avec quoi
            </h1>
          </Reveal>
          <Reveal>
            <p style={{ maxWidth: 680, fontSize: 18, color: 'var(--muted)', lineHeight: 1.75, marginBottom: 28 }}>
              Pas du conseil. Du déployé. ERP, automatisation, connecteurs, OCR —
              des outils en production chez des clients réels, avec les résultats derrière.
            </p>
          </Reveal>
          <Reveal>
            <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap', marginBottom: 40 }}>
              {['EBP', 'Cadulis', 'Kizeo', 'SKELLO', 'Pennylane', 'Python', 'OCR'].map(t => (
                <span key={t} style={{ fontFamily: 'var(--f-mono)', fontSize: 10, letterSpacing: '0.12em', textTransform: 'uppercase', color: 'var(--muted)', padding: '6px 14px', border: '1px solid rgba(16,30,142,0.18)', borderRadius: 999, background: 'rgba(16,30,142,0.06)' }}>{t}</span>
              ))}
            </div>
          </Reveal>
          {/* Stack technique — intégré dans le hero (supprime la section S2) */}
          <Reveal>
            <div style={{ borderTop: '1px solid var(--line)', paddingTop: 32 }}>
              <div style={{ fontFamily: 'var(--f-mono)', fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--muted)', marginBottom: 16 }}>STACK TECHNIQUE</div>
              <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4,1fr)', gap: 10 }} className="tech-grid-hero">
                {TECH_LOGOS.map(t => (
                  <div key={t.name} style={{ padding: '14px 18px', border: `1px solid ${t.color}44`, borderRadius: 14, background: '#fff', boxShadow: `0 2px 12px ${t.color}18`, display: 'flex', flexDirection: 'column', gap: 6 }}>
                    <div style={{ display: 'flex', gap: 8, alignItems: 'center', minHeight: 32 }}>
                      {t.logos.map((l, i) => (
                        <img key={i} src={l.src} alt="" style={{ height: l.h || 26, width: 'auto', maxWidth: 72, objectFit: 'contain' }} />
                      ))}
                    </div>
                    <span className="display" style={{ fontSize: 15, fontWeight: 700, color: 'var(--text)' }}>{t.name}</span>
                    <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--muted)' }}>{t.desc}</span>
                  </div>
                ))}
              </div>
            </div>
          </Reveal>
        </div>
        <ScrollHint />
        <style>{`
          @media (max-width: 860px) { .tech-grid-hero { grid-template-columns: repeat(2,1fr) !important; } }
          @media (max-width: 480px) { .tech-grid-hero { grid-template-columns: 1fr !important; } }
        `}</style>
      </section>

      {/* S1–S4 — Un cas client par section */}
      {CAS_CLIENTS.map((cas, idx) => (
        <section key={cas.id} style={{ background: idx % 2 === 0 ? 'var(--ink-2)' : '#fff', display:'flex', alignItems:'center', paddingTop:80, paddingBottom:40 }}>
          <div className="container">
            {/* Header cas */}
            <Reveal>
              <div style={{ display: 'flex', alignItems: 'center', gap: 20, flexWrap: 'wrap', marginBottom: 32, paddingBottom: 24, borderBottom: '1px solid var(--line)' }}>
                <span style={{ fontFamily: 'var(--f-mono)', fontWeight: 700, fontSize: 'clamp(28px,4vw,48px)', color: cas.color, letterSpacing: '-0.02em' }}>{cas.num}</span>
                <div>
                  <div className="display" style={{ fontSize: 'clamp(22px,3vw,36px)', fontWeight: 700, lineHeight: 1.1 }}>{cas.titre}</div>
                  <div style={{ fontFamily: 'var(--f-mono)', fontSize: 11, color: 'var(--muted)', letterSpacing: '0.1em', marginTop: 4 }}>{cas.sousTitre}</div>
                </div>
                <div style={{ marginLeft: 'auto', display: 'flex', gap: 6, flexWrap: 'wrap' }}>
                  <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.12em', textTransform: 'uppercase', color: cas.color, padding: '4px 12px', border: `1px solid ${cas.color}44`, borderRadius: 999, background: `${cas.color}0d` }}>{cas.secteur}</span>
                  {cas.stack.map(s => (
                    <span key={s} style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--muted)', padding: '4px 10px', border: '1px solid var(--line-2)', borderRadius: 999 }}>{s}</span>
                  ))}
                </div>
              </div>
            </Reveal>
            {/* Problème + Solution */}
            <Reveal>
              <div style={{ display: 'grid', gridTemplateColumns: '1fr', gap: 16, marginBottom: 28 }} className="cas-body">
                <div style={{ padding: '24px 28px', background: idx % 2 === 0 ? 'rgba(255,255,255,0.06)' : '#f8f9fa', border: '1px solid var(--line)', borderRadius: 20 }}>
                  <div style={{ fontFamily: 'var(--f-mono)', fontSize: 10, letterSpacing: '0.12em', textTransform: 'uppercase', color: cas.color, marginBottom: 12 }}>Problème</div>
                  <p style={{ fontSize: 15, color: 'var(--muted)', lineHeight: 1.72, margin: 0 }}>{cas.probleme}</p>
                </div>
                <div style={{ padding: '24px 28px', background: idx % 2 === 0 ? 'rgba(255,255,255,0.06)' : '#f8f9fa', border: '1px solid var(--line)', borderRadius: 20 }}>
                  <div style={{ fontFamily: 'var(--f-mono)', fontSize: 10, letterSpacing: '0.12em', textTransform: 'uppercase', color: cas.color, marginBottom: 12 }}>Solution déployée</div>
                  <p style={{ fontSize: 15, color: 'var(--muted)', lineHeight: 1.72, margin: 0 }}>{cas.solution}</p>
                </div>
              </div>
            </Reveal>
            {/* KPIs + download */}
            <Reveal>
              <div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
                <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--muted-2)', marginRight: 4 }}>RÉSULTATS</span>
                {cas.resultats.map((r, i) => (
                  <div key={i} style={{ display: 'flex', alignItems: 'baseline', gap: 8, padding: '8px 18px', background: '#fff', borderRadius: 12, border: '1px solid var(--line-2)' }}>
                    <span className="display" style={{ fontSize: 22, color: 'var(--deep)', fontWeight: 700 }}>{r.value}</span>
                    <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--muted)' }}>{r.label}</span>
                  </div>
                ))}
                {cas.download && (
                  <a href={cas.download.url} download style={{ display: 'inline-flex', alignItems: 'center', gap: 8, padding: '12px 24px', borderRadius: 999, fontFamily: 'var(--f-mono)', fontSize: 11, letterSpacing: '0.1em', textTransform: 'uppercase', fontWeight: 600, background: cas.color, color: '#fff', textDecoration: 'none', marginLeft: 'auto', transition: 'opacity 200ms' }}
                  onMouseEnter={(e) => e.currentTarget.style.opacity = '0.85'}
                  onMouseLeave={(e) => e.currentTarget.style.opacity = '1'}>
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3"/></svg>
                    {cas.download.label}
                  </a>
                )}
              </div>
            </Reveal>
          </div>
          <style>{`
            @media (max-width: 760px) { .cas-body { grid-template-columns: 1fr !important; } }
          `}</style>
        </section>
      ))}

      {/* S5–S6 — Teasers Kizeo + SKELLO en cours */}
      {[
        {
          num: '06', id: 'kizeo', color: '#ea580c',
          titre: 'Déploiement Kizeo Forms',
          sousTitre: 'Dématérialisation formulaires terrain — En cours',
          secteur: 'Artisan / Service',
          stack: ['Kizeo Forms', 'Formation terrain', 'PDF auto'],
          teaser: true,
          context: "Un client artisan-service en Vendée remplace ses formulaires papier par des formulaires numériques Kizeo remplis directement sur tablette par ses techniciens terrain. Rapport d'intervention généré automatiquement, transmis au client en temps réel.",
          wip: 'Chantier démarré début 2026 — Résultats en cours de mesure',
        },
        {
          num: '07', id: 'skello', color: '#7c3aed',
          titre: 'Déploiement SKELLO',
          sousTitre: 'Planning équipes & gestion du temps — En cours',
          secteur: 'Artisan / Commerçant',
          stack: ['SKELLO', 'Formation RH', 'Export paie'],
          teaser: true,
          context: "Un client commerçant avec plusieurs équipes de terrain passe d'un planning Excel manuel à SKELLO. Gestion des congés, compteurs d'heures, export paie automatique — plusieurs heures d'admin récupérées par semaine.",
          wip: 'Chantier en cours — Cas client détaillé à venir',
        },
      ].map((cas, i) => (
        <section key={cas.id} style={{ background: (4 + i) % 2 === 0 ? 'var(--ink-2)' : '#fff', position: 'relative', overflow: 'hidden', display:'flex', alignItems:'center', paddingTop:80, paddingBottom:40 }}>
          {/* Badge WIP */}
          <div style={{ position: 'absolute', top: 20, right: 20, display: 'flex', alignItems: 'center', gap: 8, padding: '6px 14px', background: `${cas.color}18`, border: `1px solid ${cas.color}55`, borderRadius: 999, zIndex: 2 }}>
            <span style={{ width: 7, height: 7, borderRadius: '50%', background: cas.color, boxShadow: `0 0 10px ${cas.color}`, animation: 'pulse 1.5s ease-in-out infinite' }}></span>
            <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.14em', textTransform: 'uppercase', color: cas.color, fontWeight: 700 }}>🔧 En cours chez le client</span>
          </div>
          <div className="container">
            <Reveal>
              <div style={{ display: 'flex', alignItems: 'center', gap: 20, flexWrap: 'wrap', marginBottom: 32, paddingBottom: 24, borderBottom: '1px solid var(--line)' }}>
                <span style={{ fontFamily: 'var(--f-mono)', fontWeight: 700, fontSize: 'clamp(28px,4vw,48px)', color: cas.color, letterSpacing: '-0.02em', opacity: 0.5 }}>{cas.num}</span>
                <div>
                  <div className="display" style={{ fontSize: 'clamp(22px,3vw,36px)', fontWeight: 700, lineHeight: 1.1 }}>{cas.titre}</div>
                  <div style={{ fontFamily: 'var(--f-mono)', fontSize: 11, color: 'var(--muted)', letterSpacing: '0.1em', marginTop: 4 }}>{cas.sousTitre}</div>
                </div>
                <div style={{ marginLeft: 'auto', display: 'flex', gap: 6, flexWrap: 'wrap' }}>
                  <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.12em', textTransform: 'uppercase', color: cas.color, padding: '4px 12px', border: `1px solid ${cas.color}44`, borderRadius: 999, background: `${cas.color}0d` }}>{cas.secteur}</span>
                  {cas.stack.map(s => (
                    <span key={s} style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--muted)', padding: '4px 10px', border: '1px solid var(--line-2)', borderRadius: 999 }}>{s}</span>
                  ))}
                </div>
              </div>
            </Reveal>
            <Reveal>
              <div style={{ display: 'grid', gridTemplateColumns: '1fr', gap: 16 }} className="cas-body">
                <div style={{ padding: '24px 28px', background: (4 + i) % 2 === 0 ? 'rgba(255,255,255,0.06)' : '#f8f9fa', border: '1px solid var(--line)', borderRadius: 20 }}>
                  <div style={{ fontFamily: 'var(--f-mono)', fontSize: 10, letterSpacing: '0.12em', textTransform: 'uppercase', color: cas.color, marginBottom: 12 }}>Contexte client</div>
                  <p style={{ fontSize: 15, color: 'var(--muted)', lineHeight: 1.72, margin: 0 }}>{cas.context}</p>
                </div>
                <div style={{ padding: '24px 28px', background: (4 + i) % 2 === 0 ? 'rgba(255,255,255,0.06)' : '#f8f9fa', border: `1px dashed ${cas.color}44`, borderRadius: 20, display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', gap: 16, textAlign: 'center' }}>
                  <span style={{ fontSize: 36 }}>🔧</span>
                  <div style={{ fontFamily: 'var(--f-mono)', fontSize: 11, letterSpacing: '0.14em', textTransform: 'uppercase', color: cas.color, fontWeight: 700 }}>{cas.wip}</div>
                  <div style={{ fontFamily: 'var(--f-mono)', fontSize: 10, color: 'var(--muted-2)', letterSpacing: '0.1em' }}>Résultats chiffrés publiés dès validation client</div>
                </div>
              </div>
            </Reveal>
          </div>
        </section>
      ))}

      {/* Bridge vers LogicielsHub */}
      <section style={{ background: 'var(--ink-2)', borderTop: '1px solid var(--line)', display:'flex', alignItems:'center', paddingTop:80, paddingBottom:40 }}>
        <div className="container">
          <Reveal>
            <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: 'wrap', gap: 16, marginBottom: 28 }}>
              <div>
                <div style={{ fontFamily: 'var(--f-mono)', fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase', color: 'var(--electric)', marginBottom: 8 }}>NOS OUTILS NUMÉRIQUES</div>
                <h2 className="display" style={{ color: 'var(--text)', fontSize: 22, margin: 0 }}>5 outils que l&rsquo;on installe pour vous</h2>
              </div>
              <button onClick={() => navigate('logiciels')} className="btn btn-primary" style={{ fontSize: 11, padding: '10px 22px' }}>
                Voir les 5 outils →
              </button>
            </div>
            <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap' }}>
              {[
                { id: 'cadulis',   label: 'Cadulis',     sub: 'Planification terrain',  color: '#2563eb', logo: 'cadulis.png' },
                { id: 'kizeo',     label: 'Kizeo Forms', sub: 'Formulaires terrain',    color: '#ea580c', logo: 'kizeo-logo.svg' },
                { id: 'skello',    label: 'SKELLO',       sub: 'Planning équipes',       color: '#7c3aed', logo: 'Skello logo.svg' },
                { id: 'ebp',       label: 'EBP',          sub: 'ERP PME',               color: '#1e40af', logo: 'Logo-EBP-2024-RVB-grand.png' },
                { id: 'pennylane', label: 'Pennylane',   sub: 'Comptabilité cloud',     color: '#16a34a', logo: 'pennylane.webp' },
              ].map(t => (
                <button key={t.id} onClick={() => navigate(t.id)} style={{
                  background: '#fff', border: `1px solid ${t.color}33`,
                  borderRadius: 14, padding: '14px 20px', cursor: 'pointer', textAlign: 'left',
                  transition: 'background 180ms, border-color 180ms, box-shadow 180ms', minWidth: 140,
                }}
                onMouseEnter={e => { e.currentTarget.style.background = `${t.color}0d`; e.currentTarget.style.borderColor = t.color; e.currentTarget.style.boxShadow = `0 4px 16px ${t.color}22`; }}
                onMouseLeave={e => { e.currentTarget.style.background = '#fff'; e.currentTarget.style.borderColor = `${t.color}33`; e.currentTarget.style.boxShadow = 'none'; }}>
                  {t.logo
                    ? <img src={t.logo} alt={t.label} style={{ height: 22, width: 'auto', maxWidth: 72, objectFit: 'contain', marginBottom: 8, display: 'block' }} />
                    : <div style={{ fontFamily: 'var(--f-display)', fontWeight: 700, fontSize: 15, color: 'var(--text)', marginBottom: 3 }}>{t.label}</div>
                  }
                  {t.logo && <div style={{ fontFamily: 'var(--f-display)', fontWeight: 700, fontSize: 13, color: 'var(--text)', marginBottom: 3 }}>{t.label}</div>}
                  <div style={{ fontFamily: 'var(--f-mono)', fontSize: 9, color: 'var(--muted)', letterSpacing: '0.1em', textTransform: 'uppercase' }}>{t.sub}</div>
                </button>
              ))}
            </div>
          </Reveal>
        </div>
      </section>

    </main>
  );
}

function ServicePage({ id, navigate }) {
  const data = SERVICE_PAGES[id];
  if (!data) return null;
  if (id === 'outils') return <OutilsPage navigate={navigate} />;
  if (data.isOverview) return <DomainesPage navigate={navigate} />;

  return (
    <main className="page-enter">
      {/* Hero with image background */}
      <section style={{
        position: 'relative',
        minHeight: '85vh',
        display: 'flex',
        alignItems: 'flex-end',
        paddingTop: 200,
        paddingBottom: 80,
        overflow: 'hidden',
      }}>
        {data.bg && (
          <img src={data.bg} alt="" style={{
            position: 'absolute', inset: 0, width: '100%', height: '100%',
            objectFit: 'cover', filter: 'saturate(0.6) contrast(1.05)',
          }}/>
        )}
        <div style={{
          position: 'absolute', inset: 0,
          background: 'linear-gradient(180deg, rgba(16,30,142,0.5) 0%, rgba(16,30,142,0.7) 50%, var(--ink) 100%)',
        }}></div>
        <div className="bg-glow" style={{ left: '60%', top: '20%' }}></div>

        <div className="container" style={{ position: 'relative', zIndex: 2, color: '#fff' }}>
          <Reveal>
            <div style={{ display: 'flex', gap: 8, alignItems: 'center', marginBottom: 20, flexWrap: 'wrap' }}>
              <button onClick={() => navigate('domaines')} style={{ background: 'none', border: 'none', color: 'rgba(255,255,255,0.5)', fontFamily: 'var(--f-mono)', fontSize: 11, letterSpacing: '0.12em', textTransform: 'uppercase', cursor: 'pointer', padding: 0 }}>
                ← Les 7 expertises
              </button>
              <span style={{ color: 'rgba(255,255,255,0.28)' }}>·</span>
              <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, color: 'rgba(255,255,255,0.45)', letterSpacing: '0.12em', textTransform: 'uppercase' }}>{data.eyebrow}</span>
            </div>
          </Reveal>
          <Reveal>
            <h1 className="display display-xl" style={{ margin: '0 0 32px', whiteSpace: 'pre-line', maxWidth: 1100 }}>
              {data.title.split('\n').map((line, i) => (
                <React.Fragment key={i}>
                  {i === 1 ? <span className="italic-accent">{line}</span> : line}
                  {i < data.title.split('\n').length - 1 && <br/>}
                </React.Fragment>
              ))}
            </h1>
          </Reveal>
          <Reveal>
            <p style={{ maxWidth: 720, fontSize: 18, color: 'rgba(255,255,255,0.85)', lineHeight: 1.7, margin: 0 }}>
              {data.intro}
            </p>
          </Reveal>
        </div>
        <ScrollHint dark />
      </section>

      {/* Stats strip */}
      {data.ctas && (
        <section style={{ padding: '80px 0 40px' }}>
          <div className="container">
            <Reveal stagger>
              <div style={{
                display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 0,
                background: '#fff',
                border: '1px solid var(--line-2)',
                borderRadius: 24, overflow: 'hidden',
                boxShadow: '0 12px 40px rgba(16,30,142,0.08)',
              }} className="stats-strip">
                {data.ctas.map((c, i) => (
                  <div key={i} style={{
                    padding: 'clamp(24px,4vw,40px)',
                    borderRight: i < data.ctas.length - 1 ? '1px solid var(--line-2)' : 'none',
                  }}>
                    <div className="display display-m" style={{ color: 'var(--deep)', marginBottom: 8 }}>{c.value}</div>
                    <div style={{ fontFamily: 'var(--f-mono)', fontSize: 12, letterSpacing: '0.12em', textTransform: 'uppercase', color: 'var(--muted)' }}>{c.label}</div>
                  </div>
                ))}
              </div>
            </Reveal>
          </div>
          <style>{`
            @media (max-width: 760px) {
              .stats-strip { grid-template-columns: 1fr !important; }
              .stats-strip > div { border-right: none !important; border-bottom: 1px solid var(--line-2); }
              .stats-strip > div:last-child { border-bottom: none; }
            }
          `}</style>
        </section>
      )}

      {/* Pillars grid */}
      <section className="section-pad" style={{ background: 'var(--ink-2)' }}>
        <div className="container">
          <div style={{ marginBottom: 64 }}>
            <Reveal><Eyebrow>NOTRE APPROCHE</Eyebrow></Reveal>
            <Reveal>
              <h2 className="display display-l" style={{ margin: '20px 0 0', maxWidth: 800 }}>
                Six leviers <span className="italic-accent">opérationnels</span>
              </h2>
            </Reveal>
          </div>
          <Reveal stagger>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 20 }} className="pillars-grid">
              {data.pillars.map((p, i) => (
                <MagCard key={i}>
                  <span style={{ fontFamily: 'var(--f-mono)', fontSize: 13, color: 'var(--electric)', letterSpacing: '0.1em' }}>{p.num}</span>
                  <h3 className="display" style={{ fontSize: 28, margin: '20px 0 16px', lineHeight: 1.05 }}>{p.title}</h3>
                  <p style={{ color: 'var(--muted)', fontSize: 14, lineHeight: 1.65, margin: 0 }}>{p.desc}</p>
                </MagCard>
              ))}
            </div>
          </Reveal>
        </div>
        <style>{`
          @media (max-width: 980px) { .pillars-grid { grid-template-columns: repeat(2, 1fr) !important; } }
          @media (max-width: 640px) { .pillars-grid { grid-template-columns: 1fr !important; } }
        `}</style>
      </section>

      {/* Carousel — case studies */}
      <Carousel />

      {/* Other services */}
      <section className="section-pad-sm">
        <div className="container">
          <div style={{ marginBottom: 32 }}>
            <Eyebrow>AUTRES PRESTATIONS</Eyebrow>
          </div>
          <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))', gap: 16 }}>
            {SERVICES.filter(s => s.id !== id && s.id !== 'diagnostic').slice(0, 4).map(s => (
              <a key={s.id} onClick={() => navigate(s.id)} style={{
                cursor: 'pointer',
                padding: '24px',
                background: '#fff',
                border: '1px solid var(--line-2)', borderRadius: 20,
                display: 'flex', flexDirection: 'column', gap: 8,
                transition: 'border-color 200ms, transform 200ms',
              }} onMouseEnter={(e) => { e.currentTarget.style.borderColor = 'var(--electric)'; e.currentTarget.style.transform = 'translateY(-2px)'; }}
                 onMouseLeave={(e) => { e.currentTarget.style.borderColor = ''; e.currentTarget.style.transform = ''; }}>
                <span style={{ fontFamily: 'var(--f-mono)', fontSize: 11, color: 'var(--electric)', letterSpacing: '0.1em' }}>{s.num}</span>
                <span className="display" style={{ fontSize: 20, whiteSpace: 'pre-line' }}>{s.title}</span>
              </a>
            ))}
          </div>
        </div>
      </section>

    </main>
  );
}

// ====== Carousel of mini case studies ======
function Carousel() {
  const slides = [
    { tag: 'CAS · AGROALIMENTAIRE', title: 'Refonte ligne conditionnement', kpi: '+38% de TRS en 4 mois', color: 'rgba(94,76,255,0.4)' },
    { tag: 'CAS · MÉCANIQUE', title: 'Implantation cellule usinage', kpi: '−52% de trajets opérateurs', color: 'rgba(251,220,116,0.4)' },
    { tag: 'CAS · CHIMIE', title: 'Déploiement Lean & 5S', kpi: '+28 idées par équipe / mois', color: 'rgba(62,45,214,0.4)' },
    { tag: 'CAS · MENUISERIE', title: 'Modernisation équipements', kpi: '−45% de temps de cycle', color: 'rgba(94,76,255,0.5)' },
  ];
  const [i, setI] = useState(0);
  const len = slides.length;

  // Auto-advance
  useEffect(() => {
    const t = setInterval(() => setI(v => (v + 1) % len), 5000);
    return () => clearInterval(t);
  }, [len]);

  return (
    <section className="section-pad" style={{ borderTop: '1px solid var(--line)', background: 'var(--ink-2)' }}>
      <div className="container">
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', marginBottom: 40, gap: 24, flexWrap: 'wrap' }}>
          <div>
            <Eyebrow>RÉFÉRENCES</Eyebrow>
            <h2 className="display display-l" style={{ margin: '20px 0 0' }}>
              Quelques <span className="italic-accent">missions</span>
            </h2>
          </div>
          <div style={{ display: 'flex', gap: 8 }}>
            <button onClick={() => setI(v => (v - 1 + len) % len)} style={{
              width: 48, height: 48, borderRadius: '50%', border: '1px solid var(--line-2)',
              display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              transition: 'background 200ms', color: 'var(--text)',
            }} onMouseEnter={(e) => e.currentTarget.style.background = 'rgba(16,30,142,0.06)'}
               onMouseLeave={(e) => e.currentTarget.style.background = ''}>
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>
            </button>
            <button onClick={() => setI(v => (v + 1) % len)} style={{
              width: 48, height: 48, borderRadius: '50%', background: 'var(--deep)', color: '#fff',
              display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            }}>
              <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M5 12h14M13 5l7 7-7 7"/></svg>
            </button>
          </div>
        </div>

        <div style={{ position: 'relative', overflow: 'hidden', borderRadius: 36 }}>
          <div style={{
            display: 'flex',
            transform: `translateX(-${i * 100}%)`,
            transition: 'transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1)',
          }}>
            {slides.map((s, idx) => (
              <div key={idx} style={{
                minWidth: '100%',
                aspectRatio: '21/9',
                position: 'relative',
                background: `linear-gradient(135deg, var(--deep), var(--electric))`,
                padding: 'clamp(32px, 5vw, 80px)',
                display: 'flex', flexDirection: 'column', justifyContent: 'space-between',
                overflow: 'hidden',
                color: '#fff',
              }}>
                <div className="bg-stars" style={{ opacity: 0.5, mixBlendMode: 'screen' }}></div>
                <div className="bg-glow" style={{ right: -150, top: -150, background: `radial-gradient(closest-side, ${s.color}, transparent 70%)` }}></div>
                <span className="eyebrow" style={{ color: 'rgba(255,255,255,0.85)' }}>
                  <span className="pulse" style={{ background: 'var(--yellow)', boxShadow: '0 0 12px var(--yellow)' }}></span>
                  {s.tag}
                </span>
                <div>
                  <h3 className="display display-l" style={{ margin: '0 0 16px', maxWidth: 800 }}>{s.title}</h3>
                  <div className="display" style={{ fontSize: 'clamp(20px, 2.5vw, 32px)', color: 'var(--yellow)' }}>{s.kpi}</div>
                </div>
              </div>
            ))}
          </div>
          {/* Dots */}
          <div style={{
            position: 'absolute', bottom: 24, left: '50%', transform: 'translateX(-50%)',
            display: 'flex', gap: 8,
          }}>
            {slides.map((_, idx) => (
              <button key={idx} onClick={() => setI(idx)} style={{
                width: idx === i ? 24 : 8, height: 8, borderRadius: 999,
                background: idx === i ? 'var(--yellow)' : 'rgba(255,255,255,0.4)',
                transition: 'all 300ms',
              }}/>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ====== Domaines overview page — accordéon au survol ======
// Liste autonome des 7 cartes — ne dépend pas de window.SERVICES
const STRIP_LIST = [
  { id: 'performance', num: '01', title: 'Performance',           chips: ['Lean', 'KPI', 'QVCT'] },
  { id: 'continu',     num: '02', title: 'Amélioration continue', chips: ['5S', 'Kaizen', 'QVCT'] },
  { id: 'amenagement', num: '03', title: 'Aménagement',           chips: ['Flux', 'Ergonomie'] },
  { id: 'equipement',  num: '04', title: 'Équipement',            chips: ['TPM', 'Maintenance'] },
  { id: 'competences', num: '05', title: 'Compétences',           chips: ['Formation', 'QRQC', 'Régleurs'] },
  { id: 'diagnostic',  num: '06', title: 'Diagnostic flash',        chips: ['VSM', 'Swimlane', 'Flux'] },
  { id: 'outils',      num: '07', title: 'Automatisation & Outils', chips: ['Cadulis', 'Kizeo', 'EBP', 'Skello', 'Pennylane'] },
];

function DomainesPage({ navigate }) {
  return (
    <main className="page-enter">

      {/* S0 — Hero + liste des 7 domaines */}
      <section style={{ position: 'relative', paddingTop: 110, paddingBottom: 64, overflow: 'hidden' }}>
        <div className="bg-stars"></div>
        <div className="bg-grid"></div>
        <div className="bg-glow" style={{ right: '-10%', top: '20%' }}></div>
        <div className="container" style={{ position: 'relative', zIndex: 2 }}>
          <Reveal><Eyebrow>DOMAINES D&rsquo;INTERVENTION</Eyebrow></Reveal>
          <Reveal>
            <h1 className="display display-xl" style={{ margin: '24px 0 24px', maxWidth: 1100 }}>
              Sept expertises,<br/>
              une <span className="italic-accent">combinaison</span><br/>
              sur mesure
            </h1>
          </Reveal>
          <Reveal>
            <p style={{ maxWidth: 720, fontSize: 18, color: 'var(--muted)', lineHeight: 1.7, marginBottom: 40 }}>
              Sept domaines d&rsquo;intervention mobilisables &agrave; la carte ou en programme int&eacute;gr&eacute;. Faites d&eacute;filer pour d&eacute;couvrir chaque expertise.
            </p>
          </Reveal>
          {/* Grille des 7 domaines — cliquable vers chaque page expertise */}
          <Reveal stagger>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: 12 }} className="dom-hero-list">
              {STRIP_LIST.map((s) => (
                <button key={s.id} onClick={() => navigate(s.id)} style={{
                  display: 'flex', alignItems: 'center', gap: 16,
                  padding: '16px 20px',
                  background: '#fff',
                  border: '1px solid rgba(16,30,142,0.14)',
                  borderRadius: 16,
                  transition: 'background 180ms, border-color 180ms, box-shadow 180ms',
                  cursor: 'pointer', textAlign: 'left', width: '100%',
                }}
                onMouseEnter={(e) => { e.currentTarget.style.background = 'rgba(94,76,255,0.07)'; e.currentTarget.style.borderColor = 'rgba(94,76,255,0.4)'; e.currentTarget.style.boxShadow = '0 4px 16px rgba(94,76,255,0.1)'; }}
                onMouseLeave={(e) => { e.currentTarget.style.background = '#fff'; e.currentTarget.style.borderColor = 'rgba(16,30,142,0.14)'; e.currentTarget.style.boxShadow = 'none'; }}>
                  <span style={{ fontFamily: 'var(--f-mono)', fontWeight: 700, fontSize: 18, color: 'var(--electric)', letterSpacing: '-0.02em', flexShrink: 0 }}>{s.num}</span>
                  <div style={{ flex: 1 }}>
                    <div style={{ fontSize: 14, fontWeight: 600, lineHeight: 1.2, color: 'var(--text)' }}>{s.title}</div>
                    <div style={{ display: 'flex', gap: 4, flexWrap: 'wrap', marginTop: 4 }}>
                      {s.chips.map(c => (
                        <span key={c} style={{ fontFamily: 'var(--f-mono)', fontSize: 8, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--muted)', padding: '2px 6px', border: '1px solid rgba(16,30,142,0.14)', borderRadius: 4 }}>{c}</span>
                      ))}
                    </div>
                  </div>
                  <span style={{ color: 'var(--electric)', fontSize: 14, flexShrink: 0, opacity: 0.55 }}>→</span>
                </button>
              ))}
            </div>
          </Reveal>
        </div>
        <ScrollHint />
        <style>{`
          @media (max-width: 760px) { .dom-hero-list { grid-template-columns: 1fr !important; } }
        `}</style>
      </section>

      {/* S1–S7 — Une section snap par domaine */}
      {STRIP_LIST.map((svc, idx) => {
        const data = SERVICE_PAGES[svc.id];
        if (!data) return null;
        const isOdd = idx % 2 !== 0;
        return (
          <section key={svc.id} style={{ background: isOdd ? 'var(--ink-2)' : '#fff' }}>
            <div className="container" style={{ paddingTop: 'clamp(80px,6vh,100px)', paddingBottom: 'clamp(40px,5vh,72px)' }}>
              <Reveal>
                <div style={{ display: 'flex', alignItems: 'baseline', gap: 24, flexWrap: 'wrap', marginBottom: 28 }}>
                  <span style={{ fontFamily: 'var(--f-mono)', fontWeight: 700, fontSize: 'clamp(28px,4vw,48px)', color: 'var(--electric)', letterSpacing: '-0.02em' }}>{svc.num}</span>
                  <h2 className="display" style={{ fontSize: 'clamp(28px,4vw,52px)', margin: 0 }}>{svc.title}</h2>
                  <div style={{ display: 'flex', gap: 6, flexWrap: 'wrap' }}>
                    {svc.chips.map(c => (
                      <span key={c} style={{ fontFamily: 'var(--f-mono)', fontSize: 10, letterSpacing: '0.12em', textTransform: 'uppercase', color: 'var(--electric)', padding: '4px 10px', border: '1px solid rgba(94,76,255,0.35)', borderRadius: 999, background: 'rgba(94,76,255,0.06)' }}>{c}</span>
                    ))}
                  </div>
                </div>
              </Reveal>
              <Reveal>
                <p style={{ fontSize: 17, color: 'var(--muted)', lineHeight: 1.75, maxWidth: 900, margin: '0 0 32px', borderLeft: '3px solid var(--electric)', paddingLeft: 20 }}>{data.intro}</p>
              </Reveal>
              {data.pillars && (
                <Reveal stagger>
                  <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3,1fr)', gap: 14, marginBottom: 28 }} className="card-pillars">
                    {data.pillars.map((p, i) => (
                      <div key={i} style={{ padding: '18px 22px', background: isOdd ? 'rgba(255,255,255,0.06)' : 'rgba(16,30,142,0.03)', border: '1px solid var(--line-2)', borderRadius: 16 }}>
                        <div style={{ fontFamily: 'var(--f-mono)', fontSize: 11, color: 'var(--electric)', letterSpacing: '0.1em', marginBottom: 8 }}>{p.num}</div>
                        <div className="display" style={{ fontSize: 18, fontWeight: 700, marginBottom: 6, lineHeight: 1.1 }}>{p.title}</div>
                        <div style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.6 }}>{p.desc}</div>
                      </div>
                    ))}
                  </div>
                </Reveal>
              )}
              <div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
                {data.ctas && data.ctas.map((c, i) => (
                  <div key={i} style={{ padding: '10px 22px', background: '#fff', border: '1px solid var(--line-2)', borderRadius: 12 }}>
                    <span className="display" style={{ fontSize: 24, color: 'var(--deep)', fontWeight: 700, lineHeight: 1 }}>{c.value}</span>
                    <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--muted)', marginLeft: 10 }}>{c.label}</span>
                  </div>
                ))}
                {svc.id === 'outils' && (
                  <a onClick={() => navigate('logiciels')} className="btn btn-ghost" style={{ marginLeft: 'auto', cursor: 'pointer' }}>
                    Voir les 5 outils numériques
                    <svg className="arrow" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M5 12h14M13 5l7 7-7 7"/></svg>
                  </a>
                )}
                {svc.id === 'diagnostic' && (
                  <a onClick={() => navigate('diagnostic')} className="btn btn-ghost" style={{ marginLeft: 'auto', cursor: 'pointer' }}>
                    Voir la page Diagnostic
                    <svg className="arrow" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M5 12h14M13 5l7 7-7 7"/></svg>
                  </a>
                )}
              </div>
            </div>
            <style>{`
              @media (max-width: 860px) { .card-pillars { grid-template-columns: repeat(2,1fr) !important; } }
              @media (max-width: 540px) { .card-pillars { grid-template-columns: 1fr !important; } }
            `}</style>
          </section>
        );
      })}

    </main>
  );
}

function CardSection({ svc, navigate }) {
  const data = SERVICE_PAGES[svc.id];
  if (!data) return null;
  const isSelfLink = false;

  return (
    <Reveal>
      <div style={{
        borderTop: '1px solid var(--line)',
        padding: 'clamp(40px, 5vw, 72px) 0',
      }}>
        {/* En-tête carte */}
        <div style={{ display: 'flex', alignItems: 'baseline', gap: 24, flexWrap: 'wrap', marginBottom: 24 }}>
          <span style={{ fontFamily: 'var(--f-mono)', fontWeight: 700, fontSize: 'clamp(28px, 4vw, 48px)', color: 'var(--electric)', letterSpacing: '-0.02em' }}>
            {svc.num}
          </span>
          <h2 className="display" style={{ fontSize: 'clamp(28px, 4vw, 52px)', margin: 0 }}>
            {svc.title}
          </h2>
          <div style={{ display: 'flex', gap: 6, flexWrap: 'wrap', marginLeft: 8 }}>
            {svc.chips.map(c => (
              <span key={c} style={{
                fontFamily: 'var(--f-mono)', fontSize: 10, letterSpacing: '0.12em',
                textTransform: 'uppercase', color: 'var(--electric)',
                padding: '4px 10px', border: '1px solid rgba(94,76,255,0.35)',
                borderRadius: 999, background: 'rgba(94,76,255,0.06)',
              }}>{c}</span>
            ))}
          </div>
        </div>

        {/* Intro */}
        <p style={{
          fontSize: 17, color: 'var(--muted)', lineHeight: 1.75,
          maxWidth: 900, margin: '0 0 36px',
          borderLeft: '3px solid var(--electric)', paddingLeft: 20,
        }}>
          {data.intro}
        </p>

        {/* Piliers 3×2 */}
        {data.pillars && (
          <div style={{
            display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)',
            gap: 14, marginBottom: 32,
          }} className="card-pillars">
            {data.pillars.map((p, i) => (
              <div key={i} style={{
                padding: '18px 22px',
                background: 'rgba(16,30,142,0.03)',
                border: '1px solid var(--line-2)',
                borderRadius: 16,
              }}>
                <div style={{ fontFamily: 'var(--f-mono)', fontSize: 11, color: 'var(--electric)', letterSpacing: '0.1em', marginBottom: 8 }}>{p.num}</div>
                <div className="display" style={{ fontSize: 18, fontWeight: 700, marginBottom: 6, lineHeight: 1.1 }}>{p.title}</div>
                <div style={{ fontSize: 13, color: 'var(--muted)', lineHeight: 1.6 }}>{p.desc}</div>
              </div>
            ))}
          </div>
        )}

        {/* Stats + lien */}
        <div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
          {data.ctas && data.ctas.map((c, i) => (
            <div key={i} style={{
              padding: '10px 22px', background: '#fff',
              border: '1px solid var(--line-2)', borderRadius: 12,
              display: 'flex', flexDirection: 'column', alignItems: 'flex-start',
            }}>
              <span className="display" style={{ fontSize: 24, color: 'var(--deep)', fontWeight: 700, lineHeight: 1 }}>{c.value}</span>
              <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--muted)', marginTop: 4 }}>{c.label}</span>
            </div>
          ))}
          {svc.id === 'outils' && (
            <a onClick={() => navigate('outils')} className="btn btn-ghost" style={{ marginLeft: 'auto', cursor: 'pointer' }}>
              Voir l&rsquo;expertise Automatisation
              <svg className="arrow" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M5 12h14M13 5l7 7-7 7"/></svg>
            </a>
          )}
        </div>
      </div>
    </Reveal>
  );
}

function AccordionStrip({ svc, isOpen, onEnter, onLeave, onToggle, navigate }) {
  const data = SERVICE_PAGES[svc.id];
  if (!data) return null;
  const isSelfLink = false;

  return (
    <div
      onMouseEnter={onEnter}
      onMouseLeave={onLeave}
      onClick={onToggle}
      style={{ borderBottom: '1px solid var(--line)' }}
    >
      {/* Bandeau titre */}
      <div style={{
        display: 'grid',
        gridTemplateColumns: '72px 1fr auto',
        gap: 24, alignItems: 'center',
        padding: 'clamp(18px, 2vw, 28px) 0',
        cursor: 'default',
      }} className="strip-header">
        <span style={{
          fontFamily: 'var(--f-mono)', fontWeight: 700,
          fontSize: 'clamp(18px, 2vw, 28px)',
          color: isOpen ? 'var(--electric)' : 'var(--muted-2)',
          transition: 'color 300ms',
        }}>{svc.num}</span>
        <div style={{ display: 'flex', alignItems: 'center', gap: 16, flexWrap: 'wrap' }}>
          <h2 className="display" style={{
            fontSize: 'clamp(22px, 2.8vw, 42px)', margin: 0,
            color: isOpen ? 'var(--deep)' : 'var(--text)',
            transition: 'color 300ms',
          }}>{svc.title}</h2>
          <div style={{ display: 'flex', gap: 6, flexWrap: 'wrap' }}>
            {svc.chips.map(c => (
              <span key={c} style={{
                fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.12em',
                textTransform: 'uppercase',
                color: isOpen ? 'var(--electric)' : 'var(--muted)',
                padding: '3px 8px',
                border: `1px solid ${isOpen ? 'rgba(94,76,255,0.35)' : 'var(--line-2)'}`,
                borderRadius: 999, transition: 'all 300ms',
                background: isOpen ? 'rgba(94,76,255,0.06)' : 'transparent',
              }}>{c}</span>
            ))}
          </div>
        </div>
        <div style={{
          width: 40, height: 40, borderRadius: '50%',
          background: isOpen ? 'var(--yellow)' : 'rgba(16,30,142,0.04)',
          border: `1px solid ${isOpen ? 'transparent' : 'var(--line-2)'}`,
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          transition: 'all 300ms',
          transform: isOpen ? 'rotate(45deg)' : 'rotate(0deg)',
          flexShrink: 0,
        }}>
          <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
            <path d="M12 5v14M5 12h14"/>
          </svg>
        </div>
      </div>

      {/* Contenu expansible */}
      <div style={{
        display: 'grid',
        gridTemplateRows: isOpen ? '1fr' : '0fr',
        transition: 'grid-template-rows 480ms cubic-bezier(0.2, 0.7, 0.2, 1)',
      }}>
        <div style={{ overflow: 'hidden', minHeight: 0 }}>
          <div style={{ paddingBottom: 'clamp(28px, 3vw, 52px)' }}>
            <p style={{
              fontSize: 16, color: 'var(--muted)', lineHeight: 1.75,
              maxWidth: 860, margin: '0 0 28px',
              borderLeft: '2px solid var(--electric)', paddingLeft: 16,
            }}>{data.intro}</p>

            {data.pillars && (
              <div style={{
                display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)',
                gap: 10, marginBottom: 24,
              }} className="strip-pillars">
                {data.pillars.map((p, i) => (
                  <div key={i} style={{
                    padding: '14px 18px',
                    background: 'rgba(16,30,142,0.025)',
                    border: '1px solid var(--line-2)', borderRadius: 14,
                  }}>
                    <div style={{ fontFamily: 'var(--f-mono)', fontSize: 10, color: 'var(--electric)', letterSpacing: '0.1em', marginBottom: 6 }}>{p.num}</div>
                    <div className="display" style={{ fontSize: 15, fontWeight: 700, marginBottom: 4, lineHeight: 1.1 }}>{p.title}</div>
                    <div style={{ fontSize: 12, color: 'var(--muted)', lineHeight: 1.55 }}>{p.desc}</div>
                  </div>
                ))}
              </div>
            )}

            <div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
              {data.ctas && data.ctas.map((c, i) => (
                <div key={i} style={{
                  padding: '8px 18px', background: '#fff',
                  border: '1px solid var(--line-2)', borderRadius: 10,
                  display: 'flex', alignItems: 'center', gap: 10,
                }}>
                  <span className="display" style={{ fontSize: 20, color: 'var(--deep)', fontWeight: 700 }}>{c.value}</span>
                  <span style={{ fontFamily: 'var(--f-mono)', fontSize: 9, letterSpacing: '0.1em', textTransform: 'uppercase', color: 'var(--muted)' }}>{c.label}</span>
                </div>
              ))}
              {!isSelfLink && (
                <a onClick={(e) => { e.stopPropagation(); navigate(svc.id === 'domaines' ? 'diagnostic' : svc.id); }} style={{
                  marginLeft: 'auto', cursor: 'pointer',
                  fontFamily: 'var(--f-mono)', fontSize: 11, letterSpacing: '0.12em',
                  textTransform: 'uppercase', color: 'var(--electric)',
                  display: 'inline-flex', alignItems: 'center', gap: 6,
                  padding: '8px 16px', border: '1px solid rgba(94,76,255,0.3)', borderRadius: 999,
                  transition: 'background 200ms',
                }}
                onMouseEnter={(e) => e.currentTarget.style.background = 'rgba(94,76,255,0.06)'}
                onMouseLeave={(e) => e.currentTarget.style.background = 'transparent'}>
                  Voir l&rsquo;expertise complète
                  <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M5 12h14M13 5l7 7-7 7"/></svg>
                </a>
              )}
            </div>
          </div>
        </div>
      </div>

      <style>{`
        @media (max-width: 860px) {
          .strip-pillars { grid-template-columns: repeat(2, 1fr) !important; }
          .strip-header  { grid-template-columns: 48px 1fr auto !important; }
        }
        @media (max-width: 540px) {
          .strip-pillars { grid-template-columns: 1fr !important; }
          .strip-header  { grid-template-columns: 1fr auto !important; }
        }
      `}</style>
    </div>
  );
}

Object.assign(window, { ServicePage, SERVICE_PAGES, SERVICES: STRIP_LIST, Carousel, DomainesPage, AccordionStrip, OutilsPage });
