/* archflow.css - ReactFlow-Optik für die Architektur-Map (archflow.js).
   Weiße Karten mit optionalem Thumbnail oben (16:9, Hairline darunter), Titelzeile +
   schlichten Body-Zeilen (feine Trenner), Port-Punkte, orthogonale Step-Kanten mit
   weißem Label-Chip, GROUP-Hülle "W-API · W-App" (zarte Fläche, dashed Rahmen) um den
   App-Schwarm, Punktraster-Canvas, floatende Zoom-Controls unten rechts ÜBER dem
   Canvas. Bewusst KEINE Toolbar/Suche/Filter (siehe archflow.js).
   Pink #e736b0 = Hot-Farbe wie in stackflow/Landing. */
.af { --ink: #17171c; --muted: #6b7280; --line: #b6bcc8; --hot: #e736b0; height: 100%; }

/* ---------- Viewport + Canvas ---------- */
.af-view {
  position: relative; height: 100%; min-height: 320px;
  border: 1px solid #e5e5ea; border-radius: 18px; overflow: hidden;
  cursor: grab; touch-action: none;
  background-color: #fafafb;
  background-image: radial-gradient(#d9d9de 1px, transparent 1px);
  background-size: 22px 22px;
}
.af-view.af-panning { cursor: grabbing; }
.af-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.af-canvas.af-glide { transition: transform .35s ease; }
.af-edges, .af-labels { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.af-groups, .af-layer, .af-apps { position: absolute; inset: 0; pointer-events: none; }
.af-layer > *, .af-apps > * { pointer-events: auto; }
.af-error { color: #b42318; padding: 1rem; }

/* ---------- Group-Hülle: der W-API/W-App-Vertrag um JEDE App (unterste Ebene) ---------- */
.af-group {
  position: absolute; box-sizing: border-box;
  background: #fafbfc; border: 1px dashed #d9dce3; border-radius: 14px;
}
.af-ghead { padding: .8rem 1rem .6rem; }
.af-ghead b { display: block; font-size: .92rem; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.af-gchips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .42rem; }
.af-gchips i {
  font-style: normal; font-size: .62rem; font-weight: 600; color: var(--muted);
  background: #fff; border: 1px solid #e7e9ef; border-radius: 99px;
  padding: .14rem .52rem; line-height: 1.2; white-space: nowrap;
}

/* ---------- Kanten: Step-Pfade (smoothstep) + Ports + Label-Chip ---------- */
.af-path { fill: none; stroke: var(--line); stroke-width: 1.6; transition: stroke .15s ease, opacity .15s ease; }
.af-port { fill: #fff; stroke: #9aa1ad; stroke-width: 1.4; }
.af-elab text { font: 600 11px/1 system-ui, -apple-system, "Segoe UI", sans-serif; fill: #566070; text-anchor: middle; dominant-baseline: central; }
.af-elab rect { fill: #fff; stroke: #e7e7ec; }
.af-edge, .af-elab { transition: opacity .15s ease; }
.af-edge.af-hot .af-path { stroke: var(--hot); stroke-width: 2.4; }
.af-edge.af-hot .af-port { stroke: var(--hot); }
.af-elab.af-hot text { fill: var(--hot); }
.af-focus .af-edge:not(.af-hot), .af-focus .af-elab:not(.af-hot) { opacity: .22; }

/* ---------- Struktur-Karten (ReactFlow-Node), optional mit Thumbnail oben ---------- */
.af-node {
  position: absolute; box-sizing: border-box;
  background: #fff; border: 1px solid #e8e8ec; border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
  color: var(--ink); user-select: none; cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease, opacity .15s ease;
}
.af-node:hover { box-shadow: 0 8px 22px rgba(0,0,0,.1); border-color: #c9ccd6; }
.af-node.af-sel { border-color: var(--hot); box-shadow: 0 8px 24px rgba(231,54,176,.22); }
.af-node.af-hot { border-color: #c9ccd6; }
.af-focus .af-node:not(.af-sel):not(.af-hot) { opacity: .45; }
.af-thumb {
  display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 9px 9px 0 0; border-bottom: 1px solid #f1f1f5; background: #fff;
}
.af-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.af-thumb.af-contain img { object-fit: contain; padding: 16px; box-sizing: border-box; }
.af-title { display: flex; align-items: center; gap: .42rem; font-size: .84rem; font-weight: 700; line-height: 1.15; padding: .52rem .7rem .46rem; }
.af-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.af-row { display: block; font-size: .8rem; color: #3d4350; line-height: 1.2; padding: .3rem .7rem; border-top: 1px solid #f1f1f5; }

/* ---------- App-Schwarm: kleine Karten (Icon + Name, darunter ogTitle) ---------- */
.af-app {
  position: absolute; transform: translate(-50%, -50%); width: 152px;
  box-sizing: border-box; display: block; text-align: left;
  padding: .42rem .55rem .46rem;
  background: #fff; border: 1px solid #e8e8ec; border-radius: 10px;
  box-shadow: 0 1px 5px rgba(0,0,0,.05); cursor: pointer; font: inherit; color: var(--ink);
  transition: box-shadow .15s ease, border-color .15s ease, opacity .15s ease;
}
.af-ahead { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.af-ahead img { width: 18px; height: 18px; object-fit: contain; display: block; flex: none; }
.af-cemoji { font-size: 15px; line-height: 18px; flex: none; }
.af-ahead small { font-size: .72rem; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-adesc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: .62rem; color: var(--muted); line-height: 1.3; margin-top: .18rem;
}
.af-app:hover { border-color: #c9ccd6; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.af-focus .af-app { opacity: .45; }

/* focus(): kurzer Ping-Ring auf der angesprungenen Karte */
@keyframes afping { 0% { box-shadow: 0 0 0 0 rgba(231,54,176,.55); } 100% { box-shadow: 0 0 0 14px rgba(231,54,176,0); } }
.af-app.af-ping, .af-node.af-ping { animation: afping .9s ease-out 2; border-color: var(--hot); }

/* ---------- Floatende Zoom-Controls (−/+/Fit) unten rechts ÜBER dem Canvas ---------- */
.af-ctl { position: absolute; right: .9rem; bottom: .9rem; display: flex; flex-direction: column; gap: .35rem; z-index: 6; }
.af-cbtn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid #e2e2e8;
  background: #fff; color: var(--ink); font-size: 1rem; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.1); display: grid; place-items: center; padding: 0;
}
.af-cbtn:hover { border-color: #b9bcc6; box-shadow: 0 4px 12px rgba(0,0,0,.15); }

/* ---------- Mobile (<700px): statische, scrollbare Spalte - Kanten aus ----------
   Reihenfolge: Group als Abschnitt (Titel + Vertrags-Chips), darunter die App-Karten
   als Grid MIT Description, darunter die Struktur-Karten (mit Thumbnail) untereinander. */
@media (max-width: 700px) {
  .af-view {
    position: static; height: auto; min-height: 0; overflow: visible;
    border: 0; border-radius: 0; background: none; cursor: default; touch-action: auto;
  }
  .af-canvas { position: static; transform: none !important; width: auto !important; height: auto !important; display: flex; flex-direction: column; }
  .af-edges, .af-labels, .af-ctl { display: none; }
  .af-groups { position: static; order: 1; pointer-events: auto; }
  .af-group { position: static; width: auto !important; height: auto !important; }
  .af-apps { position: static; order: 2; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin: .6rem 0 1rem; }
  .af-app { position: static; transform: none; width: auto; }
  .af-layer { position: static; order: 3; display: flex; flex-direction: column; gap: .7rem; }
  .af-node { position: static; width: auto !important; }
}
