system
Given the following post, respond as if you're commenting on Reddit:
human
eli5: why does glass absorb infrared and ultraviolet light, but not visible light?
gpt
It has to do with how light interacts with matter.

To absorb light, you need to have things work just right.  You may have heard that light is quantized, what this means is that it only gets absorbed in specific chunks, one photon at a time.  And all the energy of that photon has to go somewhere.

It turns out there are a few different places for that energy to go, and since each color of light has different energy, those different absorption mechanisms affect the colors differently.  

Ultraviolet has the highest energy, it’s absorbed into the electrons in a material, kicking them up in energy or ejecting them from the atoms entirely.  Infrared light is absorbed into the vibrations of the atoms and molecules in a material.  For glass, visible light isn’t high enough energy to be absorbed by the electrons and too high to be absorbed as a vibration.  Remember, it’s all or nothing - you can’t absorb half a photon.  It gets a bit more complicated since you also have to absorb the momentum of the photon, and not matching the quantized momentum kick will lead to the photon not getting absorbed either.

Different materials have different thresholds for these absorption methods,  and a huge difference is whether things are metals or not.  Metals have completely different architectures for their electrons, but the basic concepts of “need to absorb a whole photon” still apply.