/* ============================================================
   TechBy — pipeline section (animated production AI lifecycle)
   Light Material theme · IBM Plex Sans / Mono
   ============================================================ */

.pipeline-section {
  padding: clamp(84px, 11vw, 136px) 0;
  background: #fff;
}

.pipeline-stage {
  background: #fff;
  border: 1px solid var(--line, #e8eaed);
  border-radius: 22px;
  padding: clamp(14px, 2vw, 28px);
  box-shadow: 0 30px 70px -40px rgba(16, 24, 40, 0.25);
}

#pipeline-svg {
  display: block;
  width: 100%;
  height: auto;
}

#pipeline-svg text {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* animated connectors */
.pl-flow {
  stroke-dasharray: 6 6;
  animation: pl-dash 1.2s linear infinite;
}

@keyframes pl-dash {
  to { stroke-dashoffset: -12; }
}

/* loss curve draws itself */
.pl-loss {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: pl-draw 5s cubic-bezier(0.3, 0.6, 0.4, 1) infinite alternate;
}

@keyframes pl-draw {
  to { stroke-dashoffset: 0; }
}

/* stage highlight loop (driven by js/pipeline.js) */
.pl-stage {
  opacity: 0.92;
  transition: opacity 0.4s ease;
}

.pl-stage.active {
  opacity: 1;
}

.pl-stage.active rect:first-of-type {
  stroke: #1a73e8;
  stroke-width: 2;
}

.pl-packet {
  will-change: transform;
}

/* legend */
.pipeline-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  margin-top: 18px;
  padding: 0 clamp(2px, 1vw, 10px);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #5f6368;
}

.pipeline-legend span {
  display: inline-flex;
  align-items: center;
}

.pl-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c, #1a73e8);
  margin-right: 8px;
  flex: none;
}

@media (max-width: 640px) {
  .pipeline-legend {
    gap: 8px 16px;
    font-size: 10px;
  }
}

/* reduced motion: kill every CSS animation/transitions on the diagram */
@media (prefers-reduced-motion: reduce) {
  .pl-flow,
  .pl-loss {
    animation: none;
  }

  .pl-flow {
    stroke-dasharray: none;
  }

  .pl-loss {
    stroke-dashoffset: 0;
  }

  .pl-stage {
    transition: none;
  }
}
