Drivers of Macroinvertebrate Communities in Mediterranean Rivers: A Mesohabitat Approach

: We investigated the relationship between benthic macroinvertebrate community a tt rib-utes (richness, abundance, biodiversity, and climate-speci ﬁ c and resistance forms) and the physical characteristics of distinct mesohabitats (hydromorphological unit types) discretized into fast (e.g., ri ﬄ es or rapids) and slow (e.g., pools or glides) ﬂ ow types in four Mediterranean rivers of Spain. Key a tt ributes of hydromorphological units, including length, width, depth, shade, substrate composition, embeddedness, abundance of aquatic vegetation, and density of woody debris, were considered. Through a comprehensive suite of multivariate analyses, we unraveled taxonomic and habitat distinctions among rivers and hydromorphological unit types, with a notable in ﬂ uence of spatial proximity (greater similarity within the same river basin). In slow hydromorphological units, aquatic vegetation, depth, and abundance of coarse substrate emerged as pivotal factors shaping macroinvertebrate assemblages, whereas in fast-ﬂ owing units, vegetation, substrate embeddedness, and density of woody debris were the most important. Contrary to the remaining community attributes, the studied resistance forms (absent, eggs, cocoons, and cells against desiccation and diapause) exhibited uniformity across rivers despite observed variations in macroinvertebrate communities, underscoring regional functional analogies in biological and ecological mechanisms within the investigated Mediterranean river basins. This study contributes valuable insights for anticipating the repercussions of ongoing climate change, particularly in regions where fast-ﬂ owing hydro-morphological units are more susceptible to depletion during drought periods.


Introduction
Freshwater ecosystems have been recognized among the most globally disturbed environments, owing to the multifaceted impacts of land use changes, climate fluctuations, pollution, overexploitation, and the intrusion of invasive alien species [1,2].Assessing the health and sustainability of these ecosystems requires a comprehensive understanding of their intricate dynamics.Benthic macroinvertebrates have emerged as pivotal indicators, serving as proxies for both water quality and the biotic integrity of freshwater biomes (e.g., [3]).However, unraveling cause-and-effect relationships in the face of abiotic processes acting across diverse spatial scales poses a significant challenge [4][5][6].The intricate interplay of environmental attributes and stressors influencing biotic communities requires studies at varying scales, from unaltered to regulated rivers, spanning catchment kilometers down to mesohabitats at the square meter level [7][8][9].In this hierarchical framework, macroinvertebrate communities exhibit associations with river habitats across spatial scales, ranging from catchment dimensions to mesohabitats, underscoring the need for a nuanced understanding of their distribution [10][11][12][13][14].
At the macro-scale, encompassing catchment and basin dimensions, macroinvertebrate communities parallel climatic, geological, and land-use factors [15,16].Comprehending how environmental factors such as flow regime, temperature, nutrients, oxygen, and pH influence macroinvertebrate composition along the longitudinal gradient from headwaters to mouth is crucial [8,[17][18][19].Conversely, at the microhabitat scale, hydraulics and associated environmental factors drive the distribution of macroinvertebrates within river segments, leading to locally differentiated communities [20][21][22].Mesohabitats, or hydromorphological units (HMUs), offer a valuable middle ground for studying and managing these communities, as they effectively synthesize the influences of environmental factors at various spatial scales [21].Mesohabitats, characterized by consistent depth, velocity, slope, substrate distribution, and cover elements, present distinct macroinvertebrate communities in slow-flow (e.g., pools or glides) and fast-flow (e.g., riffles or rapids) HMUs [21,23,24].Understanding the effects of hydrological events on macroinvertebrate communities requires an analysis of these mesoscale units [25].Despite the existence of various mesohabitat classification approaches, a simplified categorization into slow-flow and fast-flow mesohabitats enables the application and generalization of results across diverse rivers, especially when referring to the assessment of the invertebrate communities that live in these habitats [26,27].In addition to abiotic factors, biotic interactions such as predation and competition, as well as colonization events, play pivotal roles in shaping the distribution patterns of invertebrates [28,29].Understanding these dynamic ecological processes is essential for elucidating the complex mechanisms driving community assembly and biodiversity dynamics in river ecosystems.
The role of environmental attributes, particularly hydraulics, in shaping macroinvertebrate assemblages at the genus or family level has been extensively explored [18,30,31].However, the significance of other factors such as detritus, woody debris, and aquatic vegetation and their influence on macroinvertebrate communities, remains underexplored [32][33][34][35][36]. Furthermore, the integration of biological traits, reflecting species adaptation to the environment, into the study of macroinvertebrate communities has recently gained prominence [37].While studies have delved into the relationship between hydraulics and microhabitat-scale traits [38], HMUs have been employed to scrutinize the connections among biological traits, community structure, richness, and diversity of aquatic macroinvertebrates [39].Notably, functional trait-based approaches have proven robust in discerning differences between species across rivers [37].
Despite these advances, there remains a notable gap in research concerning climatespecific adaptive traits and their distribution across HMUs.Given the anticipated exacerbation of hydrological variability by global change in Mediterranean climate rivers, understanding the functional traits that allow macroinvertebrates to endure these impacts becomes imperative [40][41][42].Our study tries to fill this gap by investigating the relationships between taxonomic-and trait-based macroinvertebrate descriptors and HMU attributes across diverse Mediterranean rivers, aiming to enhance our understanding of the dynamics shaping freshwater ecosystems in the face of ongoing environmental changes.

Study Sites
This study was carried out on four headwater rivers in the Júcar River Basin District, located in the eastern Iberian Peninsula (Figure 1).The sampled rivers were Ebrón (Turia River tributary), Vallanca (Turia River tributary), Villahermosa (Mijares River tributary), and Palencia.All sampling sites were located in the Mediterranean region, where the climate is temperate with a dry season and a hot (Cfa) or temperate (Cfb) summer, according to the Köppen-Geiger classification [43].The hydrological regimen is very variable, with precipitations concentrated at the end of winter and the beginning of spring and low flows in summer [44].Consequently, they are typical Mediterranean rivers with an irregular flow regime, with large seasonal floods and strong droughts; in fact, frequent droughts have recently been documented in the headwaters of these rivers [45].The mean annual discharge recorded in situ in the Ebrón, Villahermosa, Vallanca, and Palancia rivers was 1.13, 1.08, 0.35, and 0.26 m 3 /s, respectively.The maximum water temperature oscillates between 12 and 14 • C in the winter, with minimum temperatures usually greater than 5 • C, while in summer maximum temperatures usually do not exceed 20 • C. Land use along the four rivers is mainly forest (84%), while agricultural and urbanized areas represent only a small percentage of the total land use (16%).Additional details of the study sites can be found in [46,47].
Sustainability 2024, 16,3075 3 of 1 to the Köppen-Geiger classification [43].The hydrological regimen is very variable, with precipitations concentrated at the end of winter and the beginning of spring and low flow in summer [44].Consequently, they are typical Mediterranean rivers with an irregula flow regime, with large seasonal floods and strong droughts; in fact, frequent drought have recently been documented in the headwaters of these rivers [45].The mean annua discharge recorded in situ in the Ebrón, Villahermosa, Vallanca, and Palancia rivers wa 1.13, 1.08, 0.35, and 0.26 m 3 /s, respectively.The maximum water temperature oscillate between 12 and 14 °C in the winter, with minimum temperatures usually greater than 5 °C, while in summer maximum temperatures usually do not exceed 20 °C.Land use along the four rivers is mainly forest (84%), while agricultural and urbanized areas represen only a small percentage of the total land use (16%).Additional details of the study site can be found in [46,47].

Data Collection
Data were collected during low flow (July and August) between 2004 and 2006.Fou sampling sites were selected in the upstream-downstream gradient for each river, and two different HMUs (slow-and fast-flow) were established per site.The recurrence of drough was evident in the last two years (2005 and 2006), which were characterized by scarce precipitation that caused the upper reaches of the Vallanca and Villahermosa rivers to dry out.In total, 82 HMUs were sampled: 44 in slow-flow habitats and 38 in fast-flow habitats

Mesohabitat Survey and Characterization
Habitat classification was based on previous studies in which HMUs were grouped into two types: (i) slow-flow HMUs that included pools and glides and (ii) fast-flow HMU that included riffles and rapids [27,47].Once an HMU was classified, several mesohabita attributes were measured: HMU length, width, obtained from three equidistant cross-sec tions, and mean depth calculated from nine point measurements (three per cross-section) while the maximum depth of the mesohabitat was also recorded.Because the structure o the macroinvertebrate community is largely determined by habitat characteristics such a substrate and sediment types [48], several cover-related attributes were visually estimated (expressed as percentages) following the Basinwide Visual Estimation Technique sam

Data Collection
Data were collected during low flow (July and August) between 2004 and 2006.Four sampling sites were selected in the upstream-downstream gradient for each river, and two different HMUs (slow-and fast-flow) were established per site.The recurrence of drought was evident in the last two years (2005 and 2006), which were characterized by scarce precipitation that caused the upper reaches of the Vallanca and Villahermosa rivers to dry out.In total, 82 HMUs were sampled: 44 in slow-flow habitats and 38 in fast-flow habitats.

Mesohabitat Survey and Characterization
Habitat classification was based on previous studies in which HMUs were grouped into two types: (i) slow-flow HMUs that included pools and glides and (ii) fast-flow HMUs that included riffles and rapids [27,47].Once an HMU was classified, several mesohabitat attributes were measured: HMU length, width, obtained from three equidistant crosssections, and mean depth calculated from nine point measurements (three per cross-section), while the maximum depth of the mesohabitat was also recorded.Because the structure of the macroinvertebrate community is largely determined by habitat characteristics such as substrate and sediment types [48], several cover-related attributes were visually estimated (expressed as percentages) following the Basinwide Visual Estimation Technique sampling protocol [27,47,49].These were: shade, embeddedness (riverbed covered by fine sediment particles), aquatic vegetation (vascular plants), substrate, and woody debris.Specifically, substrate granulometry was divided into three categories: coarse (diameter > 256 mm), medium (diameter between 2 and 256 mm), and fine (diameter < 2 mm).The density of woody debris was visually estimated and expressed in pieces of wood per m 2 .

Macroinvertebrates Data Compilation
We took two macroinvertebrate samples from each HMU to adequately cover the entire mesohabitat area.The Hess Stream Bottom Sampler (total area 0.05 m 2 ) with a 460 µm mesh size was used to catch macroinvertebrates following the international standard protocol (ISO 8265:1988).All samples were preserved in 4% formalin for subsequent processing in the laboratory, where macroinvertebrates were sorted, identified, and counted.The samples were classified at the family level, according to Oscoz et al. (2011) [50].Using macroinvertebrates at the family level offers efficient data analysis and a comprehensive community overview, mitigating errors associated with higher taxonomic resolutions (genus and species) and reducing identification costs.Nonetheless, this strategy compromises species-level variability and constrains the detection of finer-scale changes within communities [51].For each HMU, macroinvertebrate abundance was calculated as individuals per square meter (henceforth simply termed abundance) and relative abundance was defined as the percentage of the total macroinvertebrate sample comprised by the given macroinvertebrate family.Furthermore, the taxa richness was estimated as the number of families present in each sample, as well as the Shannon (H ′ ) and Simpson (1 − λ) diversity indices that were calculated following Equations ( 1) and ( 2), where p i is the proportion of families i in a benthos sample [52,53].

Statistical Analyses
First, we evaluated the role of habitat in macroinvertebrate communities along the two types of HMU (slow and fast) using principal component analysis (PCA).Abundances were grouped according to their taxonomic order to display all information on the biplots.We used a permutation Monte Carlo approach to test the statistical significance (p < 0.05) of the analysis corresponding to each river [54].Second, we related richness, abundance, and diversity indices with habitat attributes using canonical correspondence analysis (CCA).Before CCA analysis, habitat attributes and macroinvertebrate diversity indices were normalized because the data was non-normal according to the Shapiro-Wilk (N < 50) and Kolmogorov-Smirnov (N > 50) tests.Thus, ANOVA and Kruskal-Wallis tests for normal and non-normal distributed data (respectively) were used to detect differences in environmental and biological parameters between rivers and HMU types.All tests were considered statistically significant at p < 0.05.
In a third step, fuzzy principal component analysis (FPCA) was used to analyze macroinvertebrates communities according to that resistance trait in each of the HMU types independently.FPCA is a method for robust estimation of principal components and is capable of diminishing the influence of outliers [55].The trait database (developed after Tachet et al. [56]) was used for the trait-based approach.The resistance traits include five categories: absent (indicating the absence of any discernible resistance form within the family) eggs (reproductive structures laid capable of enduring adverse environmental conditions until hatching), cocoons (protective structures produced to encase their eggs, providing insulation and safeguarding against environmental stressors), cells against desiccation (specialized cellular adaptations that confer resistance against dehydration, allowing survival during periods of low water availability) and diapause or dormancy (physiological state entered in response to unfavorable conditions, characterized by metabolic suppression and reduced activity until environmental conditions become more favorable) [56].
The taxonomic resolution used in the classification process corresponded to the family level, using the average profile of all genera in the same family [57].Trait information was structured using a "fuzzy coding" procedure [58].A score was assigned to every taxon describing its affinity for each of the five trait categories, with "0" indicating "no affinity" and "5" indicating "high affinity" [56].Affinity scores were rescaled as proportions (summing up to 1) for each taxon, representing the probability that any taxon belonged to a particular category.Then, to describe the structure of the community in terms of the relative abundance of each trait, the relative abundance of each taxon was multiplied by the proportion of each category per trait (Relative Abundance × Affinity score per category = Category matrix) [59].The resulting trait-by-species array contained the relative abundance of each trait category in each river, and this new array was used in the multivariate analysis (Table S3).The Monte Carlo test was used to explore the difference between groups (p < 0.05).All analyses and graphical outputs of the PCA, CCA, and FPCA models were calculated with the "ade4" [60] and "vegan" [61] packages implemented in the version 4.2.2. of R software [62].

Differences by River and HMU Type
The habitat attributes of fast and slow HMUs reveal substantial variations, emphasizing the intricate ecological diversity present within stream habitats.Despite similarities in width, shade, and aquatic vegetation coverage between both groups, pronounced distinctions arise in depth parameters and substrate composition.Slow HMUs had greater mean and maximum depths, as well as higher percentages of embeddedness, fine substrate, and woody debris (Table 1).Conversely, fast HMUs exhibit shallower depths, with a higher proportion of medium substrates (Table 1).At the family level, a total of 86 taxa were identified, and macroinvertebrate abundances varied widely among sampling sites (Table 2).Chironomidae were the most abundant taxon within the slow and fast habitats of Palancia and Villahermosa, representing between 44.0% and 54.6% of the total number of individuals.On the contrary, Elmidae (24.6% in slow habitats) and Gammaridae (20.6% in fast habitats) dominated Ebrón habitats.Furthermore, Gammaridae (23.6% and 31.1% within slow and fast habitats, respectively) prevailed in the Vallanca (Figure S1 and Table S1).Analysis of biological parameters in fast HMU indicated that abundance (p = 0.008) and Simpson index (p = 0.029) were statistically different among rivers, while Shannon index and richness showed marginal differences (0.05 < p < 0.1).However, in slow HMUs, no significant statistical differences were found (p > 0.1).
PCAs revealed differences among rivers in both HMU types, considering either the habitat attributes or macroinvertebrate communities (Figure 2).Regarding the PCA on habitat attributes, the two axes of the slow HMUs explained 50.7% of the total variance (with eigenvalues of 2.85 and 2.22), while for the fast HMUs, they contained 53.3% (2.98 and 2.33).The overlap among rivers was smaller in slow than in fast HMUs (permutations test; p < 0.001), with the Ebrón and Palancia rivers completely overlapping in fast HMUs.Villahermosa had the lowest variability, in contrast to Vallanca, as was highlighted by the different sizes of its ellipses (Figure 2a,b).Concerning macroinvertebrate communities, the two axes of slow HMUs explained 35.7% (with eigenvalues of 2.95 and 1.69), whereas for fast HMUs, the two contained 33.8% of the total variance (2.55 and 1.85).There was overlap between Ebrón and Vallanca (both are tributaries of the Turia river) and Palancia and Villahermosa, but with notable differences among rivers (permutations test; p = 0.001 for slow and p = 0.006 for fast water) (Figure 2).Despite a clear overlap in the habitat attributes of the fast HMUs between Palancia and Ebrón, such conditions did not replicate in their macroinvertebrate communities (Figure 2c,d).In contrast, no similarity was observed between the communities on those two rivers, either in slow or fast HMUs.In general, the communities were better explained by the gradient in the abundance of Gastropoda, Oligochaeta, Crustacea, and Coleoptera in the Vallanca and Ebrón rivers, while Diptera, Ephemeroptera, Odonata, and Plecoptera prevailed in the Palancia and Villahermosa rivers (Figure 2c,d).The CCA revealed clear differences by HMU types and by river in terms of the macroinvertebrate community (Figure 3).The first two axes were sufficient to depict the relationships between the community descriptors (richness, abundance, and diversity) and habitat attributes, accounting for more than 75% of total variability in every case.In general, for slow HMUs (left column in Figure 3), vegetation, mean depth, and coarse substrate were the most important attributes, whereas for fast HMUs (right column in Figure 3), vegetation, substrate embeddedness, and woody debris were the most important at- The CCA revealed clear differences by HMU types and by river in terms of the macroinvertebrate community (Figure 3).The first two axes were sufficient to depict the relationships between the community descriptors (richness, abundance, and diversity) and habitat attributes, accounting for more than 75% of total variability in every case.In general, for slow HMUs (left column in Figure 3), vegetation, mean depth, and coarse substrate were the most important attributes, whereas for fast HMUs (right column in Figure 3), vegetation, substrate embeddedness, and woody debris were the most important attributes (Figure 3 and Table S2).Specifically, the Shannon and Simpson diversity indices increased with mean depth in slow HMUs (Table S2) and decreased with a higher abundance of aquatic vegetation in slow HMUs.By contrast, the diversity indices increased with embeddedness and shade in fast HMUs (Table S2).

Analyses of Macroinvertebrate Traits (Resistant Forms)
The FPCA exhibited a clear overlap of the resistance traits among rivers, either in slow or fast HMUs (permutations test; p > 0.05 in both cases) (Figure 4), despite the differences among rivers found in preceding analyses (Figure 2).For slow HMUs, the first axis explained 59% of the total variance, whereas the second axis explained 25% (with eigenvalues of 0.040 and 0.068, respectively); similarly, in fast HMUs, the first axis explained

Analyses of Macroinvertebrate Traits (Resistant Forms)
The FPCA exhibited a clear overlap of the resistance traits among rivers, either in slow or fast HMUs (permutations test; p > 0.05 in both cases) (Figure 4), despite the differences among rivers found in preceding analyses (Figure 2).For slow HMUs, the first axis explained 59% of the total variance, whereas the second axis explained 25% (with eigenvalues of 0.040 and 0.068, respectively); similarly, in fast HMUs, the first axis explained 58% and the second axis 27% (with eigenvalues of 0.067 and 0.039, respectively).The most relevant resistance forms were cells against desiccation and eggs, although cocoons and diapause had certain explanatory powers.Thus, these trait categories were positively related to either the slow or fast HMUs, regardless of the river considered.
Sustainability 2024, 16, 3075 9 of 1 58% and the second axis 27% (with eigenvalues of 0.067 and 0.039, respectively).The mos relevant resistance forms were cells against desiccation and eggs, although cocoons and diapause had certain explanatory powers.Thus, these trait categories were positively re lated to either the slow or fast HMUs, regardless of the river considered.

Discussion
Variations in habitat attributes were discernible both among and within rivers acros diverse hydromorphological units (HMUs).In addition, macroinvertebrate communitie exhibited distinct differences among rivers, despite being statistically demonstrated pri marily in fast HMUs, which altogether underscores the suitability of meso-scale ap proaches for comprehensively investigating macroinvertebrate communities in the head waters of Mediterranean rivers.Noteworthy dissimilarities in the family of different orde levels were apparent in macroinvertebrate communities between the studied HMU groups.In particular, the diversity and abundance of macroinvertebrates exhibited varia tions in fast HMUs.These disparities emphasize the critical importance of sampling vari ous habitat types to ensure dependable community comparisons, as the selection of sam pled habitats can significantly influence results and conclusions based on the sampled habitat ratio [63,64].
Numerous studies have elucidated the transition of macroinvertebrate communitie from slow to fast habitats [23,63,65].Carter and Fend [66] distinguished two primary mesohabitats, pools and riffles, highlighting their influence on macroinvertebrates in Mediterranean riverine system in eastern California.However, the variation of macroin vertebrates in these habitats was influenced by the large-scale effects of climate and flow regime.It was particularly relevant that riffles exhibited significantly higher richness than pools during years of lower discharge in California, contrasting with normal years [66].In contrast, studies in Central Italy and Brazil rivers did not observe such richness difference between pool (slow) and riffle (fast) HMUs [67,68].This apparent inconsistency may b attributed to differences in river size or geological variation in the sampled areas.Pace e al. [68] conducted the study in siliceous and small rivers, whereas our samples were col lected in calcareous rivers.Our study, examining diversity, abundance, and traits in fas and slow HMUs, revealed substantial spatial variations (Table 2), which may indicate loca

Discussion
Variations in habitat attributes were discernible both among and within rivers across diverse hydromorphological units (HMUs).In addition, macroinvertebrate communities exhibited distinct differences among rivers, despite being statistically demonstrated primarily in fast HMUs, which altogether underscores the suitability of meso-scale approaches for comprehensively investigating macroinvertebrate communities in the headwaters of Mediterranean rivers.Noteworthy dissimilarities in the family of different order levels were apparent in macroinvertebrate communities between the studied HMU groups.In particular, the diversity and abundance of macroinvertebrates exhibited variations in fast HMUs.These disparities emphasize the critical importance of sampling various habitat types to ensure dependable community comparisons, as the selection of sampled habitats can significantly influence results and conclusions based on the sampled habitat ratio [63,64].
Numerous studies have elucidated the transition of macroinvertebrate communities from slow to fast habitats [23,63,65].Carter and Fend [66] distinguished two primary mesohabitats, pools and riffles, highlighting their influence on macroinvertebrates in a Mediterranean riverine system in eastern California.However, the variation of macroinvertebrates in these habitats was influenced by the large-scale effects of climate and flow regime.It was particularly relevant that riffles exhibited significantly higher richness than pools during years of lower discharge in California, contrasting with normal years [66].In contrast, studies in Central Italy and Brazil rivers did not observe such richness differences between pool (slow) and riffle (fast) HMUs [67,68].This apparent inconsistency may be attributed to differences in river size or geological variation in the sampled areas.Pace et al. [68] conducted the study in siliceous and small rivers, whereas our samples were collected in calcareous rivers.Our study, examining diversity, abundance, and traits in fast and slow HMUs, revealed substantial spatial variations (Table 2), which may indicate local environmental constraints for macroinvertebrate communities.In addition, habitat attributes emerge as primary drivers influencing macroinvertebrate communities and their descriptors.Discrepancies observed in our results compared to other studies may be caused by the unique combination of abiotic attributes within the studied rivers or at varying spatial scales.Our investigation encompassed a spectrum of mesohabitat scale attributes, revealing that in slow habitats, mean depth, vegetation, and coarse substrate played pivotal roles, whereas in fast-flow HMUs, vegetation, embeddedness, and woody debris were key drivers.On the mesohabitat scale, the richness and abundance of macroinvertebrates in fast habitats (riffles) were linked to the pronounced variability of depth [65].On the contrary, at the microhabitat scale, most of the studies focused on the relationships between macroinvertebrate distribution and habitat attributes, especially hydraulic parameters such as roughness, Reynolds number, shear velocity, and Froude number [20,21,33,69,70].Nevertheless, it is undeniable that the mesohabitat scale can reasonably summarize microhabitat conditions, thereby streamlining sampling efforts in terms of time and resources [21].
Our findings align with Seger et al. [69], who observed reduced invertebrate richness due to modifications in the riparian zone, emphasizing the crucial role of woody debris.Wood in aquatic habitats serves vital functions such as enhancing structural complexity, refuge, flow velocity range, and providing new places for attachment, feeding, and oviposition [33][34][35].Furthermore, some families in high mountains and pristine rivers were observed to be independent, whereas other families and functional feeding groups have been specifically associated with certain types of native riparian vegetation [71,72].It has also been reported that some macroinvertebrates may almost exclusively inhabit the depositional zones (e.g., silt); nevertheless, most mountain river species inhabit coarse substrates [73].Notably, stable substrates (usually the coarse ones) are sites of minimal disturbance during peak flows, and thus, these substrates are associated with high abundance, richness, and community persistence (e.g., [74,75]).In our case, the impact of substrate type on macroinvertebrate communities was evident, with diversity tending to be higher in coarse substrates in slow habitats, while embedded habitats exhibited higher diversity in fast-flow environments.This underscores the influence of substrate stability, with coarse substrates associated with high abundances and richness during peak flows, ensuring community persistence.
Contrary to the widely recognized detrimental effect of fine sediment on aquatic biodiversity, our results, consistent with studies using sediment-specific indices, suggest that hydrological variability and mesohabitat-scale hydraulic conditions play key roles in shaping the functional response to deposition and embeddedness [76].Additionally, depth emerged as a positive driver for macroinvertebrate communities, echoing previous studies [31,77].The interplay between depth and velocity, demonstrated by Shearer et al. [70], emphasizes their contextual interaction, varying with river size and affecting macroinvertebrate abundance.Our study aligns with this, indicating that depth, particularly crucial in mountainous rivers where remarkable changes in flow magnitude occur, plays a determinant role in community structure.Mediterranean rivers, known for their particular hydrology (extreme hydrological regimes), pose unique challenges to aquatic organisms due to these events [7].Such challenges may result in the alteration of invertebrate populations or their spatial re-distribution.Nonetheless, owing to the inherent qualities of stability, complexity, and integrity within freshwater ecosystems, they possess the capacity for sustainability over time [78].Our use of a single group of biological traits (resistance forms) as a proxy for climate-specific adaptive traits highlighted that habitat types (fastversus slow-flow) in different Mediterranean rivers were dominated by taxa with similar strategies to counteract climatic events.These results resonate with previous studies emphasizing the significant role of disturbances caused by large flow events and droughts in determining macroinvertebrate distribution, abundance, and recolonization [20,[79][80][81].The observed differences in resistance forms among HMUs suggest that specific combinations of biological traits reflecting adaptation to environmental variability may be present in each major group of HMUs [82].Proximity and the resulting similarity in environmental conditions likely contribute to the analogy in biological adaptations, a factor deserving attention in future studies.Notably, fast-flow HMUs accumulate a relevant part of the biodiversity and are more susceptible to drying during drought periods than slow-flow HMUs [83], but slow-flow HMUs (i.e., pools) can act as microrefugia to accumulate and conserve biodiversity during drought periods [83].Recent projections about the impact of climate change on Mediterranean rivers in Spain show that macroinvertebrate richness will largely decrease over the next few decades [84].Thus, it is important to note the key role of slow-flow habitats in understanding and mitigating climate change impacts on macroinvertebrate communities in Mediterranean regions, along with other mitigation measures such as the restoration of riverside vegetation [84].Current global change scenarios pose threats to macroinvertebrate communities; more attention needs to be paid to phenological shifts in aquatic insect emergence based on exposure and sensitivity to climate change [85] and the consequences of such phenological shifts on upper trophic levels [86].In this regard, it is reasonable to posit that resistance forms enhance population maintenance in streams given their functional importance to overcome floods and droughts in future climate scenarios [87,88].

Conclusions
A caveat should be exercised regarding conclusions, as they may suffer limitations regarding the date of sampling and not be representative of the current macroinvertebrate communities.It should be kept in mind that Mediterranean macroinvertebrate communities are dependent on environmental conditions that change temporally [89,90].This represents a particularly promising area for future research to understand whether the drivers responsible for the macroinvertebrate communities in the study area change over time as a result of climate change.Another limitation was the taxonomic resolution (family level) used in this study; deeper taxonomic analyses (genus and species level) of the macroinvertebrate communities are needed in future research.Still, this study has addressed the intricate dynamics of macroinvertebrate communities in the headwaters of Mediterranean rivers, employing meso-scale approaches to unravel the relationships between habitats, hydromorphological characteristics, and biological communities.The application of these methodologies has unveiled substantial differences in habitat attributes and macroinvertebrate communities both within and among rivers, emphasizing the necessity to account for spatial and contextual variability in future investigations.The pivotal influence of factors such as mean depth, woody debris, vegetation, and coarse and embedded substrate composition on community structure has been clearly elucidated.Furthermore, the diverse responses of macroinvertebrates to different habitat types and hydraulic conditions underscore the importance of sampling a variety of habitats for reliable community comparisons.This study has enhanced our understanding of macroinvertebrate community responses to environmental conditions in Mediterranean rivers, providing valuable insights for the sustainable management of these ecosystems amid current and future challenges, particularly in the context of climate change.

Supplementary Materials:
The following supporting information can be downloaded at: https: //www.mdpi.com/article/10.3390/su16073075/s1, Figure S1.Relative abundance of macroinvertebrates (%) aggregated by families (excluding the order Ostracoda) and river.Data are categorized on habitat types, delineated as (a) slow and (b) fast hydromorphological units (HMUs).Other families comprise taxa present in less than 5 % of the samples in any of the four rivers; Table S1.Relative abundance of macroinvertebrates (%) pooled by river.Data are displayed by habitat type (slow and fast hydromorphological units or HMUs); Table S2.Pearson correlation coefficients between biological parameters (abundance, richness and diversity indices) and environmental attributes in (a) slow and (b) fast hydromorphological units (HMUs).HMU width (Wid), mean depth (Dmed), maximum depth (Dmax), substrate coarse (Scoarse), substrate medium (Smed), substrate fine

Figure 1 .
Figure 1.Location of the study sites along the rivers Ebrón, Vallanca, Palancia, and Villahermosa with a focus on the highlighted Júcar River basin in Spain.

Figure 1 .
Figure 1.Location of the study sites along the rivers Ebrón, Vallanca, Palancia, and Villahermosa, with a focus on the highlighted Júcar River basin in Spain.

Figure 2 .
Figure 2. Principal component analysis (PCA) plot based on habitat attributes by (a) slow and (b) fast hydromorphological units (HMUs) and on macroinvertebrate communities by (c) slow and (d) fast HMUs.The figure shows the ellipse projections with a confidence interval of 75% and gravity centers grouped by rivers.

Figure 2 .
Figure 2. Principal component analysis (PCA) plot based on habitat attributes by (a) slow and (b) fast hydromorphological units (HMUs) and on macroinvertebrate communities by (c) slow and (d) fast HMUs.The figure shows the ellipse projections with a confidence interval of 75% and gravity centers grouped by rivers.

Sustainability 2024, 16 , 3075 8 of 16 Figure 3 .
Figure 3. Canonical correspondence analysis (CCA) relating macroinvertebrate community descriptors (richness, abundance, and diversity indices) and environmental attributes (width, mean depth, maximum depth, shade, embeddedness, aquatic vegetation, density of woody debris, substrate coarse, substrate medium, and substrate fine) by (a) slow and (b) fast hydromorphological units (HMUs) in the Ebrón River, (c) slow and (d) fast HMUs in the Vallanca River, (e) slow and (f) fast HMUs in the Palancia River, and (g) slow and (h) fast HMUs in the Villahermosa River.

Figure 3 .
Figure 3. Canonical correspondence analysis (CCA) relating macroinvertebrate community descriptors (richness, abundance, and diversity indices) and environmental attributes (width, mean depth, maximum depth, shade, embeddedness, aquatic vegetation, density of woody debris, substrate coarse, substrate medium, and substrate fine) by (a) slow and (b) fast hydromorphological units (HMUs) in the Ebrón River, (c) slow and (d) fast HMUs in the Vallanca River, (e) slow and (f) fast HMUs in the Palancia River, and (g) slow and (h) fast HMUs in the Villahermosa River.

Figure 4 .
Figure 4. Fuzzy principal component analysis (FPCA) plot of resistance forms.Data are displayed by (a) slow and (b) fast hydromorphological units (HMUs).Ellipses envelop weighted average o taxa positions.

Figure 4 .
Figure 4. Fuzzy principal component analysis (FPCA) plot of resistance forms.Data are displayed by (a) slow and (b) fast hydromorphological units (HMUs).Ellipses envelop weighted average of taxa positions.

Table 1 .
Habitat attributes, units, and mean values (range in parentheses) by fast and slow HMUs.