For the first time in the post-World War II era, cities are growing at about the same rate as their suburbs, which for decades grew at a much faster clip. That’s good news for Democrats (especially Hillary Clinton) nationally: Their party’s recent Electoral College victories have been fueled by huge vote margins in urban cores.

But presidential success may come at the expense of Democratic candidates at the congressional and state legislative levels: The increased clustering of Democratic votes in central cities has diminished the party’s fortunes in the large swath of suburban and rural seats that are crucial to building legislative majorities.

In late June, the U.S. Census Bureau released its newest population estimates for America’s 3,142 counties and county equivalents. A useful way to pick apart the data is to divide the nation’s population into roughly equal thirds:

Urban America: residents of the 103 counties that form the urban cores of the nation’s 100 most populous metropolitan statistical areas (106.1 million people) Suburban America: residents of the 499 outlying counties within the nation’s 100 most populous MSAs (106.3 million people). Rural America: residents of the 2,540 counties that don’t fall within the nation’s 100 most populous MSAs (106.3 million people).

A quick caveat: This isn’t a flawless breakdown of residential settings. For example, Portland, Maine, is a bustling metropolis by Maine standards, but because it’s not one of the nation’s top 100 metro areas or one of those areas’ suburbs, it counts as rural in this analysis. Still, the overall trend lines reveal a lot.

Suburbs have dominated the nation’s postwar growth. During the 1950s baby boom, suburban counties swelled by an average of 3.4 percent a year, about double the urban growth rate and quadruple the rural rate. In the 1970s, widespread white flight caused urban growth rates to plummet to 0.3 percent a year, lower than even the growth rate of rural counties. Cities rebounded a bit in the 1980s, but suburbs still easily led the way through the 2000s.

So far, the 2010s have flipped the script: The recession caused 20-somethings to delay moves to the suburbs, and the appeal of the urban lifestyle has flourished — trends well-documented by leading demographers like William Frey of the Brookings Institution. While suburban and rural growth has slowed considerably, growth in urban counties is slightly up and is now roughly equal to growth in suburban counties:

FiveThirtyEight’s Ben Casselman has persuasively argued that the media narrative of millennials moving to cities in droves is often overhyped. Even so, Casselman has calculated that migration of 20-somethings from cities to suburbs has slowed considerably since the 1990s. And voters between 18 and 29 years old are by far Democrats’ best age group, giving President Obama 66 percent in 2008 and 60 percent in 2012.

It’s even more useful to merge the Census Bureau’s population estimates with county-level presidential election results over time. Peering through this lens, we can see how the country has pulled apart over the past three decades, as well as the two vastly different trajectories of the parties’ geographical bases.

In 1988, Democratic presidential nominee Michael Dukakis took 52.3 percent of the vote in urban counties. He did 2.6 percentage points better in rural counties (44.2 percent) than suburban ones (41.6 percent). But in the 1990s, as many liberal urbanites migrated to the suburbs, Democrats began to perform much better there. In 1996, Bill Clinton took 51.9 percent in the suburbs, 1 percentage point better than his share in rural counties. By 2000, Al Gore did 4.4 percentage points better in suburban than rural counties.

That trend has culminated in Obama’s recent victories, which were stories of urban domination. In 2008, Obama took 64.5 percent in urban cores, 13.6 percentage points better than his suburban share and 17.8 points better than his rural share. In 2012, as suburban growth stalled, Obama’s share fell 2 percentage points in the suburbs and 2.7 points in rural areas — he lost both. But newcomers to cities helped keep Obama’s urban share steady at 64.1 percent, fueling a commanding 332-vote Electoral College victory.

So what’s driving these trends? It may be impossible to precisely parse how much of Democrats’ skyrocketing presidential vote share in cities is attributable to higher turnout, shifting attitudes among longtime residents and residential migration patterns. But to the extent that voters make a conscious choice between urban and rural settings and lifestyle preferences are increasingly correlated with partisan ones, residential migration patterns are playing a role.

A 2014 Pew Research Center study on polarization asked voters whether they would prefer to live in a community where “the houses are larger and farther apart, but schools, stores, and restaurants are several miles away” or a community where “the houses are smaller and closer to each other, but schools, stores, and restaurants are within walking distance.” Seventy-five percent of consistently conservative voters chose the larger house, while 77 percent of consistently liberal voters chose the smaller house with the higher walkability score.

Some demographers have observed that the urban resurgence has begun to subside as the economy has bounced back. But many of the urban liberal magnets crucial to Democratic presidential victories in battleground states have continued to surge in the newest population estimates — including Denver (up 2.4 percent between 2013 and 2014); Durham, North Carolina (up 2.2 percent); Orlando (up 2.1 percent); Richmond, Virginia (up 1.5 percent); and Columbus, Ohio (up 1.4 percent) — all outpacing statewide growth.

Boom times for cities have treated Democrats well at the presidential level: As the two Obama campaigns have proved, when like-minded voters live in closer proximity to one another, they tend to be easier to identify, organize, excite and turn out. In 2012, a single urban county provided Obama’s entire margin of victory in five swing states: Colorado (Denver), Florida (Miami-Dade), Nevada (Clark), Ohio (Cuyahoga) and Pennsylvania (Philadelphia).

But Democrats’ love of urban life is unwittingly hobbling the party in congressional and legislative races. Liberal newcomers to cities are most often nothing but “wasted” additional votes in safe seats where Democratic candidates are already racking up huge margins. The harsh reality for Democrats is that two-thirds of all congressional and legislative districts are in suburban and rural America. Bill Clinton carried both in 1992 and 1996, but Obama lost both in 2012. This is a big reason that Democrats have lost about 70 House seats and 910 state legislative seats, on net, since Obama took office.

Back in 1988, the suburbs voted 4.5 percentage points more Republican than the nation as a whole. In the 1990s, migration of city dwellers to the suburbs made them much more diverse and helped Democrats narrow the gap to just 2 points by 2000. But millennials’ recent pattern of delaying outward moves and the resulting suburban slowdown have stifled Democratic advancement, and in 2012, the suburbs voted 3.1 percentage points more Republican than the nation.

Meanwhile, rural America has become a lost cause for Democrats; it gave Obama just 43.9 percent in 2012. Many down-ballot Democrats hope Hillary Clinton’s coalition more closely resembles Bill Clinton’s than Obama’s. But today’s Clintons are much more Brooklyn than Arkansas, and the prevailing population trends continue to pull the two parties’ presidential and congressional fortunes in opposite directions. In fact, House Democrats could use a resettlement program.

Cook Political Report intern David Steinbach contributed research to this analysis.