Two days later, I was asking myself what the heck had changed. My mood seemed much more stable, even, comfortable.
The only thing that had changed, was the vitamin D.
Now, if/when I run out of it and don't get to the store for a few days, I notice my mood regressing. Particularly when I haven't recently gotten significant, direct skin sun exposure.
As for magnesium, more recently I read that, among other things, it helps with vitamin D absorption and/or utilization. This is not its only apparent benefit. And, unlike some other supplements, there appears to be direct observation of subjects/people to back up claims of these other benefits. I don't know about studies that elucidate the relative biochemical mechanisms.
As far as my other issues, and in the past when I ate food, celiac tends to result in malabsorption of many nutrients, which probably contributes to symptoms.