Say you're doing contract development work that is accounted for and billed on an hourly basis. There has been no design work done/provided up front, and the project involves a number of problems that require a non-trivial solution. Time spent designing, researching, and implementing solutions to such problems would be billable.
However, a lot of design and problem solving tends to happen "in the background", when doing things that are completely unrelated to the project itself. For instance, it's not uncommon to come up with a solution to a problem while showering, or eating dinner. And time spent mentally planning out an approach while drifting off to sleep at night can significant cut down on the amount of coding time/trial and error required the next day. And so on.
So how is the time spent on such "background tasks" generally accounted for? If those things were done while sitting at a desk and focused on the project, they'd definitely be billable. Do they become less billable or non-billable by virtue of having been done outside of a working context? If so, how do you compensate for the fact that you're basically providing effort/value for free in that case? By charging a higher hourly rate?
And if not, how do you compensate for the fact that if you did the same task in the "foreground" it may have taken slightly less time than doing it in the background?