The role of local and regional processes on population synchrony along the gradients of habitat specialization