Changes for all the late feedback of pull request 8720.

Including fixes for #8850, #8851 and #8852 as they are closely related to the changes in this pull request. 

Also fix #8865 and #8870 for variable interpolation in LESS.
Drive-by: I'm having trouble picturing the scenario described here.  How are can two rules be siblings if one is inside an `@media` rule and the other isn't?