For the energetics of stairs vs ramps there’s a cross-over point.
For shallow slopes the swinging of the legs on a ramp is practically identical to that on the flat and the extra energy expended is trivial. But for steps on a shallow slope the need to raise the leg to avoid the riser makes the energy consumption more.
On the other hand, for steep slopes the advantage of having the feet land flat is a big one. On steep ramps the ankle flex isn’t enough so the body tends to topple over backwards from the unbalanced torque (or forwards if descending) and overcoming that torque requires non-optimal muscle movement. So steps are more energy efficient than ramps on steep slopes.