Media query support

Not the cleanest implementation, but doing it differently would requiring more refactoring.