Image copyright Getty Images Image caption Supporters of Northam displayed Trump cartoon chicken outside a polling place in Virginia

What a difference a year makes. Last November, Democrats were in despair - losing a presidential race, cementing their minority status in the US Congress and facing historic deficits in state legislatures and governor's mansions across the US.

In off-year elections on Tuesday night, the party found traces of a path out of the wilderness and cause for a glimmer of hope.

Meanwhile, the Republican Party - and Donald Trump - just heard the first crack of thunder of a possible storm to come.

After 2016, when none of the old rules seemed to apply, political gravity reasserted itself.

Out-of-power parties traditionally do well in non-presidential election cycles, and 2017 was no exception.

Here are six implications of the Democratic Party's surprisingly strong showing on Tuesday.

A Trump-style campaign without Trump is a risky proposition

Ed Gillespie, the Republican candidate for governor of Virginia, isn't anyone's idea of a Trump-style politician. The long-time Washington lobbyist, who once chaired the Republican National Committee, could give fan-boat tours of the Washington "swamp".

For the past few months, however, he adopted many of the cultural-war elements of Mr Trump's successful presidential campaign. He aired commercials blasting his opponent as being soft on crime and, in particular, the Central American gang MS-13.

Image copyright Getty Images Image caption Gillespie was defeated in Virginia on Tuesday

The New Jersey native opposed taking down the Confederate memorial statues that pepper Virginia parks and town squares. He distributed leaflets linking Democrats to the NFL players who have protested allegations of police brutality by kneeling during pre-game playing of the national anthem.

While Mr Gillespie did reasonably well among rural and working-class voters, they didn't show up at the polls on Tuesday in the kind of numbers that helped power Mr Trump to the presidency. It wasn't even close.

For Republicans trying to determine if Mr Trump's success last year was just about the man - a well-known public figure who had a tell-it-like-it-is brand that transcended issue debates and the controversies that swirled around him - they may have just gotten an answer. And it's not a good one.

Mr Trump's 2016 electoral magic may be difficult to reproduce.

Image copyright Getty Images Image caption Gillespie supporters watch results come in at an event in Richmond

Mr Trump, at least in Virginia, is a lead balloon

Opinion surveys have shown near-historic levels of unpopularity for Mr Trump for months.

Given the president's surprise victory last November, however, analysts and experts have been cautious to draw conclusions about how these numbers translate to future voting behaviour.

Now we have a snapshot of what Trump's unpopularity looks like at the ballot box in a key presidential battleground state. According to exit polls of actual Virginia voters, Mr Trump popularity stood at 40% positive and 57% negative - only marginally better than in recent national surveys.

A plurality, 34%, voted "to express opposition" to Donald Trump, while only 17% voted to show their support.

Mr Trump's unpopularity dragged Mr Gillespie - and many of his fellow Virginia Republicans - down to defeat, despite the candidate's attempt to walk a line between embracing Trumpian rhetoric and keeping his distance from the man himself.

Media playback is unsupported on your device Media caption US President Donald Trump: The political survivor?

Winning cures Democratic ills

The Democratic civil war has been postponed - at least for now.

In the days running up to Tuesday's vote, the long knives were already coming out, as the party's various factions - outspoken economic populists, establishment moderates, race-conscious activists and everyone in between - braced themselves for what would have been a humiliating defeat (or even an embarrassingly narrow victory).

For the past few weeks, the polls in Virginia had been tightening and it looked like Mr Northam - who ran a steady, cautious and largely unspectacular campaign - was going to be the early Thanksgiving turkey.

Even during his victory speech on Tuesday night, Mr Northam was interrupted by a handful of immigration activists. Now imagine what would have happened if he had lost.

Image copyright Getty Images

Instead, Mr Northam won in a rout - as did Democratic candidates of all stripes. Virginia elected its first openly lesbian state-level politician and several first-even ethnic minority candidates, and it is poised to seat the nation's first openly transgender state legislator. Moderates won. A "Democratic socialist" in the mould of Vermont Senator Bernie Sanders won. It was an across-the-board victory.

The party will continue to have debates over what direction it should take in the coming months and years, but thanks to the Virginia results there won't be omnipresent dread that a step in the wrong direction could be the difference between victory and defeat.

The "candidate x could have won" debates aren't gone forever, but they're a lot less divisive when candidates across the alphabet come out on top.

The victory went beyond Virginia

Although Virginia, as a presidential swing state that appeared to be a tight contest, drew most of the attention on Tuesday night, it wasn't the only place with a Democratic surge.

The party rolled in New Jersey, where incumbent Governor Chris Christie - once a shining star in the Republican firmament - has become historically unpopular and is scorching the earth for his fellow conservatives.

In Maine, voters passed a ballot measure calling for expanding the state's Medicaid healthcare programme for poor - over the opposition of the state's Trump-style Republican governor, Paul LePage. Democrats picked up a handful of seats in the Republican-controlled Georgia legislature and won a special election in Washington state that will give them unified control of the legislature there.

The only conservative redoubt was Utah, where a Republican cruised to victory in a congressional special election. Virginia may have been hit by a Democratic wave, but Utah is on a Republican mountaintop.

Image copyright Getty Images Image caption Trump criticised Gillespie for not fully embracing his message after his defeat

A year since Trump upset the odds

The Democratic coalition reforms

The 2016 presidential election saw the Democratic coalition of young, blue-collar, women and minority voters that powered Barack Obama to two terms in the White House crumble to dust.

Traditional Democratic white working-class voters in key states shifted to Republicans. On Tuesday, from that rubble were signs that a new winning coalition could be forming.

According to Virginia exit polls, minorities (80%) and voters age 18 to 29 (69%) backed Mr Northam in sizable numbers, as did women (61%). Joining this coalition were college-educated voters, who supported the Democrat by a 60% to 39% margin.

Image copyright Getty Images Image caption Democrats can breath a sign of relief - for now

Mr Northam did particularly well in the affluent, well-educated Washington, DC suburbs of Northern Virginia.

In Fairfax County, for instance, he won by larger margins than Hillary Clinton last year, Barack Obama in 2012, and state-wide Democrats in 2013 and 2014.

Both New Jersey and Virginia elected black lieutenant governors, and in race after race in Virginia, first-time women candidates for the state legislature knocked off entrenched Republican incumbents.

There are also signs that Democrats have found some winning policy items on which to run. A plurality of voters in Virginia (39%) said healthcare was their most important issue, and 77% of them voted for Mr Northam.

Even Virginians who said guns were most important - a topic that usually motivates only conservatives - were evenly divided between the Republican and the Democrat.

Image copyright Getty Images Image caption Democrats were just as likely as Republican to say gun rights are important

In rural Blacksburg, a former reporter whose girlfriend was shot and killed during a live local news broadcast ran and won as a gun-control candidate against a three-term incumbent backed by the NRA.

Democrats clearly have some building blocks to work with as they prepare for next year.

Media playback is unsupported on your device Media caption How do you report on your colleagues' death?

The clock is ticking for Republicans

If there was a silver lining for Republicans on Tuesday, it's that the damage was contained to just a handful of states. Their political position may be tenuous, but they have a year until the nationwide congressional midterm elections and a number of high-profile governor races to do something about it.

It won't be easy, however. Mrs Clinton carried Virginia in 2016 and Republicans still won nationwide, but Mr Northam's margins in the state were bigger. The trend-lines are heading in the wrong direction.

Complicating things is the fact that a number of Republican congressional moderates, facing tough re-election campaigns, have opted to retire. Senators Jeff Flake of Arizona and Bob Corker of Tennessee were two high-profile recent announcements, but the race to the exits is also picking up steam in the House of Representatives, which could be more susceptible to a Democratic surge next November.

It doesn't appear a change of course is in the works for Mr Trump and his political backers, however. The president took to Twitter from South Korea shortly after Mr Northam declared victory to claim that Mr Gillespie "did not embrace me or what I stand for".

Content is not available

Meanwhile, after positioning himself to take credit for what looked like it could be a Republican win in Virginia, former Trump adviser Steve Bannon has also turned on Mr Gillespie.

A headline on the pro-Trump conservative website Breitbart, which Mr Bannon runs, condemned the Virginia Republican as a "Republican swamp thing".

Content is not available

If this is the lesson Mr Trump takes from Tuesday's results - that Republicans either embrace him or face defeat - then 2018 is going to be an even bigger referendum on Trump's presidency than 2017 was.

That is a thought that will keep a lot of Republican officeholders up at night.