Political parties use gerrymandering to counteract shifting voter preferences in key battleground states