When Hocus Pocus opened in theaters in July 1993, it didn’t seem to put a spell on anyone. Janet Maslin of the New York Times called the Bette Midler-starring comedy about three 17th century Salem, Mass., witches thrust into present day “an unholy mess.” Roger Ebert’s review said the movie’s three bumbling spell-casters “don’t have personalities; they have behavior patterns and decibel levels.” The Associated Press was even harsher: “The only real curses in this film will be yours as you walk up the aisle to leave,” wrote Patricia Bibby.

Ticket sales weren’t any better. The movie debuted in fourth place at the weekend box office, quickly dropped out of the top 10, and ultimately earned just $39.5 million, a disappointment for its studio, Walt Disney. (It probably didn’t help that it opened against the equally family-friendly Free Willy and had to compete against dino juggernaut Jurassic Park.) Almost as soon as it arrived, Hocus Pocus seemed poised to go poof and disappear.

But over the past two-and-a-half decades, the movie about a trio of resurrected witchy women has come back from the dead, enchanting old fans and luring in new ones on VHS, DVD, streaming video, and annual TV airings; sparking social-media love from fans who never met an image of Midler’s Winifred Sanderson they couldn’t turn into a meme; emerging as a central part of Walt Disney World’s Halloween celebration; and spawning an in-the-works TV remake. What It’s a Wonderful Life is to Christmas, Hocus Pocus has officially become to Halloween. It only took a couple of decades — give or take. How did it happen? We asked two of the men who crafted its story, and others, to explain.

Watch a clip:

Hocus Pocus began as a bedtime story that David Kirschner, producer and co-writer of the film, told his two young daughters in the 1980s. That narrative’s basic elements would, eventually, inform the movie’s plot: A 17th-century boy named Thackery Binx tries to save his sister from three evil witches, who turn him into a cat, but who are eventually put to death by the townspeople of Salem, Mass. Three hundred years later, the witches reappear on Halloween night, after a virgin lights the black flame candle. Kirschner’s ideas sprang from his longtime love of All Hallows’ Eve as well as personal events from his childhood: Binx the cat, for example, was named after Inks, a black cat he took in as a boy. “Halloween is a huge deal in our home, and it has been since our daughters were little,” Kirschner says. “It speaks to me in a way that becomes so emotional for me and always has.”

Eventually Kirschner — who had recently persuaded Steven Spielberg to make An American Tail and would later produce the Child’s Play movies — took his spooky-ish yarn to Walt Disney Studios. On the day of his big pitch meeting in 1984, Kirschner amped up the Halloween razzle-dazzle. He suspended witches’ brooms from the ceiling of the meeting room, displayed pictures of black cats drawn by children in his neighborhood, and cut a slit in the bottom of a 15-pound bag of candy corn, arranging the orange pieces so they spilled onto a table. Once the execs arrived, he explained that Halloween was becoming a more popular, profitable holiday and that he had an idea for a movie that would allow families to celebrate it together by watching a group of kids from modern Salem, Mass., triumph over a trio of youth-obsessed sister witches who want to steal their souls.

“By the time I got to the parking lot, one of the executives — not [then-Disney chairman Jeffrey] Katzenberg, but one of the executives — ran after me,” Kirschner recalls. “And he said, ‘Don’t take it anywhere else. We want to do it.’”

Getting the project off the ground would take longer than anticipated. Through his Spielberg connection, Kirschner invited Mick Garris, then writing for the Spielberg-produced TV series Amazing Stories, to work on the screenplay, which was initially titled Halloween House. Eleven or 12 writers would work on the script after him, including Neil Cuthbert, the third officially credited writer on the project.

In the early 1990s, nearly a decade after Kirschner’s candy corn pitch meeting, the project, now titled Hocus Pocus, was finally in the shape Disney wanted and went into production. Midler, having just received her second Academy Award nomination — this time for her role in For the Boys — signed on as Winifred, one of the three witches, while Sarah Jessica Parker (five years away from Sex and the City), and Kathy Najimy (hot off a scene-stealing turn in Sister Act) rounded out the trio as Sarah and Mary, respectively. Famously, Leonardo DiCaprio was offered the part of Max, the virginal black flame candle lighter, but turned it down so he could film What’s Eating Gilbert Grape? Omri Katz, who had previously played J.R. Ewing’s son on Dallas, got the part instead.

Shooting began in October 1992, with Kenny Ortega — who had served as the choreographer on Dirty Dancing and recently directed Newsies — at the helm. Other notables were involved as well: John Debney, who would later earn an Academy Award nomination for his work on The Passion of the Christ, composed the score, and James Horner — who had already earned several Oscar nods, and would later win for his Titanic score — co-wrote “Sarah’s Theme,” the “Come Little Children” siren song Parker croons while riding her broomstick. (Horner died earlier this year in a plane crash.) With so much talent assembled, it seemed like Hocus Pocus couldn’t miss. Then it did.

Watch a clip:

“When it came out, it laid a tiny little bit of an egg, so we didn’t expect much,” Midler once said in a Reddit AMA. “And now look at it! OCTOBER is HOCUS POCUS MONTH!”

In the years that followed, Hocus Pocus did indeed achieve a cult status that eventually bled into the mainstream. According to information compiled by movie data site the Numbers, between October 2008 and Oct. 31, 2017, the film generated more than $30 million in DVD and Blu-ray revenues, the majority of which was earned in the October months. Disney has just released Hocus Pocus: 25th Anniversary Edition on Blu-ray, DVD, and digital. As of this writing, Hocus Pocus is No. 8 on Amazon’s list of bestsellers in the movies and TV category, and second on iTunes’ ranking of most popular movies for children and families.

“It really is kind of amazing, whenever someone finds out that I wrote that film — particularly females — how enthusiastic their reaction is,” says Garris, who is known primarily for his work in horror but has received increasing amounts of Hocus Pocus love over the past decade. “This has become something iconic and something that represents the holiday.”

So what explains the embrace of a movie once treated with the eye-rolling Winifred Sanderson reserves for “glorious mornings”? Certainly ’90s nostalgia is partly responsible. Many millennials associate the film with fond memories of post-trick-or-treat sugar highs. And as noted in a 2013 NPR piece by Christina Cauterucci, they continue to bond over it in their 20s and 30s. That’s why BuzzFeed is routinely flooded with Hocus Pocus tributes, posts, and quizzes, and why the movie routinely trends on Twitter during the season of pumpkin spice lattes. (A new twist to the usual social media flurry this season: the temporary replacement of the phrase “Netflix and chill” — the euphemism du jour for getting it on — with Hocus Pocus and chill.)

In the media, there also are signs of new appreciation for the movie. In a 2013 piece for the A.V. Club, Sonia Saraiya acknowledges the millennial-nostalgia factor, but also says the movie’s full-bore commitment to camp makes it enjoyable on its own merits. “Midler is an enchanting, subversive villain, as willing to steal the stage as she is to let the movie’s heroes destroy her in the end,” she writes. “It stands out from a host of other films from that era because it embraces its silliness, and then goes the extra mile to make sure that silliness is executed well.”

As Kirschner predicted in ’84, Halloween also has become more omnipresent in the culture. In 1995, Halloween spending was at about $2.5 billion, according to USA Today. This year, the National Retail Federation projects that Americans will spend $9 billion on Halloween, down a tick from 2017’s record $9.1 billion. An appetite for Halloween fits in nicely, it seems, with a movie about witches starving for little children.

There’s another factor that makes Hocus Pocus increasingly inescapable: the fact that it’s a Disney property, which means it can be made visible through a variety of venues.

For the fourth straight year, Orlando’s Walt Disney World has incorporated a Hocus Pocus show — the “Hocus Pocus Villain Spelltacular” — into its Halloween festivities, making the Sanderson sisters as integral to the Magic Kingdom as Space Mountain.

Binx the cat in Hocus Pocus (Disney)

Now that Hocus Pocus is universally beloved, what about a sequel? Midler, Najimy, and Parker have publicly expressed willingness to star in one in the past. In 2015, Midler toyed with a follow-up again, sending out a tongue-in-cheek tweet about the sequel being delayed because Disney is “having trouble finding a virgin.”

But, according to Kirschner, Disney passed a couple of years ago when he attempted to pitch a theatrical follow-up. The man who first dreamed up Hocus Pocus for his little girls has tried more recently to get a second Hocus Pocus launched as Disney Channel TV-movie remake. He is executive-producing the “reimagined” take with a new cast based on a script by Scarlett Lacey (The Royals).

Kirschner, meanwhile, is basking in the annual October glow that comes from realizing that former flop Hocus Pocus is now synonymous with Halloween magic. “Something began to happen that truly changed the way that project was viewed,” he says. “I’ve been doing this a long time, and it shocked me to be a part of something that lightning touched.”