In two weeks, Virginia will elect a new governor — and nobody knows who it will be. Polls show a tight race between former Democratic Gov. Terry McAuliffe and Republican businessman Glenn Youngkin. The race has broken state fundraising records. And the Cook Political Report recently revised its race rating from “Leans Democratic” to “Toss-up.”

Youngkin and McAuliffe each have reason to think they will win. Republicans have the wind at their backs this year as congressional Democrats dither and President Biden’s approval ratings slump. McAuliffe should benefit from demographic and political shifts that have pushed the state from red to blue.

A careful inventory of these strengths favors McAuliffe — but only marginally.

Youngkin has one key advantage in this race: timing.

Virginia’s gubernatorial contests always take place a year after the presidential election — and the party that loses the presidency often performs well in Virginia’s governor race. As others have pointed out, in 10 out of the last 11 gubernatorial elections in Virginia, the party that won the presidency lost Virginia’s governorship a year later.

This pattern is neither mystical nor coincidental — it’s part of a predictable political cycle. As a new president advances his agenda, he often energizes his opponents, placates his base and alienates swing voters.

Robert “Bob” Holsworth, a Virginia public policy consultant who moderated a debate between McAuliffe and Youngkin, summed up the situation this way: “The Democrats are perceived as the incumbent party. To some extent, particularly among Independents, or people who are just frustrated with the political class in general — they’re taking this out a little bit on the Democrats.”

That’s good news for Youngkin. He can capitalize on Biden’s falling ratings, and attempt to attract swing voters — or just count on discontented Democrats to stay home.

Youngkin has tried to keep both the centrist GOP and Trump wings of the party behind him. He wooed Donald Trump’s voters in the fold by half-embracing the former president and opposing vaccine mandates, while emphasizing his successful business career and mild manners to suburbanites. Says Quentin Kidd, pollster for Christopher Newport University, “For a suburban mom, Glenn Youngkin doesn’t generate that ire the way Trump did.”

Youngkin’s biggest obstacle: he’s running in Virginia. And in Virginia, every Democratic candidate starts with three advantages.

The first: the D.C. metro area.

In 1980, a quarter of Virginia voters lived in what’s now the D.C. metro area, and they voted for Ronald Reagan over Jimmy Carter by a 21 point margin. By 2020, more than a third of Virginians lived in the region, and they voted for Joe Biden over Trump by a 31-point margin. These voters turned Virginia blue — and if McAuliffe holds onto them, he’ll win the state.

The second: The state’s demographics match up with Democrats’ strengths.

Almost 40 percent of Virginians have a college degree. Black voters — the most reliably Democratic demographic — make up 20 percent of the population. Latinos, a swing group, comprise only 10 percent. That’s a good fit for the modern Democratic Party: Black voters, along with college-educated Whites, are the Democratic base, while Latinos are trending Republican.

Additionally, many Virginians work in the federal government or for a private business that relies on the government. These voters may be unreceptive to Republican anti-government messages. According to Holsworth, “This was part of Trump’s problem in Virginia. If you think about the message that worked in so many other states — that he was going to ‘Drain the Swamp’ in Washington — this is just seen as a direct assault on the Northern Virginia economy.”

Youngkin wants to present himself as a kinder, gentler Republican and plays down the anti-government rhetoric upstate. But many Virginians won’t vote for an anti-government candidate, regardless of how friendly he seems.

McAuliffe’s third key advantage: polarization. Virginians were once willing to vote for one party’s presidential candidate, while supporting other candidates for governor, Senate or House. Now, voters are much less interested in crossing party lines and splitting their tickets.

This trend is great for McAuliffe. The Democratic base is simply bigger than the GOP base in Virginia. If Democrats turn out and stay loyal — both of which are big IFs — Youngkin may find it difficult to put together a majority.

McAuliffe has a very slight advantage because he has a “D” next to his name — and because Trump’s brand is toxic in Virginia.

Both candidates know that. Youngkin still professes loyalty to Trump, but keeps him at an arm’s length: He recently skipped a Virginia rally hosted by Trump and his former adviser Stephen K. Bannon. McAuliffe, on the other hand, is embracing the most popular Democrats. He’ll soon campaign with Barack Obama, Stacy Abrams and Jill Biden — while a struggling Biden stays on the sidelines.

If McAuliffe emerges victorious, Democrats should still pay close attention to the margin. A narrow victory in a blue state like Virginia would be a sign that voters are souring on Democrats a year into Biden’s presidency. And if Youngkin wins, Republicans will gain a blueprint for a majority beyond Virginia.