>>14193855Okay I think it's like this: you have a jittering mass of molecules that are attached to each other via various bonds. At a higher temperature, they jitter faster and the bond lengths are slightly increased (expansion). That increase in bond length is actively held up by the amount of jittering (heat).
When you cool it, the jittering decreases and they "fall" back closer to each other (bond length decreases).
Imagine the bond length as being like "height," except that this is the version of "height" that exists in electromagnetism instead of gravity. When you remove the energy that keeps something up, it falls back down, appearing to do work.
No idea if that's actually right.