Historical DNA reveals climate adaptation in an endangered songbird