Madeleine Dean, a candidate for Congress, talks to voter Bisa Bullock in Norristown, Pa. (David Weigel/The Washington Post)

Pennsylvania was President Trump’s proudest conquest in 2016, a state no Republican had won in a presidential election for nearly three decades and a victory he is still talking about.

But in both suburbs and rural areas this year, Democrats are mounting a comeback with implications not only for November’s midterm elections but the 2020 presidential race — just as soon as they settle Tuesday’s messy primaries.

The contests, the first based on a congressional map drawn by the state’s Supreme Court, are a collection of rowdy ideological battles between Democrats running on universal Medicare, a $15 minimum wage, and whether to make college free or just cheaper. Democrats see the state as the launchpad for their party’s comeback.

“There’s a historic groundswell happening here,” said Madeleine Dean, a state legislator who is running for a U.S. House seat from suburban Philadelphia. “In 2016, I kept hearing people say stuff like, ‘The Democrats have forgotten us.’ I didn’t think that was the truth, but I kept hearing it. And we’re not going back to that.”

Of all Trump’s Rust Belt state wins, Pennsylvania was the most stunning, with the Republican prevailing by 0.7 percent despite the state’s long-standing Democratic tilt and repeated campaign appearances by Hillary Clinton, President Barack Obama and native son Vice President Joe Biden. Trump capitalized on his strength in rural areas to edge out Clinton, who got more votes than Trump in the cities and suburbs but fewer than Democrats had expected.

Now Democrats are counting on Pennsylvania to ensure another term for Gov. Tom Wolf and Sen. Robert P. Casey Jr. and to deliver a chunk of the 23 seats they need to net for the House majority.

Scott Wallace, center, a candidate for Congress, poses with voters in Morrisville, Pa. (David Weigel/The Washington Post)

Two Republican districts in the Philadelphia area have effectively been ceded to Democrats with the surprise retirement of Rep. Ryan Costello (R), the resignation of Rep. Patrick Meehan (R) and lines that made each district bluer.

Two more districts are seen as competitive — a Bucks County seat represented by Rep. Brian Fitzpatrick (R), and the Allentown-area seat vacated last week by former Rep. Charlie Dent (R).

In each race, Democrats believe they’re seeing the enthusiasm that did not materialize for Clinton. On Friday in Norristown, Dean encountered a woman who was fearful that Trump ripping up the Iran nuclear deal would lead to world war and a retired schools superintendent who was unhappy with parking on his street by people who “aren’t even here legally” but asked the campaign for a yard sign.

“I like her because she’s a Democrat,” explained Ray Raglund, 60. He is worried that total Republican control of Washington will put Medicare at risk. “I’ll give them their kudos: They put the party before the individual. They don’t like Trump, but they do whatever he says.”

Republicans, who held 13 of 18 House seats from Pennsylvania last year, have acknowledged this new map’s challenge, with the National Republican Congressional Committee reserving $7.8 million in Philadelphia-area advertising. While the party hopes that Democrats weaken each other in competitive primaries, the likely GOP nominees in the open seats around Philadelphia have, on average, just $100,000 on hand for the general election. (Fitzpatrick, the only incumbent, has $1.3 million.)

Pennsylvania lifted Democratic spirits in March when Conor Lamb grabbed a GOP-held seat in the Pittsburgh suburbs. Few states in this cycle offer so many additional pickup opportunities. For Democrats, that means competitive primaries all over the state.

In Fitzpatrick’s district, a wealthy liberal donor, Scott Wallace, faces a veteran who only recently became a Democrat, Rachel Reddick. The race for the Democratic nomination to replace Dent has become a three-way fight between a conservative district attorney and two liberals — one backed by Emily’s List, the other by Sen. Bernie Sanders (I-Vt.).

Wallace said that he would run against Fitzpatrick’s support for the 2017 tax cut law.

“He’s on the Republican team, which is all about the 1 percent, Wall Street and corporate tax cuts,” he said after a Friday meet-and-greet. “The idea of a corporate tax cut to be more competitive with other countries made sense. But what they did was deliver a huge tax cut without getting rid of the loopholes.”

While looking ahead, Democrats also offer opinions on what went wrong in 2016.

Molly Sheehan, a candidate in the new Delaware County district, said the Clinton campaign “didn’t engage the grass roots.” She had offered to register voters at the University of Pennsylvania and was told to canvass in south Philadelphia instead.

“Hillary stopped talking about jobs in the final weeks of the campaign,” said Joe Hoeffel, a former congressman who came out of retirement to compete against Dean. “I remember turning to my wife and asking: ‘What is she doing?’ Democrats were put on this Earth to talk about jobs and the little guy. We may not always do it well, but that’s what we do. And she kept attacking Trump’s character! Well, people had already made their decision on Trump’s character.”

Clinton’s Pennsylvania strategy focused on suburban Republicans who were uncomfortable with Trump but not yet ready to support her.

With Clinton gone, Pennsylvania Democrats believe that what should have happened in 2016 is happening now.

In 2017, the party surged in local elections, flipping Republican-held offices in the counties around Philadelphia.

The 2016 defeat also spawned scores of new grass-roots groups, from Reclaim Philadelphia in the city to Lancaster Stands Up in a conservative county just west of the suburbs.

Those groups, and many like them, have split their work between electioneering and voter persuasion, the sort of neighbor-to-neighbor conversations that they say Clinton’s campaign failed to engage in. In a Lancaster-based district that strongly backed Trump for president, nonprofit leader Jess King has managed to stay roughly even in fundraising with Rep. Lloyd Smucker (R).

King has argued that grass-roots campaigning can convert voters who have been disappointed by the president. “We’re winning over Republicans who are fed up with the status quo,” she said last week.

In interviews with Democratic voters and candidates across six districts, there was some worry that the ballyhooed wave could crash before November. But there was little concern that the party needed to change to win back Trump voters.

In Dent’s district, both city attorney Susan Wild and pastor Greg Edwards had criticized longtime District Attorney John Morganelli for his attacks on Obama-era immigration policy and for tweets — now deleted — urging Trump to consider him as a U.S. attorney nominee. In 2018, Wild said, voters want to support a bold and liberal Democratic Party.

Morganelli’s “whole campaign is, in my view, like a campaign from the 1980s,” Wild said as she knocked on doors in Allentown. “He says he had hope for Trump? The rest of us had our heads under our pillows, crying, and [he was] asking for a job.”

But Democrats wouldn’t be convinced that they could win these races until they identified enough voters to help them — including those who had given Trump a chance, or had sat out the 2016 election.

On Saturday, a dozen volunteers gathered at House candidate Ashley Lunkenheimer’s home in Delaware County to begin one of their final canvasses for the primary. Heidi Winder, 42, said that any Democrat could win their particular district. Every Democrat, she said, had been shaken out of complacency by Trump.

“I started listening to Fox News on November 9,” said Winder. “I can never live in a bubble again. I need to understand what the other side hears, so I can talk to them.”