Two master bakers dressed in white use a long knife to carve a heavy, thick slab of molasses-coloured gingerbread dough out of a huge metal vat, where, like wine, it has been maturing for a few months, deep in the cellar of one of the world's oldest bakeries.
The bakers at the Kopernik Confectionery Factory in Poland's historic central city of Torun taste the matured dough, checking whether each vat is ready for baking.
The factory has used a jealously-guarded secret mix of spices since it opened in 1763 and has been serving up its popular brand of gingerbread non-stop ever since, with the exception of a few years' hiatus during World War II.
Only six of the factory's bakers know the exact proportion and types of spices that are used, according to spokesman Jakub Kopczynski.
"Cloves preserve the dough, which of course also includes flour and sugar, allowing it to develop its unique flavour as it ages," he tells AFP.
Cinnamon, ginger and pepper are also in the spice mix, he adds, though he politely refuses to divulge further details.
"Like fine wine, good gingerbread must be aged and like wine making, the process requires a lot of know-how," he adds.
Around him are a hundred or so vats lined up in neat rows across the factory's bottom floor, each of them weighing around 700 kilogrammes (1,500 pounds).
A worker prepares traditional gingerbread cakes at the Kopernik Confectionery Factory in Torun, Poland
Vegan, Kosher, Non-GMO
The bold, inviting aroma of gingerbread spice wafts through the sprawling factory on the edge of Torun.
The secret recipe draws on the city's gingerbread tradition harking back to the Middle Ages when spices from India and the Middle East first began to arrive in Torun, later a major crossroads for Hanseatic trading routes.
Its origins may be ancient, but Torun gingerbread is also as trendy as it gets: the factory has acquired certification attesting that its products are vegan, kosher, non-GMO and that they do not contain palm oil.
"It's always been our traditional standard; now we have formal recognition," Kopczynski adds, having moved to another part of the factory, where a conveyor belt feeds gingerbread hearts into a 36-metre-long (119-feet) oven to bake for seven minutes.
The historic factory is a joint-stock company owned by current and former employees, who have shunned offers from foreign investors in order to prevent them from acquiring their prized recipe.
Named after Nicolaus Copernicus, the Torun-born father of modern astronomy who is known as Mikolaj Kopernik in Polish, the factory produced 3,500 tonnes of gingerbread this year, sold in Poland and across the globe.
Polish high school student Jagoda presses a ball of gingerbread dough into a hand-carved wooden cookie mould in the shape of a horseshoe inscribed "szczescie", or Polish for "luck".
She has come with her class from the nearby city of Bydgoszcz for a hands-on baking lesson at the state museum of Torun gingerbread, nestled in the original red-brick Kopernik factory near the city's historic central square.
"My family has a tradition of making decorated gingerbread cookies to give away as Christmas presents," the 17-year-old tells AFP, holding a heart-shaped cookie impressed with a flower motif in the palm of her hand.
Shaped as knights, angels, princesses or horse-drawn carriages, large gingerbread cookies and cakes, pressed from intricately carved wooden moulds, were long among the most exclusive of gifts during the pre-industrial era up until the late 1700s.
"Because the imported spices were so expensive, gingerbread was a luxury item which only the elite could afford," explains museum director Malgorzata Mikulska-Wernerowicz, adding that gingerbread bakers were also wealthy and stood high on the social ladder.
"Kings visiting Torun received gingerbread from the city council," she says, standing next to a display with gingerbread moulds carved in applewood and pearwood dating from the 1600 and 1700s.
Pepper BreadInvited by a local prince, knights of the Teutonic Order came from the Holy Land to found Torun, known in German as Thorn, in 1233.
The knights are believed to have brought the first spices from the Middle East, triggering demand and with it, a lucrative spice trade that helped Torun become one of Europe's wealthiest cities during the Middle Ages and the Renaissance.
Gingerbread is still big business in Torun, with dozens of bakeries, shops and even a private interactive museum capitalising on the tradition in the city of just over 200,000 residents.
Unlike the thin, crisp gingerbread snaps popular in Sweden or Britain, Torun gingerbread is chewy and meaty.
Traditionally based on honey, spirits, wheat and rye flour mixed with spices, records show that the Torun variety was already being made by local German bakers in the mid-1500s and drew its name from pepper -- Pfefferkuchen -- rather than ginger.
The modern-day Polish term for gingerbread -- "pierniki" -- also refers to pepper.
Legend has it that Copernicus himself enjoyed munching on the treat.
"He came from a family of wealthy merchants so there's no reason why he wouldn't have indulged in gingerbread," says Mikulska-Wernerowicz, with a twinkle in her eye.
Want more? Click on the tags below for more videos and stories