/* Flow UX hardening — loaded after app.css. */

/* A catalogue may be taller than the viewport. Keep its anchor on-screen and
   make the choices themselves scroll; flow-ux.js supplies four-edge flip/fit. */
.nf-ctx {
  max-height: min(60vh, 520px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.nf-ctx:focus-within { border-color: var(--border-hover, var(--t3)); }
.nf-ctx-item { min-height: 32px; }
.nf-ctx-item:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: -2px;
  background: var(--surface-2, rgba(255,255,255,.06));
  color: var(--t1);
}

/* Config panels get the same viewport floor; this also keeps an error reason
   and the first field reachable when the selected node is near an edge. */
.nf-popup {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.nf-popup-close,
.nf-runs-close {
  display: inline-grid;
  min-width: 24px;
  min-height: 24px;
  place-items: center;
}
.nf-popup-close:focus-visible,
.nf-runs-close:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}
.nf-popup .mf { position: relative; }
.nf-promote-input {
  min-height: 24px;
  margin-top: 5px;
  padding: 2px 7px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 4px;
  background: transparent;
  color: var(--t3);
  cursor: pointer;
  font: 600 10px/1.4 Inter, system-ui, sans-serif;
}
.nf-promote-input[aria-pressed="true"] {
  border-color: var(--t2);
  color: var(--t1);
}
.nf-promote-input:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

/* Socket types use geometry, never hue. These shapes appear in the search and
   guide; the canvas renderer draws the matching geometry at every port. */
.nf-socket {
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 1.5px solid currentColor;
  border-radius: 0;
  background: var(--surface, #16161a);
  color: var(--t2);
}
.nf-socket--circle { border-radius: 50%; }
.nf-socket--diamond,
.nf-socket--diamond-slash { transform: rotate(45deg) scale(.82); }
.nf-socket--diamond-slash {
  background: linear-gradient(135deg, transparent 44%, currentColor 45%, currentColor 55%, transparent 56%);
}
.nf-socket--square-dot {
  background: radial-gradient(circle, currentColor 0 1.5px, transparent 2px), var(--surface, #16161a);
}
.nf-socket--triangle {
  width: 0;
  height: 0;
  flex-basis: 12px;
  border: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 11px solid currentColor;
  background: transparent;
}
.nf-socket--capsule { width: 14px; flex-basis: 14px; border-radius: 999px; }
.nf-socket--hexagon { clip-path: polygon(25% 7%,75% 7%,100% 50%,75% 93%,25% 93%,0 50%); }

/* The canvas remains keyboard-focusable; this real DOM graph sits beside it in
   the accessibility tree. Clipping (not display:none) preserves AT access. */
.nf-a11y-tree,
.nf-a11y-instructions {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  content-visibility: auto;
}

.nf-toolbar { align-items: center; }
.nf-toolbar button {
  min-width: 32px;
  min-height: 32px;
}
.nf-toolbar button:focus-visible,
.nf-flow-name:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: -2px;
}
.nf-toolbar button.pri,
#flow-run {
  border-color: var(--accent-strong);
  background: var(--surface-3, rgba(255,255,255,.09));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-strong) 25%, transparent);
  font-weight: 600;
}
.nf-wires-toggle[aria-pressed="true"] {
  color: var(--t1);
  background: var(--surface-2, rgba(255,255,255,.06));
  text-decoration: line-through;
}
.nf-run-status {
  max-width: 190px;
  overflow: hidden;
  color: var(--t3);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nf-search { width: min(360px, calc(100% - 24px)); }
.nf-search-input { min-height: 32px; }
.nf-search-input:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 1px; }
.nf-search-results { max-height: min(42vh, 360px); }
.nf-search-filter-chip {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  margin: 7px 8px 0;
  padding: 0 7px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 999px;
  color: var(--t2);
  font-size: 10px;
}
.nf-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.nf-search-item[aria-selected="true"] {
  background: var(--surface-2, rgba(255,255,255,.06));
  color: var(--t1);
}
.nf-search-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 1px; }
.nf-search-description {
  overflow: hidden;
  color: var(--t4);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nf-run-open {
  min-width: 44px;
  min-height: 24px;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 4px;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  font-size: 10px;
}
.nf-run-open:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 1px; }

@media (max-width: 768px) {
  .nf-run-status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-ctx,
  .nf-search-item,
  .nf-toolbar button { scroll-behavior: auto; }
}
