/* flow-nodes.css — NVS integration flow diagrams (grey engineered system).
   Grey matte nodes; orange = the signal (triggers, outputs, pulses, the lit
   step). Logic nodes (IF / Switch / Loop) are neutral, told apart by badge. */

:root{
  --fn-bg:#0E0E11; --fn-node:#24242A; --fn-node-hi:#2A2620;
  --fn-border:rgba(255,255,255,0.07); --fn-border-hi:rgba(255,255,255,0.13);
  --fn-accent:#FF8C32;
}

/* ─── Use-case legend — floating sticky sidebar ───────────────── */
.int-legend {
  position: fixed; right: 28px; top: 50%;
  transform: translateY(-50%) translateX(12px);
  width: 192px; max-height: 72vh; overflow-y: auto; overflow-x: hidden; z-index: 200;
  background: rgba(14,14,17,0.9);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.10);
  border-top: 1px solid rgba(255,255,255,0.13);
  border-radius: 12px; padding: 6px 0;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease; scrollbar-width: none;
}
.int-legend::-webkit-scrollbar { display: none; }
.int-legend.int-legend-visible { opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0); }
@media (max-width: 900px) { .int-legend { display: none !important; } }

.int-legend-item {
  display: flex; align-items: flex-start; gap: 9px; text-decoration: none;
  padding: 9px 14px 9px 12px; border-left: 2px solid transparent;
  transition: border-color 0.2s ease, background 0.18s ease;
}
.int-legend-item:hover        { border-left-color: rgba(255,140,50,0.35); background: rgba(255,255,255,0.025); }
.int-legend-item.int-legend-active { border-left-color: var(--fn-accent); }
.int-legend-num {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700;
  letter-spacing: 0.12em; color: #5c5964; flex-shrink: 0; padding-top: 2px; transition: color 0.22s ease;
}
.int-legend-item:hover .int-legend-num        { color: rgba(255,140,50,0.7); }
.int-legend-item.int-legend-active .int-legend-num { color: var(--fn-accent); }
.int-legend-title {
  font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 300; line-height: 1.45;
  color: #76727d; transition: color 0.22s ease;
}
.int-legend-item:hover .int-legend-title        { color: #A4A0A9; }
.int-legend-item.int-legend-active .int-legend-title { color: #E2DED8; }

@keyframes fpulse {
  0%   { left: 0%;   opacity: 0; transform: scale(0.5); }
  8%   { opacity: 1; transform: scale(1); }
  92%  { opacity: 1; transform: scale(1); }
  100% { left: 100%; opacity: 0; transform: scale(0.5); }
}

/* ─── Flow wrapper — a matte panel on the stage ───────────────── */
.int-flow-wrap {
  position: relative;
  background: var(--fn-bg);
  border: 1px solid var(--fn-border);
  border-radius: 16px;
  box-shadow: 0px 0px 1px rgba(165,165,165,0.04), -1px 6px 10px -1px rgba(0,0,0,0.12), -3px 16px 26px -3px rgba(0,0,0,0.26), -7px 34px 50px -8px rgba(0,0,0,0.34);
  padding: 48px 40px 32px; overflow-x: auto; cursor: default;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
  scrollbar-width: thin; scrollbar-color: rgba(255,140,50,0.25) rgba(255,255,255,0.04);
}
.int-flow-wrap::after {
  content:''; position:absolute; inset:0; border-radius:inherit; pointer-events:none; z-index:0;
  background:linear-gradient(200deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.014) 22%, transparent 50%);
}
.int-flow-wrap > * { position: relative; z-index: 1; }
.int-flow-wrap::-webkit-scrollbar        { height: 4px; }
.int-flow-wrap::-webkit-scrollbar-track  { background: rgba(255,255,255,0.03); border-radius: 0 0 16px 16px; }
.int-flow-wrap::-webkit-scrollbar-thumb  { background: rgba(255,140,50,0.22); border-radius: 4px; }
.int-flow-wrap::-webkit-scrollbar-thumb:hover { background: rgba(255,140,50,0.45); }
.int-flow-wrap:hover { border-color: rgba(255,140,50,0.14); }

/* Hint — fades when any node is hovered */
.int-flow-wrap::before {
  content: 'hover each step'; position: absolute; top: 13px; right: 18px; z-index: 2;
  font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: #46444c; transition: opacity 0.3s ease; pointer-events: none;
}
.int-flow-wrap:has(.flow-node:hover)::before { opacity: 0; }

/* ─── Flow row ────────────────────────────────────────────────── */
.flow-row { display: flex; align-items: center; gap: 0; min-width: max-content; }

/* ─── Node base — matte grey tile ─────────────────────────────── */
.flow-node {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 128px; max-width: 148px; padding: 16px 14px 13px;
  background: var(--fn-node); border: 1px solid var(--fn-border);
  border-radius: 13px; flex-shrink: 0; position: relative; cursor: default;
  box-shadow: 0px 0px 1px rgba(165,165,165,0.04), -1px 4px 6px -1px rgba(0,0,0,0.10), -2px 10px 18px -3px rgba(0,0,0,0.22);
  transition: border-color 0.26s ease, background 0.26s ease, transform 0.30s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.26s ease, opacity 0.22s ease;
}
.flow-node::before {
  content:''; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  background:linear-gradient(200deg, rgba(255,255,255,0.05), transparent 52%);
}
.flow-node > * { position: relative; }

/* ─── Hover: lift the active node ────────────────────────────── */
.flow-node:hover {
  border-color: rgba(255,140,50,0.55); background: var(--fn-node-hi);
  transform: scale(1.06); transform-origin: center center;
  box-shadow: 0 0 0 1px rgba(255,140,50,0.18), 0 8px 28px rgba(255,140,50,0.10), 0 2px 8px rgba(0,0,0,0.5); z-index: 2;
}
.int-flow-wrap:has(.flow-node:hover) .flow-node:not(:hover) { opacity: 0.4; }

/* ─── Node type variants — orange marks the signal endpoints; logic is neutral ── */
.flow-node.fn-trigger { border-color: rgba(255,140,50,0.28); }
.flow-node.fn-trigger:hover { border-color: rgba(255,140,50,0.7); }
.flow-node.fn-output  { border-color: rgba(255,140,50,0.18); }
.flow-node.fn-output:hover  { border-color: rgba(255,140,50,0.55); }
.flow-node.fn-if,
.flow-node.fn-switch,
.flow-node.fn-loop    { border-color: var(--fn-border-hi); }
.flow-node.fn-if:hover,
.flow-node.fn-switch:hover,
.flow-node.fn-loop:hover {
  border-color: rgba(255,140,50,0.5); background: var(--fn-node-hi);
  box-shadow: 0 0 0 1px rgba(255,140,50,0.14), 0 8px 28px rgba(255,140,50,0.10), 0 2px 8px rgba(0,0,0,0.5);
}

/* ─── Pulse-lit state (JS adds .fn-lit on pulse arrival) — orange for all ── */
.flow-node.fn-lit,
.flow-node.fn-if.fn-lit,
.flow-node.fn-switch.fn-lit,
.flow-node.fn-loop.fn-lit,
.flow-node.fn-trigger.fn-lit,
.flow-node.fn-output.fn-lit {
  border-color: rgba(255,140,50,0.9) !important;
  background: #2A2418 !important;
  box-shadow: 0 0 0 1px rgba(255,140,50,0.35), 0 0 22px rgba(255,140,50,0.22) !important;
  transition: border-color 0.04s ease, background 0.04s ease, box-shadow 0.04s ease !important;
}

/* ─── Node badges ─────────────────────────────────────────────── */
.fn-badge {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--fn-accent); color: #0E0E11;
  font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; padding: 2px 9px; border-radius: 20px; text-transform: uppercase; white-space: nowrap;
  transition: background 0.26s ease;
}
/* trigger/output badges read orange on the matte pill; logic badges are neutral */
.fn-badge.fn-badge-out    { background: var(--fn-node); color: var(--fn-accent); border: 1px solid rgba(255,140,50,0.4); }
.fn-badge.fn-badge-if,
.fn-badge.fn-badge-switch,
.fn-badge.fn-badge-loop   { background: var(--fn-node); color: #A4A0A9; border: 1px solid var(--fn-border-hi); }
.flow-node:hover           .fn-badge.fn-badge-out    { background: var(--fn-node-hi); }
.flow-node.fn-if:hover     .fn-badge.fn-badge-if,
.flow-node.fn-switch:hover .fn-badge.fn-badge-switch,
.flow-node.fn-loop:hover   .fn-badge.fn-badge-loop   { background: var(--fn-node-hi); color: #E2DED8; }

/* ─── Label & service text ────────────────────────────────────── */
.fn-label {
  font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 500;
  color: #C6C2C8; line-height: 1.35; transition: color 0.22s ease;
}
.flow-node:hover .fn-label { color: #F2EFEA; }
.fn-service {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; color: #5c5964; letter-spacing: 0.04em; transition: color 0.22s ease;
}
.flow-node:hover           .fn-service,
.flow-node.fn-if:hover     .fn-service,
.flow-node.fn-switch:hover .fn-service,
.flow-node.fn-loop:hover   .fn-service { color: rgba(255,140,50,0.65); }

/* ─── Description (expands on hover) ─────────────────────────── */
.fn-desc {
  font-family: 'Poppins', sans-serif; font-size: 10px; color: transparent; line-height: 1.6;
  max-height: 0; overflow: hidden; opacity: 0; margin-top: 0; border-top: 1px solid transparent; padding-top: 0;
  transition: max-height 0.34s ease, opacity 0.26s ease, margin-top 0.26s ease, padding-top 0.26s ease, color 0.22s ease, border-color 0.22s ease;
}
.flow-node:hover .fn-desc,
.flow-node.fn-if:hover .fn-desc,
.flow-node.fn-switch:hover .fn-desc,
.flow-node.fn-loop:hover .fn-desc {
  max-height: 90px; opacity: 1; margin-top: 9px; padding-top: 8px;
  border-color: rgba(255,140,50,0.13); color: #A4A0A9;
}

/* ─── Edge / connector — faint track, orange pulse ────────────── */
.flow-edge {
  flex: none; width: 88px; min-width: 88px; height: 2px;
  background: rgba(255,255,255,0.08); position: relative; overflow: visible; flex-shrink: 0;
}
.flow-edge::after {
  content: ''; position: absolute; right: -1px; top: -4px; width: 0; height: 0;
  border-left: 7px solid rgba(255,255,255,0.14); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.flow-edge.fe-short { width: 88px; min-width: 88px; flex: none; }

/* ─── Pulse dot — the signal traveling the wire ──────────────── */
.flow-pulse {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--fn-accent); box-shadow: 0 0 6px rgba(255,140,50,0.8), 0 0 12px rgba(255,140,50,0.4);
  top: -3px; left: 0; opacity: 0; pointer-events: none;
}

/* ─── Branch wrapper (after IF / Switch nodes) ────────────────── */
.flow-branch-wrap { display: flex; flex-direction: column; gap: 16px; flex-shrink: 0; align-self: center; position: relative; padding-left: 18px; }
.fn-svg-connected { padding-left: 0; }
.fn-svg-connected::before { display: none; }
.fn-svg-connected .flow-branch::before { display: none; }
.fn-svg-connected .fe-short { visibility: hidden; }
.flow-branch-wrap::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(to bottom, transparent 0%, rgba(255,255,255,0.14) 8%, rgba(255,255,255,0.14) 92%, transparent 100%);
  pointer-events: none;
}
.flow-branch { display: flex; align-items: center; gap: 0; position: relative; padding-top: 16px; }
.flow-branch::before {
  content: ''; position: absolute; left: -18px; top: 50%; width: 18px; height: 2px;
  background: rgba(255,255,255,0.14); transform: translateY(-50%); pointer-events: none;
}

/* ─── Service cross-link hover ───────────────────────────────── */
.fn-service-link { cursor: pointer; position: relative; }
.fn-service-link::after { content: ' ↗'; opacity: 0; font-size: 7px; color: rgba(255,140,50,0.9); transition: opacity 0.15s ease; vertical-align: middle; pointer-events: none; }
.fn-service-link:hover { color: rgba(255,140,50,0.9) !important; }
.fn-service-link:hover::after { opacity: 1; }

/* ─── Branch path labels ──────────────────────────────────────── */
.flow-branch-label {
  font-family: 'JetBrains Mono', monospace; font-size: 8.5px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; flex-shrink: 0;
  position: absolute; top: 0; left: 0; line-height: 1; opacity: 0;
  transform: translate(-50%, 2px); transition: opacity 0.22s ease, transform 0.22s ease;
}
.flow-branch:has(.flow-node:hover) .flow-branch-label { opacity: 1; transform: translate(-50%, -100%); }
.fbl-yes  { color: rgba(255,140,50,0.8); }
.fbl-no   { color: #76727d; }
.fbl-path { color: #A4A0A9; }
