/* global React */
const { useState, useEffect, useRef } = React;

/* ============================================================
   Kalvi — Shared atoms : Logo, Nav, Footer, Illustrations
   ============================================================ */

const KalviLogo = ({ size = 28, mono = false }) => null;


const NavBar = ({ light = false }) => null;


const Footer = () =>
<footer className="section" style={{ borderTop: "1px solid var(--line)", padding: "32px 64px", position: "relative", zIndex: 2, display: "flex", justifyContent: "space-between", fontSize: 11, color: "var(--ink-mute)", fontFamily: "var(--ff-mono)", letterSpacing: "0.12em", textTransform: "uppercase" }}>
    <span>© 2026 KALVI</span>
    <span></span>
  </footer>;


/* ============================================================
   Illustrations 2D — éditoriales, géométriques, accent rouge
   ============================================================ */

// All illustrations share the same 220x220 viewBox, centered geometry (~cx=110,cy=110), same visual weight.

// 1. Diagnostic — radar / cible
const IllustrationDiagnostic = ({ size = 220 }) =>
<svg viewBox="0 0 220 220" width={size} height={size} fill="none">
    {[100, 75, 50, 25].map((r, i) =>
  <circle key={r} cx="110" cy="110" r={r} stroke="var(--ink)" strokeWidth="0.8" strokeOpacity={0.3 - i * 0.04} fill="none" />
  )}
    <line x1="110" y1="10" x2="110" y2="210" stroke="var(--ink)" strokeWidth="0.6" strokeOpacity="0.2" />
    <line x1="10" y1="110" x2="210" y2="110" stroke="var(--ink)" strokeWidth="0.6" strokeOpacity="0.2" />
    <line x1="40" y1="40" x2="180" y2="180" stroke="var(--ink)" strokeWidth="0.6" strokeOpacity="0.12" />
    <line x1="180" y1="40" x2="40" y2="180" stroke="var(--ink)" strokeWidth="0.6" strokeOpacity="0.12" />
    <circle cx="150" cy="80" r="4" fill="var(--accent)" />
    <circle cx="86" cy="60" r="3" fill="var(--ink)" />
    <circle cx="70" cy="138" r="3" fill="var(--ink)" />
    <circle cx="145" cy="148" r="5" fill="var(--accent)" />
    <path d="M 110 110 L 150 80 A 50 50 0 0 1 145 148 Z" fill="var(--accent)" fillOpacity="0.18" stroke="var(--accent)" strokeWidth="1" />
    <circle cx="110" cy="110" r="3" fill="var(--ink)" />
  </svg>;


// 2. Architecture — nested rectangles + connection lines
const IllustrationArchitecture = ({ size = 220 }) =>
<svg viewBox="0 0 220 220" width={size} height={size} fill="none">
    <rect x="20" y="30" width="180" height="160" stroke="var(--ink)" strokeWidth="0.8" strokeOpacity="0.25" fill="none" />
    <rect x="38" y="50" width="66" height="54" stroke="var(--ink)" strokeWidth="0.8" fill="rgba(255,255,255,0.4)" />
    <rect x="116" y="50" width="66" height="54" stroke="var(--ink)" strokeWidth="0.8" fill="rgba(255,255,255,0.4)" />
    <rect x="38" y="130" width="144" height="40" fill="var(--accent)" stroke="var(--accent)" />
    <text x="46" y="70" fontFamily="var(--ff-mono)" fontSize="8" fill="var(--ink-mute)" letterSpacing="0.1em">CLIENT</text>
    <text x="46" y="86" fontFamily="var(--ff-serif)" fontSize="15" fill="var(--ink)" fontStyle="italic">Demande</text>
    <text x="124" y="70" fontFamily="var(--ff-mono)" fontSize="8" fill="var(--ink-mute)" letterSpacing="0.1em">EXPERT</text>
    <text x="124" y="86" fontFamily="var(--ff-serif)" fontSize="15" fill="var(--ink)" fontStyle="italic">Savoir</text>
    <text x="110" y="155" textAnchor="middle" fontFamily="var(--ff-mono)" fontSize="9" fill="var(--cream)" letterSpacing="0.18em">AGENT VERTICAL</text>
    <line x1="71" y1="104" x2="82" y2="130" stroke="var(--accent)" strokeWidth="1" />
    <line x1="149" y1="104" x2="138" y2="130" stroke="var(--accent)" strokeWidth="1" />
    <circle cx="71" cy="104" r="2.5" fill="var(--accent)" />
    <circle cx="149" cy="104" r="2.5" fill="var(--accent)" />
  </svg>;


// 3. Prototypage — three stacked panels with iteration progress
const IllustrationPrototype = ({ size = 220 }) =>
<svg viewBox="0 0 220 220" width={size} height={size} fill="none">
    <rect x="20" y="40" width="160" height="40" stroke="var(--ink)" strokeOpacity="0.25" strokeWidth="0.8" fill="rgba(255,255,255,0.35)" />
    <rect x="20" y="90" width="160" height="40" stroke="var(--ink)" strokeOpacity="0.25" strokeWidth="0.8" fill="rgba(255,255,255,0.35)" />
    <rect x="20" y="140" width="160" height="40" stroke="var(--accent)" strokeWidth="1" fill="var(--accent-soft)" />
    <line x1="32" y1="54" x2="118" y2="54" stroke="var(--ink)" strokeOpacity="0.28" strokeWidth="2" />
    <line x1="32" y1="66" x2="88" y2="66" stroke="var(--ink)" strokeOpacity="0.16" strokeWidth="2" />
    <line x1="32" y1="104" x2="138" y2="104" stroke="var(--ink)" strokeOpacity="0.28" strokeWidth="2" />
    <line x1="32" y1="116" x2="96" y2="116" stroke="var(--ink)" strokeOpacity="0.16" strokeWidth="2" />
    <line x1="32" y1="154" x2="148" y2="154" stroke="var(--accent)" strokeWidth="2.5" />
    <line x1="32" y1="166" x2="108" y2="166" stroke="var(--accent)" strokeOpacity="0.55" strokeWidth="2" />
    <text x="194" y="60" fontFamily="var(--ff-mono)" fontSize="9" fill="var(--ink-mute)">S2</text>
    <text x="194" y="110" fontFamily="var(--ff-mono)" fontSize="9" fill="var(--ink-mute)">S4</text>
    <text x="194" y="160" fontFamily="var(--ff-mono)" fontSize="9" fill="var(--accent)" fontWeight="600">S6</text>
    <circle cx="168" cy="160" r="9" fill="var(--accent)" />
    <polygon points="165,156 165,164 172,160" fill="var(--cream)" />
  </svg>;


// 4. Mise en marché — bars rising, red highlight on last
const IllustrationGoToMarket = ({ size = 220 }) =>
<svg viewBox="0 0 220 220" width={size} height={size} fill="none">
    <line x1="20" y1="180" x2="200" y2="180" stroke="var(--ink)" strokeOpacity="0.3" strokeWidth="0.8" />
    {[
  { x: 30, h: 36, label: "M1" },
  { x: 64, h: 58, label: "M2" },
  { x: 98, h: 84, label: "M3" },
  { x: 132, h: 114, label: "M4" }].
  map((b) =>
  <g key={b.x}>
        <rect x={b.x} y={180 - b.h} width="22" height={b.h} stroke="var(--ink)" strokeOpacity="0.35" strokeWidth="0.8" fill="rgba(255,255,255,0.4)" />
        <text x={b.x + 11} y="194" textAnchor="middle" fontFamily="var(--ff-mono)" fontSize="8" fill="var(--ink-mute)">{b.label}</text>
      </g>
  )}
    <rect x="166" y="40" width="22" height="140" fill="var(--accent)" />
    <text x="177" y="194" textAnchor="middle" fontFamily="var(--ff-mono)" fontSize="8" fill="var(--accent)" fontWeight="600">M5</text>
    <path d="M 41 144 Q 100 60 177 48" stroke="var(--accent)" strokeWidth="1" fill="none" strokeDasharray="3 3" />
    <circle cx="41" cy="144" r="3" fill="var(--ink)" />
    <circle cx="177" cy="48" r="4" fill="var(--accent)" />
    <text x="30" y="30" fontFamily="var(--ff-serif)" fontStyle="italic" fontSize="18" fill="var(--ink)">×7.3</text>
    <text x="30" y="44" fontFamily="var(--ff-mono)" fontSize="8" fill="var(--ink-mute)" letterSpacing="0.1em">ARR PROJETÉ</text>
  </svg>;


const Illustrations = {
  diagnostic: IllustrationDiagnostic,
  architecture: IllustrationArchitecture,
  prototype: IllustrationPrototype,
  market: IllustrationGoToMarket
};

/* ============================================================
   Content shared by all variations
   ============================================================ */

const FEATURES = [
{
  n: "01",
  key: "diagnostic",
  title: "Diagnostic stratégique",
  italic: "Le terrain avant la doctrine.",
  body: "Cartographie de votre modèle actuel, des marges cachées et des poches d'agentification. Quatre semaines d'enquête menée avec vos équipes, vos clients et vos données.",
  meta: "Semaines 1–4 · Livrable : Atlas du modèle"
},
{
  n: "02",
  key: "architecture",
  title: "Architecture aGaaS",
  italic: "Le geste de bascule.",
  body: "Conception du nouveau modèle économique, de la stack agentique et des flux qui transforment le service en logiciel. Le tout calibré pour préserver votre cœur de métier.",
  meta: "Semaines 5–8 · Livrable : Plan directeur"
},
{
  n: "03",
  key: "prototype",
  title: "Prototypage rapide",
  italic: "Six semaines, un agent.",
  body: "Mise en service d'un premier agent vertical sur un usage à fort impact. Vos équipes apprennent à concevoir, prompter et superviser en conditions réelles.",
  meta: "Semaines 9–14 · Livrable : Agent v1"
},
{
  n: "04",
  key: "market",
  title: "Mise en marché",
  italic: "Du sur-mesure à la collection.",
  body: "Pricing par usage, packaging produit, repositionnement commercial. Vos équipes vente passent de l'heure facturée à la licence — sans rupture pour les clients en place.",
  meta: "Semaines 15–18 · Livrable : Go-to-market"
}];


const TESTIMONIALS = [
{
  quote: "On vendait du conseil au forfait. On vend désormais un agent qui fait le travail. Notre marge brute est passée de 38 à 71% en quatre trimestres.",
  name: "Marc Delaunay",
  role: "Founding partner — Cabinet Brevia",
  place: "Paris"
},
{
  quote: "Kalvi nous a appris à penser comme un éditeur, pas comme un formateur. La méthode est exigeante. Les résultats, à la hauteur.",
  name: "Léa Tournier",
  role: "CEO — Atelier Pédagogique Nord",
  place: "Lille"
},
{
  quote: "L'accompagnement ressemble plus à une école qu'à un cabinet. Six mois plus tard, mon équipe écrit ses propres agents.",
  name: "Hugo Rambert",
  role: "Directeur — Studio Mensa",
  place: "Lyon"
}];


const FAQ = [
{
  q: "Qu'est-ce que le modèle Agentic-as-a-Service ?",
  a: "C'est la mutation d'une activité de service — conseil, formation, expertise — en produit logiciel piloté par des agents. Vous ne vendez plus du temps, vous vendez l'accès à une capacité automatisée et supervisée. Le client paie à l'usage, à la licence ou à la performance."
},
{
  q: "Combien de temps dure un pivot complet avec Kalvi ?",
  a: "Dix-huit semaines pour boucler les quatre étapes : diagnostic, architecture, prototypage, mise en marché. Les premiers revenus aGaaS apparaissent généralement à partir de la semaine douze."
},
{
  q: "Faut-il être une entreprise tech pour pivoter ?",
  a: "Non. Nos clients sont des cabinets de conseil, des écoles, des studios de formation, des agences. La technicité est portée par notre équipe — votre rôle reste de définir le savoir-faire à agentifier."
},
{
  q: "Quelle taille d'entreprise est concernée ?",
  a: "De 5 à 250 personnes, avec une activité de service ou d'éducation déjà rentable. En-dessous, il manque la matière à agentifier. Au-dessus, le pivot demande un dispositif plus large que celui de Kalvi."
},
{
  q: "Comment se déroule concrètement l'accompagnement ?",
  a: "Un binôme Kalvi (architecte + ingénieur) intégré à votre équipe deux jours par semaine, plus un atelier mensuel à Paris ou Milan. Le tout encadré par un comité éditorial qui valide chaque livrable."
}];


const CLIENT_LOGOS = ["Brevia", "Atelier Nord", "Studio Mensa", "Maison Olivar", "Frontière", "Lumen"];

Object.assign(window, {
  KalviLogo, NavBar, Footer, Illustrations,
  FEATURES, TESTIMONIALS, FAQ, CLIENT_LOGOS
});