Habitat fragmentation mediates the mechanisms underlying long-term climate-driven shifts in bird community composition towards more warm-adapted species.