/* ============================================================
   SECTION: PIPELINE — multi-agent workflow. Horizontal node row
   with animated dashed SVG connectors, traveling lime dot,
   sequential "executing" pulse + rotating mono log line.
   Every rule scoped under .sec-pipeline.
   ============================================================ */

/* ---------- Panel ---------- */
.sec-pipeline .pipeline-panel {
  border-radius: var(--radius-card-lg);
  padding: 24px 16px;
}

/* Scroll wrapper: free on desktop (tooltips escape upward),
   horizontal scroll under 1100px */
.sec-pipeline .pipeline-track {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

/* ---------- Node ---------- */
.sec-pipeline .pipeline-node {
  position: relative;
  z-index: 1;
  flex: 0 0 120px;
  width: 120px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--bg-white-5);
  border-radius: var(--radius-card);
  box-shadow: var(--inset-highlight);
  outline: none;
  transition: background-color var(--dur-fast) var(--ease-ui),
              border-color var(--dur-fast) var(--ease-ui);
}
.sec-pipeline .pipeline-node:hover { background: var(--bg-elevated); }
.sec-pipeline .pipeline-node:focus-visible {
  box-shadow: var(--inset-highlight), var(--ring-accent);
}

/* Icon circle 28px */
.sec-pipeline .pipeline-ico {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  box-shadow: var(--inset-highlight-soft);
  color: var(--text-primary);
  transition: color var(--dur-fast) var(--ease-ui);
}
.sec-pipeline .pipeline-ico svg { width: 14px; height: 14px; }
.sec-pipeline .pipeline-node:hover .pipeline-ico { color: var(--accent); }

/* Name + role (fixed slots so all 7 nodes stay equal height) */
.sec-pipeline .pipeline-name {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}
.sec-pipeline .pipeline-role {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-ui);
}
.sec-pipeline .pipeline-role.pipeline-live { color: var(--accent); }

/* Last node: Robinhood Chain */
.sec-pipeline .pipeline-node-chain { border-color: var(--accent-24); }
.sec-pipeline .pipeline-node-chain .pipeline-ico {
  background: var(--accent-08);
  color: var(--accent);
}

/* Executing state: pulsing lime ring */
.sec-pipeline .pipeline-node.pipeline-active {
  border-color: var(--accent-24);
  animation: pipeline-pulse 1.5s var(--ease-ui) infinite;
}
@keyframes pipeline-pulse {
  0% {
    box-shadow: var(--inset-highlight),
                0 0 0 1px var(--accent-glow),
                0 0 0 1px var(--accent-glow);
  }
  100% {
    box-shadow: var(--inset-highlight),
                0 0 0 1px var(--accent-glow),
                0 0 0 9px transparent;
  }
}

/* ---------- Connectors: dashed SVG, slow flow ---------- */
.sec-pipeline .pipeline-link {
  flex: 1 1 28px;
  min-width: 16px;
  height: 10px;
  margin: 0 2px;
}
.sec-pipeline .pipeline-link svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.sec-pipeline .pipeline-link line {
  stroke: rgba(255, 255, 255, 0.18); /* brief-mandated connector value */
  stroke-width: 1.5;
  stroke-dasharray: 4 6;
  animation: pipeline-flow 1.4s linear infinite;
}
@keyframes pipeline-flow { to { stroke-dashoffset: -10; } }

/* ---------- Traveling lime dot (positioned by JS) ---------- */
.sec-pipeline .pipeline-dot {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 0;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  box-shadow: 0 0 8px 1px var(--accent-glow);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Tooltip above node ---------- */
.sec-pipeline .pipeline-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  width: 188px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-card-xl), var(--inset-highlight-soft);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  color: var(--text-secondary);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-ui),
              transform var(--dur-med) var(--ease-pop),
              visibility var(--dur-fast) var(--ease-ui);
  z-index: 6;
}
.sec-pipeline .pipeline-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top-color: var(--bg-elevated);
}
.sec-pipeline .pipeline-node:hover .pipeline-tip,
.sec-pipeline .pipeline-node:focus-visible .pipeline-tip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* Edge nodes: keep tooltip inside the panel width */
.sec-pipeline .pipeline-tip-start { left: -1px; transform: translate(0, 4px); }
.sec-pipeline .pipeline-node:hover .pipeline-tip-start,
.sec-pipeline .pipeline-node:focus-visible .pipeline-tip-start { transform: translate(0, 0); }
.sec-pipeline .pipeline-tip-start::after { left: 56px; margin-left: 0; }

.sec-pipeline .pipeline-tip-end { left: auto; right: -1px; transform: translate(0, 4px); }
.sec-pipeline .pipeline-node:hover .pipeline-tip-end,
.sec-pipeline .pipeline-node:focus-visible .pipeline-tip-end { transform: translate(0, 0); }
.sec-pipeline .pipeline-tip-end::after { left: auto; right: 56px; margin-left: 0; }

/* ---------- Mono log line below pipeline ---------- */
.sec-pipeline .pipeline-log {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--bg-white-5);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sec-pipeline .pipeline-log-line { display: inline-block; max-width: 100%; }
.sec-pipeline .pipeline-log-line.pipeline-log-in {
  animation: pipeline-log-in var(--dur-med) var(--ease-pop);
}
@keyframes pipeline-log-in {
  from { opacity: 0; transform: translateY(3px); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sec-pipeline .pipeline-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .sec-pipeline .pipeline-track { min-width: 880px; }
  /* hover tooltips clip inside the scroll container — off below 1100 */
  .sec-pipeline .pipeline-tip { display: none; }
}

@media (max-width: 760px) {
  .sec-pipeline .pipeline-panel { padding: 20px 12px; }
}

/* ---------- Reduced motion: dot hidden, ring static ---------- */
@media (prefers-reduced-motion: reduce) {
  .sec-pipeline .pipeline-dot { display: none; }
  .sec-pipeline .pipeline-link line { animation: none; }
  .sec-pipeline .pipeline-node.pipeline-active {
    animation: none;
    box-shadow: var(--inset-highlight), 0 0 0 1px var(--accent-glow);
  }
  .sec-pipeline .pipeline-log-line.pipeline-log-in { animation: none; }
}
