Skip to content

Commit ab65a1e

Browse files
feat: update CSS for local sites
1 parent a05927b commit ab65a1e

1 file changed

Lines changed: 256 additions & 43 deletions

File tree

document/stylesheets/extra.css

Lines changed: 256 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,164 @@
11
/* ==========================================================================
2-
CFDesktop Docs - Custom Stylesheet
2+
Tutorial_AwesomeModernCPP - Custom Stylesheet
33
Improve Chinese typography, code readability, and visual hierarchy
44
========================================================================== */
55

6+
/* ---------- Global ---------- */
7+
8+
/* Smooth scrolling for the entire page */
9+
html {
10+
scroll-behavior: smooth;
11+
}
12+
13+
/* Custom text selection color */
14+
::selection {
15+
background: rgba(81, 107, 232, 0.25);
16+
color: inherit;
17+
}
18+
19+
[data-md-color-scheme="slate"] ::selection {
20+
background: rgba(99, 126, 255, 0.3);
21+
}
22+
623
/* ---------- Chinese Typography ---------- */
724

8-
/* Base body text: generous line-height for Chinese character readability.
9-
Chinese characters are more visually dense than Latin; 1.85 prevents
10-
the "wall of text" feeling. */
1125
.md-typeset {
1226
line-height: 1.85;
1327
font-size: 0.82rem;
1428
}
1529

16-
/* Headings: slightly tighter line-height than body */
17-
.md-typeset h1 { line-height: 1.4; }
18-
.md-typeset h2 { line-height: 1.45; }
19-
.md-typeset h3 { line-height: 1.5; }
20-
.md-typeset h4 { line-height: 1.55; }
30+
.md-typeset h1 {
31+
line-height: 1.4;
32+
}
33+
34+
.md-typeset h2 {
35+
line-height: 1.45;
36+
}
37+
38+
.md-typeset h3 {
39+
line-height: 1.5;
40+
}
41+
42+
.md-typeset h4 {
43+
line-height: 1.55;
44+
}
2145

22-
/* Paragraph spacing: add vertical breathing room */
2346
.md-typeset p {
2447
margin-bottom: 1.2em;
2548
}
2649

50+
/* ---------- Header Gradient ---------- */
51+
52+
/* Subtle indigo-to-blue gradient for a modern look */
53+
.md-header {
54+
background: linear-gradient(135deg, #3f51b5 0%, #5c6bc0 50%, #42a5f5 100%);
55+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
56+
}
57+
58+
[data-md-color-scheme="slate"] .md-header {
59+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
60+
}
61+
62+
/* Header tabs bar matches gradient */
63+
.md-tabs {
64+
background: linear-gradient(135deg, #3949ab 0%, #5c6bc0 50%, #42a5f5 100%);
65+
}
66+
67+
[data-md-color-scheme="slate"] .md-tabs {
68+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
69+
}
70+
71+
/* ---------- Sidebar ---------- */
72+
73+
/* Sidebar items: more spacing and smooth hover transitions */
74+
.md-nav__item {
75+
padding: 0.15em 0;
76+
}
77+
78+
.md-nav__link {
79+
transition: all 0.2s ease;
80+
border-radius: 4px;
81+
margin: 1px 4px;
82+
padding: 4px 8px !important;
83+
}
84+
85+
.md-nav__link:hover {
86+
background-color: rgba(81, 107, 232, 0.08);
87+
}
88+
89+
[data-md-color-scheme="slate"] .md-nav__link:hover {
90+
background-color: rgba(99, 126, 255, 0.12);
91+
}
92+
93+
/* Active sidebar item highlight */
94+
.md-nav__link--active {
95+
font-weight: 600;
96+
}
97+
98+
.md-nav__section-title {
99+
font-size: 0.72rem;
100+
letter-spacing: 0.03em;
101+
}
102+
103+
/* ---------- Content Width ---------- */
104+
105+
.md-grid {
106+
max-width: 80rem;
107+
}
108+
27109
/* ---------- Code Blocks ---------- */
28110

29-
/* Code blocks: prevent excessive height for long C++ headers */
30-
.md-typeset pre > code {
111+
/* Rounded corners for code blocks */
112+
.md-typeset pre>code {
31113
max-height: 32rem;
32114
font-size: 0.75rem;
33115
line-height: 1.6;
116+
border-radius: 8px;
34117
}
35118

36-
/* Inline code: match CJK character width */
119+
/* Code block container with subtle shadow */
120+
.md-typeset pre {
121+
border-radius: 8px;
122+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
123+
margin: 1em 0;
124+
}
125+
126+
[data-md-color-scheme="slate"] .md-typeset pre {
127+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
128+
}
129+
130+
/* Inline code with better visual treatment */
37131
.md-typeset code {
38132
font-size: 0.78em;
39133
padding: 0.15em 0.35em;
40-
border-radius: 3px;
134+
border-radius: 4px;
135+
transition: background-color 0.2s ease;
136+
}
137+
138+
/* Code copy button styling */
139+
.md-clipboard {
140+
transition: all 0.2s ease;
141+
border-radius: 4px;
142+
}
143+
144+
.md-clipboard:hover {
145+
color: var(--md-accent-fg-color);
41146
}
42147

43148
/* ---------- Tables ---------- */
44149

45-
/* Tables: more padding for CJK cell content, subtle alternating rows */
46150
.md-typeset table:not([class]) {
47151
font-size: 0.78rem;
48152
line-height: 1.6;
49153
display: table;
50154
width: 100%;
155+
border-radius: 8px;
156+
overflow: hidden;
157+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
158+
}
159+
160+
[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
161+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
51162
}
52163

53164
.md-typeset table:not([class]) th {
@@ -59,7 +170,6 @@
59170
padding: 0.65em 1em;
60171
}
61172

62-
/* Alternating row colors */
63173
.md-typeset table:not([class]) tr:nth-child(even) {
64174
background-color: rgba(0, 0, 0, 0.02);
65175
}
@@ -70,48 +180,40 @@
70180

71181
/* ---------- Admonitions ---------- */
72182

73-
/* Admonitions: larger text and more padding */
183+
/* Admonitions with rounded corners and subtle shadow */
74184
.md-typeset .admonition,
75185
.md-typeset details {
76186
font-size: 0.8rem;
77187
line-height: 1.75;
78188
padding: 0.8em 1.2em;
79-
border-radius: 6px;
80-
}
81-
82-
.md-typeset .admonition-title,
83-
.md-typeset summary {
84-
font-weight: 600;
85-
font-size: 0.85rem;
189+
border-radius: 8px;
190+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
191+
transition: box-shadow 0.2s ease;
86192
}
87193

88-
/* ---------- Sidebar ---------- */
89-
90-
/* Sidebar items: more spacing for better clickability */
91-
.md-nav__item {
92-
padding: 0.15em 0;
194+
.md-typeset .admonition:hover,
195+
.md-typeset details:hover {
196+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
93197
}
94198

95-
/* Section labels in sidebar: more visually distinct */
96-
.md-nav__section-title {
97-
font-size: 0.72rem;
98-
letter-spacing: 0.03em;
199+
[data-md-color-scheme="slate"] .md-typeset .admonition,
200+
[data-md-color-scheme="slate"] .md-typeset details {
201+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
99202
}
100203

101-
/* ---------- Content Width ---------- */
102-
103-
/* Widen the content area for tables and code blocks */
104-
.md-grid {
105-
max-width: 80rem;
204+
.md-typeset .admonition-title,
205+
.md-typeset summary {
206+
font-weight: 600;
207+
font-size: 0.85rem;
106208
}
107209

108210
/* ---------- Links ---------- */
109211

110-
/* Links: visually distinct from body text */
111212
.md-typeset a {
112213
text-decoration: underline;
113214
text-decoration-style: dotted;
114215
text-underline-offset: 3px;
216+
transition: color 0.2s ease, text-decoration-style 0.2s ease;
115217
}
116218

117219
.md-typeset a:hover {
@@ -121,11 +223,87 @@
121223
/* ---------- Blockquotes ---------- */
122224

123225
.md-typeset blockquote {
124-
border-left: 3px solid var(--md-primary-fg-color);
125-
padding-left: 1em;
226+
border-left: 4px solid var(--md-primary-fg-color);
227+
padding: 0.5em 1em;
126228
margin-left: 0;
127229
font-style: normal;
128230
opacity: 0.9;
231+
border-radius: 0 4px 4px 0;
232+
background: rgba(81, 107, 232, 0.04);
233+
}
234+
235+
[data-md-color-scheme="slate"] .md-typeset blockquote {
236+
background: rgba(99, 126, 255, 0.06);
237+
}
238+
239+
/* ---------- Back-to-top Button ---------- */
240+
241+
.md-top {
242+
border-radius: 50% !important;
243+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
244+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
245+
}
246+
247+
.md-top:hover {
248+
transform: translateY(-2px);
249+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
250+
}
251+
252+
/* ---------- Search Overlay ---------- */
253+
254+
.md-search__overlay {
255+
transition: opacity 0.2s ease;
256+
}
257+
258+
.md-search__form {
259+
border-radius: 8px;
260+
transition: box-shadow 0.2s ease;
261+
}
262+
263+
.md-search__form:focus-within {
264+
box-shadow: 0 0 0 2px var(--md-accent-fg-color);
265+
}
266+
267+
/* ---------- Custom Scrollbar ---------- */
268+
269+
::-webkit-scrollbar {
270+
width: 8px;
271+
height: 8px;
272+
}
273+
274+
::-webkit-scrollbar-track {
275+
background: transparent;
276+
}
277+
278+
::-webkit-scrollbar-thumb {
279+
background: rgba(0, 0, 0, 0.15);
280+
border-radius: 4px;
281+
}
282+
283+
::-webkit-scrollbar-thumb:hover {
284+
background: rgba(0, 0, 0, 0.25);
285+
}
286+
287+
[data-md-color-scheme="slate"] ::-webkit-scrollbar-thumb {
288+
background: rgba(255, 255, 255, 0.15);
289+
}
290+
291+
[data-md-color-scheme="slate"] ::-webkit-scrollbar-thumb:hover {
292+
background: rgba(255, 255, 255, 0.25);
293+
}
294+
295+
/* ---------- Footer ---------- */
296+
297+
.md-footer {
298+
border-top: 1px solid rgba(0, 0, 0, 0.05);
299+
}
300+
301+
[data-md-color-scheme="slate"] .md-footer {
302+
border-top: 1px solid rgba(255, 255, 255, 0.05);
303+
}
304+
305+
.md-footer__link {
306+
transition: background-color 0.2s ease;
129307
}
130308

131309
/* ---------- Dark Mode Adjustments ---------- */
@@ -134,16 +312,51 @@
134312
background-color: rgba(255, 255, 255, 0.07);
135313
}
136314

315+
/* Dark mode: slightly brighter code block background for contrast */
316+
[data-md-color-scheme="slate"] .md-typeset pre>code {
317+
background-color: rgba(0, 0, 0, 0.3);
318+
}
319+
320+
/* ---------- Tabbed Content ---------- */
321+
322+
/* Smooth tab transitions */
323+
.md-typeset .tabbed-labels {
324+
box-shadow: 0 1px 0 var(--md-primary-fg-color--light);
325+
}
326+
327+
.md-typeset .tabbed-labels>label {
328+
transition: color 0.2s ease;
329+
}
330+
331+
/* ---------- Images ---------- */
332+
333+
/* Rounded corners and subtle shadow for images */
334+
.md-typeset img:not([class]) {
335+
border-radius: 6px;
336+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
337+
transition: box-shadow 0.2s ease;
338+
}
339+
340+
.md-typeset img:not([class]):hover {
341+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
342+
}
343+
344+
[data-md-color-scheme="slate"] .md-typeset img:not([class]) {
345+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
346+
}
347+
137348
/* ---------- Print Styles ---------- */
138349

139350
@media print {
140351
.md-typeset {
141352
font-size: 11pt;
142353
line-height: 1.7;
143354
}
355+
144356
.md-sidebar,
145357
.md-header,
146-
.md-footer {
358+
.md-footer,
359+
.md-top {
147360
display: none !important;
148361
}
149-
}
362+
}

0 commit comments

Comments
 (0)