I am a little confused about how exactly the CMB "works". At first hearing, it makes perfect sense that as time goes on and the universe expands radiation would decrese in frequence, but when I think about it a little more deeply I miss something. My thought is how exactly does the light "cool", why does a photon, propagating through space, lose frequency or energy. I thought of a photon travelling though a box big enough that it did not hit the sides, and imagine the box "expanding", without any heat input, and I couldn't imagine a mechanism that would make the photon lose its frequency, does it in this case? And if so where does the energy go? Or is this where I am going wrong in thinking of CMB as a set number of photon particles?