|
62 | 62 | top: 0; |
63 | 63 | left: 0; |
64 | 64 | height: 100vh; |
65 | | - width: 60vw; |
| 65 | + width: 67vw; |
66 | 66 | position: fixed; |
67 | 67 | background-color: #fff; |
68 | 68 | border: 0; |
|
74 | 74 | transition: opacity 0.1s ease-in; |
75 | 75 | } |
76 | 76 |
|
77 | | - h1 { font-size: 2.4em; font-weight: 200; margin-bottom: 0;} |
78 | | - h2 { font-size: 1.8em; } |
| 77 | + h1 { font-size: 2.25em; font-weight: 200; margin-bottom: 0;} |
| 78 | + h2 { font-size: 1.5em; } |
79 | 79 | h3 { font-size: 1.4em; } |
80 | 80 | h4 { font-size: 1.2em; } |
81 | 81 | h2, h3, h4 { font-weight: 500; } |
| 82 | + h1, h2, h3, h4 { margin: .25em 0; } |
82 | 83 |
|
83 | 84 | main { |
84 | 85 | box-sizing: border-box; |
85 | 86 | position: absolute; |
86 | 87 | right: 0; |
87 | | - width: 40vw; |
88 | | - padding: 0 5vh; |
| 88 | + width: 33vw; |
| 89 | + padding: 0 3vh; |
89 | 90 | margin: 0; |
90 | 91 | } |
91 | 92 |
|
92 | 93 | section { |
93 | 94 | margin-top: 100vh; |
94 | | - margin-bottom: 100vh; |
95 | | - } |
96 | | - |
97 | | - section:first-of-type, section:last-of-type { |
| 95 | + padding: 1vh 0 0 0; |
| 96 | + margin-bottom: 100vh; |
| 97 | + min-height: 100vh; |
98 | 98 | display: flex; |
99 | 99 | justify-content: center; |
100 | 100 | flex-direction: column; |
101 | 101 | } |
102 | 102 |
|
103 | | - section:first-of-type { |
104 | | - min-height: 100vh; |
| 103 | + section:first-of-type { |
105 | 104 | margin-top: 0; |
106 | 105 | } |
107 | 106 |
|
108 | 107 | section:last-of-type { |
109 | | - min-height: 93vh; |
110 | 108 | margin-bottom: 0; |
111 | 109 | } |
112 | 110 |
|
113 | 111 | p { |
114 | 112 | font-size: 1em; |
115 | 113 | line-height: 1.5em; |
| 114 | + margin: .5em 0; |
116 | 115 | } |
117 | | - |
| 116 | + |
118 | 117 | a { |
119 | 118 | color: #000; |
120 | 119 | } |
121 | 120 |
|
122 | 121 | ul, ol { |
123 | | - padding-left: 1em; |
| 122 | + padding-left: 1.25em; |
| 123 | + margin: .5em 0; |
124 | 124 | } |
125 | 125 |
|
126 | 126 | li { |
|
350 | 350 | if (event.key === 'Escape') { |
351 | 351 | window.scrollTo({ top: 0, behavior: 'smooth' }); |
352 | 352 | } |
| 353 | + |
| 354 | + else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { |
| 355 | + const sections = Array.from(document.querySelectorAll('main section')); |
| 356 | + if (sections.length === 0) return; |
| 357 | + |
| 358 | + const currentY = window.scrollY; |
| 359 | + const viewportHeight = window.innerHeight; |
| 360 | + |
| 361 | + let targetSection = null; |
| 362 | + |
| 363 | + if (event.key === 'ArrowDown') { |
| 364 | + targetSection = sections.find(section => { |
| 365 | + const rect = section.getBoundingClientRect(); |
| 366 | + return rect.top > 1; // more than 1px below the viewport top |
| 367 | + }); |
| 368 | + } else if (event.key === 'ArrowUp') { |
| 369 | + for (let i = sections.length - 1; i >= 0; i--) { |
| 370 | + const rect = sections[i].getBoundingClientRect(); |
| 371 | + if (rect.bottom < -1) { // completely above the viewport |
| 372 | + targetSection = sections[i]; |
| 373 | + break; |
| 374 | + } |
| 375 | + } |
| 376 | + } |
| 377 | + |
| 378 | + if (targetSection) { |
| 379 | + event.preventDefault(); |
| 380 | + targetSection.scrollIntoView({ behavior: 'smooth' }); |
| 381 | + } |
| 382 | + } |
| 383 | + |
353 | 384 | }); |
354 | 385 |
|
355 | 386 | // Load, parse, and display markdown on page load |
|
0 commit comments