// ServiceIllustrations — 各カード用のSVGアイソメ風イラスト（モノクロ＋黄アクセント）。
// トーン&マナー: 白背景 / 黒線 (#111) / グレー塗り / 黄色 (#f5c842) を小面積でアクセント

function IsoBase({ children, viewBox = "0 0 200 160" }) {
  return (
    <svg
      viewBox={viewBox}
      preserveAspectRatio="xMidYMid meet"
      xmlns="http://www.w3.org/2000/svg"
      style={{ width: "100%", height: "100%", display: "block" }}
      aria-hidden="true"
    >
      <defs>
        <pattern id="halftone" x="0" y="0" width="5" height="5" patternUnits="userSpaceOnUse">
          <circle cx="2.5" cy="2.5" r="0.9" fill="#111" opacity="0.35" />
        </pattern>
      </defs>
      {children}
    </svg>
  );
}

// 01 AIコンサルティング — ホワイトボード＋3キャラが議論
function IllustrationConsulting() {
  return (
    <IsoBase>
      {/* backdrop halftone */}
      <ellipse cx="100" cy="140" rx="80" ry="10" fill="url(#halftone)" opacity="0.4" />

      {/* Whiteboard (isometric) */}
      <g stroke="#111" strokeWidth="1.4" strokeLinejoin="round" fill="#fff">
        <polygon points="48,30 140,20 150,45 58,55" />
        <polygon points="140,20 150,45 150,95 140,70" fill="#eeeeea" />
        <polygon points="48,30 58,55 58,105 48,80" fill="#eeeeea" />
      </g>

      {/* Whiteboard contents: flow diagram */}
      <g stroke="#111" strokeWidth="1.1" fill="none">
        <rect x="58" y="34" width="16" height="10" />
        <text x="62" y="42" fontSize="5" fontFamily="sans-serif" fill="#111">INPUT</text>
        <line x1="74" y1="39" x2="90" y2="39" />
        <polygon points="88,36 92,39 88,42" fill="#111" />
        <rect x="90" y="34" width="22" height="10" fill="#f5c842" />
        <text x="92" y="42" fontSize="5" fontFamily="sans-serif" fill="#111">AI STRATEGY</text>
        <line x1="112" y1="39" x2="128" y2="39" />
        <polygon points="126,36 130,39 126,42" fill="#111" />
        <rect x="128" y="34" width="14" height="10" />
        <text x="130" y="42" fontSize="5" fontFamily="sans-serif" fill="#111">GOAL</text>

        {/* secondary note */}
        <line x1="62" y1="52" x2="120" y2="48" strokeDasharray="1.4 1.4" />
      </g>

      {/* Character 1 - left, presenter */}
      <g stroke="#111" strokeWidth="1.3" fill="#fff" strokeLinejoin="round">
        <circle cx="36" cy="102" r="6" fill="#fff" />
        <path d="M30 108 L30 130 L42 130 L42 108 Z" fill="#fff" />
        <line x1="36" y1="108" x2="36" y2="130" stroke="#111" strokeWidth="0.8" />
        {/* pointing arm */}
        <path d="M42 112 L58 90" strokeLinecap="round" />
        <circle cx="58" cy="90" r="1.5" fill="#111" stroke="none" />
      </g>

      {/* Character 2 - sitting center-right */}
      <g stroke="#111" strokeWidth="1.3" strokeLinejoin="round">
        <circle cx="108" cy="108" r="6" fill="#fff" />
        <path d="M100 114 L100 134 L116 134 L116 114 Z" fill="#eeeeea" />
        <rect x="98" y="130" width="20" height="3" fill="#f5c842" stroke="#111" />
        {/* laptop hint */}
        <rect x="102" y="122" width="12" height="7" fill="#fff" />
      </g>

      {/* Character 3 - right standing */}
      <g stroke="#111" strokeWidth="1.3" fill="#fff" strokeLinejoin="round">
        <circle cx="150" cy="100" r="6" fill="#fff" />
        <path d="M144 106 L144 132 L156 132 L156 106 Z" fill="#fff" />
        <line x1="150" y1="106" x2="150" y2="132" stroke="#111" strokeWidth="0.8" />
      </g>

      {/* Floor line */}
      <line x1="20" y1="134" x2="180" y2="134" stroke="#111" strokeWidth="1" />

      {/* floating geometric accents */}
      <circle cx="170" cy="36" r="3" fill="#f5c842" stroke="#111" strokeWidth="1" />
      <rect x="22" y="24" width="6" height="6" fill="#fff" stroke="#111" strokeWidth="1" transform="rotate(12 25 27)" />
    </IsoBase>
  );
}

// 02 AIエージェント開発 — ノードワークフロー＋歯車＋ロボ手
function IllustrationAgent() {
  return (
    <IsoBase>
      <ellipse cx="100" cy="140" rx="80" ry="10" fill="url(#halftone)" opacity="0.4" />

      {/* Big workflow panel */}
      <g stroke="#111" strokeWidth="1.4" fill="#fff" strokeLinejoin="round">
        <rect x="36" y="26" width="128" height="86" rx="3" />
        <line x1="36" y1="36" x2="164" y2="36" strokeWidth="1" />
        <circle cx="42" cy="31" r="1.2" fill="#f05d4a" stroke="none" />
        <circle cx="47" cy="31" r="1.2" fill="#f5c842" stroke="none" />
        <circle cx="52" cy="31" r="1.2" fill="#6bc38a" stroke="none" />
      </g>

      {/* Nodes */}
      <g stroke="#111" strokeWidth="1.2" fill="#fff">
        <rect x="48" y="52" width="26" height="16" rx="2" />
        <text x="53" y="62" fontSize="5" fontFamily="sans-serif" fill="#111">Trigger</text>

        <rect x="88" y="42" width="26" height="16" rx="2" fill="#f5c842" />
        <text x="93" y="52" fontSize="5" fontFamily="sans-serif" fill="#111">Agent</text>

        <rect x="88" y="68" width="26" height="16" rx="2" />
        <text x="94" y="78" fontSize="5" fontFamily="sans-serif" fill="#111">Tool</text>

        <rect x="128" y="52" width="26" height="16" rx="2" />
        <text x="133" y="62" fontSize="5" fontFamily="sans-serif" fill="#111">Output</text>

        {/* connecting lines */}
        <path d="M74 60 L88 50" fill="none" />
        <path d="M74 60 L88 76" fill="none" />
        <path d="M114 50 L128 60" fill="none" />
        <path d="M114 76 L128 60" fill="none" />
      </g>

      {/* Gears - bottom-left */}
      <g stroke="#111" strokeWidth="1.2" fill="#fff">
        <circle cx="36" cy="118" r="10" />
        <circle cx="36" cy="118" r="3" fill="#111" stroke="none" />
        {[0, 45, 90, 135, 180, 225, 270, 315].map((a, i) => {
          const rad = (a * Math.PI) / 180;
          const x1 = 36 + Math.cos(rad) * 10;
          const y1 = 118 + Math.sin(rad) * 10;
          const x2 = 36 + Math.cos(rad) * 13;
          const y2 = 118 + Math.sin(rad) * 13;
          return <line key={i} x1={x1} y1={y1} x2={x2} y2={y2} />;
        })}
      </g>

      {/* Robotic arm - bottom-right */}
      <g stroke="#111" strokeWidth="1.4" fill="#fff" strokeLinejoin="round" strokeLinecap="round">
        <rect x="156" y="122" width="18" height="10" fill="#eeeeea" />
        <line x1="165" y1="122" x2="150" y2="105" />
        <circle cx="165" cy="122" r="2" fill="#111" stroke="none" />
        <circle cx="150" cy="105" r="2" fill="#111" stroke="none" />
        <line x1="150" y1="105" x2="140" y2="96" />
        <path d="M138 92 L140 96 L145 95 L143 90 Z" fill="#f5c842" />
      </g>

      {/* Floor */}
      <line x1="20" y1="132" x2="180" y2="132" stroke="#111" strokeWidth="1" />

      {/* accent */}
      <polygon points="172,32 180,36 172,40" fill="#f5c842" stroke="#111" strokeWidth="1" />
    </IsoBase>
  );
}

// 03 AI研修 — 講師＋スクリーン＋着席受講者
function IllustrationTraining() {
  return (
    <IsoBase>
      <ellipse cx="100" cy="140" rx="80" ry="10" fill="url(#halftone)" opacity="0.4" />

      {/* Projector screen */}
      <g stroke="#111" strokeWidth="1.4" fill="#fff" strokeLinejoin="round">
        <rect x="40" y="20" width="90" height="54" />
        <line x1="85" y1="74" x2="85" y2="84" strokeWidth="1.2" />
        <path d="M75 84 L95 84" strokeWidth="1.2" />
      </g>

      {/* Screen content - chart */}
      <g stroke="#111" strokeWidth="1" fill="none">
        <rect x="50" y="30" width="70" height="34" fill="#f5f6f1" />
        {/* bars */}
        <rect x="55" y="50" width="6" height="12" fill="#111" stroke="none" />
        <rect x="64" y="44" width="6" height="18" fill="#111" stroke="none" />
        <rect x="73" y="38" width="6" height="24" fill="#f5c842" stroke="#111" />
        <rect x="82" y="46" width="6" height="16" fill="#111" stroke="none" />
        <rect x="91" y="40" width="6" height="22" fill="#111" stroke="none" />
        {/* trend line */}
        <polyline points="55,52 64,46 73,40 82,48 91,42 105,36" stroke="#111" strokeWidth="1.1" fill="none" />
        <circle cx="105" cy="36" r="1.6" fill="#f5c842" stroke="#111" />
      </g>

      {/* Lecturer */}
      <g stroke="#111" strokeWidth="1.3" fill="#fff" strokeLinejoin="round">
        <circle cx="148" cy="70" r="6" fill="#fff" />
        <path d="M142 76 L142 108 L154 108 L154 76 Z" fill="#fff" />
        {/* pointer */}
        <line x1="142" y1="82" x2="128" y2="60" strokeLinecap="round" />
      </g>

      {/* Audience — 3 rows of seats */}
      <g stroke="#111" strokeWidth="1.1" fill="#eeeeea">
        {[0, 1, 2].map((row) => (
          <g key={row}>
            {[0, 1, 2, 3].map((col) => (
              <g key={col}>
                <rect x={36 + col * 22} y={94 + row * 12} width="14" height="8" />
                <circle cx={43 + col * 22} cy={92 + row * 12} r="3" fill="#fff" />
              </g>
            ))}
          </g>
        ))}
      </g>

      {/* Floor */}
      <line x1="20" y1="134" x2="180" y2="134" stroke="#111" strokeWidth="1" />

      {/* accents */}
      <circle cx="28" cy="36" r="2.5" fill="#f5c842" stroke="#111" strokeWidth="1" />
      <rect x="156" y="30" width="6" height="6" fill="#fff" stroke="#111" strokeWidth="1" transform="rotate(20 159 33)" />
    </IsoBase>
  );
}

// 04 AIツール導入 — PC画面＋チャット吹き出し＋ツール選定カード
function IllustrationTools() {
  return (
    <IsoBase>
      <ellipse cx="100" cy="140" rx="80" ry="10" fill="url(#halftone)" opacity="0.4" />

      {/* Laptop */}
      <g stroke="#111" strokeWidth="1.4" fill="#fff" strokeLinejoin="round">
        <path d="M50 36 L150 36 L156 96 L44 96 Z" fill="#fff" />
        <rect x="56" y="42" width="88" height="48" fill="#f5f6f1" />
        <path d="M36 100 L164 100 L168 108 L32 108 Z" fill="#eeeeea" />
      </g>

      {/* Screen UI — chat bubbles */}
      <g stroke="#111" strokeWidth="1" fill="#fff">
        <rect x="60" y="48" width="34" height="10" rx="4" />
        <rect x="106" y="62" width="34" height="10" rx="4" fill="#f5c842" />
        <rect x="60" y="76" width="28" height="8" rx="3" />
      </g>
      <g stroke="none" fill="#111">
        <text x="63" y="55" fontSize="5" fontFamily="sans-serif">User: help me...</text>
        <text x="109" y="69" fontSize="5" fontFamily="sans-serif">AI: Sure!</text>
        <text x="63" y="82" fontSize="5" fontFamily="sans-serif">...</text>
      </g>

      {/* Tool selection cards - right side, stacked */}
      <g stroke="#111" strokeWidth="1.2" fill="#fff">
        <rect x="130" y="98" width="32" height="20" />
        <line x1="130" y1="104" x2="162" y2="104" />
        <circle cx="134" cy="101" r="1.2" fill="#f5c842" stroke="none" />
        <text x="134" y="114" fontSize="5" fontFamily="sans-serif" fill="#111">Tool A</text>

        <rect x="126" y="104" width="32" height="20" transform="translate(2 8)" fill="#eeeeea" />
      </g>

      {/* Magnifier */}
      <g stroke="#111" strokeWidth="1.5" fill="none" strokeLinecap="round">
        <circle cx="40" cy="116" r="8" fill="#fff" />
        <line x1="46" y1="122" x2="54" y2="130" />
        <circle cx="40" cy="116" r="3.5" fill="#f5c842" stroke="#111" strokeWidth="1" />
      </g>

      {/* Checklist */}
      <g stroke="#111" strokeWidth="1.1" fill="#fff">
        <rect x="66" y="112" width="30" height="18" />
        <line x1="70" y1="118" x2="90" y2="118" />
        <line x1="70" y1="122" x2="90" y2="122" />
        <line x1="70" y1="126" x2="86" y2="126" />
        <path d="M91 117 L93 119 L96 115" stroke="#f5c842" strokeWidth="1.4" fill="none" />
      </g>

      {/* Floor */}
      <line x1="20" y1="134" x2="180" y2="134" stroke="#111" strokeWidth="1" />

      {/* accents */}
      <circle cx="170" cy="34" r="2.5" fill="#f5c842" stroke="#111" strokeWidth="1" />
      <rect x="24" y="30" width="5" height="5" fill="#fff" stroke="#111" strokeWidth="1" transform="rotate(15 26 32)" />
    </IsoBase>
  );
}

window.ServiceIllustration = {
  consulting: IllustrationConsulting,
  agent: IllustrationAgent,
  training: IllustrationTraining,
  tools: IllustrationTools,
};
