A comprehensive framework for global patterns in biodiversity