+ @media not screen { visibility: hidden; }
+}
+
+// General table styles.
+table {
+ border: 1px solid $ruledefaultcolour;
+ border-collapse: collapse;
+ width: 100%;
+}
+
+table>* { font-size: 0.9em; }
+caption {
+ caption-side: top;
+ font-weight: bold;
+ font-size: 1em;
+ text-align: left;
+ margin: 0 0 0.5em 0;
+}
+
+td, th {
+ vertical-align: middle;
+ text-align: left;
+ padding: 1ex;
+ margin: 0;
+}
+
+thead>tr, tbody>tr { border: solid $ruledefaultcolour; }
+th, thead>tr { border-bottom: 1px solid $rulestrongcolour; }
+*>table, *>th { border: none; }
+thead>tr { border-width: 1px; }
+tbody>tr { border-width: 0 1px; }
+
+td + td { box-shadow: -1px 0 $backgroundcolour; }
+
+tbody>tr {
+ &:nth-of-type(even) { background-color: $tableshadecolour; }
+ &:last-child { border-bottom: solid 1px $ruledefaultcolour; }
+}
+
+// Specific table styles
+table.cc {
+ &>tr>*:first-child, &>*>tr>*:first-child {
+ &+* { text-align: center; }
+ text-align: center;
+ }
+}
+
+$sortcols: name, date, size;
+@each $col in $sortcols {
+ #filelist-#{$col}-sort {
+ &:checked {
+ & ~ table.filelist {
+ /* Update table header state */
+ th.#{$col} {
+ label~label {
+ display: -moz-inline-box !important;
+ display: inline-block !important;
+ }
+ label { display: none; }
+ }
+
+ /* Show only appropriate items from the sort body (forward) */
+ tbody+tbody>tr.#{$col} { display: table-row; }
+ tbody+tbody>tr { display: none; }
+ }
+
+ & ~ #filelist-#{$col}-rev:checked ~ table.filelist {
+ /* Show only appropriate items from sort body (reversed) */
+ tbody+tbody>tr.#{$col}rev { display: table-row; }
+ tbody+tbody>tr { display: none; }
+ }
+
+ /* Unhide associated checkbox for keyboard navigation */
+ & ~ #filelist-#{$col}-rev { display: block !important; }
+ }
+
+ &:focus ~ table.filelist th>label~label>span {
+ border: 1px dotted;
+ padding: 0;
+ }
+
+ display: block !important;
+ position: absolute;
+ z-index: -1;
+ opacity: 0;
+ }
+
+ #filelist-#{$col}-rev {
+ &:checked ~ table.filelist {
+ /* Update table header state */
+ th.#{$col} {
+ img+img {
+ display: -moz-inline-box !important;
+ display: inline !important;
+ }
+ img { display: none; }
+ }
+ }
+
+ &:focus ~ table.filelist th>label~label>img {
+ border: 1px dotted;
+ padding: 0;
+ }
+
+ position: absolute;
+ z-index: -2;
+ opacity: 0;
+ }