The genomic basis and architecture underlying local adaptation and divergence with gene flow