Drying and fragmentation drive the dynamics of resources, consumers and ecosystem functions across aquatic-terrestrial habitats in a river network.