Linking environmental heterogeneity and reproductive success at single-cell resolution