I have several suggestions -
Since you feel better outside there may be something in your office which is causing this. A sensitivity to a chemical in the office environment especially new -less than 2-3 years old - equipment which leak chemical solvents used in their manufacture. In people who are sensitive to chemicals there is an intuitive reaction, our heads tend to jerk back (not always noticably) and our neck muscles tighten constricting the flow of the blood to the brain. I find that massaging my neck and shoulder muscles using equal pressure on both sides helps this problem and restores normal circulation. Other chemicals such as rug cleaner or other chemicals used on rugs also cause a reaction. Begin noticing smells - chemical, perfumes and see if they cause a problem.
Many people with various forms of gluten intolerance have brain fog. Look at Celiac.com for more information. Try a strict gluten free diet for at least a month and see if you have less problems or just feel generally better.
Posture is important so you may need a different chair or adjust your work area and computer so your muscles do not become strained.