Spatio-temporal patterns in coral reef composition and function across an altered environmental gradient: A 15-year study in the Caribbean

Coral species, which function to build the framework structure of reef ecosystems, vary across sheltered to exposed environmental gradients. For centuries, conditions in sheltered environments that impact lagoonal reefs have been altered by local anthropogenic disturbances, while conditions in exposed environments that impact forereefs have largely buffered the effects of local anthropogenic disturbances. Yet, bleaching events induced by global anthropogenic disturbances challenge how we predict changes in reef composition and function across environmental gradients. Here, we quantify spatio-temporal variation in the composition and function of 11 coral reefs across sheltered to exposed environmental conditions over 15 years and 3 bleaching events in Bocas del Toro, Panama. We find that the composition and function of lagoonal reefs and forereefs were distinct and shaped by an environmental gradient altered by anthropogenic disturbance. Lagoonal reefs lacked major reef-building species and experienced greater losses in coral species and diversity over time. Although only lagoonal reefs changed in coral species composition, both lagoonal reefs and forereefs became functionally similar over time. Our findings indicate that lagoonal reefs may be less resilient to global environmental change than forereefs due to long-term effects of local anthropogenic disturbances. Additionally, increasing global anthropogenic disturbances might lead to the homogenization of reef function, as reefs adapt to novel environmental conditions.


Introduction
Coral reefs are composed of diverse taxa that support key ecosystem processes and functions (Woodhead et al., 2019). Within coral reefs, hard coral species are the primary taxa that uphold ecosystem functioning through reef-building processes (Perry and Alvarez-Filip, 2018). Reef-building maintains the complex structure of coral reefs, which provides habitat for fish populations that support human livelihoods and protects shorelines from waves and extreme weather (Cinner, 2014). However, anthropogenic disturbances are reshaping coral reef communities worldwide, altering ecosystem processes and functions across space and time (Knowlton and Jackson, 2008;Williams and Graham, 2019). Spatially, local anthropogenic disturbances tend to affect reefs in sheltered, lagoonal environments more than reefs in exposed, forereef environments (Brown, 1997;Jackson et al., 2001;Fabricius et al., 2005;Pandolfi et al., 2005;Fabricius, 2011) with the exception of opposing patterns observed in the Florida Keys (Lirman and Fong, 2007;Gintert et al., 2018) and additional anomalous cases (van Woesik et al., 2012;Guest et al., 2016;Pizarro et al., 2017). Temporally, local anthropogenic disturbances have altered coastal environmental conditions that impact reefs, such as chlorophyll a concentration, for centuries (Bell et al., 2014), whereas global anthropogenic disturbances have only begun altering environmental conditions, such as sea surface temperature, in recent decades (Glynn, 1993). Thus, to predict and prevent the loss of key ecosystem processes, conservation strategies must be informed on how reef composition and function vary spatially and temporally across sheltered to exposed environmental gradients altered by anthropogenic disturbance.
Historically, local anthropogenic disturbances have primarily impacted coastal conditions in sheltered environments, affecting lagoonal reefs. Specifically, anthropogenic sources of effluent and runoff increase chlorophyll a concentrations and can create eutrophic conditions in sheltered environments where lagoonal reefs are found (Fabricius et al., 2005). In recent years, rising sea surface temperatures associated with global anthropogenic disturbance have induced thermal stress and frequent bleaching events across coral reefs worldwide (Hughes et al., 2018). As global anthropogenic disturbances increase, reefs that can no longer maintain reef-building processes are more susceptible to regimeshifts. In particular, coral reefs that lack key reef-building species, such as large, structurally complex, and fast-growing corals, seem unable to maintain a calcium carbonate framework and can begin to erode (Hoegh-Guldberg et al., 2017). Due to the long-term effects of local anthropogenic disturbances, major reef-building coral species may no longer dominate lagoonal reefs. Yet, there remains little understanding of how lagoonal reefs and forereefs differ in resilience to novel environmental conditions created by global anthropogenic disturbances.
Shifts in the dominance of coral species across space and time offer some insight on how conditions in sheltered versus exposed environments can affect reef response to increasing global anthropogenic disturbance (Hughes, 1994;Gardner, 2003). In the Caribbean, key reef-building corals have been progressively replaced by opportunistic or disturbance-tolerant corals, such as Agaricia and Porites that occur in small colonies (Estrada-Saldıvar et al., 2019) and typically don't fulfil the same framework-building functions as more structurally complex, fast-growing corals like Acropora (Gonzaĺez- Barrios and Álvarez-Filip, 2018). Acropora populations along the Caribbean coast of Panama first began to decrease in sheltered, lagoonal reefs, decades before outbreaks of disease and bleaching induced by rising sea surface temperatures (Aronson et al., 2004;Cramer et al., 2020). Nonetheless, populations of this reef-building coral have begun decreasing in some forereefs in more recent decades, as bleaching events increase (Brandt et al., 2003;Cramer et al., 2012). These findings indicate that changes in sheltered to exposed environmental gradients originally caused by local anthropogenic disturbances and, more recently, global anthropogenic disturbances have played a role in shaping reef community composition and function through time.
Here, we quantify spatio-temporal variation in the composition and function of 11 coral reefs along a sheltered to exposed environmental gradient altered by anthropogenic disturbance in the Bocas del Toro archipelago. Specifically, we assess how benthic cover, coral species, and coral functional traits have changed over a period of 15 years and 3 bleaching events by measuring reef community composition, as well as taxonomic and functional diversity. First, we predict that lagoonal reefs and forereefs differ in composition and function due to natural and anthropogenically-sourced differences in environmental conditions. Second, we predict that bleaching events induced by global anthropogenic disturbances occurring during our observational time series will have degraded reef composition and function over time, leading to the functional homogenization of lagoonal reefs and forereefs. Third, under the hypothesis that forereefs have been less impacted by long-term local anthropogenic disturbances, we predict greater declines in key coral species and diversity in lagoonal reefs compared to forereefs.

Study area
The Bocas del Toro archipelago, located on the Caribbean coast of Panama, consists of seven large islands fringed with mangrove forests and diverse coral reefs (Guzmań and Guevara, 1998a;Guzmań and Guevara, 1998b;Guzmań and Guevara, 1999;Guzmań and Guevara, 2001;Schloder et al., 2013). The two main bodies of water within the archipelago are the ChiriquıĹ agoon and Almirante Bay. These bodies of water are surrounded by land and northern reef barriers, which reduce the influence of wind, tide and surf. Reefs in the sheltered waters of Chiriquı́Lagoon and Almirante Bay are exposed to marginal conditions associated with higher concentrations of nutrients, chlorophyll a, and zooplankton compared to reefs in more exposed environments (Bak and Meesters, 2000;Guzmań and Guevara, 2001;D'Croz et al., 2005). Additional nearshore nutrient enrichment has been attributed to effluent and runoff generated by coastal towns and agricultural activity (Cramer, 2013). In particular, the Chiriquı́Lagoon incurs higher amounts of coastal runoff and maintains a relatively low flushing rate compared to Almirante Bay (Kwiecinski and Chial, 1984). Consequently, mixing between nutrient-rich freshwater and oceanic water within the archipelago varies across an environmental gradient altered by anthropogenic disturbance, along which sheltered lagoonal reefs are affected by nutrient-rich and eutrophic conditions more than exposed forereefs, which are well-flushed (D'Croz et al., 2005;Kaufmann and Thompson, 2005;Seemann et al., 2014). Due to differences in nearshore conditions, reefs in Almirante Bay can be found up to a maximum depth of around 23 m (Guzman and Guevara 1998a), whereas reef growth in the Chiriquı́Lagoon is limited (O'Dea et al., 2007). Coral reefs within the archipelago have more recently been impacted by bleaching induced by high thermal stress prior to our study, in 1989-90 (Glynn, 1991), and during our study, in 1998-99, 2005(Eakin et al., 2010.

Reef community data
We collected reef community data through the Smithsonian Tropical Research Institute's Panama Coral Reef Monitoring Network, which monitored coral reefs across Bocas del Toro using underwater visual surveys once a year from 1999 to 2013. In 2008, the Monitoring Network increased the number of reefs surveyed each year from 6 to 11 due to additional monitoring capacity (Supplementary Material; Guzmań and Guevara, 1998a;Guzmań and Guevara, 1998b;Guzmań and Guevara, 1999;Guzmań and Guevara, 2001). Survey sites (n = 11) were selected based on the presence of reef structure and established across the variable geographic contexts within the archipelago, encompassing both lagoonal reefs (n = 7) and forereefs (n = 4). Each survey measured benthic % cover within ten 1 m 2 quadrats positioned along the shoreward side of 10 meter transects. At each reef, 2 to 5 depth zones were randomly selected parallel to the shore (Supplementary Table S1). Three belt transects were permanently laid 10 meters apart within each depth zone and positioned parallel to the shore. In total, six to fifteen transects were established at each reef.
To separately assess variation in benthic cover and coral species among reef communities in Bocas del Toro, we compiled two datasets of benthic cover: one containing estimates of all forms of benthic cover (158 cover types), and the second containing estimates of only hard coral species cover (46 coral species). In each dataset, cover estimates were summed across replicate transects and depth zones for every reef site (n = 11) and year (n = 6 or 15) to capture variation in species abundances, as sampling effort (area surveyed) was equal within and across depth zones, reef sites, and years. To differentiate reef community composition, we log 10 (x + 1) transformed each table and calculated Bray-Curtis dissimilarity matrices.

Functional trait data
To assess functional variation among reef communities in Bocas del Toro, we quantified 10 coral traits based on ecosystem function, including species' typical growth form, maximum colony diameter, maximum corallite width, growth rate, larval development strategy, sexual system, water clarity preference, wave exposure preference, upper depth limit, and depth range (Supplementary Table S2). We collected coral trait measurements from the Coral Trait Database (Madin et al., 2016). Specifically, we collected fixed trait measurements for each coral species, rather than each coral colony, to evaluate community-level rather than population-level dynamics. We filled in missing trait values based on new searches of specieslevel traits in the published and grey (report and field guide) literature, as well as multivariate phylogenetic imputation methods to estimate 35 missing trait values, or 7.6% of all trait values or categories (Supplementary Material;Huang and Roy, 2015;Goolsby et al., 2017).
To summarize the functional composition of each reef community in Bocas del Toro, we calculated communityweighted mean (CWM) trait values across all reefs and years. For continuous traits, we calculated CWMs as the mean trait value of all coral species present in the community (after excluding species with missing values), weighted by their relative cover. For categorical traits, we calculated CWMs as the proportional cover of species with each trait category. We then compiled CWMs of every trait for each reef community (n = 11) and year (n = 6 or 15). The CWMs of each trait were then standardized by subtracting the mean trait value and dividing by the standard deviation across all years and sites.

Environmental data
We collected data on environmental variables that shape reefs along sheltered to exposed environmental gradients, including exposure, depth, chlorophyll a concentration, sea surface temperature, and turbidity, at each reef and across all years in Bocas del Toro. As much of the variation in these environmental conditions can be attributed to synergies between anthropogenic and natural factors, we do not attempt to parse variables based on these criteria. Environmental values were calculated as the annual average (1999)(2000)(2001)(2002)(2003)(2004)(2005)(2006)(2007)(2008)(2009)(2010)(2011)(2012)(2013) at each site. We used sea surface temperature measurements to account for the 3 bleaching events that occurred in 2005, and 2010 (Supplementary Figure S1). We primarily obtained measurements from satellite imagery, including chlorophyll a concentration at a 4 km resolution (Copernicus-GlobColour; Garnesson et al., 2019), sea surface temperature at a 5 km resolution (NOAA Coral Reef Watch, 2018), and turbidity at a 4 km resolution (Copernicus-GlobColour; Gohin, 2011). We calculated wind exposure in R and Google Earth Pro as the fetch at each reef. Specifically, we averaged fetch vectors, representing the unobstructed length of water over which wind can intersect a site, for each reef. Depth (m) was measured in situ for each quadrat during benthic surveys using a depth (pressure) gauge. To adjust for any minor variation in measurements related to pressure, we averaged depth within sites and across years. We standardized all environmental data by scaling values to zero mean and unit variance prior to analysis (Borcard et al., 2018).

Spatial analyses
We distinguished reefs across the archipelago based on community composition and function via k-means clustering, which delineates clusters by identifying high-density regions within the data (Borcard et al., 2018). We used Bray-Curtis distance to cluster reef communities based on benthic and coral species cover averaged across all years, and Euclidean distance to cluster reef communities based on trait values averaged across all years. Hereafter, we refer to these clusters as reef type.
To assess spatial variation in reef community composition, we applied Principal Coordinate Analyses (PCoA) to the dissimilarity matrices of benthic cover and coral species within each of the 11 reef communities during every year from 1999 to 2013, correcting for negative eigenvalues using Lingoes correction (Gower and Legendre, 1986). To assess spatial variation in reef community function, we also applied a Multiple Factor Analysis (MFA) to the standardized CWMs of coral traits within each of the reef communities during every year. In contrast to other ordination methods, MFA can equally weight groups of categorical and continuous traits (McLean et al., 2019). To characterize the dominant benthic cover, coral species, and coral traits in reef communities, we extracted the top scores of each along the first PCoA and MFA axes. We evaluated how reef types distribute along these axes to approximate spatial variation in community composition.
To determine how altered environmental conditions shape reef community composition, we applied a distance-based redundancy analysis (dbRDA) to the Bray-Curtis dissimilarity matrices of benthic cover and coral species within each of the reef communities during every year. Each dbRDA was constrained by exposure, depth, chlorophyll a concentration, sea surface temperature, and turbidity. We used a distance-based method to accommodate reef community data with many zeros. Similarly, to assess how altered environmental conditions shape reef community function, we applied an RDA to trait CWMs using Euclidean distance. We used forward model selection (function ordiR2step) based on adjusted R 2 values. To further assess variation in reef community composition as explained by environmental thresholds across the archipelago, we also applied multivariate regression trees to our data (De'Ath 2002; Supplementary Figure S2).

Temporal analyses
To assess whether anthropogenically-altered environmental conditions shape reef composition and function across time, we modelled the first PCoA and MFA axes scores of reef communities against time. Specifically, we fit mixed-effects linear models with reef communities nested in reef type as random effects on the intercept to community composition of benthic cover, coral species and coral traits along the 1 st PCoA or MFA axis from 1999 to 2013. Specifically, community composition was defined as the score of each site along these axes, which changed through time. Next, we tested whether trends were significantly different between reef types using likelihood ratio (chi-square) tests to compare models with (community composition~year * reef type + [1|reef type/reef community]) and without (community composition~year + reef type + [1|reef type/reef community]) an interaction term between time and reef type. We similarly fit mixed-effects linear models to second axis PCoA and MFA axes scores (Supplementary Figure S3). Our models allowed the intercept to change for each reef community, which are nested in reef type, to account for variation in the length of timeseries.
To further evaluate how reef composition and function changed, we then quantified shifts in the relative dominance of benthic cover, coral species, and coral traits, using partial dbRDAs and RDAs. We applied partial dbRDAs and RDAs to each reef type with spatial variation conditioned out to detect temporal variation in dominance. We then extracted the top scores of benthic cover, coral species, and coral traits along the first partial dbRDA and RDA axes. Temporal analyses were mainly limited to the last 6 years of monitoring, as surveying began in 2008 for 5 reefs. However, similar patterns in temporal variation were observed among the reefs surveyed across the entire time series from 1999 to 2013 (Supplementary Table S3).
To track how reef diversity changed over time, we fit mixedeffects linear models to the taxonomic diversity of coral species and functional diversity of coral traits as a function of time from 1999 to 2013 (using function Rao;Borcard et al., 2018). These diversity indices were calculated using the quadratic diversity index Q (Rao, 1982), or the summed dissimilarities between all species pairs weighted by the product of species proportions. Q measured as taxonomic diversity reduces to inverse Simpson diversity N 2 . When measured as functional diversity, Q is computed using dissimilarities between functional traits rather than species. In our models of taxonomic and functional diversity, we used reef communities nested in reef type as random effects on the slope and intercept. We tested whether trends were significantly different between reef types using likelihood ratio (chi-square) tests to compare models with (diversity~year * reef type + [reef type|reef type/reef community]) and without (diversity~year + reef type + [reef type|reef type/reef community]) an interaction term between time and reef type. Nested terms similarly accounted for variation in the length of timeseries.

Spatial variation in reef communities
Two groups of reef communities formed from k-means clustering: lagoonal reefs and forereefs (Figure 1). Groupings differed for the reef community at Zapatilla Oeste (Z), which was grouped with forereefs when clustered based on benthic cover and coral species, but grouped with lagoonal reefs when clustered based on coral traits. Consequently, we continued to categorize Zapatilla Oeste as a forereef for the remaining analyses.
Two spatially distinct groups of lagoonal reef and forereef communities emerged along the first axes of both PCoA analyses, which captured 17.5% of variation in benthic cover and 16.2% of variation in coral species, respectively. Similarly, the first axis of the MFA mostly distinguished lagoonal reefs and forereefs, capturing 32.5% of variation in coral traits (Figure 2). Lagoonal reefs and forereefs were thus dominated by different benthic cover (Figures 2A, D), coral species ( Figures 2B, E), and coral traits (Figures 2C, F). Lagoonal reefs were dominated by gonochoric corals that brood, including Porites furcata (see leftmost column in Table 1; top PCoA coral species and MFA trait scores). Zoanthids, sponges and sand also dominated lagoonal reefs (top PCoA benthic scores). Conversely, forereefs were primarily dominated by large, hermaphroditic corals that spawn, including Acropora palmata, Orbicella faveolata, and Pseudodiploria strigosa (top PCoA coral species and MFA trait scores). Crustose algae and other non-coral species also dominated forereefs (top PCoA benthic scores). Although both PCoAs and MFA were applied to all benthic cover, coral species and coral traits, we report the top % of scores to simplify the presentation of our results. As the number of benthic cover types (n = 158), coral species (n = 46), and coral traits (n = 10) varied, we present the top 10% of benthic cover, top 15% of coral species, and top 30% of coral traits.
Lagoonal reefs and forereefs in the Bocas del Toro archipelago occur along an environmental gradient of exposure, depth, chlorophyll a concentration, sea surface temperature, and turbidity, which significantly explained variation in benthic cover ( Figure 3A; dbRDA: R 2 adj = 0.23, p <.001), coral species ( Figure 3B; dbRDA: R 2 adj = 0.22, p <.001), and coral traits ( Figure 3C; RDA: R 2 adj = 0.32, p <.001). Lagoonal reefs tend to be deeper (on average) and higher in chlorophyll a concentration. Conversely, forereefs tend to be more turbid and exposed to wind and waves. Sea surface temperature broadly affected reefs across the archipelago (Figure 3).

Temporal variation in reef communities
Temporal trends in reef composition varied between benthic cover ( Figure 2G), coral species ( Figure 2H), and coral traits ( Figure 2I). Community composition of benthic cover, as defined by the first PCoA axis, did not change significantly over time in either lagoonal reefs (ß = 0.0092, SE = 0.008, p >.05) or forereefs (ß = -0.013, SE = 0.007, p >.05). Community composition of coral species, as defined by the first PCoA axis, Variation in reef community composition and function across space and time. Colouring shows two spatially distinct types of reef communities differentiated by benthic cover (A, D, G), coral species (B, E, H), and coral traits (C, F, I). Each point represents one of 11 reef communities in a given year. PCoA and MFA biplots show variation in all communities across all years (A-C) and the species most associated (D-F). Coloured ellipses highlight the reef type associated with each species or trait. Timeplots show temporal variation in community composition along the first PCoA and MFA axes (G-I). Black lines represent the predicted trends and coloured bands represent standard error. Grey dashed lines mark the years during which bleaching events occurred in Bocas del Toro. Asterisks mark significant trends (*p <.05; **p <.01; ***p <.001). Letters represent reef locations and mark community composition in 2013. changed significantly over time in lagoonal reefs (ß = -0.013, SE = 0.005, p <.05), but not in forereefs (ß = -0.00058, SE = 0.005, p >.05). By contrast, community composition of coral traits, as defined by the first MFA axis, changed significantly over time in both lagoonal reefs (ß =0.14, SE =0.031, p <.001) and forereefs (ß =-0.077, SE =0.028, p <.01). Lagoonal reefs and forereefs showed significantly different temporal trends in community composition of coral species (X 2 = 5.92, df = 1, Increasing and decreasing benthic cover, coral species, and traits shown are those with highest loading scores in the temporal dbRDA and RDA ordination spaces. Analyses were conducted on the entire dataset, but as n benthic cover, coral species, and coral traits differed, we report the top 10% of benthic cover, top 15% of coral species, and top 30% of coral traits separately for lagoonal reefs and forereefs to simplify the table. See Table S4 for the top 30% of all scores.

FIGURE 3
Environmental conditions that drive variation in reef community composition and function across space and time. Colouring within each RDA triplot differentiates lagoonal reef and forereef communities of benthic cover (A), the coral species (B), and coral traits (C). Points represent each of 11 reef communities in Bocas del Toro every year of monitoring. Arrows show the loading of environmental variables that explain variation within and between reef communities. Letters represent reef locations and mark community composition in 2013.
p<.05) and coral traits (X 2 = 19.7, df = 1, p <.001). Notably, the composition of lagoonal reefs and forereefs converged towards similar coral traits over time and across 3 bleaching events ( Figure 2I). Different benthic cover, coral species, and coral traits increasingly dominated lagoonal reefs and forereefs from 2008 to 2013 (see two rightmost columns in Table 1; Figure S4). In lagoonal reef communities, the relative cover of rubble and algae, as well as species of sea anemones and sponges, increased over time (top partial dbRDA benthic cover scores). Conversely, in forereef communities, the relative cover of macroalgae, turf algae, crustose coralline algae, as well as encrusting and massive coral species, such as Orbicella faveolata, increased over time (top partial dbRDA benthic cover scores). Both forereef and lagoonal reef communities became increasingly dominated by similar coral traits associated with reef framework accretion, competitive ability, and broad environmental tolerance (top partial RDA coral trait scores).
Here, we similarly present the top 10% of benthic cover, top 15% of coral species, and top 30% of coral traits for simplicity.
Taxonomic diversity of coral species declined significantly in both lagoonal reefs ( Figure 4A; ß = -0.0015, SE = 0.0007, p <.05) and forereefs (ß = -0.0012, SE = 0.0006, p <.05). Conversely, functional diversity of coral traits declined significantly in only lagoonal reefs ( Figure 4B; ß = -0.0023, SE = 0.0006, p <.001). The slope of functional diversity decline in forereefs was not statistically different from zero (ß = -0.00046, SE = 0.0005, p >.05). Lagoonal reefs and forereefs showed significantly different temporal trends in taxonomic diversity (X 2 = 4.91, df = 1, p <.05) and functional diversity (X 2 = 15.5, df = 1, p <.001). Notably, diversity declined more rapidly in lagoonal reefs than forereefs. Specifically, taxonomic diversity declined 1.25x faster and functional diversity declined 5x faster in lagoonal reefs compared to forereefs ( Figure 4B). However, we note that data series were shorter and more variable for most forereef communities. Change in reef community diversity over time. Temporal change in lagoonal reef and forereef taxonomic, or coral species, diversity (A) and functional, or coral trait, diversity (B). Black lines show the predicted trend, coloured lines show the observed trends of individual reef communities and coloured bands represent standard error. Grey, dashed lines mark the years during which bleaching events occurred in Bocas del Toro. Asterisks mark significant trends (*p <.05; ***p <.001). Letters represent reef locations and mark community diversity in 2013.

Discussion
Our findings reveal how reef composition and function vary spatially and temporally across natural environmental gradients altered by anthropogenic disturbance. We found that reefs in Bocas del Toro were shaped by altered environmental conditions in three ways that were consistent with our predictions. First, we found that reefs fall into two main groups based on composition and function (Figures 1, 2). These compositional differences track a combination of natural and anthropogenically-sourced environmental variation in exposure, depth, chlorophyll a concentration, sea surface temperature, and turbidity ( Figure 3). Second, we found that functional traits in lagoonal reefs and forereefs became increasingly homogenous over time ( Figure 2; Table 1). Third, despite convergence towards similar coral traits, lagoonal reefs experienced greater declines in the relative cover of key coral species and diversity (5x greater) than forereefs ( Figure 4; Table 1), which was consistent with our hypothesis that forereefs were less impacted by long-term local anthropogenic disturbances and are thus more resilient to the effects of global anthropogenic disturbances.
Reef composition and function across the study region varied largely as a function of environmental conditions that were likely altered by anthropogenic disturbances. Lagoonal reefs were associated with high concentrations of chlorophyll a, which could indicate that reef development in sheltered environments has been limited by natural or anthropogenic sources of nutrient enrichment. Specifically, effluent and runoff tend to accumulate in sheltered environments and create eutrophic conditions (Fabricius, 2011). Natural runoff from the mountains surrounding Almirante Bay and the Chiriqui Lagoon, as well as local anthropogenic disturbances, have long contributed to the marginal environmental conditions in the archipelago thought to limit lagoonal reef development (Bak and Meesters, 2000;Guzmań and Guevara, 2001;Schloder et al., 2013). Conversely, forereefs were associated with high exposure and low concentrations of chlorophyll a, which could indicate that reefs in exposed environments are flushed by waves that inhibit the accumulation of effluent and runoff (Fabricius et al., 2005). Additionally, the extended distance, or geographic isolation, of forereefs from sources of effluent and runoff may limit the effects of local anthropogenic disturbances and natural orographic conditions (Cinner et al., 2018), enabling more rapid recovery from bleaching events induced by global anthropogenic disturbances.
In contrast to forereefs, lagoonal reef composition and function was indicative of long-term anthropogenic disturbance along the coast. Specifically, lagoonal reefs were dom inated by traits associ at ed with spec ies that opportunistically colonize disturbed environments, such as Porites furcata, as well as disturbance-tolerant species, such as Stephanocoenia intersepta (Darling et al., 2012). Conversely, forereefs were mainly dominated by traits associated with species characteristic of unaltered environments, including key reef-builders like Acropora palmata. The persistence of A. palmata in forereefs is consistent with paleoecological evidence that showed declines in A. palmata among sheltered reefs in Bocas del Toro prior to the 1960s, and in some exposed reefs following the 1960s (Guzmań and Guevara, 2001;Cramer et al., 2020). These findings suggest that lagoonal reefs cannot maintain reef-building processes upheld by large, structurally complex, and fast-growing species like A. palmata. Thus, based on community composition, we predict that lagoonal reefs are more susceptible to erosion and regime-shifts than forereefs, particularly as bleaching events increase.
Consistent with our predictions based on community composition, temporal trends over three bleaching events revealed that lagoonal reefs were more vulnerable to regimeshifts than forereefs. The composition of coral species in lagoonal reefs changed over time, while forereefs remained relatively stable. Additionally, taxonomic and functional diversity declined more rapidly in lagoonal reefs than in forereefs. In fact, a shift in dominance away from all coral species occurred in lagoonal reefs, which were becoming increasingly characterized by rubble and algae. In contrast, some reef-building corals, such as Orbicella faveolata, were increasingly dominant in forereefs, which were also becoming characterized by algae and other benthic cover. Similar discrepancies between reef types have been noted in the Mexican Caribbean, where coral cover declined drastically in lagoonal reefs, but remained constant in forereefs (Estrada-Saldıvar et al., 2019). Although our findings indicate that lagoonal reefs are degrading faster under chronic thermal stress, both lagoonal reefs and forereefs could be susceptible to regime-shifts towards algal-dominated states, as macroalgae and turf algae have begun to replace coral species and other benthic cover across the archipelago.
Lagoonal reefs may have experienced greater declines in relative coral cover and diversity compared to forereefs due to associated environmental conditions that can amplify the effects of increasing global anthropogenic disturbances. Results from previous research conducted within the archipelago are consistent with this interpretation. For example, a recent study conducted in Bocas del Toro during the 2005 bleaching event detected a density-driven temperature inversion at a lagoonal reef, augmenting stress and bleaching at greater depths (Neal et al., 2014). This suggests depth may not provide a refuge from thermal stress and may even contribute to greater coral mortality and bleaching. As such, lagoonal reefs in Bocas del Toro, which also tend to be deeper, may experience greater thermal stress and bleaching than forereefs along a sheltered to exposed gradient. Another study conducted within the archipelago found that runoff containing agrochemicals (Guzmań and Jimeńez, 1992;Guzmań and Garcıá, 2002) have created hypoxic, or "dead", zones in lagoonal areas with low circulation in Almirante Bay, resulting in greater coral mortality and bleaching than previously expected (Altieri et al., 2017). The most recent recorded hypoxic event coincided with the 2010 bleaching event, affecting lagoonal reefs within the archipelago. Thus, lagoonal reefs likely experienced greater temporal change than forereefs due to the concentrated effects of both local and global anthropogenic disturbances in sheltered waters.
While only lagoonal reefs experienced change in coral species composition, both lagoonal reefs and forereefs became more functionally similar over time. Specifically, lagoonal reefs and forereefs converged towards traits associated with opportunistic and disturbance-tolerant or generalist coral species. We note that trait values and categories used in the calculation of CWMs were species-level estimates that did not change within individuals or populations, but rather with the cover of associated coral species. Since traits can be rare or redundant among coral species, quantifying changes in the community composition of species-level traits can reveal functional changes that would otherwise go undetected (McClean et al., 2019). Thus, we may detect trends in coral trait composition, rather than coral species composition, due to declines in a few rare coral species with unique trait values, affecting trait diversity without causing considerable changes in species composition (Mouillot et al., 2013;Violle et al., 2017).
Despite the apparent influence of an environmental gradient and proximity to local anthropogenic disturbance within the Bocas del Toro archipelago and many reefs globally (Bryant et al., 1998;Burke and Maidens, 2004;Wilkinson, 2004), multiple studies within the Florida Keys (Lirman and Fong, 2007;Gintert et al., 2018), Singapore (Guest et al., 2016), Palau (van Woesik et al., 2012, Miami (Rubin et al., 2021), Colombia (Pizarro et al., 2017), and the Great Barrier Reef (Morgan et al., 2017) have observed unanticipated resilience among lagoonal reefs when compared to forereefs. Resilience among marginal, lagoonal reefs subject to poor water quality and fluctuating sea surface temperatures has been largely attributed to diverse coral community composition, acclimation or adaptation through repeated exposure to high temperatures, vertical growth patterns, thermotolerant symbionts, heterotrophy, and reduced irradiance caused by turbid conditions (McClanahan and Maina, 2003;Wagner et al., 2010;Manzello et al., 2019). Therefore, environmental conditions that are often considered unfavorable may act to buffer the effects of climate change on coral reef communities until a threshold is surpassed. However, similarities can be drawn between resilience in both lagoonal reefs and forereefs. Consistent with our findings showing increased O. faveolata dominance among more resilient forereefs, O. faveolata survivorship has comparably supported the persistence of Atlantic or Caribbean lagoonal reefs in several cases (Pizarro et al., 2017;Gintert et al., 2018;Manzello et al., 2019). As a generalist species compatible with thermotolerant symbionts, O. faveolata, although slow-growing, may help maintain carbonate production in both lagoonal reefs and forereefs under recurring thermal stress.
In Bocas del Toro, Specialist species with unique functional roles were likely replaced by opportunistic and generalist species, as disturbance tends to favor fewer generalist species that can tolerate or adapt to new conditions and thus competitively dominate the ecosystem (Clavel et al., 2011;Darling et al., 2012;Alvarez-Filip et al., 2015). Generalist species like Orbicella faveolata, which increasingly dominated forereefs, can acclimate to novel environmental conditions created by high sea surface temperatures (Grottoli, 2014). In fact, Orbicella sp., demonstrated a positive acclimative response during the 2010 bleaching event in Bocas del Toro due to prior thermal stress in 2005 (Neal et al., 2017). Shifts towards slow-growing, disturbance-tolerant or generalist coral species and subsequently low-relief, opportunistic coral species have occurred in reefs across the Caribbean (Green et al., 2008;Estrada-Saldıvar et al., 2019), leading to a reduction in reef-building processes typically upheld by larger and more structurally complex coral species. Nonetheless, strong survivorship among some Orbicella sp. could support reef-building processes in reefs that would otherwise rapidly degrade. Conservation efforts should be directed toward preventing further shifts in dominance towards low-relief, opportunistic coral species, as expanding evidence suggests that these simplified or homogenized communities cannot maintain key ecosystem functions and services (Hughes et al., 2018).
Our temporal analyses were limited by variation in time series length, as only a subset of 6 reefs were surveyed from 1999 to 2013, whereas all 11 reefs were monitored from 2008 to 2013. Additionally, we note that the Caribbean-wide 1989-90 and 1998-99 bleaching events occurred before and during our study. Prior impacts of high thermal stress on coral community composition may have impacted the baseline data collected for our study and, thus, temporal trends in our analyses. Nevertheless, our analyses provide evidence that reef response to thermal stress induced by global anthropogenic disturbances depends largely on preceding environmental conditions and the residual impacts of local anthropogenic disturbances, which vary spatially. Temporally, we also provide evidence that reef function may homogenize as sea surface temperatures continue to rise. Multiscale management strategies that account for pre-existing conditions and prior disturbance are better equipped to ensure the persistence of coral reef processes and functions upon which many livelihoods depend.

Data availability statement
All datasets are available as Supplementary Material with the exception of the benthic cover data, which will be provided upon request, but are not shared publicly due to sensitivities in the data about the locations of endangered coral species. Phylogenetic data used for analysis is publicly available via the Dryad Digital Repository (http://dx.doi.org/10.5061/dryad. 178n3; Huang and Roy, 2015).

Author contributions
The study was developed by JB under the supervision of JS and HG. All coral reef monitoring data was collected by HG and assistant Carlos Guevara. Data analyses were designed and performed by JB with guidance from JS. Manuscript text was written by JB with input from JS and HG. JB prepared all figures and supplementary materials with counsel from JS and HG. All authors contributed to the article and approved the submitted version.