Remember: the best fliers generate large flight forces (longer arms) and don't weigh very much (shorter legs).
So let's look at arm length relative to leg length in birds and their ancestors.
Map where the arms became nearly as long as the legs, or even longer.
Oops.
Look at the arms and legs carefully.
Archaeopteryx was the first of these dinosaurs to have arms nearly as long as their legs.