The struggling city’s mayor was blown away after a trip to Philly, and wants to apply what he learned: “We go to cities because they’re gritty.”

Atlantic City Mayor Don Guardian really didn’t want to leave the shore. It was 3 p.m. on a beautiful June Friday, and he was having misgivings about his promise to visit Philadelphia.

“I could have had a free night to party!” says the 63-year-old Republican who is the city’s first openly gay mayor, playing up the drama with his signature flair. “That very rarely happens.”

For a politician, Guardian’s as effusive as they come, but there’s no need for him to hyperbolize the challenge he faces in getting the seaside metropolis of 39,000 back on track. Legalized gambling in other nearby states (Pennsylvania chief among them) — combined with a general tourism slowdown after the crash of 2008 — has left Atlantic City financially reeling. This spring, municipal government nearly shut down for three weeks because of a $33.5 million gap in the budget. City Hall was able to stay open thanks to a bridge loan from the state, but now faces the threat of state takeover in a charge led by N.J. Gov. Chris Christie. (Some observers say Christie is simply angling for better position in his play to get casinos approved in North Jersey.)

Guardian doesn’t care about political repercussions. “At my age, I don’t have to worry that I need to be doing favors for people,” he says. “I don’t have to worry about moving up a political chain.”

He also doesn’t shy away from the seriousness of the situation. When he took office in 2014, he characterized his coming tenure as “like a dentist doing a root canal” — and that was before four casinos shuttered in quick succession, decimating the city’s ratables. A recent court ruling that evaluated the Borgata as taxable at just $880 million, instead of the city’s estimated $2.2 billion, did not help.

There are several big picture projects Guardian has set in motion to help the city redefine itself. He worked to bring in Philadelphia developer Bart Blatstein, who revamped the defunct Caesars shopping pier and turned it into the gambling-free Playground, and plans to rebrand and re-open the former Showboat as an 850-room hotel. Developer Glenn Straub is relaunching shuttered Revel — although that has stalled as the Florida real estate magnate battles with the state over whether he personally needs to apply for a gaming license to do so.

But it’s actually smaller projects that have a real chance to help the scrambling city define a new, post-casino identity, say some developers, including Philly’s John Longacre.

“It has to be turned from a gaming town that happens to have a beach into a beach town that happens to have gambling,” Longacre says.

He uses his 80-year-old mother as an example. “Right now, the kind of person who goes to A.C. is my mom — she’ll go there to see a comedian and eat at Bobby Flay’s. On the other side, it’s got pawn shops and dive bars and strip clubs. There just isn’t a middle market in Atlantic City. We are trying to create one.”

In 2014, Longacre’s LPMG Properties bought the Morris Guards Armory Building, a 30,000-square-foot historic structure in the city’s Ducktown neighborhood. A planned $3 million investment will transform it from a vacant eyesore into a mixed-use apartment and retail complex. It’s similar to the type of development on which Longacre has built his career — best evidenced in the ongoing revitalization of Point Breeze.

Which is why Guardian found himself reluctantly departing the shore on that gorgeous June afternoon, heading opposite the traffic to take a look around South Philly.

“My director of planning Elizabeth [Terenik] said, ‘I know you’ll like John when he speaks about millennials — creating places where young people can live and work in the same neighborhood,’” Guardian explains. “And she talked about all these pop-up parks he wanted to show me, how we could do something like that in Atlantic City. So I agreed to check them out.”

When he got to Philadelphia, the mayor was wowed.

“I was thinking the whole trip would be very businesslike, and that the pop-up parks would just be little corner spots. I was rudely incorrect,” he says.

He met up with Longacre in what Guardian describes, apologetically, as “a neighborhood no one would want to drive through” and went on a tour. The mayor was especially impressed by the vibrant makerspace at NextFab, the Point Breeze Pop-Up beer garden and the combo Ultimo coffee shop/Brew bottle shop.

“We stopped at another pub-like setting [South Philadelphia Tap Room],” Guardian says, “and it became obvious to me that he had created an atmosphere that kept people in the city, even on summer weekends. People were taking pride in their neighborhood.”

The fact that Longacre didn’t “eminent domain out all the poor people,” and tried to rebuild instead of just razing abandoned buildings left a lasting impression. “We go to cities because they’re gritty,” the mayor says. “Miami Beach isn’t like Disney.”

The tour continued to several other pop-ups around Philly, including the PHS Pop-Up on South Street — “It was as fancy as a Ritz-Carlton!” — and Spruce Street Harbor Park, where “there were 4,000 other people partying and having fun, and we ate what John said was the best fried chicken in town.”

One issue that makes revitalization in Atlantic City different is that much of its underutilized land is zoned for casino use, which limits potential investors’ options. Not all of it is, however, and Guardian has begun auctioning off dozens of small lots. A real estate auction held June 23 was attended by more than 100 people, and netted $1.7 million for the city’s cash-starved coffers.

Guardian hopes the intrepid investors follow Longacre’s lead.

“If I had 50 Johns investing here I would be thrilled,” he says. He points to the vacant lots near what will soon become a new extension of the boardwalk, and suggests that they have the potential for lucrative independent retail.

“Before Atlantic City had gambling, it had dozens of mom and pop operations, but we lost the feel of it being fun to leave the hotel and hang out on the street. We need to realize we’re a great urban center, not just a shore town with gambling.

“But change is never easy,” he says, and then laughs.

“I just hope that after I retire, I can sleep well at night, and then bicycle down the boardwalk and people will greet me with all five fingers when they wave.”