/ static / simple.css
simple.css
  1  /* Set the global variables for everything. Change these to use your own fonts and colours. */
  2  :root {
  3    /* Set sans-serif & mono fonts */
  4    --sans-font: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir,
  5      "Nimbus Sans L", Roboto, Noto, "Segoe UI", Arial, Helvetica,
  6      "Helvetica Neue", sans-serif;
  7    --mono-font: Consolas, Menlo, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  8  
  9    /* Body font size. By default, effectively 18.4px, based on 16px as 'root em' */
 10    --base-fontsize: 1.15rem;
 11  
 12    /* Major third scale progression - see https://type-scale.com/ */
 13    --header-scale: 1.25;
 14  
 15    /* Line height is set to the "Golden ratio" for optimal legibility */
 16    --line-height: 1.618;
 17  
 18    /* Default (light) theme */
 19    --bg: #fff;
 20    --accent-bg: #f5f7ff;
 21    --text: #212121;
 22    --text-light: #585858;
 23    --border: #d8dae1;
 24    --accent: #0d47a1;
 25    --accent-light: #90caf9;
 26    --code: #d81b60;
 27    --preformatted: #444;
 28    --marked: #ffdd33;
 29    --disabled: #efefef;
 30  }
 31  
 32  /* Dark theme */
 33  @media (prefers-color-scheme: dark) {
 34    :root {
 35      --bg: #212121;
 36      --accent-bg: #2b2b2b;
 37      --text: #dcdcdc;
 38      --text-light: #ababab;
 39      --border: #666;
 40      --accent: #ffb300;
 41      --accent-light: #ffecb3;
 42      --code: #f06292;
 43      --preformatted: #ccc;
 44      --disabled: #111;
 45    }
 46  
 47    img,
 48    video {
 49      opacity: 0.6;
 50    }
 51  }
 52  
 53  html {
 54    /* Set the font globally */
 55    font-family: var(--sans-font);
 56  }
 57  
 58  /* Make the body a nice central block */
 59  body {
 60    color: var(--text);
 61    background: var(--bg);
 62    font-size: var(--base-fontsize);
 63    line-height: var(--line-height);
 64    display: flex;
 65    min-height: 100vh;
 66    flex-direction: column;
 67    flex: 1;
 68    margin: 0 auto;
 69    max-width: 45rem;
 70    padding: 0 0.5rem;
 71    overflow-x: hidden;
 72    word-break: break-word;
 73    overflow-wrap: break-word;
 74  }
 75  
 76  /* Make the header bg full width, but the content inline with body */
 77  header {
 78    background: var(--accent-bg);
 79    border-bottom: 1px solid var(--border);
 80    text-align: center;
 81    padding: 2rem 0.5rem;
 82    width: 100vw;
 83    position: relative;
 84    box-sizing: border-box;
 85    left: 50%;
 86    right: 50%;
 87    margin-left: -50vw;
 88    margin-right: -50vw;
 89  }
 90  
 91  /* Remove margins for header text */
 92  header h1,
 93  header p {
 94    margin: 0;
 95  }
 96  
 97  /* Add a little padding to ensure spacing is correct between content and nav */
 98  main {
 99    padding-top: 1.5rem;
100  }
101  
102  /* Fix line height when title wraps */
103  h1,
104  h2,
105  h3 {
106    line-height: 1.1;
107  }
108  
109  /* Format navigation */
110  nav {
111    font-size: 1rem;
112    line-height: 2;
113    padding: 1rem 0;
114  }
115  
116  nav a {
117    margin: 1rem 1rem 0 0;
118    border: 1px solid var(--border);
119    border-radius: 5px;
120    color: var(--text) !important;
121    display: inline-block;
122    padding: 0.1rem 1rem;
123    text-decoration: none;
124    transition: 0.4s;
125  }
126  
127  nav a:hover {
128    color: var(--accent) !important;
129    border-color: var(--accent);
130  }
131  
132  nav a.current:hover {
133    text-decoration: none;
134  }
135  
136  footer {
137    margin-top: 4rem;
138    padding: 2rem 1rem 1.5rem 1rem;
139    color: var(--text-light);
140    font-size: 0.9rem;
141    text-align: center;
142    border-top: 1px solid var(--border);
143  }
144  
145  /* Format headers */
146  h1 {
147    font-size: calc(
148      var(--base-fontsize) * var(--header-scale) * var(--header-scale) *
149        var(--header-scale) * var(--header-scale)
150    );
151    margin-top: calc(var(--line-height) * 1.5rem);
152  }
153  
154  h2 {
155    font-size: calc(
156      var(--base-fontsize) * var(--header-scale) * var(--header-scale) *
157        var(--header-scale)
158    );
159    margin-top: calc(var(--line-height) * 1.5rem);
160  }
161  
162  h3 {
163    font-size: calc(
164      var(--base-fontsize) * var(--header-scale) * var(--header-scale)
165    );
166    margin-top: calc(var(--line-height) * 1.5rem);
167  }
168  
169  h4 {
170    font-size: calc(var(--base-fontsize) * var(--header-scale));
171    margin-top: calc(var(--line-height) * 1.5rem);
172  }
173  
174  h5 {
175    font-size: var(--base-fontsize);
176    margin-top: calc(var(--line-height) * 1.5rem);
177  }
178  
179  h6 {
180    font-size: calc(var(--base-fontsize) / var(--header-scale));
181    margin-top: calc(var(--line-height) * 1.5rem);
182  }
183  
184  /* Format links & buttons */
185  a,
186  a:visited {
187    color: var(--accent);
188  }
189  
190  a:hover {
191    text-decoration: none;
192  }
193  
194  a button,
195  button,
196  [role="button"],
197  input[type="submit"],
198  input[type="reset"],
199  input[type="button"] {
200    border: none;
201    border-radius: 5px;
202    background: var(--accent);
203    font-size: 1rem;
204    color: var(--bg);
205    padding: 0.7rem 0.9rem;
206    margin: 0.5rem 0;
207    transition: 0.4s;
208  }
209  
210  a button[disabled],
211  button[disabled],
212  [role="button"][aria-disabled="true"],
213  input[type="submit"][disabled],
214  input[type="reset"][disabled],
215  input[type="button"][disabled],
216  input[type="checkbox"][disabled],
217  input[type="radio"][disabled],
218  select[disabled] {
219    cursor: default;
220    opacity: 0.5;
221    cursor: not-allowed;
222  }
223  
224  input:disabled,
225  textarea:disabled,
226  select:disabled {
227    cursor: not-allowed;
228    background-color: var(--disabled);
229  }
230  
231  input[type="range"] {
232    padding: 0;
233  }
234  
235  /* Set the cursor to '?' while hovering over an abbreviation */
236  abbr {
237    cursor: help;
238  }
239  
240  button:focus,
241  button:enabled:hover,
242  [role="button"]:focus,
243  [role="button"]:not([aria-disabled="true"]):hover,
244  input[type="submit"]:focus,
245  input[type="submit"]:enabled:hover,
246  input[type="reset"]:focus,
247  input[type="reset"]:enabled:hover,
248  input[type="button"]:focus,
249  input[type="button"]:enabled:hover,
250  input[type="checkbox"]:focus,
251  input[type="checkbox"]:enabled:hover,
252  input[type="radio"]:focus,
253  input[type="radio"]:enabled:hover {
254    filter: brightness(1.4);
255    cursor: pointer;
256  }
257  
258  /* Format the expanding box */
259  details {
260    background: var(--accent-bg);
261    border: 1px solid var(--border);
262    border-radius: 5px;
263    margin-bottom: 1rem;
264  }
265  
266  summary {
267    cursor: pointer;
268    font-weight: bold;
269    padding: 0.6rem 1rem;
270  }
271  
272  details[open] {
273    padding: 0.6rem 1rem 0.75rem 1rem;
274  }
275  
276  details[open] summary {
277    margin-bottom: 0.5rem;
278    padding: 0;
279  }
280  
281  details[open] > *:last-child {
282    margin-bottom: 0;
283  }
284  
285  /* Format tables */
286  table {
287    border-collapse: collapse;
288    width: 100%;
289    margin: 1.5rem 0;
290  }
291  
292  td,
293  th {
294    border: 1px solid var(--border);
295    text-align: left;
296    padding: 0.5rem;
297  }
298  
299  th {
300    background: var(--accent-bg);
301    font-weight: bold;
302  }
303  
304  tr:nth-child(even) {
305    /* Set every other cell slightly darker. Improves readability. */
306    background: var(--accent-bg);
307  }
308  
309  table caption {
310    font-weight: bold;
311    margin-bottom: 0.5rem;
312  }
313  
314  /* Lists */
315  ol,
316  ul {
317    padding-left: 3rem;
318  }
319  
320  /* Format forms */
321  textarea,
322  select,
323  input {
324    font-size: inherit;
325    font-family: inherit;
326    padding: 0.5rem;
327    margin-bottom: 0.5rem;
328    color: var(--text);
329    background: var(--bg);
330    border: 1px solid var(--border);
331    border-radius: 5px;
332    box-shadow: none;
333    box-sizing: border-box;
334    width: 60%;
335    -moz-appearance: none;
336    -webkit-appearance: none;
337    appearance: none;
338  }
339  
340  /* Add arrow to  */
341  select {
342    background-image: linear-gradient(45deg, transparent 49%, var(--text) 51%),
343      linear-gradient(135deg, var(--text) 51%, transparent 49%);
344    background-position: calc(100% - 20px), calc(100% - 15px);
345    background-size: 5px 5px, 5px 5px;
346    background-repeat: no-repeat;
347  }
348  
349  select[multiple] {
350    background-image: none !important;
351  }
352  
353  /* checkbox and radio button style */
354  input[type="checkbox"],
355  input[type="radio"] {
356    vertical-align: bottom;
357    position: relative;
358  }
359  
360  input[type="radio"] {
361    border-radius: 100%;
362  }
363  
364  input[type="checkbox"]:checked,
365  input[type="radio"]:checked {
366    background: var(--accent);
367  }
368  
369  input[type="checkbox"]:checked::after {
370    /* Creates a rectangle with colored right and bottom borders which is rotated to look like a check mark */
371    content: " ";
372    width: 0.1em;
373    height: 0.25em;
374    border-radius: 0;
375    position: absolute;
376    top: 0.05em;
377    left: 0.18em;
378    background: transparent;
379    border-right: solid var(--bg) 0.08em;
380    border-bottom: solid var(--bg) 0.08em;
381    font-size: 1.8em;
382    transform: rotate(45deg);
383  }
384  input[type="radio"]:checked::after {
385    /* creates a colored circle for the checked radio button  */
386    content: " ";
387    width: 0.25em;
388    height: 0.25em;
389    border-radius: 100%;
390    position: absolute;
391    top: 0.125em;
392    background: var(--bg);
393    left: 0.125em;
394    font-size: 32px;
395  }
396  
397  /* Make the textarea wider than other inputs */
398  textarea {
399    width: 80%;
400  }
401  
402  /* Makes input fields wider on smaller screens */
403  @media only screen and (max-width: 720px) {
404    textarea,
405    select,
406    input {
407      width: 100%;
408    }
409  }
410  
411  /* Ensures the checkbox and radio inputs do not have a set width like other input fields */
412  input[type="checkbox"],
413  input[type="radio"] {
414    width: auto;
415  }
416  
417  /* do not show border around file selector button */
418  input[type="file"] {
419    border: 0;
420  }
421  
422  /* Without this any HTML using <fieldset> shows ugly borders and has additional padding/margin. (Issue #3) */
423  fieldset {
424    border: 0;
425    padding: 0;
426    margin: 0;
427  }
428  
429  /* Misc body elements */
430  
431  hr {
432    color: var(--border);
433    border-top: 1px;
434    margin: 1rem auto;
435  }
436  
437  mark {
438    padding: 2px 5px;
439    border-radius: 4px;
440    background: var(--marked);
441  }
442  
443  main img,
444  main video {
445    max-width: 100%;
446    height: auto;
447    border-radius: 5px;
448  }
449  
450  figure {
451    margin: 0;
452  }
453  
454  figcaption {
455    font-size: 0.9rem;
456    color: var(--text-light);
457    text-align: center;
458    margin-bottom: 1rem;
459  }
460  
461  blockquote {
462    margin: 2rem 0 2rem 2rem;
463    padding: 0.4rem 0.8rem;
464    border-left: 0.35rem solid var(--accent);
465    opacity: 0.8;
466    font-style: italic;
467  }
468  
469  cite {
470    font-size: 0.9rem;
471    color: var(--text-light);
472    font-style: normal;
473  }
474  
475  /* Use mono font for code like elements */
476  code,
477  pre,
478  pre span,
479  kbd,
480  samp {
481    font-size: 1.075rem;
482    font-family: var(--mono-font);
483    color: var(--code);
484  }
485  
486  kbd {
487    color: var(--preformatted);
488    border: 1px solid var(--preformatted);
489    border-bottom: 3px solid var(--preformatted);
490    border-radius: 5px;
491    padding: 0.1rem;
492  }
493  
494  pre {
495    padding: 1rem 1.4rem;
496    max-width: 100%;
497    overflow: auto;
498    overflow-x: auto;
499    color: var(--preformatted);
500    background: var(--accent-bg);
501    border: 1px solid var(--border);
502    border-radius: 5px;
503  }
504  
505  /* Fix embedded code within pre */
506  pre code {
507    color: var(--preformatted);
508    background: none;
509    margin: 0;
510    padding: 0;
511  }