Mechanistic insights into pH-dependent hydrogen electrocatalysis by flipping interfacial water