// Shared building blocks for the offer pages — three times map, measure block, pricing, timeline, FAQ

const SectionHeader = ({ eyebrow, title, lede, dark = false, maxWidth = 980, mb = 56 }) => (
  <Reveal>
    <Eyebrow color={dark ? "var(--ahead-comp-05)" : undefined}>{eyebrow}</Eyebrow>
    <h2 className="h-section" style={{ marginTop: 16, marginBottom: lede ? 24 : mb, maxWidth, color: dark ? "#fff" : undefined }}>
      {title}
    </h2>
    {lede && (
      <p className="lede" style={{ marginBottom: mb, maxWidth: 760, color: dark ? "var(--ahead-fg-on-dark-2)" : undefined }}>
        {lede}
      </p>
    )}
  </Reveal>
);

const PageHero = ({ pill, title, lede, ctas = [], meta = [] }) => {
  const isMobile = useIsMobile();
  return (
    <section style={{
      background: "var(--ahead-primary)", color: "#fff",
      padding: isMobile ? "80px 0 64px" : "120px 0 88px", position: "relative", overflow: "hidden",
    }}>
      <div aria-hidden style={{
        position: "absolute", right: -100, top: -100, width: 420, height: 420,
        borderRadius: "50%", background: "var(--ahead-secondary)", opacity: 0.18, filter: "blur(80px)",
      }} />
      <div className="container" style={{ position: "relative" }}>
        <span className="pill pill-onDark" style={{ marginBottom: 28 }}>{pill}</span>
        <h1 className="display-lg" style={{ color: "#fff", marginBottom: 28, maxWidth: 1100 }}>{title}</h1>
        <p style={{ fontSize: isMobile ? 17 : 22, lineHeight: 1.5, color: "var(--ahead-fg-on-dark-2)", maxWidth: 760, fontWeight: 300, margin: 0 }}>
          {lede}
        </p>
        {ctas.length > 0 && (
          <div style={{ display: "flex", gap: 12, flexWrap: "wrap", marginTop: 36 }}>
            {ctas.map((c, i) => (
              <Button key={c.label} variant={i === 0 ? "accent" : "link-onDark"} icon={c.icon || "arrow-right"} href={c.href}>
                {c.label}
              </Button>
            ))}
          </div>
        )}
        {meta.length > 0 && (
          <div style={{
            display: "grid", gridTemplateColumns: isMobile ? "1fr 1fr" : `repeat(${meta.length}, 1fr)`,
            gap: isMobile ? 20 : 24, marginTop: isMobile ? 48 : 72, paddingTop: 32,
            borderTop: "1px solid rgba(255,255,255,.12)",
          }}>
            {meta.map(([n, l]) => (
              <div key={l}>
                <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: isMobile ? 26 : 34, color: "var(--ahead-secondary)", lineHeight: 1 }}>{n}</div>
                <div style={{ fontSize: 13, color: "var(--ahead-fg-on-dark-2)", marginTop: 8, lineHeight: 1.4 }}>{l}</div>
              </div>
            ))}
          </div>
        )}
      </div>
    </section>
  );
};

// ---- The offer map: three times (Amorcer, Co-construire, Industrialiser) + transverse e-commerce
const OFFER_TIMES = [
  {
    n: "01", name: "Amorcer", tagline: "Comprendre, prioriser, former.",
    offers: [
      { id: "acculturation", name: "Acculturation", icon: "mic", body: "Démystifier l'IA, du Comex au terrain.", price: "Dès 4 000 € HT", unit: "la demi-journée", href: "offres.html#acculturation" },
      { id: "diagnostic", name: "Diagnostic IA", icon: "scan-search", body: "Le bon cas d'usage, chiffré, avant d'investir.", price: "Dès 13 000 € HT", unit: "30 % déduits ensuite", href: "offres.html#diagnostic" },
      { id: "formations", name: "Formations", icon: "graduation-cap", body: "Une formation par métier et par profil.", price: "Dès 4 000 € HT", unit: "par jour", href: "formations.html" },
    ],
  },
  {
    n: "02", name: "Co-construire", tagline: "Déployer, faire adopter, mesurer.",
    offers: [
      { id: "ahead-impact", name: "Ahead Impact", icon: "rocket", body: "Vos solutions IA en production, adoptées, mesurées : votre plateforme poussée au maximum, ou un processus automatisé sur mesure.", price: "Sur devis", unit: "chiffré au Diagnostic", href: "ahead-impact.html", featured: true, span: 2 },
      { id: "ahead-desk", name: "Ahead Desk", icon: "headset", body: "Un consultant IA en temps partagé. PME et ETI.", price: "Dès 2 000 € HT", unit: "par mois", href: "offres.html#ahead-desk" },
    ],
  },
  {
    n: "03", name: "Industrialiser", tagline: "Internaliser, jusqu'à l'autonomie.",
    offers: [
      { id: "ai-factory", name: "AI Factory", icon: "factory", body: "Construire avec vos équipes, sur votre infrastructure, jusqu'à ce qu'elles lancent leurs cas d'usage sans nous. ETI et grands groupes.", price: "Dimensionnée avec vous", unit: "sur mesure", href: "ai-factory.html", dark: true, span: 3 },
    ],
  },
];

const OfferCard = ({ o }) => {
  const dark = o.dark;
  return (
    <a href={o.href} style={{ textDecoration: "none", display: "block", height: "100%" }}>
      <div className="card" style={{
        height: "100%", padding: 22, display: "flex", flexDirection: "column", gap: 10,
        background: dark ? "var(--ahead-primary)" : "#fff",
        color: dark ? "#fff" : "var(--ahead-fg-1)",
        border: o.featured ? "2px solid var(--ahead-secondary)" : dark ? "1px solid transparent" : "1px solid var(--ahead-line)",
      }}>
        <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }}>
          <div style={{
            width: 40, height: 40, borderRadius: 11,
            background: dark ? "rgba(255,255,255,.1)" : "var(--ahead-surface-3)",
            display: "inline-flex", alignItems: "center", justifyContent: "center",
          }}>
            <Icon name={o.icon} size={20} stroke={1.75} color={dark ? "#fff" : "var(--ahead-primary)"} />
          </div>
          {o.featured && (
            <span style={{
              fontSize: 11, fontWeight: 700, letterSpacing: "0.1em", textTransform: "uppercase", whiteSpace: "nowrap",
              background: "var(--ahead-secondary)", color: "#fff", padding: "4px 10px", borderRadius: 999,
            }}>Offre phare</span>
          )}
        </div>
        <h3 style={{
          fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 24, lineHeight: 1,
          textTransform: "uppercase", letterSpacing: "-0.015em", margin: "4px 0 0",
          color: dark ? "#fff" : "var(--ahead-primary)",
        }}>{o.name}</h3>
        <p style={{ margin: 0, fontSize: 14.5, lineHeight: 1.5, color: dark ? "var(--ahead-fg-on-dark-2)" : "var(--ahead-fg-2)" }}>{o.body}</p>
        <div style={{ marginTop: "auto", paddingTop: 12, borderTop: dark ? "1px solid rgba(255,255,255,.12)" : "1px solid var(--ahead-line)", display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 8 }}>
          <span>
            <span style={{ display: "block", fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 20, color: dark ? "#fff" : "var(--ahead-primary)" }}>{o.price}</span>
            <span style={{ display: "block", fontSize: 12.5, marginTop: 2, color: dark ? "var(--ahead-fg-on-dark-3)" : "var(--ahead-fg-3)" }}>{o.unit}</span>
          </span>
          <Icon name="arrow-right" size={16} color={dark ? "var(--ahead-secondary)" : "var(--ahead-comp-02)"} />
        </div>
      </div>
    </a>
  );
};

const OfferMap = () => {
  const isMobile = useIsMobile();
  const isTablet = useIsTablet();
  return (
    <div>
      <div style={{ display: "flex", flexDirection: "column", gap: isTablet ? 32 : 20 }}>
        {OFFER_TIMES.map((t, i) => (
          <Reveal key={t.n} delay={i * 90}>
            <div style={{ display: "grid", gridTemplateColumns: isTablet ? "minmax(0, 1fr)" : "220px minmax(0, 1fr)", gap: isTablet ? 14 : 24, alignItems: "stretch" }}>
              <div style={{ borderTop: "3px solid var(--ahead-secondary)", paddingTop: 14 }}>
                <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 13, letterSpacing: "0.18em", color: "var(--ahead-secondary)" }}>{t.n}</div>
                <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 28, textTransform: "uppercase", color: "var(--ahead-primary)", lineHeight: 1, marginTop: 4 }}>{t.name}</div>
                <div style={{ fontSize: 15, color: "var(--ahead-fg-2)", marginTop: 8 }}>{t.tagline}</div>
              </div>
              <div style={{ display: "grid", gap: 12, gridTemplateColumns: isMobile ? "minmax(0, 1fr)" : "repeat(3, minmax(0, 1fr))" }}>
                {t.offers.map(o => (
                  <div key={o.id} style={{ gridColumn: isMobile ? "auto" : `span ${o.span || 1}` }}><OfferCard o={o} /></div>
                ))}
              </div>
            </div>
          </Reveal>
        ))}
      </div>
      <Reveal delay={200}>
        <a href="offres.html#ecommerce" style={{
          marginTop: 20, textDecoration: "none", display: "flex", alignItems: "center", gap: 14, flexWrap: "wrap",
          border: "1px dashed var(--ahead-fg-3)", borderRadius: 16, padding: "14px 18px", background: "var(--ahead-surface-2)",
        }}>
          <Icon name="shopping-bag" size={20} color="var(--ahead-secondary)" />
          <span style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 17, textTransform: "uppercase", color: "var(--ahead-primary)" }}>Transverse · AI & eCommerce</span>
          <span style={{ fontSize: 14.5, color: "var(--ahead-fg-2)", flex: "1 1 260px" }}>Flowshopper et notre expertise e-commerce : contenu produit à l'échelle, SEO et GEO.</span>
          <Icon name="arrow-right" size={16} color="var(--ahead-comp-02)" />
        </a>
      </Reveal>
      <Reveal delay={240}>
        <p style={{ margin: "18px 0 0", fontSize: 14.5, lineHeight: 1.6, color: "var(--ahead-fg-2)", maxWidth: 860 }}>
          Chaque temps s'active indépendamment : vous entrez là où vous en êtes. Entre Co-construire et Industrialiser,
          un <strong style={{ color: "var(--ahead-primary)" }}>bilan de valeur</strong> mesure ce que l'IA a rapporté avant d'aller plus loin.
        </p>
      </Reveal>
    </div>
  );
};

// ---- Our commitment: we measure (replaces the former result guarantee)
const MeasureBlock = ({ compact = false }) => {
  const isMobile = useIsMobile();
  const commitments = [
    { icon: "timer", title: "Un point de départ", body: "Au Diagnostic, nous décrivons vos processus et mesurons le temps qu'ils prennent. Sans mesure avant, il n'y a pas de bilan après." },
    { icon: "gauge", title: "Un indicateur par déploiement", body: "Chaque Ahead Impact suit un indicateur unique, mesuré au départ puis après chaque vague : temps par unité de travail, délai, volume absorbé." },
    { icon: "file-bar-chart", title: "Un bilan de valeur au Comex", body: "L'indicateur comparé au point de départ et converti en euros avec la méthode ROAI. C'est sur cette base que vous décidez de la suite." },
  ];
  const asks = [
    "Un sponsor identifié, qui arbitre et porte le sujet",
    "Les accès aux données et aux outils, fournis à temps",
    "Un périmètre stable pendant le déploiement",
  ];
  return (
    <section className="section" style={{ background: "var(--ahead-comp-01)", color: "#fff", position: "relative", overflow: "hidden" }}>
      <div aria-hidden style={{
        position: "absolute", left: -140, bottom: -140, width: 420, height: 420,
        borderRadius: "50%", background: "var(--ahead-secondary)", opacity: 0.14, filter: "blur(90px)",
      }} />
      <div className="container" style={{ position: "relative" }}>
        <SectionHeader
          dark
          eyebrow="Notre engagement"
          title={<>Nous ne promettons pas un chiffre.<br/>Nous nous engageons à le <span style={{ color: "var(--ahead-secondary)", fontStyle: "italic" }}>mesurer</span>.</>}
          lede="95 % des pilotes d'IA générative n'ont produit aucun impact mesurable sur le compte de résultat (MIT NANDA, 2025). La cause n'est pas la technologie : c'est l'adoption, et l'absence de mesure. Nous traitons les deux."
        />
        <div style={{ display: "grid", gridTemplateColumns: isMobile ? "1fr" : "repeat(3, minmax(0, 1fr))", gap: 16 }}>
          {commitments.map((p, i) => (
            <Reveal key={p.title} delay={i * 90}>
              <div style={{
                height: "100%", borderRadius: 20, padding: 28,
                background: "rgba(255,255,255,.05)", border: "1px solid rgba(255,255,255,.12)",
                display: "flex", flexDirection: "column", gap: 14,
              }}>
                <div style={{
                  width: 44, height: 44, borderRadius: 12, background: "var(--ahead-secondary)",
                  display: "inline-flex", alignItems: "center", justifyContent: "center",
                }}>
                  <Icon name={p.icon} size={22} stroke={1.75} color="#fff" />
                </div>
                <div style={{ fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 20, textTransform: "uppercase", color: "#fff" }}>{p.title}</div>
                <p style={{ margin: 0, fontSize: 15, lineHeight: 1.6, color: "var(--ahead-fg-on-dark-2)" }}>{p.body}</p>
              </div>
            </Reveal>
          ))}
        </div>
        {compact ? (
          <Reveal delay={150}>
            <div style={{ marginTop: 28 }}>
              <Button variant="link-onDark" icon="arrow-right" href="methode.html#roai">Voir la méthode ROAI</Button>
            </div>
          </Reveal>
        ) : (
          <Reveal delay={150}>
            <div style={{
              marginTop: 24, borderRadius: 20, padding: isMobile ? 24 : 32,
              background: "#fff", color: "var(--ahead-fg-1)",
              display: "grid", gridTemplateColumns: isMobile ? "1fr" : "260px minmax(0, 1fr)", gap: isMobile ? 16 : 40, alignItems: "start",
            }}>
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 22, textTransform: "uppercase", color: "var(--ahead-primary)", lineHeight: 1.1 }}>
                  Ce que nous vous demandons
                </div>
                <p style={{ margin: "10px 0 0", fontSize: 14, lineHeight: 1.55, color: "var(--ahead-fg-2)" }}>
                  Un indicateur ne tient que si les deux parties jouent le jeu. Ces conditions sont écrites dans la proposition.
                </p>
                <a href="methode.html#roai" style={{ display: "inline-flex", alignItems: "center", gap: 6, marginTop: 12, fontSize: 14, fontWeight: 600, color: "var(--ahead-comp-02)", textDecoration: "none" }}>
                  La méthode ROAI <Icon name="arrow-right" size={14} />
                </a>
              </div>
              <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "grid", gridTemplateColumns: isMobile ? "1fr" : "repeat(3, minmax(0, 1fr))", gap: 14 }}>
                {asks.map(a => (
                  <li key={a} style={{ display: "flex", gap: 12, alignItems: "flex-start", fontSize: 15, lineHeight: 1.5 }}>
                    <span style={{
                      flex: "0 0 auto", marginTop: 3, width: 18, height: 18, borderRadius: "50%",
                      background: "var(--ahead-primary)", display: "inline-flex", alignItems: "center", justifyContent: "center",
                    }}>
                      <Icon name="check" size={11} stroke={3} color="#fff" />
                    </span>
                    {a}
                  </li>
                ))}
              </ul>
            </div>
          </Reveal>
        )}
      </div>
    </section>
  );
};

// ---- Pricing cards (tiers)
const PricingGrid = ({ plans, note }) => {
  const isMobile = useIsMobile();
  return (
    <div>
      <div style={{ display: "grid", gridTemplateColumns: isMobile ? "1fr" : `repeat(${plans.length}, minmax(0, 1fr))`, gap: 16, alignItems: "stretch" }}>
        {plans.map((p, i) => (
          <Reveal key={p.name} delay={i * 80} style={{ height: "100%" }}>
            <div style={{
              height: "100%", borderRadius: 20, padding: 28, background: "#fff",
              border: p.featured ? "2px solid var(--ahead-secondary)" : "1px solid var(--ahead-line)",
              display: "flex", flexDirection: "column", gap: 16, position: "relative",
            }}>
              {p.featured && (
                <span style={{
                  position: "absolute", top: -12, left: 24,
                  fontSize: 11, fontWeight: 700, letterSpacing: "0.1em", textTransform: "uppercase",
                  background: "var(--ahead-secondary)", color: "#fff", padding: "4px 10px", borderRadius: 999,
                }}>{p.badge || "Le plus choisi"}</span>
              )}
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 22, textTransform: "uppercase", color: "var(--ahead-primary)" }}>{p.name}</div>
                {p.for && <div style={{ fontSize: 14, color: "var(--ahead-fg-2)", marginTop: 4, lineHeight: 1.45 }}>{p.for}</div>}
              </div>
              <div>
                <span style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 40, color: "var(--ahead-primary)", letterSpacing: "-0.02em" }}>{p.price}</span>
                {p.unit && <span style={{ fontSize: 15, color: "var(--ahead-fg-2)", marginLeft: 6 }}>{p.unit}</span>}
                {p.sub && <div style={{ fontSize: 13, color: "var(--ahead-fg-3)", marginTop: 2 }}>{p.sub}</div>}
              </div>
              <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "flex", flexDirection: "column", gap: 10, flex: 1 }}>
                {p.items.map(it => (
                  <li key={it} style={{ display: "flex", gap: 10, alignItems: "flex-start", fontSize: 14.5, lineHeight: 1.5, color: "var(--ahead-fg-1)" }}>
                    <span style={{ flex: "0 0 auto", marginTop: 2 }}><Icon name="check" size={16} stroke={2.5} color="var(--ahead-secondary)" /></span>
                    {it}
                  </li>
                ))}
              </ul>
              <Button variant={p.featured ? "accent" : "ghost"} icon="arrow-right" href={p.href || "contact.html"} style={{ justifyContent: "center" }}>
                {p.cta || "En parler"}
              </Button>
            </div>
          </Reveal>
        ))}
      </div>
      {note && <p style={{ margin: "20px 0 0", fontSize: 13, color: "var(--ahead-fg-3)", lineHeight: 1.55 }}>{note}</p>}
    </div>
  );
};

// ---- Standard journey — an ETI of 300 people over twelve months, in three times
const PARCOURS = [
  {
    n: "01", name: "Amorcer", from: 1, to: 2, color: "var(--ahead-secondary)",
    does: ["Séminaire de direction", "Diagnostic IA : cas d'usage, mesure de départ, gouvernance", "Formations par métier"],
    adoption: "Comex embarqué, cas priorisés, champions repérés",
  },
  {
    n: "02", name: "Co-construire", from: 3, to: 9, color: "var(--ahead-comp-02)",
    does: ["Ahead Impact plateforme, déployé par vagues", "Deux processus automatisés, branchés au SI", "Ahead Desk en continu"],
    adoption: "Usage suivi, champions actifs, bilan de valeur",
  },
  {
    n: "03", name: "Industrialiser", from: 10, to: 12, color: "var(--ahead-primary)",
    does: ["AI Factory : plateforme socle, centre d'excellence", "Gouvernance et mise à l'échelle", "Makers internes formés"],
    adoption: "Un premier cas lancé par vos équipes, sans nous",
  },
];

const ParcoursTimeline = () => {
  const isMobile = useIsMobile();
  const months = Array.from({ length: 12 }, (_, i) => i + 1);
  return (
    <div style={{ background: "#fff", border: "1px solid var(--ahead-line)", borderRadius: 24, padding: isMobile ? 18 : 28 }}>
      <div style={{ display: "flex", alignItems: "baseline", justifyContent: "space-between", gap: 12, flexWrap: "wrap", marginBottom: 18 }}>
        <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 20, textTransform: "uppercase", color: "var(--ahead-primary)" }}>
          Exemple : une ETI de 300 personnes, sur douze mois
        </div>
        <span style={{ fontSize: 13, color: "var(--ahead-fg-3)" }}>Parcours indicatif, chaque temps se décide séparément</span>
      </div>
      {!isMobile && (
        <div style={{ marginBottom: 20 }}>
          <div style={{ display: "grid", gridTemplateColumns: "repeat(12, minmax(0, 1fr))", gap: 4 }}>
            {PARCOURS.map(p => (
              <div key={p.n} style={{
                gridColumn: `${p.from} / ${p.to + 1}`, height: 12, borderRadius: 6, background: p.color,
              }} />
            ))}
          </div>
          <div style={{ display: "grid", gridTemplateColumns: "repeat(12, minmax(0, 1fr))", gap: 4, marginTop: 6 }}>
            {months.map(m => (
              <div key={m} style={{ fontFamily: "var(--font-mono)", fontSize: 11, color: "var(--ahead-fg-3)", textAlign: "center" }}>M{m}</div>
            ))}
          </div>
        </div>
      )}
      <div style={{ display: "grid", gridTemplateColumns: isMobile ? "1fr" : "repeat(3, minmax(0, 1fr))", gap: 14 }}>
        {PARCOURS.map(p => (
          <div key={p.n} style={{ background: "var(--ahead-surface-2)", borderRadius: 16, padding: 20, borderTop: `4px solid ${p.color}`, display: "flex", flexDirection: "column", gap: 12 }}>
            <div>
              <div style={{ fontSize: 12, fontWeight: 700, letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--ahead-secondary)" }}>
                {p.n} · M{p.from}{p.to !== p.from ? `–M${p.to}` : ""}
              </div>
              <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 22, textTransform: "uppercase", color: "var(--ahead-primary)", marginTop: 2 }}>{p.name}</div>
            </div>
            <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "flex", flexDirection: "column", gap: 8 }}>
              {p.does.map(d => (
                <li key={d} style={{ display: "flex", gap: 10, alignItems: "flex-start", fontSize: 14.5, lineHeight: 1.45, color: "var(--ahead-fg-1)" }}>
                  <span style={{ flex: "0 0 auto", width: 6, height: 6, borderRadius: "50%", background: p.color, marginTop: 8 }} />
                  {d}
                </li>
              ))}
            </ul>
            <div style={{ marginTop: "auto", paddingTop: 12, borderTop: "1px solid var(--ahead-line)", fontSize: 14, lineHeight: 1.45, color: "var(--ahead-primary)" }}>
              <span style={{ fontSize: 11, fontWeight: 700, letterSpacing: "0.14em", textTransform: "uppercase", color: "var(--ahead-fg-3)", display: "block", marginBottom: 4 }}>Adoption visible</span>
              {p.adoption}
            </div>
          </div>
        ))}
      </div>
    </div>
  );
};

// ---- Accordion FAQ
const FAQList = ({ items }) => {
  const [open, setOpen] = React.useState(0);
  return (
    <div style={{ display: "flex", flexDirection: "column", gap: 12 }}>
      {items.map((it, i) => (
        <div key={it.q} style={{ background: "#fff", borderRadius: 16, padding: "20px 24px", border: "1px solid var(--ahead-line)" }}>
          <button onClick={() => setOpen(open === i ? -1 : i)} aria-expanded={open === i} style={{
            width: "100%", border: 0, background: "transparent", cursor: "pointer",
            display: "flex", alignItems: "center", justifyContent: "space-between", gap: 16,
            fontFamily: "var(--font-sans)", fontSize: 18, fontWeight: 600,
            color: "var(--ahead-primary)", padding: 0, textAlign: "left",
          }}>
            <span>{it.q}</span>
            <span style={{ transform: open === i ? "rotate(45deg)" : "rotate(0)", transition: "transform 200ms", color: "var(--ahead-secondary)", flex: "0 0 auto" }}>
              <Icon name="plus" size={22} />
            </span>
          </button>
          {open === i && (
            <p style={{ margin: "16px 0 0", fontSize: 16, lineHeight: 1.6, color: "var(--ahead-fg-2)" }}>{it.a}</p>
          )}
        </div>
      ))}
    </div>
  );
};

const FAQSection = ({ items, title = "Tout ce que vous voulez savoir." }) => (
  <section className="section" style={{ background: "var(--ahead-surface-2)" }}>
    <div className="container" style={{ maxWidth: 900 }}>
      <SectionHeader eyebrow="Questions fréquentes" title={title} mb={48} />
      <FAQList items={items} />
    </div>
  </section>
);

// ---- Proof strip — deployment results from real missions
const ProofStrip = ({ dark = false }) => {
  const isMobile = useIsMobile();
  const proofs = [
    ["+ 80 %", "d'adoption mesurée", "300 licences Copilot · RAJA", "etude-de-cas-raja-copilot.html"],
    ["7", "agents IA en production", "Amazon Quick Suite · PMU", "etude-de-cas-pmu.html"],
    ["1 000", "fiches produits en moins d'1 h", "Générateur sur-mesure · RAJA", "etude-de-cas-raja-deploiement.html"],
    ["~ 20", "filiales équipées", "Flowshopper · Groupe RAJA", "etude-de-cas-flowshopper.html"],
  ];
  return (
    <div style={{ display: "grid", gridTemplateColumns: isMobile ? "1fr 1fr" : "repeat(4, minmax(0, 1fr))", gap: isMobile ? 24 : 20 }}>
      {proofs.map(([n, l, sub, href], i) => (
        <Reveal key={l} delay={i * 80}>
          <a href={href} style={{ textDecoration: "none", display: "block", borderLeft: "2px solid var(--ahead-secondary)", paddingLeft: 18 }}>
            <div style={{
              fontFamily: "var(--font-display)", fontWeight: 800, fontSize: isMobile ? 40 : 56,
              color: dark ? "#fff" : "var(--ahead-primary)", lineHeight: 0.95, letterSpacing: "-0.025em",
            }}>{n}</div>
            <div style={{ fontWeight: 600, fontSize: 15, marginTop: 10, color: dark ? "#fff" : "var(--ahead-primary)" }}>{l}</div>
            <div style={{ fontSize: 13, color: dark ? "var(--ahead-fg-on-dark-3)" : "var(--ahead-fg-3)", marginTop: 4 }}>{sub}</div>
          </a>
        </Reveal>
      ))}
    </div>
  );
};

// ---- Continuous improvement loop: Diagnostic → Ahead Impact → Ahead Desk → next Diagnostic
const OfferLoop = () => {
  const isMobile = useIsMobile();
  const isTablet = useIsTablet();
  const steps = [
    { k: "A", name: "Diagnostic IA", icon: "scan-search", body: "Le bon cas d'usage, la mesure de départ, le chiffrage.", href: "offres.html#diagnostic" },
    { k: "B", name: "Ahead Impact", icon: "rocket", body: "La solution déployée, adoptée et mesurée.", href: "ahead-impact.html" },
    { k: "C", name: "Ahead Desk", icon: "headset", body: "Un consultant IA au quotidien, qui fait émerger le besoin suivant.", href: "offres.html#ahead-desk" },
  ];
  const stacked = isTablet;
  return (
    <div style={{ background: "var(--ahead-surface-3)", borderRadius: 24, padding: isMobile ? 18 : 28 }}>
      <div style={{ display: "grid", gridTemplateColumns: stacked ? "minmax(0, 1fr)" : "minmax(0, 1fr) 32px minmax(0, 1fr) 32px minmax(0, 1fr)", gap: stacked ? 4 : 0, alignItems: "stretch" }}>
        {steps.map((s, i) => (
          <React.Fragment key={s.k}>
            {i > 0 && (
              <div aria-hidden style={{ display: "flex", alignItems: "center", justifyContent: "center", padding: stacked ? "4px 0" : 0 }}>
                <Icon name={stacked ? "arrow-down" : "arrow-right"} size={22} stroke={2} color="var(--ahead-secondary)" />
              </div>
            )}
            <a href={s.href} style={{
              textDecoration: "none", display: "flex", gap: 14, alignItems: "flex-start",
              background: "#fff", border: s.k === "B" ? "2px solid var(--ahead-secondary)" : "1px solid var(--ahead-line)",
              borderRadius: 16, padding: "16px 18px",
            }}>
              <span style={{
                flex: "0 0 auto", width: 34, height: 34, borderRadius: "50%", background: "var(--ahead-primary)", color: "#fff",
                display: "inline-flex", alignItems: "center", justifyContent: "center",
                fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 16,
              }}>{s.k}</span>
              <span>
                <span style={{ display: "flex", alignItems: "center", gap: 8 }}>
                  <Icon name={s.icon} size={16} color="var(--ahead-secondary)" />
                  <span style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 18, textTransform: "uppercase", color: "var(--ahead-primary)" }}>{s.name}</span>
                </span>
                <span style={{ display: "block", fontSize: 14, lineHeight: 1.45, color: "var(--ahead-fg-2)", marginTop: 4 }}>{s.body}</span>
              </span>
            </a>
          </React.Fragment>
        ))}
      </div>
      <div style={{ marginTop: 14, display: "grid", gridTemplateColumns: isMobile ? "1fr" : "repeat(2, minmax(0, 1fr))", gap: 12 }}>
        <div style={{ display: "flex", gap: 12, alignItems: "flex-start", border: "1px dashed var(--ahead-secondary)", borderRadius: 14, padding: "12px 16px", background: "rgba(255,85,91,.06)", fontSize: 14, lineHeight: 1.5, color: "var(--ahead-primary)" }}>
          <Icon name="repeat" size={18} color="var(--ahead-secondary)" />
          <span><strong>La boucle :</strong> toute demande Desk de plus de deux jours devient un nouveau Diagnostic, puis un nouvel Ahead Impact.</span>
        </div>
        <div style={{ display: "flex", gap: 12, alignItems: "flex-start", border: "1px dashed var(--ahead-secondary)", borderRadius: 14, padding: "12px 16px", background: "rgba(255,85,91,.06)", fontSize: 14, lineHeight: 1.5, color: "var(--ahead-primary)" }}>
          <Icon name="percent" size={18} color="var(--ahead-secondary)" />
          <span><strong>30 % du Diagnostic sont déduits</strong> de l'Ahead Impact s'il est signé dans les trois mois.</span>
        </div>
      </div>
    </div>
  );
};

// ---- Where to start — orientation by situation
const ORIENTATION = [
  ["Vous découvrez l'IA et voulez embarquer vos équipes", "Acculturation, Formations", "offres.html#acculturation"],
  ["Vous avez des idées, mais pas de priorités claires", "Diagnostic IA", "offres.html#diagnostic"],
  ["Vous avez des licences IA encore peu utilisées", "Diagnostic, puis Ahead Impact sur votre plateforme", "ahead-impact.html#chemins"],
  ["Vous avez un processus à automatiser", "Diagnostic, puis Ahead Impact sur mesure", "ahead-impact.html#chemins"],
  ["Vous avez un cas d'usage précis, mais doutez de sa faisabilité", "Ahead Impact, ouvert par un POC de faisabilité", "ahead-impact.html#poc"],
  ["Vous voulez un appui IA au quotidien (PME, ETI)", "Ahead Desk", "offres.html#ahead-desk"],
  ["Vous voulez internaliser (ETI, grands groupes)", "AI Factory", "ai-factory.html"],
  ["Vous vendez en ligne, avec un catalogue important", "AI & eCommerce (Flowshopper)", "offres.html#ecommerce"],
];

const OrientationTable = () => {
  const isMobile = useIsMobile();
  return (
    <div style={{ background: "#fff", border: "1px solid var(--ahead-line)", borderRadius: 20, overflow: "hidden" }}>
      {!isMobile && (
        <div style={{ display: "grid", gridTemplateColumns: "minmax(0, 1.3fr) minmax(0, 1fr) 24px", gap: 16, padding: "14px 24px", background: "var(--ahead-primary)", color: "#fff", fontSize: 12, fontWeight: 700, letterSpacing: "0.14em", textTransform: "uppercase" }}>
          <span>Votre situation</span><span>Notre réponse</span><span />
        </div>
      )}
      {ORIENTATION.map(([situation, answer, href], i) => (
        <a key={situation} href={href} style={{
          textDecoration: "none", display: "grid",
          gridTemplateColumns: isMobile ? "minmax(0, 1fr) 20px" : "minmax(0, 1.3fr) minmax(0, 1fr) 24px",
          gap: isMobile ? 6 : 16, padding: isMobile ? "14px 18px" : "16px 24px", alignItems: "center",
          borderTop: i === 0 ? "none" : "1px solid var(--ahead-line)",
        }}>
          <span style={{ fontSize: 15, lineHeight: 1.45, color: "var(--ahead-fg-1)", gridColumn: isMobile ? "1 / 2" : "auto" }}>{situation}</span>
          <span style={{ fontSize: 15, lineHeight: 1.45, fontWeight: 600, color: "var(--ahead-primary)", gridColumn: isMobile ? "1 / 2" : "auto", gridRow: isMobile ? 2 : "auto" }}>{answer}</span>
          <span style={{ gridColumn: isMobile ? "2 / 3" : "auto", gridRow: isMobile ? "1 / 3" : "auto", display: "inline-flex" }}>
            <Icon name="arrow-right" size={16} color="var(--ahead-secondary)" />
          </span>
        </a>
      ))}
    </div>
  );
};

// ---- Client names — text strip (no logos)
const CLIENTS = ["RAJA", "PMU", "Almaviva Santé", "Plastivaloire", "La Parfumerie Europe", "Intermarché", "Lemaire", "Optae", "Rétif", "Mondoffice", "SMT", "Hansgrohe", "NU Skin"];

const ClientsStrip = ({ title = "Ils nous font confiance" }) => (
  <section style={{ padding: "48px 0", background: "#fff", borderTop: "1px solid var(--ahead-line)" }}>
    <div className="container">
      <span className="eyebrow">{title}</span>
      <div style={{ display: "flex", flexWrap: "wrap", gap: "14px 36px", marginTop: 20, alignItems: "baseline" }}>
        {CLIENTS.map(c => (
          <span key={c} style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 24, textTransform: "uppercase", letterSpacing: "-0.01em", color: "var(--ahead-primary)", opacity: 0.8, whiteSpace: "nowrap" }}>{c}</span>
        ))}
      </div>
    </div>
  </section>
);

Object.assign(window, {
  SectionHeader, PageHero, OFFER_TIMES, OfferCard, OfferMap, MeasureBlock, PricingGrid,
  ParcoursTimeline, OfferLoop, OrientationTable, ClientsStrip,
  FAQList, FAQSection, ProofStrip,
});
