In a few horrible hours, Pompeii was turned from a vibrant city into an ash-embalmed wasteland, smothered by a furious volcanic eruption in A.D. 79.

Then in this century, the excavated Roman city appeared alarmingly close to a second death, assailed by decades of neglect, mismanagement and scant systematic maintenance of the heavily visited ruins. The 2010 collapse of a hall where gladiators trained nearly cost Pompeii its coveted UNESCO World Heritage Site designation.

But these days, Pompeii is experiencing the makings of a rebirth.

Excavations undertaken as part of engineering stabilization strategies to prevent new collapses are yielding a raft of revelations about the everyday lives of Pompeii’s residents, as the lens of social class analysis is increasingly applied to new discoveries.

Also read | Mysterious black diamond named ‘The Enigma’ up for auction at $7 million

Under the archaeological park’s new director, innovative technology is helping restore some of Pompeii’s nearly obliterated glories and limit the effects of a new threat: climate change.

Gabriel Zuchtriegel, an archaeologist who was appointed director general 10 months ago, likens Pompeii’s rapid deterioration, starting in the 1970s, to “an airplane going down to the ground and really risking breaking” apart.

The Great Pompeii Project, an infusion of about 105 million euros ($120 million) in European Union funds — on condition it be spent promptly and effectively by 2016 — helped spare the ruins from further degradation.

“It was all spent and spent well,” Zuchtriegel said in an interview on a terrace with Pompeii’s open-air Great Theater as a backdrop.

Also read | Holocaust Remembrance Day: Lesser-known facts about Adolf Hitler

But with future conservation problems inevitable for building remains first excavated 250 years ago, new technology is crucial in this “battle against time,” the 41-year-old told The Associated Press.

Climate extremes, including increasingly intense rainfall and spells of baking heat, could threaten Pompeii.

“Some conditions are changing and we can already measure this,” said Zuchtriegel.

Relying on human eyes to discern signs of climate-caused deterioration on mosaic floors and frescoed walls in about 10,000 excavated rooms of villas, workshops and humble homes would be impossible. So artificial intelligence and drones will provide data and images in real time.

Also read | Archaeologists find well-preserved wooden figure from Roman era

Experts will be alerted to “take a closer look and eventually intervene before things happen, before we get back to this situation where buildings are collapsing,” Zuchtriegel said.

Since last year, AI and robots are tackling what otherwise would be impossible tasks — reassembling frescoes that have crumbled into the tiniest of fragments. Among the goals is reconstructing the frescoed ceiling of the House of the Painters at Work, shattered by Allied bombing during World War II.

Robots will also help repair fresco damage in the Schola Armaturarum — the gladiators’ barracks — once symbolizing Pompeii’s modern-day deterioration and now celebrated as evidence of its revival. The weight of tons of unexcavated sections of the city pressing against excavated ruins, combined with rainfall accumulation and poor drainage, prompted the structure’s collapse.

Seventeen of Pompeii’s 66 hectares (42 of 163 acres) remain unexcavated, buried deep under lava stone. A long-running debate revolves on whether they should stay there.

Also read | 180 million-year-old sea dragon fossil discovered in UK

At the start of the 19th century, the approach was “let’s … excavate all of Pompeii,” Zuchtriegel said.

But in the decades before the Great Pompeii Project, “there was something like a moratorium — because we have so many problems we won’t excavate any more,” Zuchtriegel said. “And it was almost like, psychologically speaking, a depression.”

His predecessor, Massimo Osanna, took a different approach: targeted digs during stabilization measures aimed at preventing further collapses.

“But it was a different kind of excavation. It was part of a larger approach where we have the combination of protection, research and accessibility,” Zuchtriegel said.

Also read | In pics: Americans celebrate Martin Luther King Jr. Day

After the gladiator hall’s collapse, engineers and landscapers created gradual slopes out of the land fronting excavated ruins with netting, keeping the newly-shaped “hillsides” from crumbling.

Near the end of Via del Vesuvio, one of Pompeii’s stone-paved streets, work in 2018 revealed an upscale domus, or home, with a bedroom wall decorated with a small, sensual fresco depicting the Roman god Jupiter disguised as a swan and impregnating Leda, the mythical queen of Sparta and mother of Helen of Troy.

But if visitors stand on tiptoe to look past the marvelous fresco over the home’s jagged walls, they’ll see how the back rooms remain embedded under the newly “stabilized” unexcavated edge of Pompeii.

Nearby is the most crowd-pleasing discovery to emerge from the shoring-up project — a corner “thermopolium” with a countertop setup similar to current salad-and-soup bar arrangements.

Also read | Large Roman fort used for the invasion of Britain discovered near Amsterdam

This fast-food locale is the only one discovered with frescoes in vivid hues of mustard-yellow and the omnipresent Pompeii red decorating the counter’s base — apparently advertising the chef’s specialties and including a bawdy graffito. Judging by the organic remains found in containers, the menu featured concoctions with ingredients like fish, snails and goat meat.

Quick street meals were likely a mainstay of the vast majority of Pompeiians not affluent enough to have kitchens.

Archaeologists have been increasingly using social-class and gender analyses to help interpret the past.

When they explored an ancient villa on Pompeii’s outskirts, a 16-square-meter (172-square-foot) room emerged. It had doubled as the villa’s storeroom and the sleeping quarters for a family of enslaved people. Crammed into the room were three beds, fashioned from cord and wood. Judging by the dimensions, a shorter bed was for a child.

Also read | When John Lennon was shot dead: How US learnt of the global icon’s death

When the discovery was announced last year, Zuchtriegel described it as a “window on the precarious reality of people who rarely appeared in historical sources” about Pompeii.

This winter, an afternoon guided tour is offered at sites not otherwise open to the public. One such offering is the House of the Little Pig. On a wall of a tiny kitchen is a whimsical painted design of a pig’s head with a prominent snout.

The park’s ambitions stretch further: Nearby Naples and its sprawling suburbs ringing Vesuvius suffer from organized crime and high youth unemployment, which drives many young people to emigrate.

So the archaeological park is bringing together students from the area’s more elite institutions and from working class neighborhoods who attend trade schools to perform a classical Greek play at the Great Theater.

“We … can try to contribute to a change,” Zuchtriegel said.

There are also plans to create public strolling grounds in an unexcavated section of ancient Pompeii which, until recently, had been used as an illegal dump and even a marijuana farm.