Host and microbiome jointly contribute to environmental adaptation