@clarusjs/theme-docs 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -6
- package/src/learn-path.tscl +134 -0
- package/src/lesson-bar.tscl +2 -0
- package/src/lesson.css +30 -3
- package/src/lesson.tscl +21 -1
- package/src/nav.ts +24 -6
- package/src/parts/icon.tscl +21 -0
- package/src/parts/icons.ts +17 -0
- package/src/parts/sidebar.tscl +100 -12
- package/src/search.tscl +4 -0
- package/src/styles/theme.css +413 -0
- package/src/theme.css +1567 -259
- package/src/vite.js +7 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/* The source of src/theme.css, written with Tailwind (v4) and built by `pnpm css` (#368). Edit this file, not the
|
|
2
|
+
built one; a test fails when they differ. Sites using the theme get the built, plain CSS: they need no Tailwind.
|
|
3
|
+
|
|
4
|
+
- No preflight: the theme keeps its own base styles below, and a site its own.
|
|
5
|
+
- Utilities are unlayered, like the rules below: ordinary specificity decides, so a utility (a class) wins over a
|
|
6
|
+
base rule for an element (a, li). In a layer, every unlayered rule would win over it.
|
|
7
|
+
- The tokens (--bg, --accent…) stay the public way to restyle the theme; Tailwind's colours and fonts are built on
|
|
8
|
+
them (bg-surface, text-muted, border-rule, bg-accent-soft, font-mono…), so utilities follow light and dark.
|
|
9
|
+
- Classes come from the theme's own templates only, and only from their class="…" attributes: scripts/classes.js
|
|
10
|
+
lists them for Tailwind (reading the templates, every word would be a candidate: .hidden, .block…). A test keeps
|
|
11
|
+
the theme's own class names (.sidebar, .step…) from also being utilities.
|
|
12
|
+
- Rules below use @apply for keywords and token colours (flex items-center border border-rule text-muted), and
|
|
13
|
+
plain declarations for sizes: Tailwind's spacing and radii are in rem, the theme's sizes in px. No hover: variant
|
|
14
|
+
either (it adds @media (hover: hover)); :hover rules @apply instead. */
|
|
15
|
+
@layer theme;
|
|
16
|
+
@import 'tailwindcss/theme.css' layer(theme) source(none);
|
|
17
|
+
@import 'tailwindcss/utilities.css' source(none);
|
|
18
|
+
@source '../../node_modules/.cache/theme-docs/classes.txt'; /* the templates' class names: scripts/classes.js */
|
|
19
|
+
|
|
20
|
+
@theme inline {
|
|
21
|
+
--color-bg: var(--bg);
|
|
22
|
+
--color-surface: var(--surface);
|
|
23
|
+
--color-fg: var(--fg);
|
|
24
|
+
--color-muted: var(--muted);
|
|
25
|
+
--color-rule: var(--rule);
|
|
26
|
+
--color-accent: var(--accent);
|
|
27
|
+
--color-accent-soft: var(--accent-soft); --color-xp: var(--xp); --color-xp-soft: var(--xp-soft);
|
|
28
|
+
--color-code: var(--code-bg);
|
|
29
|
+
--font-sans: var(--sans);
|
|
30
|
+
--font-mono: var(--mono);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* The theme's own rules: unlayered, as before (in a layer, any rule of a site's would win over them). */
|
|
34
|
+
/* @clarusjs/theme-docs: a quiet reading layout. Every colour, font and size is a custom property on :root (tokens). */
|
|
35
|
+
:root {
|
|
36
|
+
--header-height: 64px;
|
|
37
|
+
--page-width: 1440px; /* the header, sidebar, content and contents columns together */
|
|
38
|
+
--sidebar-width: 260px;
|
|
39
|
+
--toc-width: 220px;
|
|
40
|
+
--bg: #fbfcfc;
|
|
41
|
+
--surface: #f1f5f5;
|
|
42
|
+
--fg: #1a2526;
|
|
43
|
+
--muted: #566768;
|
|
44
|
+
--rule: #dbe4e4;
|
|
45
|
+
--accent: #0b6e70;
|
|
46
|
+
--accent-soft: rgba(11, 110, 112, 0.1);
|
|
47
|
+
--code-bg: #f1f5f5;
|
|
48
|
+
/* Highlighted code: the theme's own background, and line tints light enough that every token keeps WCAG AA. */
|
|
49
|
+
--shiki-bg: #ffffff;
|
|
50
|
+
--line-highlight: rgba(11, 110, 112, 0.07);
|
|
51
|
+
--line-add: rgba(47, 158, 110, 0.1);
|
|
52
|
+
--line-remove: rgba(208, 69, 59, 0.08);
|
|
53
|
+
--sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
|
|
54
|
+
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
55
|
+
color-scheme: light;
|
|
56
|
+
}
|
|
57
|
+
/* Dark: when the system is dark and light wasn't chosen, or when dark was chosen (theme toggle). */
|
|
58
|
+
@media (prefers-color-scheme: dark) {
|
|
59
|
+
:root:not([data-theme='light']) {
|
|
60
|
+
--bg: #0c1213;
|
|
61
|
+
--surface: #121b1c;
|
|
62
|
+
--fg: #e3eded;
|
|
63
|
+
--muted: #93a6a7;
|
|
64
|
+
--rule: #223031;
|
|
65
|
+
--accent: #4cc9cb;
|
|
66
|
+
--accent-soft: rgba(76, 201, 203, 0.12);
|
|
67
|
+
--code-bg: #121b1c;
|
|
68
|
+
--shiki-bg: var(--code-bg);
|
|
69
|
+
--line-highlight: rgba(76, 201, 203, 0.12);
|
|
70
|
+
--line-add: rgba(47, 158, 110, 0.14);
|
|
71
|
+
--line-remove: rgba(208, 69, 59, 0.14);
|
|
72
|
+
color-scheme: dark;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
:root[data-theme='dark'] {
|
|
76
|
+
--bg: #0c1213;
|
|
77
|
+
--surface: #121b1c;
|
|
78
|
+
--fg: #e3eded;
|
|
79
|
+
--muted: #93a6a7;
|
|
80
|
+
--rule: #223031;
|
|
81
|
+
--accent: #4cc9cb;
|
|
82
|
+
--accent-soft: rgba(76, 201, 203, 0.12);
|
|
83
|
+
--code-bg: #121b1c;
|
|
84
|
+
--shiki-bg: var(--code-bg);
|
|
85
|
+
--line-highlight: rgba(76, 201, 203, 0.12);
|
|
86
|
+
--line-add: rgba(47, 158, 110, 0.14);
|
|
87
|
+
--line-remove: rgba(208, 69, 59, 0.14);
|
|
88
|
+
color-scheme: dark;
|
|
89
|
+
}
|
|
90
|
+
:root[data-theme='light'] { color-scheme: light; }
|
|
91
|
+
|
|
92
|
+
* { box-sizing: border-box; }
|
|
93
|
+
html { -webkit-text-size-adjust: 100%; }
|
|
94
|
+
body {
|
|
95
|
+
margin: 0;
|
|
96
|
+
background: var(--bg);
|
|
97
|
+
color: var(--fg);
|
|
98
|
+
font: 16px/1.65 var(--sans);
|
|
99
|
+
}
|
|
100
|
+
a { color: var(--accent); text-underline-offset: 3px; }
|
|
101
|
+
/* Skip link: off screen until it has keyboard focus. */
|
|
102
|
+
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--bg); font-weight: 600; text-decoration: none; }
|
|
103
|
+
.skip-link:focus { top: 12px; }
|
|
104
|
+
/* Focused by the skip link and after navigation (the new page's heading or <main>), not controls: no ring after a
|
|
105
|
+
click; keyboard users keep it so they can see where they are. */
|
|
106
|
+
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; } /* keyboard focus (the skip link) keeps its ring */
|
|
107
|
+
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
|
|
108
|
+
|
|
109
|
+
.site-header {
|
|
110
|
+
position: sticky;
|
|
111
|
+
top: 0;
|
|
112
|
+
z-index: 10;
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
gap: 12px 24px;
|
|
116
|
+
background: var(--bg);
|
|
117
|
+
/* Its content lines up with the page below (.docs, at most --page-width wide), not the window's edges. */
|
|
118
|
+
box-sizing: border-box;
|
|
119
|
+
min-height: var(--header-height); /* what the sticky sidebar and contents sit under */
|
|
120
|
+
padding: 0 max(16px, env(safe-area-inset-right, 0px), calc((100% - var(--page-width)) / 2 + 16px)) 0 max(16px, env(safe-area-inset-left, 0px), calc((100% - var(--page-width)) / 2 + 16px));
|
|
121
|
+
border-bottom: 1px solid var(--rule);
|
|
122
|
+
}
|
|
123
|
+
.brand { @apply inline-flex items-center text-fg no-underline; gap: 10px; font-weight: 650; font-size: 18px; }
|
|
124
|
+
.js { color: var(--accent); font-weight: 500; }
|
|
125
|
+
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
|
|
126
|
+
.site-header nav a { @apply text-muted no-underline; font-size: 15px; }
|
|
127
|
+
.site-header nav a:hover { @apply text-fg; }
|
|
128
|
+
.site-header nav a[aria-current] { @apply text-accent font-semibold; }
|
|
129
|
+
|
|
130
|
+
.content {
|
|
131
|
+
max-width: 760px;
|
|
132
|
+
margin: 0 auto;
|
|
133
|
+
padding: 32px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px));
|
|
134
|
+
}
|
|
135
|
+
/* app: a tool that fills the window under the header (a playground); it lays itself out. */
|
|
136
|
+
.content.app { max-width: none; margin: 0; padding: 0; height: calc(100dvh - var(--header-height)); display: flex; flex-direction: column; }
|
|
137
|
+
@media (max-width: 899px) { .content.app { height: auto; } }
|
|
138
|
+
h1, h2 { line-height: 1.2; text-wrap: balance; }
|
|
139
|
+
h1 { font-size: clamp(30px, 5vw, 40px); margin: 0 0 16px; letter-spacing: -0.01em; }
|
|
140
|
+
h2 { font-size: 22px; margin: 40px 0 12px; }
|
|
141
|
+
p, ul, ol { margin: 0 0 16px; }
|
|
142
|
+
li { margin-bottom: 6px; }
|
|
143
|
+
|
|
144
|
+
code { font: 0.9em var(--mono); background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
|
|
145
|
+
pre {
|
|
146
|
+
background: var(--code-bg);
|
|
147
|
+
border: 1px solid var(--rule);
|
|
148
|
+
border-radius: 8px;
|
|
149
|
+
padding: 14px 16px;
|
|
150
|
+
overflow-x: auto;
|
|
151
|
+
margin: 0 0 20px;
|
|
152
|
+
}
|
|
153
|
+
pre code { background: none; padding: 0; font-size: 14px; line-height: 1.55; }
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
.site-footer {
|
|
157
|
+
@apply border-t border-rule text-muted text-center;
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
padding: 20px max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.sample { position: relative; }
|
|
163
|
+
.sample pre { padding-right: 72px; }
|
|
164
|
+
.copy {
|
|
165
|
+
@apply absolute border border-rule bg-bg text-muted cursor-pointer;
|
|
166
|
+
top: 8px; right: 8px; font: 600 12px var(--sans); padding: 4px 10px; border-radius: 6px;
|
|
167
|
+
}
|
|
168
|
+
.copy:hover { @apply text-accent border-accent; }
|
|
169
|
+
.theme-toggle {
|
|
170
|
+
@apply border border-rule bg-transparent text-fg cursor-pointer;
|
|
171
|
+
font-size: 16px; line-height: 1; width: 30px; height: 30px; border-radius: 8px;
|
|
172
|
+
}
|
|
173
|
+
.theme-toggle:hover { @apply border-accent text-accent; }
|
|
174
|
+
.site-header nav { align-items: center; }
|
|
175
|
+
|
|
176
|
+
/* Docs pages: sidebar, content and "On this page" (from 1280px a column, below that a box above the content). */
|
|
177
|
+
.docs { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width); max-width: var(--page-width); margin: 0 auto; }
|
|
178
|
+
.docs .content { margin: 0; max-width: 760px; min-width: 0; }
|
|
179
|
+
.sidebar { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding: 28px 16px 40px max(16px, env(safe-area-inset-left, 0px)); border-right: 1px solid var(--rule); }
|
|
180
|
+
.crumb { @apply font-semibold text-accent; margin: 0 0 6px; font-size: 13px; letter-spacing: 0.04em; }
|
|
181
|
+
.lead { @apply text-muted; font-size: 18px; }
|
|
182
|
+
.page-footer { @apply border-t border-rule; margin-top: 48px; padding-top: 16px; }
|
|
183
|
+
.edit { font-size: 14px; }
|
|
184
|
+
.updated { @apply text-muted; margin: 4px 0 0; font-size: 14px; }
|
|
185
|
+
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
|
|
186
|
+
.pager a { @apply block border border-rule no-underline font-semibold; padding: 12px 14px; border-radius: 8px; }
|
|
187
|
+
.pager a:hover { @apply border-accent; }
|
|
188
|
+
.pager small { @apply block font-normal text-muted; font-size: 12px; }
|
|
189
|
+
.pager .next { @apply col-start-2 text-right; }
|
|
190
|
+
table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 15px; }
|
|
191
|
+
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
|
|
192
|
+
.content table { display: block; overflow-x: auto; }
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
.persist { display: contents; }
|
|
196
|
+
|
|
197
|
+
/* Header: section links, then (pushed right) social icons, the ⋯ overflow menu and the theme toggle. */
|
|
198
|
+
.top-nav { @apply flex flex-wrap; gap: 4px 18px; }
|
|
199
|
+
.header-end { @apply ml-auto flex items-center; gap: 6px; }
|
|
200
|
+
.social { @apply flex items-center; gap: 2px; }
|
|
201
|
+
.social a, .more-button, .menu-button {
|
|
202
|
+
@apply inline-flex items-center justify-center border-0 bg-transparent text-muted cursor-pointer no-underline;
|
|
203
|
+
min-width: 40px; height: 40px; padding: 0 6px; border-radius: 8px;
|
|
204
|
+
}
|
|
205
|
+
.social a:hover, .more-button:hover, .menu-button:hover { @apply text-fg bg-accent-soft; }
|
|
206
|
+
.npm { padding: 1px 5px; border: 1.8px solid currentColor; border-radius: 4px; font: 700 11px/1.3 var(--mono); }
|
|
207
|
+
.more-button, .menu-button { display: none; }
|
|
208
|
+
.more {
|
|
209
|
+
@apply m-0 border border-rule bg-bg text-fg;
|
|
210
|
+
inset: auto; padding: 6px; min-width: 200px; border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18); position-area: bottom span-left;
|
|
211
|
+
}
|
|
212
|
+
.more a { @apply flex items-center text-fg no-underline; min-height: 44px; padding: 0 12px; border-radius: 8px; }
|
|
213
|
+
.more a:hover { @apply bg-accent-soft; }
|
|
214
|
+
|
|
215
|
+
/* Search: a button in the header, a modal dialog with the results. */
|
|
216
|
+
.search-button {
|
|
217
|
+
@apply inline-flex items-center border border-rule bg-bg text-muted cursor-pointer;
|
|
218
|
+
gap: 8px; height: 40px; min-width: 40px; padding: 0 10px; border-radius: 10px; font: inherit; font-size: 14px;
|
|
219
|
+
}
|
|
220
|
+
.search-button:hover { @apply text-fg border-accent; }
|
|
221
|
+
.search-button kbd { @apply border border-rule; padding: 1px 6px; border-radius: 6px; font: 12px var(--mono); }
|
|
222
|
+
.search-dialog {
|
|
223
|
+
@apply p-0 border border-rule bg-bg text-fg;
|
|
224
|
+
width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 96px)); margin: 72px auto auto; border-radius: 14px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
|
|
225
|
+
}
|
|
226
|
+
.search-dialog::backdrop { background: rgba(15, 23, 25, 0.45); }
|
|
227
|
+
.search-box { @apply flex flex-col; max-height: inherit; }
|
|
228
|
+
.search-box input { @apply border-0 border-b border-rule bg-transparent text-inherit; height: 52px; padding: 0 16px; font: inherit; font-size: 17px; }
|
|
229
|
+
.search-box input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
|
|
230
|
+
.search-status { @apply m-0 text-muted; padding: 8px 16px 0; font-size: 13px; }
|
|
231
|
+
.search-status:empty { display: none; }
|
|
232
|
+
#search-results { @apply list-none m-0 overflow-y-auto; padding: 8px; }
|
|
233
|
+
#search-results a { @apply grid text-fg no-underline; gap: 2px; padding: 10px 12px; border-radius: 10px; }
|
|
234
|
+
#search-results [aria-selected="true"] a, #search-results a:hover { @apply bg-accent-soft; }
|
|
235
|
+
.search-heading { font-weight: 650; }
|
|
236
|
+
.search-page { @apply text-accent; font-size: 13px; }
|
|
237
|
+
.search-text { @apply text-muted line-clamp-2; font-size: 13px; }
|
|
238
|
+
|
|
239
|
+
/* Where the sidebar is shown in place (from 1024px) it has the search box: the header's button would repeat it. */
|
|
240
|
+
@media (min-width: 1024px) { body:has(.sidebar) .site-header .search-button { display: none; } }
|
|
241
|
+
/* The sidebar is a popover (so it can be a drawer on small screens): shown in place from 1024px. */
|
|
242
|
+
/* inset first: it would reset top. */
|
|
243
|
+
.sidebar[popover] { display: block; position: sticky; inset: auto; top: var(--header-height); width: auto; height: auto; max-height: calc(100vh - var(--header-height)); margin: 0; border: 0; border-right: 1px solid var(--rule); background: transparent; color: inherit; overflow-y: auto; }
|
|
244
|
+
.sidebar-head, .sidebar-links, .sidebar-switch { display: none; }
|
|
245
|
+
|
|
246
|
+
/* On this page */
|
|
247
|
+
.toc { position: sticky; top: var(--header-height); align-self: start; max-height: calc(100vh - var(--header-height)); overflow-y: auto; padding: 36px 16px; font-size: 14px; }
|
|
248
|
+
.toc p { margin: 0 0 8px; font-weight: 650; }
|
|
249
|
+
.toc ul, .toc-inline ul { @apply list-none m-0 p-0; }
|
|
250
|
+
.toc li, .toc-inline li { margin: 0 0 6px; }
|
|
251
|
+
.toc li.sub, .toc-inline li.sub { padding-left: 14px; }
|
|
252
|
+
.toc a, .toc-inline a { @apply text-muted no-underline; }
|
|
253
|
+
.toc a:hover, .toc-inline a:hover { @apply text-accent; }
|
|
254
|
+
.toc-inline { @apply hidden border border-rule; margin: 0 0 24px; border-radius: 10px; }
|
|
255
|
+
.toc-inline > summary { @apply flex items-center cursor-pointer; min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 650; }
|
|
256
|
+
.toc-inline ul { padding: 0 14px 12px; font-size: 14px; }
|
|
257
|
+
|
|
258
|
+
/* Below 1280px: no room for the column; "On this page" is a box above the content, social links fold into ⋯. */
|
|
259
|
+
@media (max-width: 1279px) {
|
|
260
|
+
.docs { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
|
|
261
|
+
.toc { display: none; }
|
|
262
|
+
.toc-inline { display: block; }
|
|
263
|
+
.social { display: none; }
|
|
264
|
+
.more-button { display: inline-flex; }
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/* Below 1024px: the sidebar is a drawer from the ☰ button; the page takes the full width. */
|
|
268
|
+
@media (max-width: 1023px) {
|
|
269
|
+
.docs { display: block; }
|
|
270
|
+
.menu-button { display: inline-flex; }
|
|
271
|
+
.sidebar[popover] { display: none; }
|
|
272
|
+
.sidebar[popover]:popover-open { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: min(340px, 86vw); height: 100%; max-height: none; padding: 0 12px 16px; border-right: 1px solid var(--rule); background: var(--bg); box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25); }
|
|
273
|
+
.sidebar[popover]::backdrop { background: rgba(15, 23, 25, 0.45); }
|
|
274
|
+
.sidebar-head { @apply flex items-center justify-between font-bold border-b border-rule; min-height: 60px; margin: 0 -12px 8px; padding: 0 8px 0 16px; }
|
|
275
|
+
.sidebar-head button { @apply border-0 bg-transparent text-muted cursor-pointer; width: 44px; height: 44px; border-radius: 8px; }
|
|
276
|
+
/* Pinned to the bottom of the drawer, over the list as it scrolls (the drawer's 16px bottom padding included). */
|
|
277
|
+
.sidebar-links { display: flex; flex-wrap: wrap; position: sticky; bottom: -16px; margin: auto -12px -16px; padding: 12px 16px 16px; background: var(--bg); }
|
|
278
|
+
.sidebar-switch { display: grid; }
|
|
279
|
+
/* The drawer (#370): no search box (the header's button is there) or icons; larger rows. */
|
|
280
|
+
.sidebar .sidebar-search, .sidebar .group-icon { display: none; }
|
|
281
|
+
.sidebar summary { font-size: 15px; padding-block: 10px; }
|
|
282
|
+
.sidebar details a { font-size: 15px; padding-block: 6px; }
|
|
283
|
+
.more-button, .social { display: none; }
|
|
284
|
+
/* The icon alone shows; "Search" stays for screen readers (the button's name), only out of sight. */
|
|
285
|
+
.search-button kbd { display: none; }
|
|
286
|
+
.search-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* Phones: the section links move into the drawer. */
|
|
290
|
+
@media (max-width: 699px) {
|
|
291
|
+
.site-header .top-nav { display: none; }
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/* ::: details blocks from Markdown: a native <details>. */
|
|
295
|
+
details.custom-block { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 14px; margin: 20px 0; }
|
|
296
|
+
details.custom-block > summary { cursor: pointer; font-weight: 600; }
|
|
297
|
+
details.custom-block[open] > summary { margin-bottom: 8px; }
|
|
298
|
+
|
|
299
|
+
/* Highlighted code from Markdown (Shiki, build time). Tokens carry both themes as variables; the page picks one. */
|
|
300
|
+
.code-block { position: relative; margin: 0 0 20px; }
|
|
301
|
+
.code-block pre { margin: 0; padding-right: 72px; }
|
|
302
|
+
.code-block .lang { position: absolute; top: 8px; right: 64px; font: 12px var(--mono); color: var(--muted); pointer-events: none; }
|
|
303
|
+
.code-block .code-title { margin: 0; padding: 6px 12px; font: 600 13px/20px var(--mono); border: 1px solid var(--rule); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--code-bg); }
|
|
304
|
+
.code-block .code-title + .lang + pre { border-top-left-radius: 0; border-top-right-radius: 0; }
|
|
305
|
+
.shiki span { color: var(--shiki-light); }
|
|
306
|
+
.shiki { background: var(--shiki-bg); border: 1px solid var(--rule); }
|
|
307
|
+
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .shiki span { color: var(--shiki-dark); } }
|
|
308
|
+
:root[data-theme='dark'] .shiki span { color: var(--shiki-dark); }
|
|
309
|
+
.shiki code { display: block; }
|
|
310
|
+
.shiki .line { display: inline-block; width: 100%; }
|
|
311
|
+
.shiki .line.highlighted { background: var(--line-highlight); }
|
|
312
|
+
.shiki .line.diff.add { background: var(--line-add); }
|
|
313
|
+
.shiki .line.diff.remove { background: var(--line-remove); }
|
|
314
|
+
.shiki .line.diff.add::before { content: '+ '; }
|
|
315
|
+
.shiki .line.diff.remove::before { content: '- '; }
|
|
316
|
+
.shiki.has-focused .line:not(.focused) { opacity: 0.45; filter: blur(0.5px); }
|
|
317
|
+
.shiki.has-focused:hover .line { opacity: 1; filter: none; }
|
|
318
|
+
.code-block.line-numbers pre { padding-left: 44px; }
|
|
319
|
+
.line-numbers-column { position: absolute; top: 14px; left: 0; width: 32px; display: flex; flex-direction: column; text-align: right; font: 14px/1.55 var(--mono); color: var(--muted); }
|
|
320
|
+
/* Below a title (6 + 20 + 6 px, and its 1px top border) the code, and so the numbers, start lower. */
|
|
321
|
+
.code-block .code-title ~ .line-numbers-column { top: calc(14px + 33px); }
|
|
322
|
+
|
|
323
|
+
/* ::: code-group: radio tabs, no JavaScript. The checked tab's label is followed by its block. */
|
|
324
|
+
.code-group { display: flex; flex-wrap: wrap; margin: 0 0 20px; }
|
|
325
|
+
.code-group > input { position: absolute; opacity: 0; pointer-events: none; }
|
|
326
|
+
.code-group > label { order: 0; font: 600 13px var(--mono); padding: 6px 12px; border: 1px solid var(--rule); border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--muted); cursor: pointer; }
|
|
327
|
+
.code-group > input:checked + label { color: var(--accent); background: var(--code-bg); }
|
|
328
|
+
.code-group > input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
329
|
+
.code-group > .code-block { order: 1; width: 100%; display: none; margin: 0; }
|
|
330
|
+
.code-group > input:checked + label + .code-block { display: block; }
|
|
331
|
+
.code-group > .code-block pre { border-top-left-radius: 0; }
|
|
332
|
+
|
|
333
|
+
/* Visitors who ask for less motion get none: transitions and animations end at once, scrolling jumps. */
|
|
334
|
+
@media (prefers-reduced-motion: reduce) {
|
|
335
|
+
*, *::before, *::after {
|
|
336
|
+
animation-duration: 0.01ms !important;
|
|
337
|
+
animation-iteration-count: 1 !important;
|
|
338
|
+
transition-duration: 0.01ms !important;
|
|
339
|
+
scroll-behavior: auto !important;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/* Right and wrong (quizzes, the lesson bar): green and red that keep their contrast in both themes. */
|
|
344
|
+
:root { --ok: #17703c; --ok-soft: rgba(23, 112, 60, 0.1); --bad: #b42318; --bad-soft: rgba(180, 35, 24, 0.08); }
|
|
345
|
+
@media (prefers-color-scheme: dark) {
|
|
346
|
+
:root:not([data-theme='light']) { --ok: #4ade80; --ok-soft: rgba(74, 222, 128, 0.12); --bad: #f87171; --bad-soft: rgba(248, 113, 113, 0.12); }
|
|
347
|
+
}
|
|
348
|
+
:root[data-theme='dark'] { --ok: #4ade80; --ok-soft: rgba(74, 222, 128, 0.12); --bad: #f87171; --bad-soft: rgba(248, 113, 113, 0.12); }
|
|
349
|
+
/* XP and badges (amber): the Learn path's XP, its footer, the sidebar's "New". */
|
|
350
|
+
:root { --xp: #8a6100; --xp-soft: #fff6d6; }
|
|
351
|
+
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --xp: #ffd23f; --xp-soft: rgba(255, 210, 63, 0.12); } }
|
|
352
|
+
:root[data-theme='dark'] { --xp: #ffd23f; --xp-soft: rgba(255, 210, 63, 0.12); }
|
|
353
|
+
|
|
354
|
+
/* Quizzes: big options to tap, then the right one green and a wrong pick red. */
|
|
355
|
+
.quiz { @apply border border-rule bg-surface; margin: 24px 0; padding: 18px; border-radius: 14px; }
|
|
356
|
+
.quiz-question { font-weight: 650; margin: 0 0 12px; }
|
|
357
|
+
.quiz-options { @apply grid; gap: 8px; }
|
|
358
|
+
.quiz-options label { @apply flex items-center bg-bg cursor-pointer; gap: 10px; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--rule); border-radius: 12px; }
|
|
359
|
+
.quiz-options label:has(input:checked) { @apply border-accent bg-accent-soft; }
|
|
360
|
+
.quiz-options label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
361
|
+
.quiz .quiz-options label.right { border-color: var(--ok); background: var(--ok-soft); }
|
|
362
|
+
.quiz .quiz-options label.wrong { border-color: var(--bad); background: var(--bad-soft); }
|
|
363
|
+
.quiz-options .mark { margin-left: auto; font-size: 13px; font-weight: 700; }
|
|
364
|
+
.quiz-options .right .mark { color: var(--ok); }
|
|
365
|
+
.quiz-options .wrong .mark { color: var(--bad); }
|
|
366
|
+
.quiz-options input { accent-color: var(--accent); width: 18px; height: 18px; }
|
|
367
|
+
.quiz-check { @apply border-0 bg-accent text-bg cursor-pointer; margin-top: 12px; min-height: 44px; padding: 0 18px; border-radius: 10px; font: inherit; font-weight: 700; }
|
|
368
|
+
.quiz-check:disabled { opacity: 0.5; cursor: default; }
|
|
369
|
+
.quiz-status { margin: 8px 0 0; font-size: 14px; }
|
|
370
|
+
.quiz-status:empty { display: none; }
|
|
371
|
+
.quiz-answer { margin-top: 12px; font-size: 15px; }
|
|
372
|
+
.quiz-answer > summary { @apply cursor-pointer text-muted; }
|
|
373
|
+
.quiz-correct { font-weight: 650; margin: 8px 0; }
|
|
374
|
+
|
|
375
|
+
/* Learn: the XP chip, lesson states in the sidebar (a hint: every lesson stays open), the progress page. */
|
|
376
|
+
.xp-chip {
|
|
377
|
+
@apply inline-flex items-center border border-rule bg-bg text-fg font-bold no-underline whitespace-nowrap;
|
|
378
|
+
gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 14px;
|
|
379
|
+
}
|
|
380
|
+
.xp-chip[hidden] { display: none; }
|
|
381
|
+
.xp-chip svg { color: #c99400; }
|
|
382
|
+
.xp-chip:hover { @apply border-accent; }
|
|
383
|
+
.sidebar a[data-status]::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; border: 2px solid var(--rule); vertical-align: -1px; }
|
|
384
|
+
.sidebar a[data-status="done"]::before { background: var(--ok); border-color: var(--ok); }
|
|
385
|
+
.sidebar a[data-status="current"]::before { border-color: var(--accent); }
|
|
386
|
+
.sidebar a[data-status="locked"] { color: var(--muted); }
|
|
387
|
+
.status-note { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
388
|
+
.progress-board .status-note { position: static; width: auto; height: auto; clip-path: none; color: var(--muted); font-size: 14px; }
|
|
389
|
+
.progress-note { @apply border border-rule bg-surface; padding: 12px 14px; border-radius: 10px; }
|
|
390
|
+
.progress-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0 0 24px; }
|
|
391
|
+
.progress-stats div { @apply border border-rule bg-surface; padding: 14px 16px; border-radius: 12px; }
|
|
392
|
+
.progress-stats dt { @apply text-muted; font-size: 13px; }
|
|
393
|
+
.progress-stats dd { margin: 4px 0 0; font-size: 22px; font-weight: 800; }
|
|
394
|
+
.badges { @apply grid p-0 list-none; gap: 8px; }
|
|
395
|
+
.badges li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; padding: 12px 14px; border: 1px dashed var(--rule); border-radius: 12px; color: var(--muted); }
|
|
396
|
+
.badges li.earned { border-style: solid; border-color: var(--ok); color: var(--fg); background: var(--ok-soft); }
|
|
397
|
+
.badges em { margin-left: auto; font-style: normal; font-size: 13px; font-weight: 700; }
|
|
398
|
+
.progress-lessons li[data-status="done"] a::after { content: ' ✓'; color: var(--ok); }
|
|
399
|
+
.progress-reset { @apply bg-transparent cursor-pointer; margin-top: 16px; min-height: 44px; padding: 0 16px; border: 1px solid var(--bad); border-radius: 10px; color: var(--bad); font: inherit; font-weight: 600; }
|
|
400
|
+
|
|
401
|
+
/* While a page change runs (fragments or the client router set data-cl-navigating on <html>): a thin bar at the top.
|
|
402
|
+
Shown after a short delay, so fast swaps don't flash it. */
|
|
403
|
+
html[data-cl-navigating]::before {
|
|
404
|
+
content: ''; position: fixed; inset: 0 auto auto 0; z-index: 20; height: 3px; width: 100%; background: var(--accent);
|
|
405
|
+
transform-origin: left; animation: cl-navigating 8s cubic-bezier(0.1, 0.7, 0.2, 1) 150ms both;
|
|
406
|
+
}
|
|
407
|
+
@keyframes cl-navigating { from { transform: scaleX(0); } to { transform: scaleX(0.9); } }
|
|
408
|
+
@media (prefers-reduced-motion: reduce) { html[data-cl-navigating]::before { animation: none; transform: scaleX(1); opacity: 0.6; } }
|
|
409
|
+
|
|
410
|
+
/* View transitions (config.viewTransitions): the default cross-fade, none with reduced motion. */
|
|
411
|
+
@media (prefers-reduced-motion: reduce) {
|
|
412
|
+
::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none; }
|
|
413
|
+
}
|