Hinge-shift mechanism as a protein design principle for the evolution of β-lactamases from substrate promiscuity to specificity