Global photosynthetic capacity is optimized to the environment