media queries

This is a rehash of #656, but based on the current dev branch. Going to merge it as the lack of media query support is problematic - will raise an issue for the other at-rules