Abundance changes and habitat availability drive species’ responses to climate change