/* Runtime-accurate connector polish for the desktop discovery map.
   Exact connector x-positions are measured from the rendered source stems so
   the separate collector row cannot drift by a pixel at different widths/DPRs.
   Collector colour also follows the currently available source routes. */
.automation-value-chain-v5{
  --v5-flow-line:#3d8b65;
  --v5-blocked-line:#293238;
}

@media (min-width:1251px){
  /* Align the collector stems to the real rendered stems above. The JS sync
     writes pixel-exact variables after layout and again on resize. */
  .v5-converge .live{
    left:var(--v5-live-x,25%)!important;
    transform:translateX(-50%)!important;
    top:-3px!important;
    width:2px!important;
    height:27px!important;
  }
  .v5-converge .social-left{
    left:var(--v5-good-x,62.5%)!important;
    right:auto!important;
    transform:translateX(-50%)!important;
    top:-3px!important;
    width:2px!important;
    height:27px!important;
  }
  .v5-converge .social-right{
    left:var(--v5-piecewise-x,87.5%)!important;
    right:auto!important;
    transform:translateX(-50%)!important;
    top:-3px!important;
    width:2px!important;
    height:27px!important;
  }
  .v5-converge .bar{
    left:var(--v5-bar-left,25%)!important;
    right:auto!important;
    width:var(--v5-bar-width,62.5%)!important;
    top:23px!important;
    height:2px!important;
    background:var(--v5-flow-line)!important;
  }
  .v5-converge .down{
    left:var(--v5-moment-x,50%)!important;
    transform:translateX(-50%)!important;
    top:23px!important;
    width:2px!important;
    background:var(--v5-flow-line)!important;
  }

  /* Exact Piecewise paused: continuous/exact is still a valid Social path.
     Keep the bus green through Good Finalizer, then darken the unavailable
     piecewise segment all the way to the right-hand branch. */
  .v5-discovery-section:has(.v5-source-route.piecewise.blocked)
    .v5-converge:not(.social-blocked) .social-right{
    background:var(--v5-blocked-line)!important;
  }
  .v5-discovery-section:has(.v5-source-route.piecewise.blocked)
    .v5-converge:not(.social-blocked) .bar{
    background:linear-gradient(
      to right,
      var(--v5-flow-line) 0 var(--v5-good-stop,60%),
      var(--v5-blocked-line) var(--v5-good-stop,60%) 100%
    )!important;
  }

  /* Social Recovery paused: only the Live discovery route can still create a
     Moment. Darken the whole Social side of the shared bus back to the common
     Moment drop, while the Live -> Moment segment remains active green. */
  .v5-converge.social-blocked .social-left,
  .v5-converge.social-blocked .social-right{
    background:var(--v5-blocked-line)!important;
  }
  .v5-converge.social-blocked .bar{
    background:linear-gradient(
      to right,
      var(--v5-flow-line) 0 var(--v5-moment-stop,40%),
      var(--v5-blocked-line) var(--v5-moment-stop,40%) 100%
    )!important;
  }
}
