/
magick.css
745 lines (657 loc) · 20.3 KB
/
magick.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
/*
* Magick CSS
* by: winterveil (https://github.com/wintermute-cell/)
* license: MIT
* version: 1.0.5
*/
@charset "UTF-8";
/* Importing the fonts. */
@import url('https://fonts.googleapis.com/css2?family=Averia+Libre:ital,wght@0,400;0,700;1,400;1,700&family=Averia+Serif+Libre:ital,wght@0,300;0,700;1,300;1,700&family=Caveat&family=Courier+Prime:ital,wght@0,400;0,700;1,400;1,700&family=Spectral:ital,wght@0,300;0,600;1,300;1,600&display=swap&family=Noto+Sans+Symbols+2&display=swap');
/* Simple CSS Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
/* Theme colors */
--fg: #0e0e0e;
--bg: #fefefe;
--form-bg: #fbfbfb;
--form-fg: #00004d;
--form-fg-placeholder: #00004d9a;
}
@media (prefers-color-scheme: dark) {
:root {
--fg: #fefefe;
--bg: #0e0e0e;
--form-bg: #1a1a1a;
--form-fg: #fefefe;
--form-fg-placeholder: #fefefe9a;
}
}
/*
1) Modify the base font-size to 62.5% so that 1.6rem = 16px.
2) Set box-sizing globally to handle padding and border widths.
*/
html {
font-size: 62.5%; /* 1 */
box-sizing: border-box; /* 2 */
}
/* Use smaller sizes on mobile devices. */
@media (max-width: 600px) {
html {
font-size: 56%;
}
}
/*
1) Set the base font-size to 18px with a normal weight.
2) Set the text and background colors to match the theme.
3) Use the 'Averia Serif Libre' font for the body text.
4) Reset the counter for sidenotes.
*/
body {
font-size: 1.8rem; /* 1 */
background-color: var(--bg); /* 2 */
color: var(--fg); /* 2 */
font-family: "Averia Serif Libre", serif; /* 3 */
font-style: normal; /* 3 */
line-height: 2.2rem; /* 3 */
font-weight: 300; /* 3 */
counter-reset: sidenote-counter; /* 4 */
}
/*
1) Center the main content.
2) Set the width of the element to 760px, with lower padding on mobile devices.
3) Relative position as the default allows for absolute positioning of child elements.
*/
article,
main {
margin: auto; /* 1 */
max-width: 76rem; /* 2 */
padding: 0 1rem; /* 2 */
width: 100%; /* 2 */
position: relative; /* 3 */
}
@media (max-width: 600px) {
article,
main {
padding: 0 0.2rem; /* 2 */
}
}
/* ========================================================================================================================= */
/* Structure & Layout ===================================================================================================== */
/* ========================================================================================================================= */
/* Display the header, main, and footer sections as distinctly separate blocks. */
header,
section,
footer {
margin: 0.7rem;
padding: 0.7rem;
}
/* On mobile devices, a smaller margin looks more fitting due to the smaller view. */
@media (max-width: 600px) {
header,
section,
footer {
margin-top: 0.2rem;
margin-bottom: 0.2rem;
}
}
/* Avoid double margin on the last child of each section */
header>*:last-child,
section>*:last-child,
footer>*:last-child {
margin-bottom: 0;
}
/* Add large margins to the header to visually separate it from the main content. */
header {
margin-top: 12rem;
margin-bottom: 8rem;
}
/* On mobile devices, reduce the margin around the header to save space. */
@media (max-width: 600px) {
header {
margin: 0;
padding: 1.2rem;
}
}
/*
1) Center align the text in the footer.
2) Add a margin to the top of the footer to visually separate it from the main content.
3) Add a margin to the bottom of the footer to not have it stuck to the bottom of the page.
*/
footer {
text-align: center; /* 1 */
margin-top: 5rem; /* 2 */
margin-bottom: 2rem; /* 3 */
}
/* ========================================================================================================================= */
/* Typography & Links ===================================================================================================== */
/* ========================================================================================================================= */
/* Add some space between paragraphs. */
p {
margin: 1.6rem 0; /* 1 */
}
/* Remove link color. */
a {
color: var(--fg);
}
/* Make string a little more bold, to adjust for the font. */
b,
strong {
font-weight: 600;
}
/* Make emphasized text a little larger, to adjust for the font. */
i,
em {
font-size: calc(1em + 0.1rem);
}
/*
1) Set the font-family, color, and font-style for the headings.
2) Add a margin to the top and bottom of the headings.
*/
h1,
h2,
h3,
h4 {
font-family: "Averia Libre", cursive; /* 1 */
color: var(--fg); /* 1 */
font-style: normal; /* 1 */
font-weight: 600; /* 1 */
margin: 1.6rem 0 1.6rem 0; /* 2 */
}
/* h1 headings are uppercase and 2x the size of the base font. */
h1 {
text-transform: uppercase;
font-size: 3.6rem;
line-height: 3.3rem;
}
/* h2 headings are uppercase and 1.250x (major third) the size of the base font. */
h2 {
font-size: 2.25rem;
text-transform: uppercase;
margin: 1.2rem 0 1.2rem 0;
}
/* h3 headings are 1.125x (major second) the size of the base font. */
h3 {
font-size: 2.025rem;
}
/* Add a decorative element before h3 headings. */
h3:before {
font-family: "Noto Sans Symbols 2", sans-serif;
content: "🙛 ";
}
/* h4 headings are the same size as h3 headings, but italic and without the decorative element. */
h4 {
font-style: italic;
font-size: 2.025rem;
}
/* A uniquely styled h1 for the header */
header h1 {
font-size: 4rem;
color: var(--fg);
text-align: center;
padding: 4rem 0 1.2rem 0;
margin-bottom: 1rem;
}
/* Additional decorations for the header h1 */
header h1:before,
header h1:after {
content: "✦";
color: var(--fg);
font-size: 1.5rem;
vertical-align: middle;
padding: 0 0.5rem;
}
/*
1) Remove any list symbols.
2) Center align the nav links.
3) Add a margin to the top of the nav links.
4) Remove the default padding from the list.
*/
header nav ul {
list-style-type: none; /* 1 */
text-align: center; /* 2 */
margin-top: 1.0rem; /* 3 */
padding-inline-start: 0; /* 4 */
}
/* Display the navigation links as a centered, horizontal list. */
header nav ul li {
display: inline;
margin: 0 1.2rem;
}
/* Remove default link styles. */
header nav ul li a {
text-decoration: none;
color: var(--fg);
}
/* Add a hover effect to the navigation links. */
header nav ul li a::before {
content: "❯ "; /* 1 */
opacity: 0; /* 1 */
}
header nav ul li a:hover::before {
opacity: 1; /* 1 */
}
/* ===================================================================================================================== */
/* Lists ===================================================================================================== */
/* ===================================================================================================================== */
/*
1) Add some indentation to the list items.
2) Add a margin to the top and bottom of the list.
*/
:where(main ol, main ul) {
margin-inline-start: 0; /* 1 */
padding-inline-start: 3rem; /* 1 */
margin: 0.8rem 0; /* 2 */
}
/* Add some vertical space around a definition list. */
dl {
margin: 0.8rem 0;
}
/* Add an indent to the definition term. */
dd {
margin: 0 1.6rem;
}
/* ===================================================================================================================== */
/* Media ===================================================================================================== */
/* ===================================================================================================================== */
/*
1) Set the maximum width of the image to 100% so they don't overflow the main column.
2) Set the height in respect to the width to prevent the image from stretching.
3) Add some margin to standalone images.
*/
img {
max-width: 100%; /* 1 */
height: auto; /* 2 */
margin: 0.8rem 0; /* 3 */
}
/* Images in figures should not have their own margins */
figure img {
margin: 0;
padding: 0;
}
/*
1) Set margins and padding for figures.
2) Center align any text inside figures.
*/
figure {
margin: 2rem 0; /* 1 */
padding: 0; /* 1 */
text-align: center; /* 2 */
}
/* Center align any element that is part of a figure */
figure * {
margin-left: auto;
margin-right: auto;
}
/* We don't want to center prealigned text or code in figures */
figure code,
figure pre {
text-align: left;
}
/* Set the typography for the figure captions */
figcaption {
margin: 0.8rem 0;
font-size: 1.8rem;
}
/* ===================================================================================================================== */
/* Forms & Inputs ===================================================================================================== */
/* ===================================================================================================================== */
/*
1) Display the form elements in a grid layout, two columns wide.
2) Add some space between the form elements.
3) Set padding and margin for the form.
4) Give the form a pop out paper note look.
*/
form {
display: grid; /* 1 */
grid-template-columns: 1fr 1fr; /* 1 */
gap: 10px; /* 2 */
padding: 1rem; /* 3 */
margin: 0.8rem 0; /* 3 */
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); /* 4 */
background-color: var(--form-bg); /* 4 */
}
/* Make form inputs and labels span two columns. (They get their own line) */
form input[type="email"],
form input[type="number"],
form input[type="password"],
form input[type="search"],
form input[type="tel"],
form input[type="text"],
form input[type="url"],
form label,
form fieldset,
form textarea {
grid-column: span 2;
}
/*
1) Adjust the elements to take up full width of their grid cell.
2) Prevent textarea from being resized horizontally and overflowing the main column.
*/
form input,
form button,
form textarea {
width: 100%; /* 1 */
resize: vertical; /* 2 */
}
/*
1) Prevent radio and checkbox from taking up full width, so they can be put next to each other.
2) Add space between radio and checkbox options.
*/
input[type="radio"],
input[type="checkbox"] {
width: auto; /* 1 */
margin-right: 0.5rem; /* 2 */
}
input[type="radio"] + label,
input[type="checkbox"] + label {
margin-right: 2rem; /* 2 */
}
/* Add a disabled variant for radio and checkbox inputs */
input[type="radio"]:disabled + label,
input[type="checkbox"]:disabled + label {
text-decoration: line-through;
opacity: 0.5;
}
/*
1) Remove the default appearance of the input.
2) Set padding and margin for the input.
3) Apply some custom styles in place of the default ones.
4) Give the input a handwritten look.
*/
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="text"],
input[type="url"],
textarea,
select {
-webkit-appearance: none; /* 1 */
-moz-appearance: none; /* 1 */
appearance: none; /* 1 */
box-shadow: none; /* 1 */
box-sizing: inherit; /* 1 */
border: none; /* 1 */
padding: .4rem 1rem; /* 2 */
margin-bottom: 1.6rem; /* 2 */
font-size: 2rem; /* 3 */
color: var(--fg); /* 3 */
background-color: transparent; /* 3 */
border-bottom: 1px solid var(--fg); /* 3 */
border-radius: 0; /* 3 */
font-size: 1.8rem; /* 3 */
font-family: "Caveat", cursive; /* 4 */
font-size: 2.6rem; /* 4 */
color: var(--form-fg); /* 4 */
caret-color: var(--form-fg); /* 4 */
}
/* Add disabled variant for input fields */
input[type="email"]:disabled,
input[type="number"]:disabled,
input[type="password"]:disabled,
input[type="search"]:disabled,
input[type="tel"]:disabled,
input[type="text"]:disabled,
input[type="url"]:disabled,
textarea:disabled,
select:disabled {
border-bottom: 1px dashed var(--fg); /* 3 */
text-decoration: line-through;
}
/* A slightly more transparent color for the placeholder text. */
input::placeholder,
textarea::placeholder {
color: var(--form-fg-placeholder);
}
/*
1) Remove the default focus outline.
2) Add a thicker bottom border to the input when focused, reducing margin to prevent layout shifting.
*/
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
outline: none; /* 1 */
border-bottom: 2px solid var(--fg); /* 2 */
margin-bottom: calc(1.6rem - 1px); /* 2 */
}
/*
1) Match the theme colors.
2) Add padding.
3) Add a top margin to visually separate the buttons for the rest of the form.
4) Add a thin border.
5) Add a pointer cursor on hover.
*/
button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
background-color: transparent; /* 1 */
color: var(--fg); /* 1 */
padding: 10px; /* 2 */
margin-top: 1.6rem; /* 3 */
border: 1px solid var(--fg); /* 4 */
cursor: pointer; /* 5 */
}
/*
1) A thin border around the fieldset.
2) Set the width of the fieldset to fit around the content.
*/
fieldset {
border: 1px solid var(--fg); /* 1 */
width: fit-content; /* 2 */
}
/* In a form, the fieldset takes up 100% of the width. */
form fieldset {
width: 100%;
}
/*
1) Set the border of a disabled button to be dashed.
2) Add the not-allowed cursor when hovering a disabled button.
*/
button:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled,
input[type="submit"]:disabled {
opacity: 0.5;
border-style: dashed; /* 1 */
cursor: not-allowed; /* 2 */
text-decoration: line-through;
}
/* ===================================================================================================================== */
/* Tables ========================================================================================================== */
/* ===================================================================================================================== */
/* Remove the distance between adjacent cells, since we don't have vertical border lines. */
table {
border-spacing: 0;
}
/* Add some padding around table cells. */
td,
th {
padding: 0.4rem 1.0rem;
}
/* Remove left padding for first cell in a row. */
td:first-child,
th:first-child {
padding-left: 0;
}
/* Remove right padding for last cell in a row. */
td:last-child,
th:last-child {
padding-right: 0;
}
/*
1) Add a border under the table header.
2) Align the text to the left in the table header.
*/
th {
border-bottom: 2px solid var(--fg); /* 1 */
text-align: left; /* 2 */
}
/* ============================================================================================================================ */
/* Preformatting, Quotes & Code ============================================================================================ */
/* ============================================================================================================================ */
/*
1) Set custom padding and margins.
2) Hide the vertical scroll bar.
3) Set the width to fit just around the content, but limit it to 80% of the main column.
4) Center the blockquote horizontally and add some vertical margins.
*/
blockquote {
padding: 1rem 1.6rem; /* 1 */
overflow-y: hidden; /* 2 */
width: fit-content; /* 3 */
max-width: 80%; /* 3 */
margin: 2rem auto; /* 4 */
}
/*
1) Set a custom font for blockquote text paragraphs.
2) Add some space between the paragraphs.
*/
blockquote p {
font-family: "Spectral", serif; /* 1 */
font-style: italic; /* 1 */
font-size: 2.1rem; /* 1 */
font-weight: 300; /* 1 */
line-height: 2.4rem; /* 1 */
margin: 2.1rem 0; /* 2 */
}
/* Add a footer to the blockquote for citations. */
/*
1) Reset any margins and padding from the main footer.
2) Set the footer to float and align to the right.
3) Limit the width of the footer to 55% of the main column.
4) Set a custom font for the footer.
*/
blockquote footer {
margin: 0; /* 1 */
padding: 0; /* 1 */
float: right; /* 2 */
text-align: right; /* 2 */
width: 55%; /* 3 */
font-family: "Spectral", serif; /* 4 */
font-style: normal; /* 4 */
font-size: 1.4rem; /* 4 */
}
/* Make the actual citation italic */
blockquote footer cite {
font-style: italic;
}
/*
1) Set custom padding.
2) Hide the vertical scroll bar.
3) Set a custom monospace font.
4) Add a top and bottom border line.
*/
pre:has(code) {
padding: 1rem 1.6rem; /* 1 */
margin: 1.6rem 0; /* 1 */
overflow-y: hidden; /* 2 */
font-family: "Courier Prime", monospace; /* 3 */
font-size: 1.6rem; /* 3 */
border-top: 2px solid var(--fg); /* 4 */
border-bottom: 2px solid var(--fg); /* 4 */
}
/* Set a custom monospace font */
code {
font-family: "Courier Prime", monospace;
font-size: 1.6rem;
}
/*
1) Float the line numbers to the left, next to the code.
2) Make some distance between the line numbers and the code, and pull it all to the left with a negative margin.
3) Add a vertical line to separate the line numbers from the code.
4) Align the line numbers against the separator.
*/
pre .line-number {
float: left; /* 1 */
margin: 0 1.5rem 0 -1.5rem; /* 2 */
border-right: 1px solid; /* 3 */
text-align: right; /* 4 */
}
/*
1) Display as block, so we get a new line for each line number.
2) Add some padding to the line numbers.
*/
pre .line-number span {
display: block; /* 1 */
padding: 0 0.8rem 0 1.6rem; /* 2 */
}
/* ============================================================================================================================ */
/* Sidenotes & Asides ====================================================================================================== */
/* ============================================================================================================================ */
/*
1) On mobile devices, sidenotes behave the same as asides.
2) Float the sidenotes to the right.
3) Make sure the sidenotes don't clash.
4) Set the width of the sidenotes to 40% of the main column.
5) Add padding, margins and a border for better visual separation.
6) Adjust typography to be more compact.
*/
.sidenote, /* 1 */
aside {
float: right; /* 2 */
clear: right; /* 3 */
width: 40%; /* 4 */
margin: 1rem 1rem 1rem 3rem; /* 5 */
padding: 0.5rem 0.5rem 0.5rem 2rem; /* 5 */
border-left: 3px solid var(--fg); /* 5 */
font-size: 1.4rem; /* 6 */
line-height: 1.3; /* 6 */
}
/* Prevent double top margins */
aside h1, aside h2, aside h3, aside h4 {
margin-top: 0;
}
/*
1) Set the distance from the main column.
2) Set the width of the element to a little less than the remaining space on one side, limited to 40% of the main column.
3) Remove any values set for the mobile version of the sidenotes.
4) Set the width to the variable defined above.
5) Set a negative right margin to (self-width + distance-from-main) to pull the sidenote to the right.
*/
/* Sadly, CSS does not support var() and rem in media queries, so we have to hardcode pixels. */
/* This will break if the main column width is changed without adjusting this media query. */
@media (min-width: calc(760px + 400px)) {
.sidenote {
--distance-from-main: 3rem; /* 1 */
--self-width: min(calc((100vw - 760px)/2 - (var(--distance-from-main))), 40%); /* 2 */
margin: 0; /* 3 */
padding: 0; /* 3 */
border: none; /* 3 */
width: var(--self-width);
margin-right: calc(calc(var(--self-width) + var(--distance-from-main)) * -1);
}
}
/* Each time a sidenote anchor is encountered, increment the counter */
.sidenote-anchor {
counter-increment: sidenote-counter;
}
/* Use a custom font for the sidenote numbers */
.sidenote-anchor:after,
.sidenote:before {
font-size: 1.3rem;
position: relative;
font-family: "Spectral", serif;
}
/* Fine-adjust the number position for the sidenote anchor */
.sidenote-anchor:after {
content: counter(sidenote-counter);
top: -0.5rem;
left: 0.1rem;
}
/* Fine-adjust the number position for the sidenote */
.sidenote:before {
content: counter(sidenote-counter) " ";
top: -0.5rem;
}