"use client";
/* ═══════════════════════════════════════════════════════════════════════
RequestFlow — animated "watch a request travel through the bridge".
Deine KI → KI-Brücke (MCP) → HiveGrid and back. A packet travels the
track, stations light up, and a caption narrates each step. Auto-plays
and loops; pauses on hover; static under prefers-reduced-motion.
═══════════════════════════════════════════════════════════════════════ */
import { useEffect, useRef, useState } from "react";
import { Sparkle, PlugsConnected, Database } from "@phosphor-icons/react/ssr";
import { CHAMFER } from "@/lib/chamfer";
// Station centres in a 3-column grid → 1/6, 3/6, 5/6.
type Step = { pos: number; active: 0 | 1 | 2; n: string; title: string; detail: string; chip?: string };
const STEPS: Step[] = [
{ pos: 16.7, active: 0, n: "1", title: "Du fragst", detail: "„Zeig mir alle offenen Angebote über 10.000 €.“" },
{ pos: 50, active: 1, n: "2", title: "Über die KI-Brücke", detail: "Die Anfrage läuft sicher über MCP, nur im Rahmen deiner Freigaben." },
{ pos: 83.3, active: 2, n: "3", title: "HiveGrid führt es aus", detail: "Liest nur die Daten deines Betriebs, jeder Zugriff protokolliert.", chip: "hg_project_search · read" },
{ pos: 50, active: 1, n: "4", title: "Antwort zurück", detail: "Das Ergebnis läuft über die Brücke zurück zu deiner KI." },
{ pos: 16.7, active: 0, n: "5", title: "Ergebnis in deiner KI", detail: "3 Treffer, direkt im Chat. Kein Copy-Paste, kein Tab-Wechsel." },
];
const STATIONS = [
{ icon: