Simple obsolescence. Magic is just not that useful anymore.
As technology evolves, we find easier and easier ways of accomplishing the same tasks we've always had to do. And as these things are discovered, they quickly replace the older methods.
Throughout history this was a primary mode of transportation for many people. Unless you had the money to own a horse, or another animal for transportation, you had to walk to get to where you needed to be. And so a lot of people walked, and they got good at walking, developing the necessary muscles and stamina needed to keep walking for a long time.
But how useful is walking in today's society? Well, depending on where you live, walking is almost a lost art. There is simply no need for it. With the ready availability of cars, or other public transportation, the most you need to walk is to and from your vehicle. Technology does the bulk of the work in getting you places, while you relax in a comfortable seat.
Magic is the same way
Unless the magical system in your world is particularly generous, most spell casting involves a level of effort proportional to the effect. Whether it be prolonged magical chanting, complex mystical runes, or simple mental/physical strain, there is a cost to casting a spell. Now, in the past, the benefits of knowing magic outweighed the costs. Knowing a haste spell meant getting places faster, telepathy sped up communications, and knowing an ice spell or two meant better food preservation, and not starving when the winter came.
But with the advent of technology? Why would I strain for hours, if not days, to create a scrying mirror to observe the surroundings of my home when I can just install a camera. The haste spell still doesn't let me outrun a car, and the ice spell just needs too much upkeep compared to a fridge. In a world such as this, magic would no longer be useful for the majority of its inhabitants. Easier to use, possibly cheaper, options via technology are widely available, and so the number of magical users declines.
But this alone is not enough to account for the prodigies, the mages who in ancient times would have single-handedly stood as a powerful deterrent to conventional armies, and shaped the elements with their will.
A genius is not always needed
There is a widely accepted view in programming, that a single highly skilled programmer is often more of a detriment than a benefit to the team where they work. If the difference in skill between them and the rest of the team is too great, then the work that they do will be too difficult for the rest of the team to follow. And consequently, no one but that lone programmer will be able to modify or improve on what they did.
As I see it, there is no greater gap in skill than magic.
As such, most large organizations would be very careful not to become dependent on a single mage. An army of golems is a fantastic work force, but if each change in design of the product they are making requires the original mage's intervention, most companies will likely settle for a less efficient technological solution. Because, don't forget, magic is hard, and there are unlikely to be an army of mages capable of operating at the scale required. Meanwhile, technicians can be trained with a mere 4 years of college.
But not all is lost!
Despite all of this, I would still argue that if nothing else, magic is cool. By that reason alone, your world will probably never fully lose its mages. Children will be interested in learning it to play tricks on their peers, or impress a crush. Adults might know a spell or two that makes their daily lives slightly easier. This low level use will allow the people of your world to find out if they have an affinity for magic, and then those with the drive to pursue it can go on to become full fledged mages.
I imagine their roles would be more like Olympic athletes, or the innovators and visionaries in your world. The difficulty in acquiring, maintaining, and using their skills will weed out all but the best, but by the same token their numbers will be tiny in comparison to the rest of the population.
And so there you have it, a waning magic in your world through no fault of its own. Just people being people.