As the sun expands over the coming billions of years, Earth will become inhospitable to any life more complex than a microbe – but that might take longer than we thought