Demographic shifts and the role of climate warming in a switch from migrant to resident life history