Habitat diversification promotes environmental selection in planktonic prokaryotes and ecological drift in microbial eukaryotes