How does environmental variability drive macroecological patterns of diversity in marine and terrestrial systems?