Repository navigation
Expand file tree
/
Copy pathstyle.css
More file actions
360 lines (307 loc) · 6.54 KB
/
Copy pathstyle.css
File metadata and controls
360 lines (307 loc) · 6.54 KB
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
/* ===== 1. CSS 变量 ===== */
:root {
--bg: #fdf6ec;
--card-bg: #fff;
--text: #333;
--accent: #ff7a7a;
--radius: 24px;
--shadow: 4px 8px 20px rgba(0,0,0,.08);
--font: "Comic Neue", cursive;
}
/* ===== 2. 全局样式 ===== */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: var(--bg);
color: var(--text);
font-family: var(--font);
text-align: center;
line-height: 1.6;
padding: 40px 20px;
transition: background .3s, color .3s;
}
header {
position: relative;
margin-bottom: 60px;
}
h1 {
font-size: 3rem;
color: var(--accent);
}
.subtitle {
font-size: 1.1rem;
opacity: .7;
}
/* ===== 3. 卡片网格 ===== */
.card-grid {
display: grid;
gap: 32px;
max-width: 960px;
margin: 0 auto;
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
background: var(--card-bg);
border-radius: var(--radius);
border-radius: 16px;
border: 3px dashed #ff9e9e;
padding: 32px 24px;
box-shadow: var(--shadow);
transition: transform .3s ease;
}
.card:hover {
transform: translateY(-6px);
}
.card h2 {
margin: 12px 0 8px;
font-size: 1.5rem;
}
.card p {
font-size: 1rem;
opacity: .8;
}
/* ===== 4. 插画 & 按钮 ===== */
.svg-illu {
width: 100%;
height: 120px;
object-fit: contain;
color: var(--card-bg); /* 让SVG填充色跟随卡片背景 */
}
.btn {
display: inline-block;
margin-top: 12px;
padding: 6px 14px;
background: var(--accent);
color: #fff;
border-radius: 16px;
font-size: 14px;
text-decoration: none;
}
.btn:hover {
background: #ff5252;
}
/* ===== 5. GitHub 链接 ===== */
.github-link {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--text);
text-decoration: none;
}
.github-link:hover {
color: var(--accent);
}
/* ===== 6. 夜间模式 ===== */
body.dark {
--bg: #1e1e1e;
--card-bg: #2c2c2c;
--text: #f0f0f0;
}
/* ===== 7. 夜间模式按钮 ===== */
.theme-btn {
position: absolute;
top: 20px;
right: 20px;
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
transition: transform .3s;
}
.theme-btn:hover {
transform: scale(1.2);
}
/* ===== 8. 响应式 ===== */
@media (max-width: 600px) {
h1 { font-size: 2.4rem; }
}
/* 按钮样式 */
.btn {
display: inline-block;
margin-top: 12px;
padding: 6px 14px;
background: var(--card-bg); /* 使用变量 */
color: var(--text);
border-radius: var(--radius);
font-size: 14px;
text-decoration: none;
transition: background-color 0.3s, color 0.3s;
}
.btn:hover {
background: var(--accent);
color: #fff;
}
/* 夜间模式下按钮样式 */
body.dark .btn {
background: var(--card-bg); /* 夜间模式下按钮背景 */
color: var(--text);
}
body.dark .btn:hover {
background: var(--accent);
color: #fff;
}
/* ===== 9. 移动端优化 ===== */
@media (max-width: 600px) {
body {
padding: 20px 15px; /* 增加安全边距 */
}
.card {
padding: 25px 15px; /* 卡片内边距优化 */
}
/* 修复图片溢出问题 */
.svg-illu {
max-width: 100%;
height: auto;
}
/* 修复按钮点击区域 */
.btn {
padding: 8px 16px;
display: block; /* 让按钮独占一行 */
margin: 15px auto 0; /* 居中显示 */
}
}
/* ===== 10. 学术风标题 ===== */
.site-title {
font-family: 'Georgia', serif;
display: inline-block;
text-shadow: 0 2px 3px rgba(0,0,0,0.1);
background: linear-gradient(to right, var(--bg), var(--card-bg)); /* 使用背景变量 */
padding: 12px 20px;
border-radius: 8px;
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
color: var(--text); /* 使用文字颜色变量 */
}
/* 副标题优化 */
.subtitle {
margin-top: 15px;
font-size: 1.2rem;
letter-spacing: 1px;
opacity: 0.8;
}
/* === 修复夜间模式标题 === */
body.dark .site-title {
background: linear-gradient(to right, #2c2c2c, #1e1e1e);
border-left-color: #ff7a7a;
color: #f0f0f0;
}
/* 文章列表样式 */
.post-img {
width: 100%;
height: 160px;
object-fit: cover;
border-radius: 12px;
border: 2px dashed #ff9e9e; /* 手绘风格图片边框 */
}
.post-date {
font-size: 0.9rem;
color: #888;
margin: 8px 0;
}
/* 文章详情页样式 */
.post-content {
max-width: 800px;
margin: 0 auto;
text-align: left;
padding: 0 20px;
}
.post-banner {
width: 100%;
max-height: 400px;
object-fit: cover;
border-radius: 16px;
margin-bottom: 20px;
border: 3px dashed #ff9e9e;
}
.post-content h2 {
color: var(--accent);
margin: 30px 0 15px;
}
.post-content p {
margin: 15px 0;
line-height: 1.8;
}
pre {
background: var(--card-bg);
padding: 15px;
border-radius: 8px;
border-left: 4px solid var(--accent);
overflow-x: auto;
margin: 20px 0;
}
.sidebar-card {
position: fixed; /* 固定在页面右侧 */
right: 20px;
top: 50%;
transform: translateY(-50%); /* 垂直居中 */
background: var(--card-bg);
padding: 20px;
border-radius: 12px;
box-shadow: var(--shadow);
border: 2px dashed #ff9e9e; /* 保持手绘风格 */
width: 250px;
z-index: 10; /* 确保在其他内容上方 */
}
#time-display {
font-size: 1.5rem;
text-align: center;
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 1px dashed #ff9e9e;
}
body {
margin: 0;
padding: 40px 0;
min-height: 100vh;
background-color: var(--bg);
background-image: url('https://source.unsplash.com/random/1920x1080/?nature,light'); /* 初始背景图 */
background-size: cover; /* 图片铺满屏幕 */
background-attachment: fixed; /* 背景固定,不随滚动移动 */
background-position: center;
color: var(--text);
font-family: 'Nunito', sans-serif;
}
/* 语录切换动画 */
#hitokoto, #hitokoto-from {
transition: opacity 0.5s ease-in-out; /* 淡入淡出效果,0.5秒完成 */
}
/* 切换时的过渡状态 */
.hitokoto-fade {
opacity: 0; /* 完全透明 */
}
/* 统一图标颜色适配夜间模式 */
/* GitHub图标 */
.github-link svg {
fill: var(--text); /* 跟随文本颜色 */
transition: fill 0.3s ease;
}
/* 夜间模式下的GitHub图标 */
body.dark .github-link svg {
fill: var(--text); /* 夜间模式文本为浅色,图标同步 */
}
/* 夜间模式切换按钮图标(文字形式)*/
.theme-btn {
color: var(--text); /* 按钮文字颜色跟随文本 */
transition: color 0.3s ease;
}
/* 确保按钮在夜间模式下颜色正确 */
body.dark .theme-btn {
color: var(--text);
}
/* 添加到CSS中 */
@media (max-width: 768px) {
.buttons {
flex-direction: column;
align-items: center;
}
button {
width: 80%;
margin: 5px 0;
}
h1 {
font-size: 18px;
padding: 0 10px;
}
}