Lanae Erickson Hatalsky is vice president of social policy and politics and Jim Kessler is senior vice president for policy at Third Way, a centrist think tank.

It wasn’t supposed to be this way. Instead of holding a record-low number of elected offices at the federal, state and local levels, Democrats were supposed to have unshakable majorities. Instead of relying on a handful of “blue wall” states in the upper Midwest to preserve Democrats’ electoral college advantage, the party was supposed to expand into territory once held by Republicans. Among Democrats, it became common wisdom that a “rising American electorate” of nonwhite voters, millennials and single women would mean long-term Democratic majorities.

But since the halcyon days of 2009, Democrats have lost one-fifth of their Senate seats, one-quarter of their House seats, nearly half of their governors and more than half of the state legislative bodies they once controlled. The Trump win was the final, not the first, indignity.

Why did changing demographics not lead to electoral destiny for Democrats? Our report out this month provides several answers, starting with the fact that demographic change isn’t evenly dispersed. In our system of place-based government, unless millennials move to the rural South or the growing Latino population settles in equal measure across the Rust Belt, demography will take a long time. Take the U.S. House. Going into the 2016 cycle, the 159 House districts deemed safely Democratic by the nonpartisan Cook Political Report are already majority-minority. (The average is 45 percent white.) The 90 swing districts are 70 percent white — much closer to the breakdown in safe Republican districts, which number 186 and are 75 percent white on average.

(Sarah Parnass/The Washington Post)

The Senate is even more daunting, where 23 not very diverse states with 46 seats skew red, compared with only 13 states with 26 seats that cater blue. And despite Hillary Clinton’s popular-vote victory, Donald Trump won about 2,600 counties while she won 489. That might have been enough to keep the electoral college tally close, but it’s also a recipe for losing pretty much everything down ballot. So while national demographic numbers may continue to shift relatively quickly, they won’t significantly affect electoral outcomes if the changes are concentrated in the same cities and counties that already go blue.

“Demography equals destiny” also presumes voters are static beings with unwavering ideologies and consistent voting behavior. But voters aren’t merely reflections of their demographic characteristics, and it’s insulting to treat them that way. Young voters and voters of color aren’t monolithic liberal blocs who will always and reflexively support Democrats. As noted in our report, 44 percent of millennials call themselves independents and only 30 percent are liberals. Among Latinos, 37 percent are Independents and only 28 percent liberals. That means 7 in 10 within these rising American electorate groups consider themselves moderate or even conservative.

That is why we sometimes see dramatic shifts in voting. Independent voters went for Democrats by 17 points in 2006 then supported Republicans by 18 points just four years later. This changeability is evident at the presidential level as well. While Clinton won basically the same number of voters as President Barack Obama did in 2012 (both just under 66 million), there was tremendous voter volatility underneath the surface. A stunning 403 counties that voted for Obama at least once flipped to Trump. In 28 states, the margin of victory for either Trump or Clinton moved decisively from 2012 — by five points or more. Clinton actually outperformed Obama by more than 1 million votes in New York, Massachusetts and California and underperformed him by 3 million votes everywhere else. These are not the presumptively partisan decisions of an electorate driven to vote based on static demographic characteristics. They are the messy result of a push and pull with voters of all demographic stripes who aren’t in the bag for either side.

Democrats need to dig themselves out of a big hole from state legislative races on up, and it starts by treating voters as more than a check box on a census form. It will require building a big-tent coalition based on values and experiences, not just demographic groups, and rethinking the party’s pitch and policies to respond to the needs and concerns of Americans across the country, not just in cities and on coasts. Only if the Democratic Party can transform itself to meet those goals will it be ready to counter Trump and his noxious, dangerous strain of right-wing populism over the long term.