So what is this?
This spage is an implementation of a day/night toggle with CSS doing the heavy lifting. This is handled by using hidden <input>
checkboxes and CSS' new(ish) :checked
attribute.
All the scripting is doing is tracking the day/night state of the checkbox in a cookie, and assisting the contact modal close to not fill up the browser history. Both the modal and night/day work without the scripting, though the night/day state is lost between page-loads when JS is disabled/missing.
Again, do as much as you can without scripting FIRST! Only dive for JS for things that obviously can't be handled otherwise!