This may be key:
“Yet another version might be that sleep itself is the key: sleep, aside from any resetting, is also responsible for memory formation and appears involved in unconscious processes of creativity.‘
I find the morning is my best work time for either writing or designing and writing software. It seems that often good ideas are just there for the taking in the morning.
That said, I often get the same effect after dinner if I have taken the afternoon off for leisure (e.g., hiking all afternoon).