Add and remove classes from elements using media queries in the DOM