2 * Nick's web site: default stylesheet
4 * Copyright © 2018-2021 Nick Bowler
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 $backgroundcolour: #ffffff;
22 $foregroundcolour: #000000;
24 $linkdefaultcolour: #0000cd;
25 $linkactivecolour: #ff0000;
26 $linkvisitedcolour: #800080;
28 $ruledefaultcolour: #d3d3d3;
29 $rulestrongcolour: #696969;
31 $annotationcolour: #708090;
33 $tableshadecolour: #f5f5f5;
35 @mixin header_size($maxwidth, $fontsize) {
37 max-width: 1em * ($maxwidth / $fontsize);
41 background-color: $backgroundcolour;
42 color: $foregroundcolour;
43 font-family: sans-serif;
47 a:link { color: $linkdefaultcolour; border-color: $linkdefaultcolour; }
48 a:visited { color: $linkvisitedcolour; border-color: $linkvisitedcolour; }
49 a:active { color: $linkactivecolour; border-color: $linkactivecolour; }
51 h1 { @include header_size(60em, 2em); }
52 h2 { @include header_size(60em, 1.5em); }
53 h5 { @include header_size(60em, 1em); }
55 @supports (display: grid) {
59 grid-template-columns: repeat( auto-fill, minmax(18em, 1fr) );
62 p.img { margin: 0.5em 0; }
70 vertical-align: bottom;
77 text-decoration: none;
78 display: inline-block;
83 color: $foregroundcolour;
85 @media (max-width: 24em) { text-align: left; }
94 @media (max-width: 28em) { text-align: left; }
99 p, table, div, ul, ol, dl, hr {
105 p, table, body>div, h5 { margin: 1em 0; }
107 @media (max-width: 28em) { margin: 1em 0.5em; }
111 li { margin: 0 0 0 2em; }
112 dd { margin: 0 0 0 1em; }
118 border-top: 1px solid $ruledefaultcolour;
122 font-family: monospace;
124 &:before { content: "% "; }
125 &>span { white-space: nowrap; }
137 color: $annotationcolour;
139 a:link, a:visited { color: inherit; }
140 @media not screen { visibility: hidden; }
143 // General table styles.
145 border: 1px solid $ruledefaultcolour;
146 border-collapse: collapse;
150 table>* { font-size: 0.9em; }
160 vertical-align: middle;
166 thead>tr, tbody>tr { border: solid $ruledefaultcolour; }
167 th, thead>tr { border-bottom: 1px solid $rulestrongcolour; }
168 tbody+tbody { border-bottom: 1px solid $ruledefaultcolour; }
169 *>table, *>th { border: none; }
170 thead>tr { border-width: 1px; }
171 tbody>tr { border-width: 0 1px; }
173 td + td { box-shadow: -1px 0 $backgroundcolour; }
176 &:nth-of-type(even) { background-color: $tableshadecolour; }
177 &:last-child { border-bottom: solid 1px $ruledefaultcolour; }
180 // Specific table styles
182 &>tr>*:first-child, &>*>tr>*:first-child {
183 &+* { text-align: center; }
188 // CSS rules for stortable clicky table headers: Update the display of
189 // the /table based on the current state. Each column has its own set
190 // nearly-identical rules, only the class names differ.
192 // The clickytables.xsl stylesheet generates two inputs for each column.
193 // These inputs are siblings of the table and all precede it in document
194 // order. Moreover, the inputs for a column are ordered with respect to
195 // each other, in this sequence:
197 // input.clicky-NAME -- checked iff NAME is selected for sorting.
198 // input.clicky-NAME-rev -- checked to select reverse order.
200 // One of the column selection inputs will have a 'checked' attribute to
201 // indicate the default order. This input is always first in document
202 // order. No other inputs begin checked.
204 // The table itself consists of a thead (where the header labels are
205 // located) and two tbody elements. The bulk of these rules relate
206 // to updating the headers to visually indicate the current state.
208 // A sortable column's th element has the .clicky-NAME class, matching
209 // its corresponding inputs, and has two label children. The first label
210 // is visible only when the column is unselected, and is linked to the
211 // .clicky-NAME input to activate that column. The second label is visible
212 // only on the selected column and is linked to the .clicky-NAME-rev input
213 // to toggle the reverse order.
215 // For the table body, the first tbody contains the default ordering
216 // and is not styled by these rules (except to hide it when alternate
217 // orderings are selected). The second tbody contains rows for all
218 // alternate orderings, and is revealed by these rules. When revealed,
219 // rows with the NAMEfwd or NAMErev class (for the forward and reverse
220 // orderings, respectively) are shown and other rows are hidden.
222 $clickynames: name, date, size;
223 @each $col in $clickynames {
224 input.clicky-#{$col} {
227 // Update table header state
228 & th.clicky-#{$col} {
230 display: -moz-inline-box !important;
231 display: inline-block !important;
233 label { display: none; }
236 // Show only appropriate items from the sort body (forward)
237 &>tbody+tbody>tr.#{$col}fwd { display: table-row; }
238 &>tbody+tbody>tr { display: none; }
242 &+tbody { display: table-row-group !important; }
247 // reverse state for selected sort column
248 &~input.clicky-#{$col}-rev {
250 // Show only appropriate items from sort body (reversed)
251 &>tbody+tbody>tr.#{$col}rev { display: table-row; }
252 &>tbody+tbody>tr { display: none; }
256 &+tbody { display: table-row-group !important; }
261 // Unhide to allow keyboard navigation to this input
262 display: block !important;
266 // If default input element is the only one selected, match it to
267 // return to default view (overriding the changes above). It is
268 // always the first input element among all the sibling elements.
269 // This seems to interoperate better than using the [checked] or
270 // :first-of-type selectors.
271 @at-root &:first-child, :not(input)+& {
272 &:checked~table>tbody {
273 &+tbody { display: none !important; }
274 display: table-row-group;
278 &:focus ~ table th.clicky-#{$col}>label~label>span:first-child {
279 border-color: $foregroundcolour;
282 // Unhide to allow keyboard navigation
283 display: block !important;
284 pointer-events: none;
290 input.clicky-#{$col}-rev {
292 // Update table header state
293 & th.clicky-#{$col} {
295 display: -moz-inline-box !important;
296 display: inline-block !important;
298 .svg { display: none; }
302 &:focus ~ table th.clicky-#{$col}>label~label .svg {
303 border-color: $foregroundcolour;
306 pointer-events: none;
319 display: -moz-inline-box;
320 display: inline-block;
321 border: 1px dotted transparent;
322 vertical-align: middle;
325 // Expand the first label a bit so the table (hopefully)
326 // does not reshape as columns are selected.
328 margin-right: 1.75em;
332 &:active { color: $linkactivecolour; }
333 &:first-child:active>span, &~label:active>.svg {
334 border-color: $linkactivecolour;
341 .svg, svg, img.svgfallback {
345 .svg svg { width: 1.5em; }
349 &>*>tr>*:first-child {
351 // chrome doesn't like width: 0 for some reason
356 .svg, svg, img.svgfallback {
357 vertical-align: middle;
363 svg { width: 1.5em; }
364 display: inline-block;
370 #breadcrumbs>*, #sitetitle>* { font-size: 0.8em; }
374 list-style-type: none;
380 li + li:before { content: "/ "; }
383 display: inline-block;
388 #footer, #article-info {
395 display: inline-block;
402 #footer p { color: $annotationcolour; }
403 #article-info p { font-style: italic; }
405 .wbr:after { content: "\200b"; }
407 // "unordered" lists with explicit ordering in content
409 li { list-style: none; }
410 li>span:first-child, li>*:first-child>span:first-child {
411 display: inline-block;
418 @media (max-width: 512px) {
419 body { margin: 0.6em; }
420 ul ul { margin-left: -1.2em; }
424 @media (max-width: 35em) {
425 #sitetitle * { float: none; }
426 #footer { padding: 0 1em; }