Yes. Stop eating sugar! The headache could be from caffeine, artificial sweeteners, low blood sugar (caused by the insulin spike you get after eating sweet stuff)... the more crap you eat, the more you want (IME ).
The brain fog - quite common in people with a sensitivity to sweetners like sucralose (it's in a lot of sweets) and also, gluten.
I still eat chocolate daily - but now it's small amounts of good quality, 85% cocoa - you get the cocoa hit but virtually no sugar.
Initially you may feel worse cutting out high carb treats, expect headaches, but you will feel much better in the long term.
Just had a long chat with a friend about another problem I've got at the moment and she pointed out that I've seemed very down lately. I said I think I have been quite down, and today I feel especially like shite. I realised I ate a lot of sugar (chocolate) yesterday and I've noticed that I feel like I'm drugged the next day, or in a fog. I've got a headache, my face is red and blotchy and I just feel like I want to go to sleep. And I think it affects my mood too. I feel ok when I stay off the sweets and chocolate but it's so hard to not eat them. Anyone else experience this?