/* eslint-disable */
// MS BRIDGE — Section 4: Pour qui
// 3 grouped role tabs (Stratégie / Opérationnel / Exécution),
// big card on the right with constat + bullets + product mock.

;(function () {
const T = window.MSB.tokens;
const { useState, useEffect, useRef } = React;

/* ===========================================================================
 *  CONTENT
 * ======================================================================= */

const GROUPS = [
  {
    id: "strategy",
    num: "01",
    label: "Stratégie & pilotage",
    roles: ["Directeur Marketing", "CMO", "Head of Growth"],
    angle: "La qualité de la donnée sur laquelle vos décisions sont prises.",
    constatLead: "Le vrai frein à votre performance n'est pas",
    constatStrike: "le budget",
    constatTail: ". C'est la donnée sur laquelle il est orienté.",
    tu: false,
    bullets: [
      {
        text: "Vision exécutive des pain points qui freinent réellement vos deals, analysés en continu depuis vos calls.",
      },
      {
        text: "Le bon commercial à rencontrer pour creuser le bon pain point — vos réunions marketing-sales partent d'un sujet documenté, plus d'un agenda flou.",
        feature: "Rencontre Sales",
      },
      {
        text: "Rapports hebdo et synthèses d'objections automatisés, directement dans Claude.",
        feature: "MS·Bridge dans Claude · MCP",
      },
      {
        text: "ROI tangible — vous savez ce qui convertit, vous ne le supposez plus.",
      },
    ],
    proof: "De « je pense que ça marche » à « je sais ce qui convertit ».",
    visual: "rencontre",
  },
  {
    id: "operational",
    num: "02",
    label: "Stratégie opérationnelle",
    roles: ["Responsable Marketing", "Growth Marketer", "Social Media Manager", "Traffic Manager", "Community Manager"],
    angle: "Des angles, des hooks et des creatives ancrés dans la réalité terrain.",
    constatLead: "Les meilleurs angles sont déjà dans les appels de vos commerciaux.",
    constatStrike: "L'intuition",
    constatTail: " ne suffit plus.",
    tu: false,
    bullets: [
      {
        text: "Posts, séquences email, scripts TikTok et creatives ads générés depuis les pain points du terrain.",
        feature: "Studio de Contenu",
      },
      {
        text: "Un Kanban de production — de l'idée détectée au contenu publié, en un seul endroit.",
      },
      {
        text: "Chat RAG sur toutes vos données marketing & sales — interrogez vos calls 24/7, sans attendre personne.",
        feature: "Chat RAG",
      },
      {
        text: "Chaque contenu reste ancré sur une objection réelle détectée dans les calls — fini le contenu hors-sol.",
      },
    ],
    proof: "Du contenu ancré dans la réalité, pas dans des hypothèses.",
    visual: "kanban",
  },
  {
    id: "solopreneur",
    num: "03",
    label: "Solopreneur",
    roles: ["Consultant", "Indépendant", "Freelance"],
    angle: "L'art de transformer vos conversations en un système de génération de leads qualifiés.",
    constatLead: "Pour attirer des leads qualifiés en continu,",
    constatStrike: "l'intuition",
    constatTail: " ne suffit plus. Vos contenus doivent viser juste.",
    tu: false,
    bullets: [
      {
        text: "Une stratégie de prospection mieux orientée : acquérez une connaissance fine de leurs besoins avec le module Détecter.",
        feature: "Module /Détecter",
      },
      {
        text: "Transformez un pain point en véritable outil applicatif via le Studio Lead Magnet pour accélérer votre génération de leads.",
        feature: "Studio Lead Magnet",
      },
      {
        text: "Posts, séquences email et scripts briefés automatiquement sur les vraies objections détectées dans vos propres calls.",
        feature: "Studio de Contenu",
      },
      {
        text: "Chat RAG sur toutes vos données — interrogez vos calls passés comme un second cerveau, 24/7.",
        feature: "Chat RAG",
      },
    ],
    proof: "De 2 jours de recherche à 10 minutes pour briefer une semaine de contenu.",
    visual: "studios",
  },
];

/* ===========================================================================
 *  HEADER
 * ======================================================================= */

function WhoEyebrow({ index = "05", label = "Pour qui" }) {
  return (
    <div style={{
      display: "inline-flex", alignItems: "center", gap: 12,
      fontFamily: T.fontSans, fontSize: 11.5, fontWeight: 500,
      color: T.ink60, letterSpacing: "0.10em", textTransform: "uppercase",
    }}>
      <span aria-hidden style={{
        width: 7, height: 7, borderRadius: 999, background: T.red,
        boxShadow: "0 0 0 3px rgba(232,41,28,0.14)", display: "inline-block",
      }} />
      <span>{index}</span>
      <span aria-hidden style={{ width: 18, height: 1, background: T.ink40 }} />
      <span>{label}</span>
    </div>
  );
}

function SectionHeader({ titleSize = 52, align = "center" }) {
  return (
    <div style={{
      display: "flex", flexDirection: "column",
      alignItems: align === "center" ? "center" : "flex-start",
      textAlign: align,
    }}>
      <WhoEyebrow />
      <h2 style={{
        fontFamily: T.fontSans, fontSize: titleSize, fontWeight: 500,
        lineHeight: 1.05, letterSpacing: "-0.035em", color: T.ink,
        margin: "26px 0 0", maxWidth: 960, textWrap: "balance",
      }}>
        <span style={{
          color: T.red, fontWeight: 500,
          letterSpacing: "-0.035em",
        }}>Trois façons</span>{" "}
        de l'exploiter.
      </h2>
      <p style={{
        fontSize: 17, lineHeight: 1.55, color: T.ink80, margin: "20px 0 0",
        maxWidth: 720, letterSpacing: "-0.005em",
      }}>
        Du pilotage stratégique à l'exécution créative chaque rôle pioche dans la
        même donnée terrain, mais y trouve une réponse différente à son problème.
      </p>
    </div>
  );
}

/* ===========================================================================
 *  TABS
 * ======================================================================= */

function GroupTabs({ active, setActive, layout = "row" }) {
  const isRow = layout === "row";
  const isSlider = layout === "slider";
  const scrollRef = useRef(null);

  // Sync scroll position when active changes from parent (e.g. clicking a dot)
  useEffect(() => {
    if (isSlider && scrollRef.current) {
      const cards = Array.from(scrollRef.current.children);
      const activeIndex = GROUPS.findIndex(g => g.id === active);
      if (cards && cards[activeIndex]) {
        const leftPos = cards[activeIndex].offsetLeft - scrollRef.current.offsetLeft;
        if (Math.abs(scrollRef.current.scrollLeft - leftPos) > 10) {
          scrollRef.current.scrollTo({
            left: leftPos,
            behavior: "smooth"
          });
        }
      }
    }
  }, [active, isSlider]);

  const handleScroll = () => {
    if (isSlider && scrollRef.current) {
      const scrollLeft = scrollRef.current.scrollLeft;
      const cards = Array.from(scrollRef.current.children);
      if (cards && cards.length > 0) {
        let activeIndex = 0;
        let minDiff = Infinity;
        for (let i = 0; i < cards.length; i++) {
          const leftPos = cards[i].offsetLeft - scrollRef.current.offsetLeft;
          const diff = Math.abs(scrollLeft - leftPos);
          if (diff < minDiff) {
            minDiff = diff;
            activeIndex = i;
          }
        }
        const activeGroup = GROUPS[activeIndex];
        if (activeGroup && active !== activeGroup.id) {
          setActive(activeGroup.id);
        }
      }
    }
  };

  if (isSlider) {
    return (
      <div>
        <style dangerouslySetInnerHTML={{ __html: `
          .pn-groups-scroll::-webkit-scrollbar {
            display: none;
          }
        ` }} />
        <div
          ref={scrollRef}
          className="pn-groups-scroll"
          onScroll={handleScroll}
          style={{
            display: "flex",
            overflowX: "auto",
            scrollSnapType: "x mandatory",
            scrollBehavior: "smooth",
            paddingLeft: 20,
            paddingRight: "25vw",
            gap: 12,
            width: "100vw",
            marginLeft: "-20px",
            marginRight: "-20px",
            scrollbarWidth: "none",
            msOverflowStyle: "none",
            WebkitOverflowScrolling: "touch",
          }}
        >
          {GROUPS.map((g) => {
            const isActive = active === g.id;
            return (
              <button
                key={g.id}
                onClick={() => setActive(g.id)}
                style={{
                  flex: "0 0 78vw",
                  scrollSnapAlign: "start",
                  cursor: "pointer",
                  textAlign: "left",
                  background: isActive ? T.ink : T.surface,
                  color: isActive ? "#fff" : T.ink,
                  border: `1px solid ${isActive ? T.ink : T.border}`,
                  borderRadius: 14,
                  padding: "16px 20px",
                  boxShadow: isActive
                    ? "0 8px 24px -12px rgba(0,0,0,0.30)"
                    : "0 1px 0 rgba(0,0,0,0.02)",
                  transition: "all 220ms ease",
                  fontFamily: T.fontSans,
                  display: "flex",
                  flexDirection: "column",
                  gap: 6,
                  outline: "none",
                }}
              >
                <div style={{
                  display: "flex", alignItems: "center", gap: 10,
                  fontSize: 11, letterSpacing: "0.12em", textTransform: "uppercase",
                  color: isActive ? "rgba(255,255,255,0.55)" : T.ink40,
                  fontWeight: 500,
                }}>

                  <span>Groupe</span>
                </div>
                <div style={{
                  fontSize: 17, fontWeight: 500, lineHeight: 1.2,
                  letterSpacing: "-0.015em",
                }}>
                  {g.label}
                </div>
                <div style={{
                  fontSize: 12.5, lineHeight: 1.4,
                  color: isActive ? "rgba(255,255,255,0.65)" : T.ink60,
                  letterSpacing: "-0.005em",
                }}>
                  {g.roles.join(" · ")}
                </div>
              </button>
            );
          })}
        </div>
        {/* Stepper Dots below the slider */}
        <div style={{ display: "flex", justifyContent: "center", alignItems: "center", gap: 8, marginTop: 20 }}>
          {GROUPS.map((g, i) => (
            <button
              key={g.id}
              onClick={() => setActive(g.id)}
              aria-label={`Aller au groupe ${g.num}`}
              style={{
                width: active === g.id ? 20 : 7,
                height: 7,
                borderRadius: 999,
                background: active === g.id ? T.red : "rgba(0,0,0,0.15)",
                border: "none",
                padding: 0,
                cursor: "pointer",
                outline: "none",
                transition: "all 0.25s cubic-bezier(0.16, 1, 0.3, 1)",
              }}
            />
          ))}
        </div>
      </div>
    );
  }

  return (
    <div style={{
      display: "flex",
      flexDirection: isRow ? "row" : "column",
      gap: isRow ? 14 : 10,
      justifyContent: "center",
      alignItems: "stretch",
      width: "100%",
      fontFamily: T.fontSans,
    }}>
      {GROUPS.map((g) => {
        const isActive = active === g.id;
        return (
          <button
            key={g.id}
            onClick={() => setActive(g.id)}
            style={{
              flex: isRow ? 1 : "0 0 auto",
              cursor: "pointer",
              textAlign: "left",
              background: isActive ? T.ink : T.surface,
              color: isActive ? "#fff" : T.ink,
              border: `1px solid ${isActive ? T.ink : T.border}`,
              borderRadius: 14,
              padding: "16px 20px",
              boxShadow: isActive
                ? "0 8px 24px -12px rgba(0,0,0,0.30)"
                : "0 1px 0 rgba(0,0,0,0.02)",
              transition: "all 220ms ease",
              fontFamily: T.fontSans,
              display: "flex", flexDirection: "column", gap: 6,
            }}
          >
            <div style={{
              display: "flex", alignItems: "center", gap: 10,
              fontSize: 11, letterSpacing: "0.12em", textTransform: "uppercase",
              color: isActive ? "rgba(255,255,255,0.55)" : T.ink40,
              fontWeight: 500,
            }}>

              <span>Groupe</span>
            </div>
            <div style={{
              fontSize: 17, fontWeight: 500, lineHeight: 1.2,
              letterSpacing: "-0.015em",
            }}>
              {g.label}
            </div>
            <div style={{
              fontSize: 12.5, lineHeight: 1.4,
              color: isActive ? "rgba(255,255,255,0.65)" : T.ink60,
              letterSpacing: "-0.005em",
            }}>
              {g.roles.join(" · ")}
            </div>
          </button>
        );
      })}
    </div>
  );
}

/* ===========================================================================
 *  CARD CONTENT — left column (text)
 * ======================================================================= */

function Strike({ children }) {
  return (
    <span style={{ position: "relative", display: "inline-block", color: T.ink40, whiteSpace: "nowrap" }}>
      <span style={{
        position: "absolute", left: -2, right: -2, top: "55%",
        height: 3, background: T.red, transform: "rotate(-3deg)",
        borderRadius: 2,
      }} />
      {children}
    </span>
  );
}

function BulletItem({ b }) {
  return (
    <li style={{
      display: "flex", gap: 14, alignItems: "flex-start",
      padding: "14px 0", borderTop: `1px solid ${T.borderSoft}`,
    }}>
      <span aria-hidden style={{
        flexShrink: 0, marginTop: 8,
        width: 6, height: 6, borderRadius: 999, background: T.red,
      }} />
      <div style={{ fontSize: 15.5, lineHeight: 1.55, color: T.ink80, letterSpacing: "-0.005em", minWidth: 0 }}>
        {b.text}
        {b.feature && (
          <span style={{
            display: "inline-flex", alignItems: "center", gap: 6,
            marginLeft: 8,
            fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
            fontSize: 11, fontWeight: 500,
            color: T.redDark,
            background: T.redSoft,
            padding: "3px 8px", borderRadius: 999,
            letterSpacing: "0",
            verticalAlign: "1px",
          }}>
            <span aria-hidden style={{
              width: 5, height: 5, borderRadius: 999, background: T.red,
            }} />
            {b.feature}
          </span>
        )}
      </div>
    </li>
  );
}

function CardLeft({ group, titleSize = 30 }) {
  return (
    <div style={{
      display: "flex", flexDirection: "column", gap: 22, fontFamily: T.fontSans,
    }}>
      {/* Angle subtitle */}
      <div style={{
        display: "inline-flex", alignItems: "center", gap: 10,
        fontSize: 11.5, letterSpacing: "0.10em", textTransform: "uppercase",
        color: T.ink60, fontWeight: 500,
      }}>
        <span style={{ color: T.red, fontWeight: 500 }}>{group.num}</span>
        <span aria-hidden style={{ width: 18, height: 1, background: T.ink40 }} />
        <span>Angle</span>
      </div>
      <div style={{
        fontSize: 15, lineHeight: 1.5, color: T.ink60,
        fontStyle: "italic", letterSpacing: "-0.005em",
        maxWidth: 520,
      }}>
        {group.angle}
      </div>

      {/* Constat */}
      <h3 style={{
        fontFamily: T.fontSans, fontSize: titleSize, fontWeight: 500,
        lineHeight: 1.15, letterSpacing: "-0.025em", color: T.ink,
        margin: 0, textWrap: "balance",
      }}>
        {group.constatLead}{" "}
        <Strike>{group.constatStrike}</Strike>
        {group.constatTail}
      </h3>

      {/* Bullets */}
      <ul style={{ listStyle: "none", padding: 0, margin: 0 }}>
        {group.bullets.map((b, i) => <BulletItem key={i} b={b} />)}
        <li style={{ borderTop: `1px solid ${T.borderSoft}`, height: 0 }} />
      </ul>

      {/* Proof */}
      <div style={{
        marginTop: 4,
        background: T.ink,
        color: "#fff",
        padding: "18px 22px",
        borderRadius: 14,
        display: "flex", alignItems: "center", gap: 14,
      }}>
        <span aria-hidden style={{
          width: 3, alignSelf: "stretch", background: T.red, borderRadius: 2,
        }} />
        <div style={{
          fontSize: 16, lineHeight: 1.4, letterSpacing: "-0.01em",
          fontStyle: "italic", color: "rgba(255,255,255,0.92)",
        }}>
          {group.proof}
        </div>
      </div>
    </div>
  );
}

/* ===========================================================================
 *  PRODUCT MOCKS (right column) — one per group
 * ======================================================================= */

function MockShell({ chip, title, children, height }) {
  return (
    <div style={{
      background: T.surface,
      border: `1px solid ${T.border}`,
      borderRadius: 18,
      padding: "20px 20px 22px",
      fontFamily: T.fontSans,
      boxShadow: "0 14px 40px -22px rgba(0,0,0,0.25), 0 1px 0 rgba(0,0,0,0.02)",
      display: "flex", flexDirection: "column", gap: 16,
      height: height || "auto",
      boxSizing: "border-box",
    }}>
      <div style={{
        display: "flex", alignItems: "center", justifyContent: "space-between",
      }}>
        <div style={{
          display: "inline-flex", alignItems: "center", gap: 8,
          fontSize: 10.5, letterSpacing: "0.12em", textTransform: "uppercase",
          color: T.ink60, fontWeight: 500,
          fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
        }}>
          <span aria-hidden style={{
            width: 6, height: 6, borderRadius: 999, background: T.red,
          }} />
          {chip}
        </div>
        <div style={{
          fontSize: 10.5, color: T.ink40, letterSpacing: "0.08em",
          textTransform: "uppercase",
          fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
        }}>
          aperçu produit
        </div>
      </div>
      <div style={{
        fontSize: 18, fontWeight: 500, color: T.ink,
        letterSpacing: "-0.015em", lineHeight: 1.2,
      }}>
        {title}
      </div>
      {children}
    </div>
  );
}

/* --- Mock 1: Rencontre Sales table ---------------------------------------- */

const RENCONTRE_ROWS = [
  { name: "Thomas R.",  persona: "CMO SaaS",  conv: "34%", obj: "Prix perçu",  pcolor: "#FCEBEB", ocolor: "#FCEBEB" },
  { name: "Julie M.",   persona: "DRH PME",   conv: "27%", obj: "ROI flou",    pcolor: "#EAF0FB", ocolor: "#F2EAFB" },
  { name: "Karim B.",   persona: "CTO Scale", conv: "41%", obj: "Intégration", pcolor: "#EAF3DE", ocolor: "#F4F4F2" },
  { name: "Sarah L.",   persona: "VP Sales",  conv: "19%", obj: "Concurrent",  pcolor: "#EAF3DE", ocolor: "#F4F4F2" },
];

function MockRencontre() {
  return (
    <MockShell chip="Rencontre Sales" title="Quel commercial rencontrer ?">
      <div style={{
        border: `1px solid ${T.borderSoft}`, borderRadius: 12,
        overflow: "hidden", background: T.surface,
      }}>
        {/* Header row */}
        <div style={{
          display: "grid",
          gridTemplateColumns: "1.4fr 1.1fr 0.7fr 1.1fr",
          padding: "10px 14px",
          fontSize: 10, letterSpacing: "0.12em", textTransform: "uppercase",
          color: T.ink40, fontWeight: 500,
          fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
          borderBottom: `1px solid ${T.borderSoft}`, background: T.surface2,
        }}>
          <div>Commercial</div>
          <div>Persona clé</div>
          <div>Conv.</div>
          <div>Top objection</div>
        </div>
        {RENCONTRE_ROWS.map((r, i) => (
          <div key={r.name} style={{
            display: "grid",
            gridTemplateColumns: "1.4fr 1.1fr 0.7fr 1.1fr",
            alignItems: "center",
            padding: "12px 14px",
            borderTop: i === 0 ? "none" : `1px solid ${T.borderSoft}`,
            fontSize: 13,
            background: i === 1 ? "rgba(252,235,235,0.4)" : "transparent",
          }}>
            <div style={{ display: "flex", alignItems: "center", gap: 8, color: T.ink, fontWeight: 500 }}>
              <span aria-hidden style={{
                width: 18, height: 18, borderRadius: 999, background: T.ink, color: "#fff",
                display: "inline-flex", alignItems: "center", justifyContent: "center",
                fontSize: 9, fontWeight: 500,
              }}>
                {r.name[0]}
              </span>
              {r.name}
            </div>
            <div>
              <span style={{
                background: r.pcolor, color: T.ink,
                padding: "3px 10px", borderRadius: 999,
                fontSize: 11.5, letterSpacing: "-0.005em",
                fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
              }}>
                {r.persona}
              </span>
            </div>
            <div style={{
              fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
              fontSize: 13, color: T.ink, fontWeight: 500,
            }}>
              {r.conv}
            </div>
            <div>
              <span style={{
                background: r.ocolor,
                color: T.ink80,
                border: `1px solid ${T.borderSoft}`,
                padding: "3px 10px", borderRadius: 999,
                fontSize: 11.5, letterSpacing: "-0.005em",
              }}>
                {r.obj}
              </span>
            </div>
          </div>
        ))}
      </div>

      <div style={{
        marginTop: 6,
        background: T.cream,
        border: `1px solid ${T.borderSoft}`,
        borderRadius: 12,
        padding: "12px 14px",
        display: "flex", alignItems: "center", gap: 12,
      }}>
        <div style={{
          width: 28, height: 28, borderRadius: 8,
          background: T.red, color: "#fff",
          display: "inline-flex", alignItems: "center", justifyContent: "center",
          fontSize: 14, flexShrink: 0,
        }}>↗</div>
        <div style={{ minWidth: 0 }}>
          <div style={{
            fontSize: 10.5, letterSpacing: "0.12em", textTransform: "uppercase",
            color: T.redDark, fontWeight: 500,
            fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
          }}>
            Pain point · 34 mentions · CTO Scale
          </div>
          <div style={{ fontSize: 13.5, color: T.ink, marginTop: 3, letterSpacing: "-0.005em" }}>
            « Intégration trop complexe » → planifier 1:1 avec Karim B.
          </div>
        </div>
      </div>
    </MockShell>
  );
}

/* --- Mock 2: Two studios side by side ------------------------------------- */

function StudioCard({ chip, title, dotColor, ideas }) {
  return (
    <div style={{
      flex: 1, minWidth: 0,
      background: T.surface,
      border: `1px solid ${T.borderSoft}`,
      borderRadius: 14,
      padding: "14px 14px 16px",
      display: "flex", flexDirection: "column", gap: 10,
    }}>
      <div style={{
        display: "inline-flex", alignItems: "center", gap: 8,
        fontSize: 10, letterSpacing: "0.12em", textTransform: "uppercase",
        color: T.ink60, fontWeight: 500,
        fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
      }}>
        <span aria-hidden style={{ width: 6, height: 6, borderRadius: 999, background: dotColor }} />
        {chip}
      </div>
      <div style={{
        fontSize: 15.5, fontWeight: 500, letterSpacing: "-0.015em", color: T.ink, lineHeight: 1.2,
      }}>
        {title}
      </div>
      <div style={{ display: "flex", flexDirection: "column", gap: 8, marginTop: 4 }}>
        {ideas.map((it, i) => (
          <div key={i} style={{
            background: T.surface2,
            borderRadius: 10,
            padding: "9px 11px",
            fontSize: 12.5, color: T.ink80,
            lineHeight: 1.35, letterSpacing: "-0.005em",
            borderLeft: `2px solid ${it.accent || T.red}`,
          }}>
            <div style={{
              fontSize: 9.5, letterSpacing: "0.12em", textTransform: "uppercase",
              color: T.ink40, fontWeight: 500, marginBottom: 4,
              fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
            }}>
              {it.tag}
            </div>
            {it.body}
          </div>
        ))}
      </div>
    </div>
  );
}

function MockStudios() {
  return (
    <MockShell chip="Studios" title="Que voulez-vous produire ?">
      <div style={{ display: "flex", gap: 12 }}>
        <StudioCard
          chip="Studio Contenu"
          dotColor="#34A853"
          title="Du contenu qui engage"
          ideas={[
            { tag: "LinkedIn", body: "Comment le prix perçu détruit vos deals avant même la démo.", accent: "#0B5CFF" },
            { tag: "Email × 3", body: "Séquence nurture — objection ROI non démontré.", accent: "#F4B400" },
            { tag: "TikTok",   body: "Script 30s — l'objection que personne ne traite.", accent: "#E8291C" },
          ]}
        />
        <StudioCard
          chip="Studio Lead Magnet"
          dotColor="#E8291C"
          title="Un lead magnet qui convertit"
          ideas={[
            { tag: "PRD",          body: "Audit intégration — outil applicatif basé pain point.", accent: "#E8291C" },
            { tag: "Architecture", body: "Schéma data flow pour CTO Scale.", accent: "#7E2BFF" },
            { tag: "Export",       body: "→ Lovable · Bolt · Emergent", accent: "#3B6D11" },
          ]}
        />
      </div>
    </MockShell>
  );
}

/* --- Mock 3: Kanban content production ------------------------------------ */

const KANBAN_COLS = [
  {
    label: "Idée",
    accent: T.ink40,
    cards: [
      { tag: "LinkedIn", title: "Le prix perçu", verbatim: "« Trop cher pour ce que ça apporte »", color: "#EAF0FB" },
      { tag: "Reels",    title: "Objection ROI", verbatim: "« On verra dans 6 mois »", color: "#FCEBEB" },
    ],
  },
  {
    label: "En cours",
    accent: "#F4B400",
    cards: [
      { tag: "Email × 3", title: "Nurture freins", verbatim: "« Intégration trop complexe »", color: "#FFF7E0" },
    ],
  },
  {
    label: "Publié",
    accent: "#3B6D11",
    cards: [
      { tag: "TikTok",  title: "Concurrent X", verbatim: "« Ils font mieux le tracking »", color: "#EAF3DE" },
      { tag: "Ad META", title: "Hook ROI",     verbatim: "« Pas mesurable »", color: "#EAF3DE" },
    ],
  },
];

function MockKanban() {
  return (
    <MockShell chip="Studio de Contenu" title="Idées en production">
      <div style={{
        display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 10,
      }}>
        {KANBAN_COLS.map((col) => (
          <div key={col.label} style={{
            background: T.surface2,
            borderRadius: 12,
            padding: 10,
            display: "flex", flexDirection: "column", gap: 8,
            minHeight: 220,
          }}>
            <div style={{
              display: "flex", alignItems: "center", justifyContent: "space-between",
              fontSize: 10, letterSpacing: "0.12em", textTransform: "uppercase",
              color: T.ink60, fontWeight: 500,
              fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
              padding: "2px 4px",
            }}>
              <div style={{ display: "flex", alignItems: "center", gap: 6 }}>
                <span aria-hidden style={{ width: 6, height: 6, borderRadius: 999, background: col.accent }} />
                {col.label}
              </div>
              <span style={{ color: T.ink40 }}>{col.cards.length}</span>
            </div>

            {col.cards.map((c, i) => (
              <div key={i} style={{
                background: T.surface,
                border: `1px solid ${T.borderSoft}`,
                borderRadius: 10,
                padding: "9px 10px",
                display: "flex", flexDirection: "column", gap: 5,
                boxShadow: "0 1px 0 rgba(0,0,0,0.02)",
              }}>
                <span style={{
                  alignSelf: "flex-start",
                  background: c.color, color: T.ink80,
                  padding: "2px 7px", borderRadius: 999,
                  fontSize: 9.5, fontWeight: 500,
                  fontFamily: 'ui-monospace, "SF Mono", Menlo, Consolas, monospace',
                  letterSpacing: "0.04em",
                }}>
                  {c.tag}
                </span>
                <div style={{
                  fontSize: 12.5, fontWeight: 500, color: T.ink,
                  letterSpacing: "-0.005em", lineHeight: 1.25,
                }}>
                  {c.title}
                </div>
                <div style={{
                  fontSize: 10.5, color: T.ink60,
                  fontStyle: "italic", lineHeight: 1.3,
                  letterSpacing: "-0.005em",
                  paddingTop: 2,
                  borderTop: `1px dashed ${T.borderSoft}`,
                }}>
                  {c.verbatim}
                </div>
              </div>
            ))}
          </div>
        ))}
      </div>
    </MockShell>
  );
}

function VisualFor({ group }) {
  if (group.visual === "rencontre") return <MockRencontre />;
  if (group.visual === "studios")   return <MockStudios />;
  return <MockKanban />;
}

/* ===========================================================================
 *  FRAME + Layouts
 * ======================================================================= */

function WhoFrame({ children, padding }) {
  return (
    <div style={{
      position: "relative",
      background: "#FFFFFF",
      fontFamily: T.fontSans, color: T.ink,
      width: "100%", overflow: "hidden", padding, boxSizing: "border-box",
    }}>
      <div aria-hidden style={{
        position: "absolute", top: 80, left: "50%", transform: "translateX(-50%)",
        width: 900, height: 320,
        background: "radial-gradient(closest-side, rgba(232,41,28,0.08), transparent 70%)",
        pointerEvents: "none",
      }} />
      <div style={{ position: "relative", zIndex: 1 }}>{children}</div>
    </div>
  );
}

function ActiveCard({ group, layout = "desktop" }) {
  const stacked = layout !== "desktop";
  const isMobile = layout === "mobile";
  return (
    <div
      key={group.id}
      style={{
        marginTop: 32,
        background: T.surface,
        border: `1px solid ${T.border}`,
        borderRadius: 24,
        padding: isMobile ? "24px 16px" : stacked ? "28px 24px" : "40px 44px",
        boxShadow: "0 24px 70px -40px rgba(0,0,0,0.25), 0 1px 0 rgba(0,0,0,0.02)",
        display: "grid",
        gridTemplateColumns: stacked ? "1fr" : "1.05fr 1fr",
        gap: stacked ? 28 : 44,
        alignItems: "start",
        animation: "msbWhoFade 380ms ease",
        overflow: "hidden",
        minWidth: 0,
      }}
    >
      <CardLeft group={group} titleSize={isMobile ? 22 : stacked ? 24 : 30} />
      <div style={{ minWidth: 0, overflow: "hidden" }}>
        <VisualFor group={group} />
      </div>
    </div>
  );
}

function FadeStyles() {
  return (
    <style>{`
      @keyframes msbWhoFade {
        from { opacity: 0; transform: translateY(8px); }
        to   { opacity: 1; transform: translateY(0); }
      }
    `}</style>
  );
}

function WhoDesktop() {
  const [active, setActive] = useState("strategy");
  const group = GROUPS.find(g => g.id === active);
  return (
    <WhoFrame padding="52px 40px 100px">
      <FadeStyles />
      <div style={{ maxWidth: 1200, margin: "0 auto" }}>
        <SectionHeader />
        <div style={{ marginTop: 56 }}>
          <GroupTabs active={active} setActive={setActive} layout="row" />
        </div>
        <ActiveCard group={group} layout="desktop" />
      </div>
    </WhoFrame>
  );
}

function WhoTablet() {
  const [active, setActive] = useState("strategy");
  const group = GROUPS.find(g => g.id === active);
  return (
    <WhoFrame padding="40px 32px 72px">
      <FadeStyles />
      <div style={{ maxWidth: 720, margin: "0 auto" }}>
        <SectionHeader titleSize={36} />
        <div style={{ marginTop: 44 }}>
          <GroupTabs active={active} setActive={setActive} layout="row" />
        </div>
        <ActiveCard group={group} layout="tablet" />
      </div>
    </WhoFrame>
  );
}

function WhoMobile() {
  const [active, setActive] = useState("strategy");
  const group = GROUPS.find(g => g.id === active);
  return (
    <WhoFrame padding="28px 20px 56px">
      <FadeStyles />
      <SectionHeader titleSize={26} align="center" />
      <div style={{ marginTop: 32 }}>
        <GroupTabs active={active} setActive={setActive} layout="slider" />
      </div>
      <ActiveCard group={group} layout="mobile" />
    </WhoFrame>
  );
}

function WhoV2() {
  const [w, setW] = React.useState(typeof window !== "undefined" ? window.innerWidth : 1280);
  React.useEffect(() => {
    const o = () => setW(window.innerWidth);
    window.addEventListener("resize", o);
    return () => window.removeEventListener("resize", o);
  }, []);
  const C = w < 700 ? WhoMobile : w < 1100 ? WhoTablet : WhoDesktop;
  return <C />;
}

Object.assign(window, { WhoDesktop, WhoTablet, WhoMobile, WhoV2 });

})();
