Environmental heterogeneity promotes spatial resilience of phototrophic biofilms in streambeds