/* ── FLOW — Ablauf-Grafik (Modul), z. B. im Visual einer feature-row ──
   Schritte untereinander, dazwischen Pfeile mit Beschriftung, rechts eine
   gestrichelte Rück-Linie vom letzten zum ersten Schritt (mit Label).
   Darunter optional zwei Kennzahlen in .flow-stats.
   Farben: Icons Schritt 1–3 von Gelb nach Rot (ohne Kästchen, wie icon-cards).
   Rück-Linie, Rück-Label und Kennzahlen in Grün. Linien laufen in
   Flussrichtung (bei reduzierter Bewegung stehen sie still, außerhalb des
   Bildschirms hält global.js sie über .is-paused an, Regel in global.css).
   Variante: .flow--panel  dunkle Kartenfläche hinter der Grafik (z. B. auf Verlauf-Hintergrund)
   Gestaltungsregeln: flow.md
   Schrift: flow-step-title t-lead · flow-step-text t-small ·
            flow-link-label t-xs · flow-return-label t-xs ·
            flow-stat-val t-num-l · flow-stat-label t-small
   UI: Icons, Linien und Pfeilspitzen                                    */
.flow {
  --step-h: clamp(76px, 6.4vw, 92px);
  --link-h: clamp(56px, 5vw, 72px);
  --dash: var(--green);
  --gap: 14px;
  padding: clamp(32px, 4.5vw,80px);
}
.flow-chart {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(92px, 28%, 150px);
  column-gap: var(--gap);
}

/* Schritt */
.flow-step {
  grid-column: 1; min-height: var(--step-h);
  display: flex; align-items: center; gap: clamp(12px, 1.4vw, 18px);
  padding: 12px clamp(14px, 1.6vw, 22px);
  border: 1px solid var(--line); background: rgba(240,237,231,.03);
}
.flow-step-icon { /* UI: Line-Icon ohne Rahmen und Fläche */
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--yellow);
}
.flow-step-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.flow-step:nth-child(3) .flow-step-icon { color: var(--orange); }
.flow-step:nth-child(5) .flow-step-icon { color: var(--red); }
.flow-step-body  { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flow-step-title { font-weight: 700; color: var(--ink); }
.flow-step-text  { color: var(--mute); }

/* Pfeil nach unten mit Beschriftung */
.flow-link {
  grid-column: 1; height: var(--link-h); position: relative;
  display: flex; align-items: center; padding-left: calc(50% + 16px);
}
.flow-link::before { /* UI: Linie mit laufendem Licht */
  content: ''; position: absolute; left: 50%; top: 6px; bottom: 6px; width: 1px;
  background: linear-gradient(to bottom, transparent 0 30%, var(--orange) 50%, transparent 70% 100%) 0 0 / 100% 200% no-repeat, var(--line);
  animation: flow-down 1.6s linear infinite;
}
.flow-link::after { /* UI: Pfeilspitze */
  content: ''; position: absolute; left: 50%; bottom: 7px; width: 8px; height: 8px;
  border-right: 1px solid var(--mid); border-bottom: 1px solid var(--mid);
  transform: translateX(-50%) rotate(45deg);
}
.flow-link-label { color: var(--mute); }

/* Rück-Linie: vom Ziel rechts herum zurück zum ersten Schritt */
.flow-return { grid-column: 2; grid-row: 1 / 6; position: relative; }
.flow-return-line { /* UI: rechte Kante (läuft nach oben) */
  position: absolute; top: calc(var(--step-h) / 2); bottom: calc(var(--step-h) / 2);
  left: calc(-1 * var(--gap)); width: calc(50% + var(--gap));
  background: repeating-linear-gradient(to bottom, var(--dash) 0 6px, transparent 6px 12px) right 0 top 0 / 1px 100%;
  background-repeat: no-repeat;
  animation: flow-up .7s linear infinite;
}
.flow-return-line::before,
.flow-return-line::after { /* UI: untere Kante (läuft nach rechts) · obere Kante (läuft nach links) */
  content: ''; position: absolute; left: 0; right: 0; height: 1px;
  background: repeating-linear-gradient(to right, var(--dash) 0 6px, transparent 6px 12px);
}
.flow-return-line::before { bottom: 0; animation: flow-right .7s linear infinite; }
.flow-return-line::after  { top: 0;    animation: flow-left .7s linear infinite; }
.flow-return-arrow { /* UI: Pfeilspitze in den ersten Schritt */
  position: absolute; left: calc(2px - var(--gap)); top: calc(var(--step-h) / 2); width: 9px; height: 9px;
  border-left: 1px solid var(--dash); border-bottom: 1px solid var(--dash);
  transform: translateY(-50%) rotate(45deg);
}
.flow-return-label {
  position: absolute; top: 50%; left: 60%; transform: translate(-50%, -50%);
  width: max-content; max-width: 100%; text-align: center;
  padding: 8px 12px; border: 1px solid var(--green); border-radius: 12px;
  background: #1B1E0F; color: var(--green); font-weight: 600;
}

/* Kennzahlen darunter */
.flow-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  margin-top: clamp(28px, 3.4vw, 48px); padding-top: clamp(20px, 2.4vw, 32px);
  border-top: 1px solid var(--line);
}
.flow-stat { display: flex; flex-direction: column; gap: 4px; padding-right: clamp(12px, 2vw, 28px); }
.flow-stat + .flow-stat { padding-left: clamp(12px, 2vw, 28px); padding-right: 0; border-left: 1px solid var(--line); }
.flow-stat-val {
  font-weight: 300; width: fit-content;
  background: var(--gradient-green);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.flow-stat-label { color: var(--mid); }

@keyframes flow-down  { from { background-position: 0 200%, 0 0; } to { background-position: 0 -100%, 0 0; } }
@keyframes flow-up    { from { background-position: right 0 top 0; } to { background-position: right 0 top -12px; } }
@keyframes flow-right { to { background-position: 12px 0; } }
@keyframes flow-left  { to { background-position: -12px 0; } }

@media (max-width: 640px) {
  .flow { padding: 20px 16px; }
  .flow-chart { grid-template-columns: minmax(0, 1fr) 84px; --gap: 10px; }
  .flow-step-icon { width: 34px; height: 34px; }
  .flow-return-label { padding: 6px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .flow-link::before, .flow-return-line, .flow-return-line::before, .flow-return-line::after { animation: none; }
}

/* Variante .flow--panel: dunkle Kartenfläche hinter der Grafik */
.flow--panel { background: var(--card); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.flow--panel .flow-step { background: rgba(240,237,231,.05); }
