The evolution of Earth's biogeochemical nitrogen cycle