I didn't know about matchMedia. I'll update the code to use this feature.