-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle.css
More file actions
417 lines (355 loc) · 9.27 KB
/
style.css
File metadata and controls
417 lines (355 loc) · 9.27 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
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
/* --- 1. Global Styles & Variables --- */
:root {
--bg-color: #1a1a1b;
/* 深邃的背景色 */
--surface-color: #27272a;
/* 卡片、代码块等元素的表面颜色 */
--border-color: #3f3f46;
/* 边框和分隔线颜色 */
--text-primary: #f4f4f5;
/* 主要文本颜色 (白色) */
--text-secondary: #a1a1aa;
/* 次要文本颜色 (灰色) */
--accent-color: #06b6d4;
/* 强调色 (青色/Cyan) */
--accent-color-hover: #22d3ee;
/* 强调色悬停 */
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
--font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
}
body {
background-color: var(--bg-color);
color: var(--text-primary);
font-family: var(--font-sans);
line-height: 1.6;
}
.container {
max-width: 900px;
margin: 0 auto;
padding: 0 20px;
}
a {
color: var(--accent-color);
text-decoration: none;
transition: color 0.2s ease;
}
a:hover {
color: var(--accent-color-hover);
text-decoration: underline;
}
/* --- 2. Layout & Sections --- */
.site-header,
.site-footer {
padding: 2rem 0;
display: flex;
justify-content: space-between;
align-items: center;
color: var(--text-secondary);
}
.site-footer {
border-top: 1px solid var(--border-color);
font-size: 0.9em;
margin-top: 4rem;
}
main>section {
padding: 3rem 0;
border-bottom: 1px solid var(--border-color);
}
main>section:last-of-type {
border-bottom: none;
}
/* --- 3. Component Styles --- */
/* Header */
.logo {
font-size: 1.5rem;
font-weight: bold;
color: var(--text-primary);
text-decoration: none;
}
.logo:hover {
color: var(--accent-color);
}
.main-nav {
display: flex;
gap: 1.5rem;
}
.main-nav a {
color: var(--text-secondary);
font-weight: 500;
text-decoration: none;
}
/* Hero Section */
.hero-section h1 {
font-size: 3rem;
font-weight: 800;
line-height: 1.2;
background: linear-gradient(45deg, var(--text-primary), var(--accent-color));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.hero-section .subtitle {
font-size: 1.2rem;
color: var(--text-secondary);
margin-top: 0.5rem;
}
/* General Section Content */
h2 {
font-size: 2rem;
font-weight: 700;
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: 2px solid var(--accent-color);
display: inline-block;
}
section p {
margin-bottom: 1rem;
max-width: 75ch;
/* 优化阅读行长 */
color: var(--text-secondary);
}
section p:last-child {
margin-bottom: 0;
}
/* Code Blocks */
pre {
background-color: var(--surface-color);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 1.2rem;
margin: 1.5rem 0;
overflow-x: auto;
font-family: var(--font-mono);
font-size: 0.9em;
}
pre code {
font-family: inherit;
}
p>code {
/* Inline code */
background-color: var(--surface-color);
padding: 0.2em 0.4em;
border-radius: 4px;
font-family: var(--font-mono);
font-size: 0.9em;
color: var(--text-primary);
}
/* --- 4. Package List & Cards (Grid Layout) --- */
.package-scroll-container {
overflow-x: auto;
overflow-y: hidden;
padding-bottom: 15px;
/* 添加一个左右内边距,防止卡片紧贴边缘 */
padding-left: 5px;
padding-right: 5px;
}
/* 自定义滚动条样式 (无需改变) */
.package-scroll-container::-webkit-scrollbar {
height: 8px;
}
.package-scroll-container::-webkit-scrollbar-track {
background: var(--surface-color);
border-radius: 4px;
}
.package-scroll-container::-webkit-scrollbar-thumb {
background-color: var(--accent-color);
border-radius: 4px;
}
.package-scroll-container::-webkit-scrollbar-thumb:hover {
background-color: var(--accent-color-hover);
}
/* 我们还需要为 package-list 添加 perspective 属性,为子元素的3D变换提供舞台 */
.package-list {
display: grid;
grid-auto-flow: column;
grid-template-rows: repeat(3, 1fr);
gap: 1rem;
width: max-content;
padding: 0.5rem 2px;
perspective: 1500px;
/* 定义3D舞台的视深 */
}
.loading-text {
color: var(--text-secondary);
}
.package-card {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 280px;
height: 140px;
background-color: var(--surface-color);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 1rem;
text-decoration: none;
/* 默认状态下,为所有属性设置过渡 */
transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
box-shadow 0.2s ease,
border-color 0.2s ease;
transform-style: preserve-3d;
}
/* NEW: 当卡片处于交互状态时,禁用 transform 的过渡 */
.package-card.is-interacting {
transition: box-shadow 0.2s ease,
border-color 0.2s ease;
/* transition-property: box-shadow, border-color; 也是一种写法 */
}
.package-card:hover {
/* JS会处理transform,但我们保留其他悬停效果 */
border-color: var(--accent-color);
box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.5);
/* 关键:移除悬停时的下划线 */
text-decoration: none;
}
/* 确保卡片内的所有文字颜色在悬停时也不变 */
.package-card:hover,
.package-card:hover .package-name,
.package-card:hover .package-meta {
color: inherit;
/* 继承自身颜色,防止a:hover全局样式影响 */
}
.package-name {
font-size: 1.25rem;
font-weight: 600;
color: var(--text-primary);
word-break: break-all;
/* 防止长名称溢出 */
}
.package-meta {
display: flex;
justify-content: space-between;
align-items: flex-end;
font-size: 0.85em;
color: var(--text-secondary);
}
.package-info span {
display: block;
/* 版本和架构换行显示 */
}
.package-arch {
opacity: 0.7;
}
.package-size {
padding: 0.2em 0.6em;
border-radius: 4px;
font-weight: 500;
font-family: var(--font-mono);
/* 关键:背景色由一个CSS变量决定,默认为灰色 */
background-color: var(--size-bg-color, #3f3f46);
/* 文本颜色也由变量决定,确保可读性 */
color: var(--size-text-color, var(--text-primary));
transition: background-color 0.3s ease;
/* 让颜色变化更平滑 */
}
/* --- 5. Scroll Animation --- */
/* 5.1 Section Fade-in Animation (保持不变) */
/*
* 准备应用动画的元素。
* 初始状态:向下平移20px,完全透明。
* opacity 和 transform 属性将会被过渡。
* 贝塞尔曲线 ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1) 提供了一个快速开始、然后平滑减速的效果,非常优雅。
*/
.fade-in-up {
opacity: 0;
transform: translateY(30px);
transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1),
transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
/*
* 当元素进入视口时,JS 会为其添加 .visible 类。
* 最终状态:完全不透明,回到原始位置(transform被重置)。
*/
.fade-in-up.visible {
opacity: 1;
transform: translateY(0);
}
/* 为每个动画元素添加一个小的延迟,使其逐个出现,更有层次感 */
.fade-in-up:nth-child(2) {
transition-delay: 0.1s;
}
.fade-in-up:nth-child(3) {
transition-delay: 0.2s;
}
.fade-in-up:nth-child(4) {
transition-delay: 0.3s;
}
/* 5.2 NEW: Package Card Fly-in Animation */
.card-fly-in {
opacity: 0;
/* 统一的过渡效果,应用于不透明度和 transform */
transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* 定义不同方向的初始状态 */
.from-left {
transform: translateX(-50px);
}
.from-right {
transform: translateX(50px);
}
.from-top {
transform: translateY(-50px);
}
.from-bottom {
transform: translateY(50px);
}
/* 当卡片可见时,重置所有状态 */
.card-fly-in.visible {
opacity: 1;
transform: translateX(0) translateY(0);
}
/* --- 6. Code Block Copy Button --- */
/* 确保 <pre> 标签是按钮的定位父级 */
pre {
position: relative;
/* 为按钮留出一些内边距空间 */
padding-top: 2.5rem;
}
.copy-button {
position: absolute;
top: 0.75rem;
right: 0.75rem;
display: inline-flex;
align-items: center;
gap: 0.5rem;
background-color: var(--surface-color);
border: 1px solid var(--border-color);
color: var(--text-secondary);
padding: 0.35rem 0.75rem;
border-radius: 6px;
font-size: 0.85em;
font-family: var(--font-sans);
cursor: pointer;
opacity: 0.7;
/* 平滑的过渡效果 */
transition: all 0.2s ease-in-out;
}
.copy-button:hover {
opacity: 1;
background-color: var(--border-color);
color: var(--text-primary);
}
/* 点击反馈的“已复制”状态 */
.copy-button.copied {
background-color: var(--accent-color);
color: var(--bg-color);
/* 用深色背景以获得高对比度 */
transform: scale(1.05);
/* 轻微放大,形成“pop”效果 */
border-color: var(--accent-color);
opacity: 1;
}
/* 按钮内的SVG图标样式 */
.copy-button svg {
width: 1em;
height: 1em;
stroke-width: 2;
}