SIDI IFNI, MOROCCO - Growing up on Mount Boutmezguida in southwest Morocco on the edge of the Sahara desert, Khadija Ghouate never imagined that the fog enveloping the nearby peaks would change her life.
For hours every day and often before sunrise, Ghouate and other women from nearby villages would walk 5 km (3 miles) to fetch water from open wells, with girls pulled out of school to help and at risk of violence on the lonely treks.
But with groundwater levels dropping due to overuse, drought and climate change, the challenge to get enough water daily was becoming harder, and almost half of people in the local area sold up and quit rural life after generations for the city.
As the future of the traditional Berber region by Mount Boutmezguida floundered, a mathematician whose family came from the area had a eureka moment gleaned from living overseas - using fog to make water.
Now Ghouate's village is connected to the world's largest functioning fog collection project, alleviating the need to collect water that fell mainly on women, and with state-of-the-art equipment setting an example for other projects globally.
"You always had to go to the wells, always be there, mornings, evenings," said Ghouate, a mother-of-three, as she prepared lunch for her family, showing off the tap in her home.
"But now water has arrived in our house. I like fog a lot.
The project, running since 2015 after nine years of surveys and tests, was founded by the Moroccan non-government organization Dar Si Hmad, which works to promote and preserve local culture, history, and heritage.
It was the brainchild of mathematician and businessman Aissa Derhem whose parents were originally from Mount Boutmezguida where the slopes are covered in mist on average 130 days a year.
Derhem first came across fog collection when he learned of one of the world's first projects - in Chile's Atacama Desert - while he living in Canada in the 1980s studying for his PhD.
But it was not until visiting his parents' village years later that he realized the mountainous location, situated at the edge of the Sahara and about 35 km (22 miles) from the Atlantic Ocean, was perfect for fog.
Mist accumulates in coastal areas where a cold sea current, an anticyclone and a land obstacle, such as a mountain range, combine.
"When the sea water evaporates, the anticyclone ... stops it from becoming rain, and when it hits the mountain, that's where it can be gathered," Derhem told the Thomson Reuters Foundation, looking out from the top of Mount Boutmezguida besides a small building used as a fog observatory and tool deposit.
"If we look at the planet, we see this happening in all tropical regions ... In Chile and Peru in Latin America. The Kalahari desert in Africa. In Western Australia. Around the Thar desert in India and in California," he listed as examples.
Developed in South America in the 1980s, fog collection projects have since spread globally to countries including Guatemala, Ghana, Eritrea, Nepal and the United States.
In Morocco, Dar Si Hmad has built a system of nets stretching about 870 square metres - about 4.5 tennis courts.
These nets are hung between two poles and when wind pushes the fog through the mesh, water droplets are trapped, condense and fall into a container at the bottom of the unit with pipes connecting the water to reservoirs.
Derhem hopes the success of the Mount Boutmezguida scheme can help other areas in West Africa and in North Africa - where the United Nation's Food and Agriculture Organization (FAO) says fresh water resources are among the world's lowest.
Studies show climate change impacting water patterns globally and Derhem said in Morocco levels have dropped to about 500 cubic meters a person a year from about 1,500 cubic meters a person in the 1960s on calculations based on government figures.
The principles behind fog collection are simple, and throughout nature examples exist of creatures capturing moisture from the air in the most arid conditions, ranging from beetles in the Namib Desert to lizards in the Australian outback.
But creating a water collection project on a large scale comes with challenges, as the research and development, as well as the infrastructure and technology involved in expanding and developing fog collection projects, can be costly.
The project at Mount Boutmezguida, however, has been a trailblazer for other projects due to its equipment, according to its founders.
The original nets used were insufficiently resistant to the high winds and tore but a partnership with the German non-profit Water Foundation allowed Dar Si Hmad to develop a stronger net.
The CloudFisher was described by the WaterFoundation as the first maintance-free fog collector that can withstand wind speeds of up 120 kph with flexible troughs following the movement of the net in the wind.
Now collected water is filtered and combined with underground water before being distributed to villages on the grid with homes paying for water through a pre-paid system.
The initial pilot project served five villages. At present, the 870 square metres of nets installed reach about 140 families - 14 villages - while a second set of nets is being built.
"Fog is like aeroplanes at the start. At the beginning they were only little toys but, with some effort, things have changed ... but it needs investment," said Derhem.
"Along the coast, there is three times as much fog as there is available on Mount Boutmezguida. The government spends millions for water desalination processes. This is something that is worth exploring."
For with dry wells comes anxiety and risk but also the unraveling of traditional livelihoods and communities.
Mohamed Zabour, president of the local municipality, said more than 60 percent of the inhabitants of the region live without running water in their homes.
Between 2004 and 2014, 2,000 of the 5,000 local residents moved to cities.
"Our region is rich but it needs infrastructure. And water is one of the priorities," said Zabour.
"If we don't find a solution in the next 10 years, it's going to be a catastrophe ... It's going to be like a desert. Empty."
For Ghouate, the fog scheme has improved village life.
"When we were kids, we didn't even know what it meant to need water ... Now there is less rain and if I still had to go to the wells, I wouldn't find much water now," she said. "Everything is about water, everything. I don't have to worry about it anymore."