Two billion cups of coffee are drunk around the world every day and 25 million families rely on growing coffee for a living. Over the past 15 years, consumption of the drink has risen by 43% - but researchers are warning that the world's most popular coffee, Arabica, is under threat.
Although there are 124 known species of coffee, most of the coffee that's grown comes from just two - Arabica and Robusta.
Robusta makes up about 30% of global coffee production, and is mainly used for instant coffee. As the name implies, it is a strong plant - but for many, its taste cannot compare to the smooth and complex flavours of Arabica.
It is Arabica that drives the industry and accounts for the majority of coffee grown worldwide, but it is a more fragile plant and only tolerates a narrow band of environmental conditions. It is particularly sensitive to changes in temperature and rainfall.
In 2012, research by a team from the UK's Royal Botanic Gardens, Kew, revealed a bleak picture for wild coffee in Ethiopia, where Arabica originated. They did a computer modelling exercise to predict how environmental changes would affect Arabica for the rest of the century. They forecast that the number of locations where wild Arabica coffee grows could decrease by 85% by 2080 - the worst-case outcome was a 99.7% reduction.
"If we don't do anything now and over the next 20 years, by end of the century, wild Arabica in Ethiopia could be extinct - that's in the worst-case scenario," says Dr Aaron Davis, head of coffee research at Kew, who led the project.
The report made headlines around the world and spurred the industry into action. Since then, the team from Kew and their partners in Ethiopia have covered 25,000km in Ethiopia, visiting coffee producing areas to compare their predictions with what is happening in reality. "It's important to see what's happening on the ground, observing what influence climate change is having on coffee now, and talking to farmers. They can tell us what has happened, sometimes taking us back many decades, with several generations of farmers involved," says Davis.
The team is now working with the Ethiopian government to find ways to safeguard the coffee industry. Moving production to higher ground - where it's cooler - might be part of the solution. Some areas currently unsuitable for coffee growing may become suitable in the future. "It's jeopardy and threat in some areas, but opportunity in others," says Davis.
Little was known about wild Arabica until quite recently - it was not until the end of the 19th Century that scientists confirmed it as an Ethiopian plant, rather than Arabian, as the name suggested. Dr Tadesse Woldermariam Gole, an Ethiopian wild coffee specialist, only completed his work on mapping wild Arabica a few years ago. It is now known that wild Arabica coffee grows only in southern Ethiopia, on either side of the Rift Valley, and on the Boma plateau in South Sudan.
Kew's research has wide-ranging implications, not just for Ethiopia's many small-scale coffee producers, but also for the rest of the world. Anything that poses a threat to the indigenous, wild varieties of Arabica grown in Ethiopia is likely to affect commercial varieties even more. Environment is a key factor, but there is another reason too - genetics.
"Wild species have much greater genetic diversity - anything happening in the wild populations is usually amplified in commercial varieties where the genetic diversity is so much less," says Justin Moat, Kew's head of spatial analysis.
Commercial coffee, grown in plantations, is thought to have no more than 10% of the genetic variety of wild Arabica. Put simply, it is in-bred.
The reasons for this lack of genetic diversity are partly historical. Many plantations were established from single plants, shipped out to various colonies - a single plant was taken from Amsterdam's botanical gardens to Surinam in 1718, another was sent to Martinique in 1720, and so on.
And since then, very few new varieties have been developed. "Unlike many other crop species, coffee has had very little research behind it, says Dr Timothy Schilling, executive director of the World Coffee Research institute (WCR).
Schilling says coffee is "an orphan crop", meaning it has been grown in tropical countries that did not have the resources to invest in research. Coffee only has about 40 plant breeders, compared to thousands in crops like corn, rice or wheat.
"Richer countries buy it, roast it and drink it, but have not paid for the agronomy. Only now is the industry waking up and seeing the need for it. The coffee industry has realised no-one else is doing it - it's going to have to be us," says Schilling. "But there is a big gap in our knowledge. For example we didn't know the genetic base was so small."
Just how small became clear earlier this year.
In 2013 WCR thought it had found a gold mine of genetic variation - 870 strains of wild Arabica coffee, growing in Costa Rica's Center for Tropical Agricultural Research and Education. The plants had been collected in Ethiopia the 1960s by the UN's Food and Agriculture Organization and distributed to more than a dozen countries in an effort to increase diversity - this was one of the only collections to survive.
"We took every one of those strains and sequenced the DNA strands and matched them one by one to see what diversity there was," says Schilling. "We got the results back in the beginning of the year and there was amazingly little diversity. It was a big shock. We knew it was small, but not that small."
"As a result, we don't have the diversity in available Arabica coffees that we need for the next 200 years."
Lack of diversity in crops can have disastrous consequences - it makes them more susceptible to disease. And coffee has a foe - coffee leaf rust. The fungus wiped out Sri Lanka's coffee plantations entirely in the late 1800s, and there was a bad outbreak in 2013 in Central America. The coffee grown there had no resistance to the disease - the crop relied on the protection of low temperatures at higher altitudes.
This is why Schilling is embarking on an ambitious plan - "to recreate Arabica, but with better breeding."
The origins of Arabica are pretty extraordinary. It is a hybrid of two types of coffee, C eugenioides and C canephora (Robusta coffee).
"It's a love story actually," says Schilling. "Arabica has two parents that met some 10-15,000 years ago and combined to create Arabica. It was a one-time-only event, a one-night stand, if you will.
"So even from the get-go, the genetic base was not that big, just one C eugenioides getting it on with one C canephora."
He now intends to recreate that hybrid and improve on it. "What we aim to do is to get a bunch of highly diverse C eugenioides and C canephora and cross them, to recreate C arabica but better - more diverse."
Schilling points out that this is not genetic engineering, but old-fashioned breeding, using modern techniques - and that it could take decades.
In the shorter term, WCR has decided to start another breeding programme, too. "We need to take all the good things of Robusta and combine them with Arabica," he says. "Robusta is hardy and produces a lot, but it has a notoriously awful taste."
It may seem obvious, but taste is the critical factor in any breeding programme. This aspect has been ignored in the past, sometimes with disastrous consequences.
In the late 1800s, after coffee leaf rust devastated the Arabica plantations in Sri Lanka, the British government decided to grow a new type of coffee: Liberica. They tried in vain to convince the public that it would be a good substitute. "Liberica is a strong grower and a prolific cropper but it just doesn't taste very good, and for many tastes a bit like vegetable soup," says Davis.
The Ceylon Observer recorded the venture's dismal failure in a series of articles. "They start off saying it is great coffee. Then, five years later: 'Well it will be good for the US market, they like strong coffee,' to: 'Will anybody drink this coffee?'" says Davis.
So does nothing taste as good as Arabica? "Coffea stenophylla, sometimes known as the highland coffee of Sierra Leone, is supposed to be incredible," says Schilling. Drunk locally, in 1896 it was described by Kew as one of the two species of coffee which could "prove a formidable rival of the Arabian coffee" - the other was Liberica. Who knows, if the British had opted for C stenophylla instead, what coffee would taste like today.
Davis is not sure the answer lies in using different species of coffee. "Most wild coffee species either don't taste very good or produce small crops, although there are some species that could have potential, either as crops themselves or as part of breeding programmes. But this won't happen overnight," he says.
This is why the work of Kew and its partners, especially those in Ethiopia, to safeguard the existing indigenous population of wild Arabica is so vital - the hope is that this will provide the tools to ensure coffee's survival.
Perhaps the country that has historically been most closely associated with coffee is Colombia. Half a century ago, coffee accounted for 80% of Colombia's exports although it's a lot less now. Coffee exports were helped by a global marketing campaign based on a fictional character known as Juan Valdez. He was a caricature of a typical Colombian coffee farmer.
Other countries are trying to make their mark on the world coffee market too. Burundi is one of them. Following the end of its civil war in 2006, coffee now accounts for the bulk of its foreign exports.
Global coffee consumption is even rising in India, the home of tea.
Listen to The Food Chain on Coffee: Globalisation's drink of choice.
Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.