Abrupt population changes along smooth environmental gradients