The anatomy of the mixing transition in homogeneous and stratified free shear layers