Pennsylvania woke up Wednesday to President Donald Trump holding a significant advantage over Joe Biden in the initial votes counted so far: about 650,000 votes.

But Democrats and some Republicans said Wednesday morning that Biden still has a chance, and might even be something of a favorite to win the state, if narrowly.

If he does, it could nearly seal the election for him. Here’s why he has a path, and what wrinkles remain as the vote count continues.

There are a huge amount of mail ballots still to count

Warning, there’s some math here, but it explains a potential Biden path to victory in Pennsylvania.

There are 1.4 million mail ballots that were cast as of Election Day but not yet counted as of early Wednesday morning, according to the Pennsylvania Department of State. Of the mail ballots counted so far, 77% were votes for Biden, according to official counts, and 22% for Trump.

If that pace continues — and be clear, that’s a significant if — Biden would have a roughly 787,000 vote edge in those ballots. That would be enough to overcome Trump’s roughly 650,000 advantage so far.

And while 77% seems like a difficult pace to keep up, it’s possible that Biden could win an even larger share of the remaining mail ballots, because many of them are pending in deeply Democratic areas such as Philadelphia, Allegheny County (home to Pittsburgh and its suburbs), and the Philadelphia suburbs. More than 200,000 mail in ballots remain to be counted in Philadelphia alone, officials said Wednesday.

And to be clear: Despite what Trump said early Wednesday when he falsely declared victory, these are not new votes, or “surprise ballot dumps,” as he put it on Twitter. These are votes that have been cast, and were cast by Election Day — many in advance of Election Day — but have not been counted because mail ballots take longer to process.

This kind of “blue shift,” as it’s known, was expected: that in-person votes would be counted first, and favor Trump, but that mail ballots would favor Biden, and that his numbers would climb faster as that count continued.

State law required officials to wait until Election Day to start processing mail ballots. It was long expected that it would take several days to count them all.

On the other hand: The in-person vote is still unclear

The vast majority of the in-person, Election Day vote has been counted, but there appeared to still be some votes outstanding.

That could help Trump hang on. Republicans voted in-person much more than Democrats did, even in fairly liberal areas, so that could help Trump boost his margin and fend off Biden.

It’s less clear exactly which counties have in-person votes left to count, and how many of those votes there are. So it’s hard to put a number on this, but it’s something that could aid Trump as he tries to hold Pennsylvania.

Remaining questions

There are several other unknowns that could play a factor if the race ends up decided by a hair.

The state Supreme Court has ordered officials to count ballots if they are postmarked by Election Day and arrive by 8 p.m. on Friday, or if they arrive by then with a missing or illegible postmark. We don’t know how many of those ballots there may be. And they remain subject to a GOP legal challenge before the U.S. Supreme Court, which could still throw out those votes.

If it’s really really close, those votes could matter.

The Trump campaign hinted at a challenge to these votes Wednesday morning. “We want to make sure that all legally cast ballots are counted," said Trump campaign adviser Jason Miller. “We also want to make sure that illegally cast ballots are not counted.”

Both campaigns confidently predicted Wednesday morning that they would win Pennsylvania and the presidency.

If Pennsylvania is decided by less than 0.5%, there’s also the possibility of an automatic recount that would lead to an even longer process to determine the outcome.

Biden can win without Pennsylvania

Pennsylvania and its 20 Electoral College votes is the biggest prize still undecided. It’s a huge piece. But it won’t necessarily decide the outcome.

If either candidate can win Wisconsin and Michigan, he would have enough votes to win. Biden, as of early Wednesday, had more votes in the early counting in those states.