Requests for comment/Allow styling in templates

Background
Currently the language MediaWiki uses to author documents allows the inclusion of html elements with style attributes. Mixing layout with content causes various problems with reusability, maintainability and is not future proof. Already on the mobile version of MediaWiki problems are being seen with inline styles with how pages render on smaller screens which could be solved via css3 media queries, however these cannot be done in inline styles.

It should be possible for templates to have associated stylesheets so that media queries can be applied where necessary.

A proof of concept can be found here: https://gerrit.wikimedia.org/r/68123

Problem
In terms of how separating styles into stylesheets will help things out on mobile fundamentally it allows you to use media queries. Thus you can do radically different things such as have a 2 column layout on a desktop browser but have a 1 column layout on mobile. For instance in this code snippet:

This means if the screen is smaller than 600px then none of these css rules will apply. On a screen of 320px such a style introduced via inline style would be broken ( and you cannot do media queries in a style attribute )

Proposal
The proposal is to allow a template to have an associted stylesheet. For Template:Foo this may be the associated stylesheet Template:Foo.css An alternative would be actually to allow the style tag to be inside the template itself (potentially scoped).

Moving forward
It seems we need to make several decisions to move forward with this the first being:
 * Is this a good idea? / Would this be useful? 
 * Should this be part of the template itself or a separate template file?
 * Who should be allowed to edit the stylesheets for a template?
 * '''What measures need to be made to take into account performance and security