// Hand-drawn process illustrations for wf3 — enlarged human figures
// 4 scenes matching each step: Hearing / Planning / Development / Operation

const ProcessIllustration = ({ step }) => {
  const stroke = "#1a1a1a";
  const sw = 2.4;
  const skin = "#ffdcc6";

  // Bigger head component
  const Head = ({ cx, cy, r = 14, hairColor = stroke, smile = true }) => (
    <g>
      <circle cx={cx} cy={cy} r={r} fill={skin} stroke={stroke} strokeWidth={sw}/>
      <path d={`M ${cx-r+1},${cy-4} Q ${cx-r-1},${cy-r-4} ${cx},${cy-r-2} Q ${cx+r+1},${cy-r-4} ${cx+r-1},${cy-5}`} fill={hairColor} stroke={stroke} strokeWidth="1.6"/>
      <circle cx={cx-4} cy={cy-1} r="1.4" fill={stroke}/>
      <circle cx={cx+4} cy={cy-1} r="1.4" fill={stroke}/>
      {smile && <path d={`M ${cx-3.5},${cy+4} Q ${cx},${cy+7} ${cx+3.5},${cy+4}`} stroke={stroke} strokeWidth="1.6" fill="none" strokeLinecap="round"/>}
    </g>
  );

  if (step === 0) {
    // Hearing — two large people, table, speech bubble
    return (
      <svg viewBox="0 0 200 130" style={{ width:"100%", height:130 }}>
        {/* table */}
        <rect x="55" y="98" width="95" height="7" fill="#ffe3a8" stroke={stroke} strokeWidth={sw}/>
        <line x1="65" y1="105" x2="65" y2="125" stroke={stroke} strokeWidth={sw}/>
        <line x1="140" y1="105" x2="140" y2="125" stroke={stroke} strokeWidth={sw}/>

        {/* Client left — big (neck connects head to body) */}
        <g>
          {/* neck */}
          <rect x="35" y="60" width="10" height="10" fill={skin} stroke={stroke} strokeWidth={sw}/>
          {/* body */}
          <path d="M 12,125 Q 12,68 40,68 Q 68,68 68,125 Z" fill="#c8e6ff" stroke={stroke} strokeWidth={sw}/>
          <Head cx={40} cy={48} r={16}/>
          {/* arm gesturing */}
          <path d="M 60,82 Q 78,72 85,62" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          <circle cx="86" cy="60" r="5" fill={skin} stroke={stroke} strokeWidth={sw}/>
        </g>

        {/* Speech bubble */}
        <g>
          <path d="M 92,14 Q 92,4 104,4 L 158,4 Q 170,4 170,14 L 170,30 Q 170,40 158,40 L 108,40 L 100,48 L 102,39 Q 92,39 92,30 Z"
                fill="#fff" stroke={stroke} strokeWidth={sw}/>
          <line x1="100" y1="16" x2="162" y2="16" stroke={stroke} strokeWidth="1.4"/>
          <line x1="100" y1="24" x2="155" y2="24" stroke={stroke} strokeWidth="1.4"/>
          <line x1="100" y1="32" x2="148" y2="32" stroke={stroke} strokeWidth="1.4"/>
        </g>

        {/* Consultant right — big (with neck) */}
        <g>
          <rect x="155" y="60" width="10" height="10" fill={skin} stroke={stroke} strokeWidth={sw}/>
          <path d="M 130,125 Q 130,68 160,68 Q 190,68 190,125 Z" fill="#ffd5cb" stroke={stroke} strokeWidth={sw}/>
          <Head cx={160} cy={48} r={16}/>
          {/* notebook on table */}
          <rect x="110" y="88" width="28" height="11" fill="#fff" stroke={stroke} strokeWidth={sw}/>
          <line x1="114" y1="92" x2="134" y2="92" stroke={stroke} strokeWidth="1.2"/>
          <line x1="114" y1="95" x2="130" y2="95" stroke={stroke} strokeWidth="1.2"/>
          {/* arm with pen */}
          <path d="M 142,84 L 126,94" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          <path d="M 122,94 l 5,-3 l 2,4 z" fill="#ff5c3a" stroke={stroke} strokeWidth="1.4"/>
        </g>
        <path d="M 182,20 l0,6 M 179,23 l6,0" stroke={stroke} strokeWidth="1.5" fill="none"/>
      </svg>
    );
  }

  if (step === 1) {
    // Planning — whiteboard + two big people
    return (
      <svg viewBox="0 0 200 130" style={{ width:"100%", height:130 }}>
        {/* whiteboard */}
        <rect x="42" y="6" width="118" height="60" fill="#fff" stroke={stroke} strokeWidth={sw} rx="2"/>
        <rect x="48" y="14" width="18" height="11" fill="#ffd5cb" stroke={stroke} strokeWidth="1.4"/>
        <rect x="74" y="14" width="18" height="11" fill="#c8e6ff" stroke={stroke} strokeWidth="1.4"/>
        <rect x="100" y="14" width="18" height="11" fill="#d8f5c2" stroke={stroke} strokeWidth="1.4"/>
        <rect x="126" y="14" width="18" height="11" fill="#ffe3a8" stroke={stroke} strokeWidth="1.4"/>
        <path d="M 66,19.5 L 74,19.5 M 92,19.5 L 100,19.5 M 118,19.5 L 126,19.5" stroke={stroke} strokeWidth="1.2"/>
        {/* sticky note */}
        <rect x="52" y="34" width="22" height="20" fill="#ffd84a" stroke={stroke} strokeWidth="1.5" transform="rotate(-4 63 44)"/>
        <line x1="56" y1="40" x2="70" y2="40" stroke={stroke} strokeWidth="1" transform="rotate(-4 63 44)"/>
        <line x1="56" y1="46" x2="68" y2="46" stroke={stroke} strokeWidth="1" transform="rotate(-4 63 44)"/>
        <circle cx="86" cy="40" r="1.5" fill={stroke}/><line x1="92" y1="40" x2="130" y2="40" stroke={stroke} strokeWidth="1"/>
        <circle cx="86" cy="47" r="1.5" fill={stroke}/><line x1="92" y1="47" x2="125" y2="47" stroke={stroke} strokeWidth="1"/>
        <circle cx="86" cy="54" r="1.5" fill={stroke}/><line x1="92" y1="54" x2="135" y2="54" stroke={stroke} strokeWidth="1"/>

        {/* Person A pointing — big */}
        <g>
          <path d="M 0,130 Q 0,85 22,85 Q 44,85 44,130 Z" fill="#ffd5cb" stroke={stroke} strokeWidth={sw}/>
          <Head cx={22} cy={72} r={14}/>
          <path d="M 40,94 Q 52,80 62,72" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          <circle cx="64" cy="70" r="4.5" fill={skin} stroke={stroke} strokeWidth={sw}/>
          <line x1="67" y1="68" x2="76" y2="62" stroke={stroke} strokeWidth="1.8"/>
        </g>
        {/* Person B — big */}
        <g>
          <path d="M 156,130 Q 156,85 178,85 Q 200,85 200,130 Z" fill="#c8e6ff" stroke={stroke} strokeWidth={sw}/>
          <Head cx={178} cy={72} r={14}/>
          <path d="M 162,95 Q 152,102 146,105" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          <rect x="140" y="104" width="9" height="5" fill="#ff5c3a" stroke={stroke} strokeWidth="1.2"/>
        </g>
      </svg>
    );
  }

  if (step === 2) {
    // Development — rebuilt from scratch.
    // Same composition pattern as other cards: two figures flanking a central object (desk + laptop).
    // Coral = Algoviax FDE (left, actively coding). Blue = Client (right, observing progress).
    return (
      <svg viewBox="0 0 200 130" style={{ width:"100%", height:130 }}>
        {/* floor line */}
        <line x1="0" y1="125" x2="200" y2="125" stroke={stroke} strokeWidth={sw}/>

        {/* Center: desk with laptop */}
        <g>
          {/* desk top */}
          <rect x="66" y="92" width="68" height="6" fill="#ffe3a8" stroke={stroke} strokeWidth={sw}/>
          {/* desk legs */}
          <line x1="72" y1="98" x2="72" y2="125" stroke={stroke} strokeWidth={sw}/>
          <line x1="128" y1="98" x2="128" y2="125" stroke={stroke} strokeWidth={sw}/>

          {/* laptop on desk */}
          <g transform="translate(74,66)">
            {/* screen */}
            <rect x="2" y="0" width="48" height="26" fill="#1a1a1a" stroke={stroke} strokeWidth={sw} rx="1.5"/>
            <rect x="5" y="3" width="42" height="20" fill="#0f1117"/>
            {/* gutter (line numbers) */}
            <rect x="5" y="3" width="6" height="20" fill="#1c1f2a"/>
            <text x="6" y="8.5" fontSize="3" fontFamily="JetBrains Mono, monospace" fill="#5a6078">1</text>
            <text x="6" y="13" fontSize="3" fontFamily="JetBrains Mono, monospace" fill="#5a6078">2</text>
            <text x="6" y="17.5" fontSize="3" fontFamily="JetBrains Mono, monospace" fill="#5a6078">3</text>
            <text x="6" y="22" fontSize="3" fontFamily="JetBrains Mono, monospace" fill="#5a6078">4</text>
            {/* code lines */}
            <line x1="13" y1="7" x2="26" y2="7" stroke="#2fbf71" strokeWidth="1" strokeLinecap="round"/>
            <line x1="28" y1="7" x2="38" y2="7" stroke="#ffd84a" strokeWidth="1" strokeLinecap="round"/>
            <line x1="16" y1="11.5" x2="42" y2="11.5" stroke="#c8e6ff" strokeWidth="1" strokeLinecap="round"/>
            <line x1="16" y1="16" x2="34" y2="16" stroke="#ff5c3a" strokeWidth="1" strokeLinecap="round"/>
            <line x1="13" y1="20.5" x2="30" y2="20.5" stroke="#2fbf71" strokeWidth="1" strokeLinecap="round"/>
            {/* blinking cursor */}
            <rect x="31" y="18.5" width="1.4" height="3.5" fill="#fff"/>

            {/* laptop base (keyboard deck) */}
            <path d="M -2,26 L 54,26 L 50,30 L 2,30 Z" fill="#555" stroke={stroke} strokeWidth={sw}/>
            <rect x="18" y="28" width="16" height="1" fill="#888"/>
          </g>
        </g>

        {/* LEFT: Algoviax FDE (CORAL) — seated on chair, typing */}
        <g>
          {/* chair back */}
          <rect x="8" y="74" width="4" height="36" fill="#8a6a3a" stroke={stroke} strokeWidth={sw}/>
          {/* body (torso) */}
          <path d="M 14,118 Q 14,74 40,74 Q 66,74 66,118 Z" fill="#ffd5cb" stroke={stroke} strokeWidth={sw}/>
          {/* neck */}
          <rect x="35" y="66" width="10" height="10" fill={skin} stroke={stroke} strokeWidth={sw}/>
          {/* head */}
          <Head cx={40} cy={54} r={16}/>
          {/* glasses */}
          <circle cx="35" cy="54" r="3.3" fill="none" stroke={stroke} strokeWidth="1.3"/>
          <circle cx="45" cy="54" r="3.3" fill="none" stroke={stroke} strokeWidth="1.3"/>
          <line x1="38.3" y1="54" x2="41.7" y2="54" stroke={stroke} strokeWidth="1.3"/>
          {/* FDE badge on chest */}
          <rect x="31" y="88" width="18" height="9" fill="#ffd84a" stroke={stroke} strokeWidth="1.3"/>
          <text x="40" y="94.6" fontSize="6.5" textAnchor="middle" fontFamily="JetBrains Mono, monospace" fontWeight="700" fill={stroke}>FDE</text>
          {/* arms reaching forward to laptop keyboard */}
          <path d="M 20,88 Q 42,96 70,96" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          <path d="M 60,88 Q 78,96 95,96" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          {/* hands at keyboard */}
          <circle cx="72" cy="96" r="3.2" fill={skin} stroke={stroke} strokeWidth={sw}/>
          <circle cx="96" cy="96" r="3.2" fill={skin} stroke={stroke} strokeWidth={sw}/>
        </g>

        {/* RIGHT: Client (BLUE) — standing, holding coffee, watching */}
        <g>
          {/* body */}
          <path d="M 144,125 Q 144,78 170,78 Q 196,78 196,125 Z" fill="#c8e6ff" stroke={stroke} strokeWidth={sw}/>
          {/* neck */}
          <rect x="165" y="70" width="10" height="10" fill={skin} stroke={stroke} strokeWidth={sw}/>
          {/* head */}
          <Head cx={170} cy={58} r={16}/>
          {/* ID lanyard */}
          <path d="M 162,84 Q 170,88 178,84" stroke="#fff" strokeWidth="1.2" fill="none"/>
          <rect x="166" y="88" width="8" height="6" fill="#fff" stroke={stroke} strokeWidth="1.2"/>
          {/* left arm holding coffee mug */}
          <path d="M 152,96 Q 144,92 140,86" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          <g transform="translate(128,78)">
            <rect width="12" height="10" fill="#fff" stroke={stroke} strokeWidth={sw}/>
            <path d="M 12,2 Q 16,2 16,5 Q 16,8 12,8" fill="none" stroke={stroke} strokeWidth={sw}/>
            {/* steam */}
            <path d="M 3,-3 Q 5,-7 3,-10 M 7,-3 Q 9,-7 7,-10" stroke={stroke} strokeWidth="1.2" fill="none"/>
          </g>
          {/* right arm down at side */}
          <path d="M 188,96 Q 194,108 194,118" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
        </g>

        {/* Top-left wall sign: CLIENT OFFICE */}
        <g transform="translate(8,8)">
          <rect width="50" height="12" fill="#fff" stroke={stroke} strokeWidth="1.4"/>
          <text x="25" y="8.5" fontSize="5" textAnchor="middle" fontFamily="JetBrains Mono, monospace" fontWeight="700" fill={stroke}>CLIENT OFFICE</text>
        </g>

        {/* Top-right: speech bubble from client ("いい感じ!") with code icons */}
        <g transform="translate(134,10)">
          <path d="M 0,0 L 58,0 Q 62,0 62,4 L 62,18 Q 62,22 58,22 L 22,22 L 16,30 L 18,22 L 4,22 Q 0,22 0,18 Z"
                fill="#fff" stroke={stroke} strokeWidth={sw}/>
          <text x="31" y="14" fontSize="8" textAnchor="middle" fontFamily="JetBrains Mono, monospace" fontWeight="700" fill={stroke}>いい感じ!</text>
        </g>

        {/* floating code glyphs between them */}
        <text x="96" y="40" fontFamily="JetBrains Mono, monospace" fontSize="11" fill={stroke} fontWeight="700">{'</>'}</text>
        <text x="112" y="52" fontFamily="JetBrains Mono, monospace" fontSize="8" fill={stroke}>{'{ }'}</text>
      </svg>
    );
  }

  if (step === 3) {
    // Operation — Client (blue) watching dashboard; Algoviax (coral) points at improved KPI chart.
    return (
      <svg viewBox="0 0 200 130" style={{ width:"100%", height:130 }}>
        <line x1="5" y1="115" x2="195" y2="115" stroke={stroke} strokeWidth={sw}/>

        {/* Dashboard screen in center (the deployed system) */}
        <g transform="translate(66,18)">
          <rect x="0" y="0" width="72" height="52" fill="#fff" stroke={stroke} strokeWidth={sw} rx="2"/>
          <rect x="0" y="0" width="72" height="8" fill="#1a1a1a"/>
          <circle cx="4" cy="4" r="1.3" fill="#ff5c3a"/>
          <circle cx="8" cy="4" r="1.3" fill="#ffd84a"/>
          <circle cx="12" cy="4" r="1.3" fill="#2fbf71"/>
          <text x="38" y="5.5" fontSize="4" textAnchor="middle" fontFamily="JetBrains Mono, monospace" fill="#fff">DASHBOARD</text>

          {/* KPI bars growing */}
          <rect x="8" y="38" width="7" height="10" fill="#ffd5cb" stroke={stroke} strokeWidth="1"/>
          <rect x="18" y="30" width="7" height="18" fill="#c8e6ff" stroke={stroke} strokeWidth="1"/>
          <rect x="28" y="22" width="7" height="26" fill="#d8f5c2" stroke={stroke} strokeWidth="1"/>
          <rect x="38" y="14" width="7" height="34" fill="#ffd84a" stroke={stroke} strokeWidth="1"/>
          {/* trend line */}
          <path d="M 10,42 Q 26,26 44,16" stroke="#ff5c3a" strokeWidth="1.8" fill="none" strokeDasharray="2 2"/>
          <path d="M 42,14 l 5,2 l -1,5" stroke="#ff5c3a" strokeWidth="1.8" fill="none" strokeLinecap="round"/>
          {/* right metric */}
          <text x="52" y="22" fontSize="4" fontFamily="JetBrains Mono, monospace" fill={stroke}>+42%</text>
          <text x="52" y="30" fontSize="3.2" fontFamily="JetBrains Mono, monospace" fill="#666">uptime</text>
          <text x="52" y="38" fontSize="3.2" fontFamily="JetBrains Mono, monospace" fill="#666">99.9%</text>
        </g>

        {/* Client (BLUE) left — seated, checking dashboard */}
        <g>
          <path d="M 4,115 Q 4,70 28,70 Q 52,70 52,115 Z" fill="#c8e6ff" stroke={stroke} strokeWidth={sw}/>
          <rect x="23" y="62" width="10" height="9" fill={skin} stroke={stroke} strokeWidth={sw}/>
          <Head cx={28} cy={52} r={14}/>
          {/* arm toward dashboard */}
          <path d="M 46,86 Q 56,82 64,80" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          <circle cx="64" cy="80" r="4" fill={skin} stroke={stroke} strokeWidth={sw}/>
        </g>

        {/* Algoviax (CORAL) right — pointing at growth, gesturing explanation */}
        <g>
          <path d="M 148,115 Q 148,70 172,70 Q 196,70 196,115 Z" fill="#ffd5cb" stroke={stroke} strokeWidth={sw}/>
          <rect x="167" y="62" width="10" height="9" fill={skin} stroke={stroke} strokeWidth={sw}/>
          <Head cx={172} cy={52} r={14}/>
          {/* pointing arm toward dashboard */}
          <path d="M 152,84 Q 144,72 138,62" stroke={stroke} strokeWidth={sw} fill="none" strokeLinecap="round"/>
          <circle cx="137" cy="60" r="4" fill={skin} stroke={stroke} strokeWidth={sw}/>
          <line x1="134" y1="58" x2="128" y2="54" stroke={stroke} strokeWidth="1.8" strokeLinecap="round"/>
          {/* tablet/clipboard in other hand */}
          <rect x="184" y="84" width="14" height="18" fill="#fff" stroke={stroke} strokeWidth={sw}/>
          <line x1="187" y1="89" x2="195" y2="89" stroke={stroke} strokeWidth="1"/>
          <line x1="187" y1="93" x2="193" y2="93" stroke={stroke} strokeWidth="1"/>
          <line x1="187" y1="97" x2="195" y2="97" stroke={stroke} strokeWidth="1"/>
        </g>

        {/* Gear (ops/iteration icon) top-left */}
        <g transform="translate(18,22)">
          <circle r="8" fill="#e4ccff" stroke={stroke} strokeWidth={sw}/>
          <circle r="3" fill="#fff" stroke={stroke} strokeWidth="1.4"/>
          <path d="M 0,-11 l 0,3 M 0,11 l 0,-3 M -11,0 l 3,0 M 11,0 l -3,0 M -7.8,-7.8 l 2.1,2.1 M 7.8,7.8 l -2.1,-2.1 M 7.8,-7.8 l -2.1,2.1 M -7.8,7.8 l 2.1,-2.1"
                stroke={stroke} strokeWidth="1.6" fill="none" strokeLinecap="round"/>
        </g>

        {/* Checkmark bubble bottom-left */}
        <g transform="translate(36,96)">
          <circle r="9" fill="#d8f5c2" stroke={stroke} strokeWidth={sw}/>
          <path d="M -4,0 l 3,3 l 5,-6" stroke="#2fbf71" strokeWidth="2.2" fill="none" strokeLinecap="round" strokeLinejoin="round"/>
        </g>
      </svg>
    );
  }

  return null;
};

window.ProcessIllustration = ProcessIllustration;
