Until its oil boom of about 150 years ago, the city of Baku didn't really stretch beyond the walls of its old 12th-century fortress.
But stand today atop the 15th-century Shirvanshahs' Palace, a popular viewpoint overlooking Azerbaijan's capital, and the dramatic expansion fueled by black gold becomes apparent.
From here the view toward the ultramodern Flame Towers pans across a number of architectural layers, each revealing their own rich history, full of intrigue, heartache and loss.
Paris of the Caucasus
The oil boom took place between 1872 and World War I, a time when Baku's privatized oil fields were producing more than half of the world's oil.
They attracted a wave of fortune-seeking entrepreneurs, industry experts and blue-collar laborers, increasing the population tenfold to more 140,000 by 1903.
A construction boom followed.
From the late 1880s a small circle of wealthy oil barons -- local men such as Musa Naghiyev, Shamsi Asadullayev and Zeynalabdin Taghiyev, as well as foreigners like the Rothschilds and the Nobel brothers -- started commissioning mansions and public buildings.
In the space of just 15 to 20 years a new urban layer appeared just outside the old Muslim fortress. Mixing everything from Gothic and baroque to neo-classical and oriental, these eclectic buildings somehow found an overall harmony, giving Baku the reputation of the "Paris of the Caucasus".
"The first street that appeared outside the [old] city wall in full was Istiglaliyyat," says Gani Nasirov, founder of Baku Original Walking Free Tour, while strolling along this avenue which runs along the old walls.
At its western end are two pastel-colored buildings -- the Renaissance-style State Philharmonic Hall, modeled on the Casino de Monte-Carlo, and the pale-pink mansion of the Sadikhov brothers, which had Baku's first electric lift, moving at a very leisurely 70 centimeters per second.
Both of these appeared during the height of the construction boom, between 1910 and 1912, and were designed by an Armenian architect from Tiflis named Gabriel Ter-Mikelov.
Modern and multicultural
Baku's population at this time was an incredible multicultural mix. Azerbaijanis, Russians, Armenians, Jews, Germans and Poles each occupied their own niche.
Polish architects in particular left a mark on oil-boom Baku.
One of them, J-zef Gos-awski, was responsible for the Alexander Nevsky Cathedral, Baku's tallest building at the time, which was sadly torn down by the Soviets in 1937.
Luckily there are still two more Gos-awski masterpieces on Istiglaliyyat Street.
His last project, Baku City Hall, still functions as it always has, but the elegant building of the Institute of Manuscripts a few doors down was actually a pioneering school for Muslim girls when it opened in 1901.
Another oil-boom place of learning, just opposite the City Hall, was St. Nina's School for Girls, whose most famous student was Nino Kipiani, the fictional heroine of Kurban Said's 1937 novel "Ali and Nino."
This classic love story set in oil-boom Baku beautifully captures the struggle between East and West, which you'll still see as you explore the city center's architecture.
"There were really two towns, one inside the other, like a kernel in a nut. Outside the Old Wall was the Outer Town, with wide streets, high houses, its people noisy and greedy for money..." says the book's hero, Ali Khan Shirvanshir.
"Inside the Old Wall the houses were narrow and curved like oriental daggers."
Architecture with personality
Today the most interesting thing about the oil-boom architecture isn't so much its flamboyance but the human stories behind these buildings.
During the Soviet era these histories were swept under the carpet, but in the early 1990s some locals began to research and popularize them and now they're a tourist attraction.
"The story of architecture through personalia; it really brings the history of the city to life because people on the tour may not remember their names, but they always have a strong after-feeling," says Fuad Akhundov, whose research developed into articles, television programs and colorful walking tours.
In the streets and foyers of former oil-boom mansions, Akhundov can often be seen juggling a bulging photo archive, bringing the family feuds of fin-de-si-cle Baku to life: "I'm like an actor who is stepping on the stage and the stage is Baku," he tells CNN Travel.
People behind the palaces
Outside the Azerbaijan National History Museum, he recounts the rags-to-riches tale of its former resident, Haji Zeynalabdin Taghiyev, the most legendary oil baron of the time.
Taghiyev began as a bricklayer's apprentice but quickly became a successful builder, earning enough money to buy a piece of land in the oil-rich Bibi-Heybat suburbs. Having worked hard for several years without any success, he eventually struck oil and became an instant millionaire.
Extraordinary biographies like this aren't uncommon for Baku in the oil-boom era.
Another unique feature of these mansions, says Akhundov, is the uncanny physical resemblance with their owners. "It's my personal observation but I can show it on a bunch of examples where the houses are reflecting their owners, like dogs".
For example, after the landowner Isa Bey Hajinski became a major public figure he built an extravagant stately mansion right next to the Maiden Tower, Baku's most famous landmark. "His house was a reflection of his status," says Akhundov.
Red Army invasion
Sudden and dramatic change was to come when the Bolsheviks seized power in April 1920, replacing capitalism with socialism.
Many of Baku's architectural stories end in tragedy. A great example is today's Palace of Happiness (where marriage registrations take place).
According to local legend, the inspiration for this building came about while Murtuza Mukhtarov, another renowned oil baron, was traveling in Europe with his wife, Liza Turganova.
Turganova fell in love with a tall Gothic building encountered during the trip and remarked how much she envied its residents.
Upon their return, Mukhtarov secretly commissioned another prolific Polish architect, J-zef P-oszko, to create a copy for her in Baku. It was completed in 1912.
But, as the story goes, in the days following the Bolshevik takeover two soldiers on horseback rode into the lobby. Refusing to give up his property, Mukhtarov first shot the soldiers and then shot himself.
The barons' legacy
In a similarly sad twist of fate, after Taghiyev's death in 1924, his country house was confiscated, his family expelled and his wife Sona was later said to have been seen begging on the streets of Baku.
The Bolsheviks quickly nationalized the biggest oil-boom mansions and converted them into apartments or state offices. In most cases their owners emigrated to Istanbul, Paris and Berlin.
Over the next 70 years a new Soviet architectural layer extended Baku's borders, but the city remained quite small until Azerbaijan restored its independence in 1991.
Since then a second, post-independence oil boom has created a new 21st-century skyline, characterized by innovative structures such as the Heydar Aliyev Center, the Carpet Museum and the Flame Towers.
This has led some to dub Baku the "Caspian Dubai," but that's actually quite far from the truth.
The Azerbaijani capital is much more -- a city of love and legends, a cultural melting pot where East mingles West -- and nowhere can you see this better than in the architecture of the oil-boom.
Fuad Akhundov (+994 50 316 65 52; email@example.com) pioneered research into Baku's oil-boom architecture in the late 1980s and early '90s, and has been leading walking tours for over 25 years.
Tours with Akhundov can also be booked through Lala Huseynova (+994 50 672 7626; firstname.lastname@example.org), who manages his tours and is also a guide. Both Akhundov and Huseynova are part of a cooperative of seven guides leading tours around Baku's major sights, including the legacy of the oil boom.
Baku Original Walking Free Tour-(+994 50 722 7234) offers themed tours which explore central Baku through its oil-boom architecture, literary classics and pop culture.
Baku Sightseeing is a new online tour-booking platform offering a huge selection of Baku walking tours, including the oil boom.