// Page-level sections for the Home page

const FiveOffers = () => {
  const isMobile = useIsMobile();
  const isTablet = useIsTablet();
  const offers = [
    { id: "acculturation", num: "01", icon: "mic", title: "Acculturation IA", body: "Créer le déclic IA chez vos dirigeants et vos équipes — 2 heures à 1 journée. Comex, managers, métiers.", href: "offres.html#acculturation" },
    { id: "audit", num: "02", icon: "scan-search", title: "Audit & Conseil", body: "Cartographier vos processus, identifier les opportunités IA prioritaires, chiffrer la suite.", href: "offres.html#audit" },
    { id: "training", num: "03", icon: "graduation-cap", title: "Formation IA", body: "Rendre vos équipes autonomes sur les outils IA — formations sur étagère ou parcours sur-mesure. Agréé Qualiopi.", href: "formations.html" },
    { id: "deploy", num: "04", icon: "rocket", title: "Déploiement IA", body: "Construire et mettre en production une solution IA. POC → MVP → run, via des solutions du marché ou du sur-mesure.", href: "offres.html#deploiement" },
    { id: "factory", num: "05", icon: "factory", title: "AI Factory", body: "Construire votre capacité IA interne — plateforme socle et Centre d'Excellence en co-construction.", href: "offres.html#factory" },
  ];
  return (
    <section id="offres" className="section" style={{ background: "#fff" }}>
      <div className="container">
        <Reveal>
          <Eyebrow>Notre AI Practice</Eyebrow>
          <h2 className="h-section" style={{ marginTop: 16, marginBottom: 28, maxWidth: 1000 }}>
            5 leviers pour passer du<br/>
            <span style={{ color: "var(--ahead-secondary)", fontStyle: "italic" }}>déclic</span> à la <span style={{ color: "var(--ahead-secondary)" }}>mise en production</span>.
          </h2>
          <p className="lede" style={{ marginBottom: 64 }}>
            Une approche modulaire. Démarrez par une session d'acculturation ou un audit, structurez avec la formation,
            le déploiement, puis l'AI Factory.
          </p>
        </Reveal>

        <div style={{ display: "grid", gridTemplateColumns: isMobile ? "1fr" : "repeat(12, 1fr)", gap: isMobile ? 16 : 20 }}>
          {offers.map((o, i) => {
            // Desktop: first item span 7, etc. Mobile: each card stacks full-width.
            let span;
            if (isMobile) span = "auto";
            else if (i === 0) span = "span 7";
            else if (i === 1) span = "span 5";
            else if (i === 2) span = "span 5";
            else if (i === 3) span = "span 7";
            else span = "span 12";
            const featured = i === 0 || i === 4;
            return (
              <Reveal key={o.id} delay={i * 80} style={{ gridColumn: span }}>
                <a href={o.href} style={{ textDecoration: "none", display: "block" }}>
                  <div className="card" style={{
                    minHeight: isMobile ? "auto" : 240,
                    padding: isMobile ? 24 : 36,
                    background: featured ? "var(--ahead-primary)" : "#fff",
                    color: featured ? "#fff" : "var(--ahead-fg-1)",
                    display: "flex", flexDirection: "column", gap: 14,
                    position: "relative", overflow: "hidden",
                    border: featured ? "1px solid transparent" : "1px solid var(--ahead-line)",
                  }}>
                    {featured && (
                      <div aria-hidden style={{
                        position: "absolute", right: -60, top: -60, width: 200, height: 200,
                        borderRadius: "50%", background: "var(--ahead-secondary)",
                        opacity: 0.16, filter: "blur(40px)",
                      }} />
                    )}
                    <div style={{ display: "flex", alignItems: "center", gap: 14 }}>
                      <span style={{
                        fontFamily: "var(--font-display)", fontWeight: 800,
                        fontSize: 14, letterSpacing: "0.18em",
                        color: featured ? "var(--ahead-comp-05)" : "var(--ahead-secondary)",
                      }}>{o.num}</span>
                      <div style={{
                        width: 40, height: 40, borderRadius: 12,
                        background: featured ? "rgba(255,255,255,.1)" : "var(--ahead-surface-3)",
                        color: featured ? "#fff" : "var(--ahead-primary)",
                        display: "inline-flex", alignItems: "center", justifyContent: "center",
                      }}>
                        <Icon name={o.icon} size={20} stroke={1.75} />
                      </div>
                    </div>
                    <h3 style={{
                      fontFamily: "var(--font-display)", fontWeight: 700,
                      fontSize: isMobile ? 26 : 36,
                      lineHeight: 1, letterSpacing: "-0.015em",
                      color: featured ? "#fff" : "var(--ahead-primary)",
                      margin: "8px 0 4px", textTransform: "uppercase",
                      wordBreak: "break-word", hyphens: "auto",
                    }}>{o.title}</h3>
                    <p style={{
                      fontSize: 15, lineHeight: 1.55,
                      color: featured ? "var(--ahead-fg-on-dark-2)" : "var(--ahead-fg-2)",
                      margin: 0, maxWidth: 540,
                    }}>{o.body}</p>
                    <span style={{
                      marginTop: "auto", display: "inline-flex", alignItems: "center", gap: 8,
                      fontSize: 14, fontWeight: 600,
                      color: featured ? "var(--ahead-secondary)" : "var(--ahead-comp-02)",
                    }}>
                      En savoir plus <Icon name="arrow-right" size={14} />
                    </span>
                  </div>
                </a>
              </Reveal>
            );
          })}
        </div>
      </div>
    </section>
  );
};

// ---- Numbers strip — repères factuels de la practice
const NumbersStrip = () => {
  const isMobile = useIsMobile();
  return (
    <section style={{ background: "var(--ahead-comp-01)", color: "#fff", padding: isMobile ? "56px 0" : "72px 0" }}>
      <div className="container">
        <div style={{ display: "grid", gridTemplateColumns: isMobile ? "1fr" : "repeat(3, 1fr)", gap: isMobile ? 28 : 20 }}>
          {[
            ["+ 45", "sessions d'acculturation", "Comex, managers, équipes métier"],
            ["+ 30", "entreprises accompagnées", "ETI, grands groupes, marchands"],
            ["+ 1 000", "collaborateurs formés", "Du dirigeant à l'opérationnel"],
          ].map(([n, l, sub], i) => (
            <Reveal key={l} delay={i * 100}>
              <div style={{ borderLeft: "2px solid var(--ahead-secondary)", paddingLeft: 20 }}>
                <div style={{
                  fontFamily: "var(--font-display)", fontWeight: 800,
                  fontSize: isMobile ? 56 : 72,
                  color: "#fff", lineHeight: 0.95, letterSpacing: "-0.025em",
                }}>{n}</div>
                <div style={{ fontWeight: 600, fontSize: 15, marginTop: 12 }}>{l}</div>
                <div style={{ fontSize: 13, color: "var(--ahead-fg-on-dark-3)", marginTop: 4 }}>{sub}</div>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
};

// ---- Approach / Methodology — 3 steps
const ApproachStrip = () => {
  const isMobile = useIsMobile();
  const steps = [
    { n: "Cadrer", body: "Acculturation ou audit. On comprend votre contexte, on cartographie les usages, on priorise par valeur et faisabilité.", icon: "search" },
    { n: "Construire", body: "Formation des équipes, déploiement de la première solution. Sprints courts, livrables concrets, validation à chaque étape.", icon: "settings" },
    { n: "Pérenniser", body: "AI Factory ou transfert. Gouvernance, monitoring, montée en autonomie. Vous gardez la main.", icon: "trending-up" },
  ];
  return (
    <section className="section" style={{ background: "var(--ahead-surface-2)" }}>
      <div className="container">
        <Reveal>
          <Eyebrow>Notre approche</Eyebrow>
          <h2 className="h-section" style={{ marginTop: 16, marginBottom: isMobile ? 40 : 64, maxWidth: 900 }}>
            Trois temps, une seule promesse :<br/>
            <span style={{ color: "var(--ahead-secondary)" }}>la valeur, vite.</span>
          </h2>
        </Reveal>
        <div style={{
          display: "grid",
          gridTemplateColumns: isMobile ? "1fr" : "repeat(3, 1fr)",
          gap: isMobile ? 32 : 0,
          position: "relative",
        }}>
          {/* connecting line — desktop only */}
          {!isMobile && (
            <div aria-hidden style={{
              position: "absolute", top: 28, left: "16%", right: "16%", height: 2,
              background: "linear-gradient(to right, var(--ahead-secondary), var(--ahead-comp-02))",
              opacity: 0.4,
            }} />
          )}
          {steps.map((s, i) => (
            <Reveal key={s.n} delay={i * 120}>
              <div style={{ padding: isMobile ? 0 : "0 32px", textAlign: "left", position: "relative" }}>
                <div style={{
                  width: 56, height: 56, borderRadius: "50%",
                  background: "#fff", color: "var(--ahead-primary)",
                  display: "inline-flex", alignItems: "center", justifyContent: "center",
                  border: "2px solid var(--ahead-secondary)", marginBottom: 20,
                  position: "relative", zIndex: 2,
                }}>
                  <Icon name={s.icon} size={24} />
                </div>
                <div style={{
                  fontFamily: "var(--font-display)", fontWeight: 800, textTransform: "uppercase",
                  fontSize: 14, letterSpacing: "0.18em", color: "var(--ahead-secondary)", marginBottom: 8,
                }}>Étape {String(i + 1).padStart(2, "0")}</div>
                <h3 style={{
                  fontFamily: "var(--font-display)", fontWeight: 700,
                  fontSize: isMobile ? 26 : 32,
                  color: "var(--ahead-primary)", letterSpacing: "-0.01em", margin: "0 0 12px",
                  textTransform: "uppercase",
                }}>{s.n}</h3>
                <p style={{ fontSize: 15, lineHeight: 1.6, color: "var(--ahead-fg-2)", margin: 0, maxWidth: 320 }}>{s.body}</p>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
};

// ---- Why Ahead — 3 raisons de nous choisir
const WhyAhead = () => {
  const reasons = [
    {
      icon: "layers",
      title: "Conseil, formation et sur-mesure sous le même toit",
      body: "Une approche rare : on cadre en consulting, on transmet en formation, on livre en développement de solutions sur-mesure. Pas de relais entre cabinets, pas de perte d'information.",
    },
    {
      icon: "rocket",
      title: "Des déploiements menés à l'échelle",
      body: "Plusieurs secteurs, plusieurs métiers, des solutions IA en production avec des résultats concrets. On n'apprend pas sur votre projet — on l'utilise.",
    },
    {
      icon: "users",
      title: "Une approche centrée humain",
      body: "L'IA reste un changement majeur pour une organisation. Le change management, la formation des équipes et l'adoption sont au cœur de chaque mission, pas un vernis posé à la fin.",
    },
  ];
  return (
    <section className="section" style={{ background: "#fff", borderTop: "1px solid var(--ahead-line)" }}>
      <div className="container">
        <Reveal>
          <Eyebrow>Pourquoi Ahead Digital</Eyebrow>
          <h2 className="h-section" style={{ marginTop: 16, marginBottom: 28, maxWidth: 980 }}>
            Trois raisons<br/>
            de nous choisir<br/>
            <span style={{ color: "var(--ahead-secondary)", fontStyle: "italic" }}>pour votre IA</span>.
          </h2>
          <p className="lede" style={{ marginBottom: 64, maxWidth: 720 }}>
            On ne se positionne ni comme un pur cabinet de conseil, ni comme un pur intégrateur.
            Cette articulation fait la différence sur la durée.
          </p>
        </Reveal>
        <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))", gap: 24 }}>
          {reasons.map((r, i) => (
            <Reveal key={r.title} delay={i * 100}>
              <div style={{
                background: "var(--ahead-surface-2)",
                border: "1px solid var(--ahead-line)",
                borderRadius: 20, padding: 32, height: "100%",
                display: "flex", flexDirection: "column", gap: 16,
                position: "relative", overflow: "hidden",
              }}>
                <div aria-hidden style={{
                  position: "absolute", top: -40, right: -40, width: 140, height: 140,
                  borderRadius: "50%", background: "var(--ahead-secondary)",
                  opacity: 0.08, filter: "blur(40px)",
                }} />
                <div style={{
                  width: 56, height: 56, borderRadius: 14,
                  background: "var(--ahead-primary)", color: "#fff",
                  display: "inline-flex", alignItems: "center", justifyContent: "center",
                  position: "relative",
                }}>
                  <Icon name={r.icon} size={26} stroke={1.75} color="#fff" />
                </div>
                <div style={{
                  fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 22,
                  textTransform: "uppercase", letterSpacing: "-0.005em",
                  color: "var(--ahead-primary)", lineHeight: 1.15,
                  position: "relative",
                }}>{r.title}</div>
                <p style={{
                  margin: 0, fontSize: 15, lineHeight: 1.6,
                  color: "var(--ahead-fg-2)", position: "relative",
                }}>{r.body}</p>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
};

// ---- Tech / partners marquee
const TechMarquee = () => {
  const techs = [
    "OpenAI", "Anthropic Claude", "Mistral AI", "AWS Bedrock", "Azure OpenAI",
    "Google Gemini", "Hugging Face", "LangChain", "LlamaIndex",
    "Pinecone", "Weaviate", "Microsoft Copilot", "Databricks", "Snowflake Cortex",
  ];
  return (
    <section style={{ padding: "56px 0", background: "#fff", borderTop: "1px solid var(--ahead-line)", borderBottom: "1px solid var(--ahead-line)", overflow: "hidden" }}>
      <div className="container" style={{ marginBottom: 28 }}>
        <span className="eyebrow">Stack & partenaires</span>
      </div>
      <div className="marquee" style={{ display: "flex", gap: 64 }}>
        {[...techs, ...techs].map((t, i) => (
          <span key={i} style={{
            fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 32,
            color: "var(--ahead-primary)", letterSpacing: "-0.01em",
            textTransform: "uppercase", whiteSpace: "nowrap", opacity: 0.85,
          }}>{t} <span style={{ color: "var(--ahead-secondary)", margin: "0 32px" }}>·</span></span>
        ))}
      </div>
    </section>
  );
};

// ---- Posture — un manifeste court, signé Ahead, sans citation client inventée
const Testimonial = () => (
  <section className="section" style={{ background: "var(--ahead-comp-05)", color: "var(--ahead-primary)" }}>
    <div className="container" style={{ maxWidth: 980 }}>
      <Reveal>
        <span className="eyebrow" style={{ marginBottom: 24 }}>Notre posture</span>
        <p style={{
          fontFamily: "var(--font-display)", fontWeight: 700,
          fontSize: "clamp(28px, 3.5vw, 52px)", lineHeight: 1.1,
          letterSpacing: "-0.015em", color: "var(--ahead-primary)",
          margin: "20px 0 32px", textTransform: "none",
        }}>
          On ne vend pas l'IA pour l'IA.<br/>
          On part de votre métier — <span style={{ color: "var(--ahead-secondary)", fontStyle: "italic" }}>là où la valeur est</span>{" "}
          — et on construit ce qui se met vraiment en production.
        </p>
        <div style={{ display: "flex", flexWrap: "wrap", gap: 24, fontSize: 15, color: "var(--ahead-fg-2)", marginTop: 20 }}>
          <span><strong style={{ color: "var(--ahead-primary)" }}>Factuel</strong> avant emphatique</span>
          <span><strong style={{ color: "var(--ahead-primary)" }}>Concret</strong> avant abstrait</span>
          <span><strong style={{ color: "var(--ahead-primary)" }}>Métier</strong> avant techno</span>
          <span><strong style={{ color: "var(--ahead-primary)" }}>Court</strong> avant long</span>
        </div>
      </Reveal>
    </div>
  </section>
);

// ---- Featured case study teaser — PMU
const CaseStudyTeaser = () => {
  const isMobile = useIsMobile();
  return (
  <section className="section" style={{ background: "#fff" }}>
    <div className="container">
      <Reveal>
        <Eyebrow>Étude de cas</Eyebrow>
        <h2 className="h-section" style={{ marginTop: 16, marginBottom: isMobile ? 40 : 56, maxWidth: 900 }}>
          Acculturation et adoption de l'IA<br/>
          <span style={{ color: "var(--ahead-secondary)", fontStyle: "italic" }}>au PMU</span>.
        </h2>
      </Reveal>

      <div style={{ display: "grid", gridTemplateColumns: isMobile ? "1fr" : "1.1fr 1fr", gap: isMobile ? 24 : 40, alignItems: "stretch" }}>
        <Reveal>
          <div style={{
            background: "var(--ahead-primary)", color: "#fff",
            borderRadius: 24, padding: isMobile ? 28 : 48, height: "100%",
            display: "flex", flexDirection: "column", justifyContent: "space-between",
            position: "relative", overflow: "hidden",
          }}>
            <div aria-hidden style={{
              position: "absolute", right: -80, bottom: -80, width: 320, height: 320,
              borderRadius: "50%", background: "var(--ahead-secondary)",
              opacity: 0.18, filter: "blur(60px)",
            }} />
            <div style={{ position: "relative" }}>
              <span className="pill pill-onDark" style={{ marginBottom: 24 }}>PMU · Direction Produit · 2025-2026</span>
              <p style={{ fontSize: 18, lineHeight: 1.6, color: "var(--ahead-fg-on-dark-2)", margin: "0 0 32px", maxWidth: 460 }}>
                D'usages isolés à une adoption structurée. Sept agents IA déployés sur Amazon Quick Suite,
                gouvernance par les Champions, autonomie des équipes. Mission renouvelée pour 2026.
              </p>
              <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: isMobile ? 12 : 24, marginBottom: isMobile ? 24 : 40 }}>
                {[["−30 %", "Temps US + CA"], ["~25", "PM / PO"], ["7", "Agents IA"]].map(([n, l]) => (
                  <div key={l}>
                    <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 40, color: "var(--ahead-secondary)", lineHeight: 0.95 }}>{n}</div>
                    <div style={{ fontSize: 12, color: "var(--ahead-fg-on-dark-2)", marginTop: 6, textTransform: "uppercase", letterSpacing: "0.1em" }}>{l}</div>
                  </div>
                ))}
              </div>
            </div>
            <div style={{ position: "relative" }}>
              <Button variant="accent" icon="arrow-right" href="etude-de-cas-pmu.html">Lire l'étude complète</Button>
            </div>
          </div>
        </Reveal>
        <Reveal delay={120}>
          <div style={{
            background: "var(--ahead-comp-05)", borderRadius: 24,
            padding: isMobile ? 28 : 48,
            height: "100%", minHeight: isMobile ? 220 : "auto",
            display: "flex", flexDirection: "column", justifyContent: "space-between",
            position: "relative", overflow: "hidden",
          }}>
            <div style={{
              fontFamily: "var(--font-display)", fontWeight: 900,
              fontSize: isMobile ? 110 : 180,
              color: "var(--ahead-primary)", textTransform: "uppercase",
              lineHeight: 0.85, letterSpacing: "-0.04em",
              transform: "skewY(-6deg)",
            }}>
              <span style={{ color: "var(--ahead-secondary)" }}>2026</span><br/>
              <span style={{ fontSize: isMobile ? 36 : 56, fontStyle: "italic" }}>renouvelée.</span>
            </div>
            <div style={{ fontSize: 13, fontFamily: "var(--font-mono)", color: "var(--ahead-primary)", opacity: 0.7, marginTop: 16 }}>
              // mission étendue · preuve de valeur perçue
            </div>
          </div>
        </Reveal>
      </div>
    </div>
  </section>
  );
};

// ---- Final CTA
const FinalCTA = () => (
  <section style={{ background: "var(--ahead-primary)", padding: "120px 0", color: "#fff", position: "relative", overflow: "hidden" }}>
    <div aria-hidden style={{
      position: "absolute", left: "50%", top: "50%", width: 800, height: 800,
      transform: "translate(-50%, -50%)", borderRadius: "50%",
      background: "radial-gradient(circle, rgba(255,85,91,.25), transparent 60%)",
      pointerEvents: "none",
    }} />
    <div className="container" style={{ position: "relative", textAlign: "center", maxWidth: 980 }}>
      <Reveal>
        <h2 style={{
          fontFamily: "var(--font-display)", fontWeight: 900, textTransform: "uppercase",
          fontSize: "clamp(56px, 8vw, 120px)", lineHeight: 0.88, letterSpacing: "-0.025em",
          color: "#fff", margin: "0 0 28px",
        }}>
          On en parle ?<br/>
          <span style={{ color: "var(--ahead-secondary)", display: "inline-block", transform: "skewY(-6deg)", fontStyle: "italic" }}>
            Good A.I. ahead.
          </span>
        </h2>
        <p style={{ fontSize: 22, color: "var(--ahead-fg-on-dark-2)", margin: "0 auto 40px", maxWidth: 620, lineHeight: 1.5 }}>
          Un échange court suffit pour qualifier votre besoin et choisir le bon point d'entrée.
        </p>
        <div style={{ display: "inline-flex", gap: 14, flexWrap: "wrap", justifyContent: "center" }}>
          <Button variant="accent" icon="arrow-right" href="contact.html">Échanger sur votre besoin</Button>
          <Button variant="link-onDark" href="formations.html">Voir les formations</Button>
        </div>
      </Reveal>
    </div>
  </section>
);

Object.assign(window, { FiveOffers, NumbersStrip, ApproachStrip, WhyAhead, TechMarquee, Testimonial, CaseStudyTeaser, FinalCTA });
