Gating of proton and water transfer in the respiratory enzyme cytochrome c oxidase.