2 * Nick's web site: default stylesheet
4 * Copyright © 2018-2022 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 $focusringcolour: #628cb2;
37 @mixin header_size($maxwidth, $fontsize) {
39 max-width: 1em * ($maxwidth / $fontsize);
43 background-color: $backgroundcolour;
44 color: $foregroundcolour;
45 font-family: sans-serif;
49 a:link { color: $linkdefaultcolour; border-color: $linkdefaultcolour; }
50 a:visited { color: $linkvisitedcolour; border-color: $linkvisitedcolour; }
51 a:active { color: $linkactivecolour; border-color: $linkactivecolour; }
53 @supports (outline-style: auto) {
54 a:link { border-width: 0; }
55 a:focus { outline: auto $focusringcolour; }
56 li, td, dt { &>a:link { border: solid 1px transparent; } }
59 h1 { @include header_size(60em, 2em); }
60 h2 { @include header_size(60em, 1.5em); }
61 h5 { @include header_size(60em, 1em); }
63 @supports (display: grid) {
67 grid-template-columns: repeat( auto-fill, minmax(18em, 1fr) );
70 p.img { margin: 0.5em 0; }
78 vertical-align: bottom;
85 text-decoration: none;
86 display: inline-block;
91 color: $foregroundcolour;
93 @media (max-width: 24em) { text-align: left; }
102 @media (max-width: 28em) { text-align: left; }
107 p, table, div, ul, ol, dl, hr {
113 p, table, body>div, h5 { margin: 1em 0; }
115 @media (max-width: 28em) { margin: 1em 0.5em; }
119 li { margin: 0 0 0 2em; }
120 dd { margin: 0 0 0 1em; }
126 border-top: 1px solid $ruledefaultcolour;
130 font-family: monospace;
132 &:before { content: "% "; }
133 &>span { white-space: nowrap; }
145 color: $annotationcolour;
147 a:link, a:visited { color: inherit; }
148 @media not screen { visibility: hidden; }
151 // General table styles.
153 border: 1px solid $ruledefaultcolour;
154 border-collapse: collapse;
158 table>* { font-size: 0.9em; }
168 vertical-align: middle;
174 thead>tr, tbody>tr { border: solid $ruledefaultcolour; }
175 th, thead>tr { border-bottom: 1px solid $rulestrongcolour; }
176 tbody+tbody { border-bottom: 1px solid $ruledefaultcolour; }
177 *>table, *>th { border: none; }
178 thead>tr { border-width: 1px; }
179 tbody>tr { border-width: 0 1px; }
181 td + td { box-shadow: -1px 0 $backgroundcolour; }
184 &:nth-of-type(even) { background-color: $tableshadecolour; }
185 &:last-child { border-bottom: solid 1px $ruledefaultcolour; }
188 // Specific table styles
190 &>tr>*:first-child, &>*>tr>*:first-child {
191 &+* { text-align: center; }
196 // CSS rules for stortable clicky table headers: Update the display of
197 // the /table based on the current state. Each column has its own set
198 // nearly-identical rules, only the class names differ.
200 // The clickytables.xsl stylesheet generates two inputs for each column.
201 // These inputs are siblings of the table and all precede it in document
202 // order. Moreover, the inputs for a column are ordered with respect to
203 // each other, in this sequence:
205 // input.clicky-NAME -- checked iff NAME is selected for sorting.
206 // input.clicky-NAME-rev -- checked to select reverse order.
208 // One of the column selection inputs will have a 'checked' attribute to
209 // indicate the default order. This input is always first in document
210 // order. No other inputs begin checked.
212 // The table itself consists of a thead (where the header labels are
213 // located) and two tbody elements. The bulk of these rules relate
214 // to updating the headers to visually indicate the current state.
216 // A sortable column's th element has the .clicky-NAME class, matching
217 // its corresponding inputs, and has two label children. The first label
218 // is visible only when the column is unselected, and is linked to the
219 // .clicky-NAME input to activate that column. The second label is visible
220 // only on the selected column and is linked to the .clicky-NAME-rev input
221 // to toggle the reverse order.
223 // For the table body, the first tbody contains the default ordering
224 // and is not styled by these rules (except to hide it when alternate
225 // orderings are selected). The second tbody contains rows for all
226 // alternate orderings, and is revealed by these rules. When revealed,
227 // rows with the NAMEfwd or NAMErev class (for the forward and reverse
228 // orderings, respectively) are shown and other rows are hidden.
230 $clickynames: name, date, size;
231 @each $col in $clickynames {
232 input.clicky-#{$col} {
235 // Update table header state
236 & th.clicky-#{$col} {
238 display: -moz-inline-box !important;
239 display: inline-block !important;
241 label { display: none; }
244 // Show only appropriate items from the sort body (forward)
245 &>tbody+tbody>tr.#{$col}fwd { display: table-row; }
246 &>tbody+tbody>tr { display: none; }
250 &+tbody { display: table-row-group !important; }
255 // reverse state for selected sort column
256 &~input.clicky-#{$col}-rev {
258 // Show only appropriate items from sort body (reversed)
259 &>tbody+tbody>tr.#{$col}rev { display: table-row; }
260 &>tbody+tbody>tr { display: none; }
264 &+tbody { display: table-row-group !important; }
269 // Unhide to allow keyboard navigation to this input
270 display: block !important;
274 // If default input element is the only one selected, match it to
275 // return to default view (overriding the changes above). It is
276 // always the first input element among all the sibling elements.
277 // This seems to interoperate better than using the [checked] or
278 // :first-of-type selectors.
279 @at-root &:first-child, :not(input)+& {
280 &:checked~table>tbody {
281 &+tbody { display: none !important; }
282 display: table-row-group;
286 // Unhide to allow keyboard navigation
287 display: block !important;
288 pointer-events: none;
294 input.clicky-#{$col}-rev {
296 // Update table header state
297 & th.clicky-#{$col} {
299 display: -moz-inline-box !important;
300 display: inline-block !important;
302 .svg { display: none; }
306 pointer-events: none;
312 $focuslabel: ":focus ~ table th.clicky-#{$col}>label~label";
313 #{"input.clicky-#{$col+$focuslabel}"}>span:first-child
314 , #{"input.clicky-#{$col}-rev#{$focuslabel}"} .svg
316 border-color: $foregroundcolour;
317 @at-root { @supports (outline-style: auto) { & {
318 border-color: transparent;
319 outline: auto $focusringcolour;
330 display: -moz-inline-box;
331 display: inline-block;
332 border: 1px dotted transparent;
333 vertical-align: middle;
336 // Expand the first label a bit so the table (hopefully)
337 // does not reshape as columns are selected.
339 margin-right: 1.75em;
343 &:active { color: $linkactivecolour; }
344 &:first-child:active>span, &~label:active>.svg {
345 border-color: $linkactivecolour;
346 @at-root { @supports (outline-style: auto) { & {
347 border-color: transparent;
348 outline: auto $focusringcolour;
356 .svg, svg, img.svgfallback {
360 .svg svg { width: 1.5em; }
364 &>*>tr>*:first-child {
366 // chrome doesn't like width: 0 for some reason
371 .svg, svg, img.svgfallback {
372 vertical-align: middle;
378 svg { width: 1.5em; }
379 display: inline-block;
385 #breadcrumbs>*, #sitetitle>* { font-size: 0.8em; }
389 list-style-type: none;
395 li + li:before { content: "/ "; }
398 display: inline-block;
403 #footer, #article-info {
410 display: inline-block;
417 #footer p { color: $annotationcolour; }
418 #article-info p { font-style: italic; }
420 .wbr:after { content: "\200b"; }
422 // "unordered" lists with explicit ordering in content
424 li { list-style: none; }
425 li>span:first-child, li>*:first-child>span:first-child {
426 display: inline-block;
433 @media (max-width: 512px) {
434 body { margin: 0.6em; }
435 ul ul { margin-left: -1.2em; }
439 @media (max-width: 35em) {
440 #sitetitle * { float: none; }
441 #footer { padding: 0 1em; }