This work was supported by the National Natural Science Foundation of China (31770421, 31822049, 31870396), the Top Young Talent of the Ten Thousand Talents Programme (to F.P.F.) and Sun Yat-Sen University. C.C. would like to thank the Humboldt Foundation for providing the time to develop some of these ideas, the IDRC grant ‘Climate change and increasing human-wildlife conflict' and Kyoto University.