Geometric and demographic effects explain contrasting fragmentation-biodiversity relationships across scales