Something happened to Chip Kelly’s offense.

In 2013, it was one heck of an offense. Definitely top-two in the league. Unstoppable most of the time. Kelly, a rookie head coach in the NFL, seemed like a genius, a revolutionary. Maybe the next Bill Walsh.

But only two years later, Kelly’s offense was decidedly stoppable and the Philadelphia Eagles fired him just like that.

What happened???

I have a theory.

Kelly wants to play as fast as he can and run more plays than the other team. But, is fast offense always quality offense? To find out, we must account for pace and calculate yards per play. Forget total yards and total points. We’re concerned only with how many yards Kelly’s offense gains on average every time the center snaps the ball. Got it?

In 2013, Kelly’s offense averaged 6.3 yards per play — second-best in the NFL. A great offense any way you look at it.

In 2014, Kelly’s offense again averaged 6.3 yards per play through the first three games, and the Eagles were 3-0. At this point, Kelly’s record as an NFL head coach was 13-6. A flat-out superstar.

Then, Week 4, he faced the 49ers, and everything changed.

In that game, the Eagles averaged only 3.8 yards per play and scored zero points. The hottest offense in the NFL looked like a total joke. A botched experiment. A mere gimmick.

Here’s what really happened: Niners defensive coordinator Vic Fangio discovered the key weakness in Kelly’s offense. From that day until the day Kelly got fired (a span of 28 games), his offense averaged only 5.4 yards per play — below the league average during that time — and his record was merely 13-15 during those 28 games.

What did Fangio discover? What was the Fangio-blueprint the rest of the league followed?

Here’s my theory:

Fangio realized how to stop Kelly’s favorite play: The zone-read. That’s when the quarterback stands in the shotgun and sticks the ball in the running back’s belly without giving it to him right away. For a split second, the defense doesn’t know who will grab the ball and run — the tailback or the quarterback. A very tricky play NFL defenses couldn’t stop when the Eagles ran it.

Until Fangio.

Fangio figured out the play wasn’t really a “zone-read.” No “reading” occurred. Nick Foles, the Eagles quarterback, didn’t read the defensive end, didn’t look for an opportunity to run when it was available. Foles was bluffing the run. He had zero intention of keeping the ball. He simply wanted to give it to the running back and get out of the way. The play was really a “zone-give.”

Against San Francisco, Foles carried the ball just once and gained only 1 yard. The Niners didn’t have to worry about him running, so they could focus on tackling Eagles running back LeSean McCoy, which was easy enough. The Niners held him to just 17 rushing yards. Checkmate.

Until Kelly finds a quarterback whose legs a defense must respect, Kelly’s offense will continue to struggle. It’s that simple. Don’t listen to any “expert” who tells you Kelly’s quarterback needs to be accurate or quick-thinking above all else. That’s wrong. Kelly’s quarterback has to be a runner.

The 49ers already have two quarterbacks like that, Colin Kaepernick and Blaine Gabbert. No one believes Gabbert is a long-term solution — that’s obvious. What about Kaepernick? Running is the best thing he does. Unfortunately, he currently wants to run away from the team. If he and the 49ers can come to some sort of agreement that keeps him in Santa Clara, he might be the 49ers’ best option at quarterback. In any case, they need to draft a Chip Kelly kind of quarterback.

Jared Goff, as good of a prospect as he is, would not fit Kelly’s offense. Goff isn’t a runner. He never rushed for more than negative-8 yards in a season at Cal.

The Niners should draft a quarterback who’s an experienced runner, someone who wants to run and is good at it. Someone who has gained at least, say, 250 rushing yards in a season in college. Someone like Carson Wentz from North Dakota State, Paxton Lynch from Memphis, Kevin Hogan from Stanford, Jeff Driskel from Louisiana Tech, Dak Prescott from Mississippi State or Jacoby Brissett from North Carolina State.

San Francisco better get one of those quarterbacks. Otherwise, the Niners will have a below-average offense that playsveryfast. Call it speed checkers. They will have that until Kelly gets fired again.

Grant Cohn writes sports columns and the “Inside the 49ers” blog for The Press Democrat’s website. You can reach him at grantcohn@gmail.com.