Skip to content

Commit e904b4e

Browse files
authored
Refactor CSS structure and add section headers
1 parent 14d7686 commit e904b4e

1 file changed

Lines changed: 132 additions & 124 deletions

File tree

css/style.css

Lines changed: 132 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/* Base Reset & Typography */
1+
/* =============================================
2+
1. Reset & Base
3+
============================================= */
24
*, *::before, *::after {
35
box-sizing: border-box;
46
margin: 0;
@@ -15,18 +17,29 @@ body {
1517
min-height: 100vh;
1618
}
1719

20+
/* =============================================
21+
2. Layout
22+
============================================= */
1823
.container {
1924
max-width: 800px;
2025
margin: 0 auto;
2126
padding: 0 20px;
2227
}
2328

24-
/* Header */
29+
main {
30+
flex: 1;
31+
margin-bottom: 3rem;
32+
}
33+
34+
/* =============================================
35+
3. Header
36+
============================================= */
2537
header {
26-
background: #1a365d; /* deep navy */
38+
background: #1a365d;
2739
color: #fff;
2840
padding: 2rem 0 1rem;
2941
margin-bottom: 2rem;
42+
min-width: 100vw; /* full width even when zoomed out */
3043
}
3144

3245
header h1 {
@@ -40,6 +53,9 @@ header .subtitle {
4053
color: #cbd5e0;
4154
}
4255

56+
/* =============================================
57+
4. Navigation
58+
============================================= */
4359
nav {
4460
margin-top: 1.2rem;
4561
display: flex;
@@ -60,23 +76,23 @@ nav a.active {
6076
color: #fff;
6177
}
6278

63-
/* Main content */
64-
main {
65-
flex: 1;
66-
margin-bottom: 3rem;
67-
}
68-
79+
/* =============================================
80+
5. General Typography & Headings
81+
============================================= */
6982
h2 {
7083
margin: 1.5rem 0 0.8rem;
7184
color: #1a365d;
7285
}
7386

87+
/* =============================================
88+
6. Home Page
89+
============================================= */
7490
.intro p {
7591
font-size: 1.1rem;
7692
margin-bottom: 1rem;
7793
}
7894

79-
/* Post list on home page */
95+
/* Post list */
8096
.post-list {
8197
list-style: none;
8298
padding: 0;
@@ -110,7 +126,19 @@ h2 {
110126
color: #4a5568;
111127
}
112128

113-
/* About page */
129+
/* Intro image */
130+
.intro-image {
131+
display: block;
132+
max-width: 300px;
133+
width: 100%;
134+
height: auto;
135+
margin: 1.5rem auto 0 auto;
136+
border-radius: 8px;
137+
}
138+
139+
/* =============================================
140+
7. About Page
141+
============================================= */
114142
.about-content {
115143
display: flex;
116144
gap: 2rem;
@@ -120,7 +148,7 @@ h2 {
120148

121149
.profile-pic {
122150
border-radius: 8px;
123-
width: 250px;
151+
width: 250px; /* increased size */
124152
height: 250px;
125153
object-fit: cover;
126154
max-width: 100%;
@@ -132,6 +160,15 @@ h2 {
132160
min-width: 250px;
133161
}
134162

163+
.about-content p {
164+
margin-bottom: 1.5rem; /* more space between paragraphs */
165+
}
166+
167+
.about-content h3 {
168+
margin-top: 2rem; /* space before Contact */
169+
margin-bottom: 0.5rem;
170+
}
171+
135172
.about-content ul {
136173
list-style: none;
137174
padding: 0;
@@ -141,7 +178,9 @@ h2 {
141178
margin-bottom: 0.3rem;
142179
}
143180

144-
/* Blog post */
181+
/* =============================================
182+
8. Blog Post
183+
============================================= */
145184
.blog-post h1 {
146185
font-size: 2rem;
147186
margin-bottom: 0.5rem;
@@ -164,48 +203,29 @@ h2 {
164203
margin-bottom: 1rem;
165204
}
166205

206+
/* Code blocks */
167207
pre {
168208
background: #edf2f7;
169209
padding: 1rem;
170-
overflow-x: auto;
171210
border-radius: 6px;
172211
margin: 1.5rem 0;
212+
max-width: 100%;
213+
overflow-x: auto;
214+
white-space: pre-wrap;
215+
word-break: break-all;
216+
-webkit-overflow-scrolling: touch;
173217
}
174218

175219
code {
176220
font-family: 'Fira Code', 'Consolas', monospace;
177221
font-size: 0.9rem;
222+
white-space: pre-wrap;
223+
word-break: break-all;
178224
}
179225

180-
/* Footer */
181-
footer {
182-
background: #1a365d;
183-
color: #cbd5e0;
184-
text-align: center;
185-
padding: 1.5rem 0;
186-
margin-top: auto;
187-
}
188-
189-
footer a {
190-
color: #bee3f8;
191-
text-decoration: none;
192-
}
193-
194-
footer a:hover {
195-
text-decoration: underline;
196-
}
197-
198-
/* Responsive tweaks */
199-
@media (max-width: 600px) {
200-
.about-content {
201-
flex-direction: column;
202-
}
203-
nav {
204-
flex-wrap: wrap;
205-
gap: 1rem;
206-
}
207-
}
208-
/* Publications list */
226+
/* =============================================
227+
9. Publications Page
228+
============================================= */
209229
.publication-list {
210230
padding-left: 1.5rem;
211231
}
@@ -234,81 +254,9 @@ footer a:hover {
234254
font-size: 0.95rem;
235255
}
236256

237-
/* ===== Mobile & Responsive Fixes ===== */
238-
239-
/* Keep header/footer background full‑width even when zoomed out */
240-
header, footer {
241-
min-width: 100vw;
242-
width: 100%;
243-
}
244-
245-
/* Make code blocks horizontally scrollable without breaking layout */
246-
pre {
247-
max-width: 100%;
248-
overflow-x: auto;
249-
white-space: pre-wrap; /* wrap long lines if possible */
250-
word-break: break-all; /* break very long words */
251-
-webkit-overflow-scrolling: touch;
252-
}
253-
254-
code {
255-
white-space: pre-wrap;
256-
word-break: break-all;
257-
}
258-
259-
/* Reduce blog title size on small screens */
260-
@media (max-width: 600px) {
261-
.blog-post h1 {
262-
font-size: 1.5rem;
263-
}
264-
265-
.blog-post h2 {
266-
font-size: 1.2rem;
267-
}
268-
269-
.blog-post p,
270-
.blog-post li {
271-
font-size: 1rem;
272-
}
273-
274-
/* Prevent the container from being wider than the screen */
275-
.container {
276-
max-width: 100%;
277-
padding: 0 15px;
278-
overflow-wrap: break-word;
279-
}
280-
281-
/* Make the header stack neatly */
282-
header h1 {
283-
font-size: 1.6rem;
284-
}
285-
286-
header .subtitle {
287-
font-size: 0.9rem;
288-
}
289-
290-
nav {
291-
flex-wrap: wrap;
292-
gap: 0.8rem;
293-
}
294-
295-
/* Fix any element that might overflow */
296-
img, pre, code, table {
297-
max-width: 100%;
298-
height: auto;
299-
}
300-
}
301-
302-
/* Intro section image */
303-
.intro-image {
304-
display: block;
305-
max-width: 300px;
306-
width: 100%;
307-
height: auto;
308-
margin: 1.5rem auto 0 auto;
309-
border-radius: 8px;
310-
}
311-
/* Under construction message */
257+
/* =============================================
258+
10. Under Construction Page
259+
============================================= */
312260
.under-construction {
313261
text-align: center;
314262
padding: 4rem 1rem;
@@ -343,12 +291,72 @@ code {
343291
text-decoration: underline;
344292
}
345293

346-
/* Extra spacing for About page sections */
347-
.about-content p {
348-
margin-bottom: 1.5rem;
294+
/* =============================================
295+
11. Footer
296+
============================================= */
297+
footer {
298+
background: #1a365d;
299+
color: #cbd5e0;
300+
text-align: center;
301+
padding: 1.5rem 0;
302+
margin-top: auto;
303+
min-width: 100vw; /* full width even when zoomed out */
349304
}
350305

351-
.about-content h3 {
352-
margin-top: 2rem;
353-
margin-bottom: 0.5rem;
306+
footer a {
307+
color: #bee3f8;
308+
text-decoration: none;
309+
}
310+
311+
footer a:hover {
312+
text-decoration: underline;
313+
}
314+
315+
/* =============================================
316+
12. Responsive Tweaks (Mobile)
317+
============================================= */
318+
@media (max-width: 600px) {
319+
/* General container */
320+
.container {
321+
max-width: 100%;
322+
padding: 0 15px;
323+
overflow-wrap: break-word;
324+
}
325+
326+
/* Header */
327+
header h1 {
328+
font-size: 1.6rem;
329+
}
330+
header .subtitle {
331+
font-size: 0.9rem;
332+
}
333+
334+
/* Navigation */
335+
nav {
336+
flex-wrap: wrap;
337+
gap: 0.8rem;
338+
}
339+
340+
/* About page */
341+
.about-content {
342+
flex-direction: column;
343+
}
344+
345+
/* Blog post typography */
346+
.blog-post h1 {
347+
font-size: 1.5rem;
348+
}
349+
.blog-post h2 {
350+
font-size: 1.2rem;
351+
}
352+
.blog-post p,
353+
.blog-post li {
354+
font-size: 1rem;
355+
}
356+
357+
/* Prevent overflow on any element */
358+
img, pre, code, table {
359+
max-width: 100%;
360+
height: auto;
361+
}
354362
}

0 commit comments

Comments
 (0)