Structural and energetic determinants of primary proton transfer in bacteriorhodopsin