@chengzhao-dev/dsh-quarto-book 0.4.3 → 0.5.0

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.
Files changed (55) hide show
  1. package/README.en.md +2 -2
  2. package/README.md +2 -2
  3. package/package.json +5 -2
  4. package/skills/designing-theme/SKILL.md +2 -2
  5. package/skills/designing-theme/assets/theme/css/base.css +216 -55
  6. package/skills/designing-theme/assets/theme/css/callouts.css +32 -23
  7. package/skills/designing-theme/assets/theme/css/code.css +84 -2
  8. package/skills/designing-theme/assets/theme/css/content.css +152 -36
  9. package/skills/designing-theme/assets/theme/css/landing.css +150 -52
  10. package/skills/designing-theme/assets/theme/css/nav.css +462 -35
  11. package/skills/designing-theme/assets/theme/css/sidebar.css +76 -31
  12. package/skills/designing-theme/assets/theme/css/tokens.css +34 -16
  13. package/skills/designing-theme/assets/theme/includes/fonts.html +1 -1
  14. package/skills/designing-theme/assets/theme/includes/footer.html +16 -7
  15. package/skills/designing-theme/assets/theme/includes/palette.html +420 -0
  16. package/skills/designing-theme/assets/theme/palettes/flexoki/brand-mark.svg +3 -0
  17. package/skills/designing-theme/assets/theme/palettes/flexoki/favicon-dark.svg +5 -0
  18. package/skills/designing-theme/assets/theme/palettes/flexoki/favicon-light.svg +5 -0
  19. package/skills/designing-theme/assets/theme/palettes/flexoki/highlight-dark.theme +214 -0
  20. package/skills/designing-theme/assets/theme/palettes/flexoki/highlight-light.theme +214 -0
  21. package/skills/designing-theme/assets/theme/palettes/flexoki/meta.md +53 -0
  22. package/skills/designing-theme/assets/theme/palettes/flexoki/theme-dark.scss +43 -0
  23. package/skills/designing-theme/assets/theme/palettes/flexoki/theme-light.scss +40 -0
  24. package/skills/designing-theme/assets/theme/palettes/flexoki/tokens.css +156 -0
  25. package/skills/designing-theme/assets/theme/palettes/hill-light/brand-mark.svg +3 -0
  26. package/skills/designing-theme/assets/theme/palettes/hill-light/favicon-dark.svg +5 -0
  27. package/skills/designing-theme/assets/theme/palettes/hill-light/favicon-light.svg +5 -0
  28. package/skills/designing-theme/assets/theme/palettes/hill-light/meta.md +78 -0
  29. package/skills/designing-theme/assets/theme/palettes/hill-light/syntax.css +150 -0
  30. package/skills/designing-theme/assets/theme/palettes/hill-light/tokens.css +322 -0
  31. package/skills/designing-theme/assets/theme/palettes/solarized/brand-mark.svg +3 -0
  32. package/skills/designing-theme/assets/theme/palettes/solarized/favicon-dark.svg +5 -0
  33. package/skills/designing-theme/assets/theme/palettes/solarized/favicon-light.svg +5 -0
  34. package/skills/designing-theme/assets/theme/palettes/solarized/highlight-dark.theme +214 -0
  35. package/skills/designing-theme/assets/theme/palettes/solarized/highlight-light.theme +214 -0
  36. package/skills/designing-theme/assets/theme/palettes/solarized/meta.md +66 -0
  37. package/skills/designing-theme/assets/theme/palettes/solarized/syntax.css +67 -0
  38. package/skills/designing-theme/assets/theme/palettes/solarized/theme-dark.scss +43 -0
  39. package/skills/designing-theme/assets/theme/palettes/solarized/theme-light.scss +41 -0
  40. package/skills/designing-theme/assets/theme/palettes/solarized/tokens.css +154 -0
  41. package/skills/designing-theme/knowledge/reading-surface.md +27 -15
  42. package/skills/designing-theme/references/theme-spine.md +2 -2
  43. package/skills/designing-theme/references/theme-system.md +82 -36
  44. package/skills/designing-theme/scripts/checking-layout.py +306 -48
  45. package/skills/designing-theme/scripts/measuring-pages.mjs +40 -3
  46. package/skills/writing-quarto/quarto/render.md +2 -2
  47. package/skills/writing-quarto/scripts/checking-dom.py +14 -7
  48. package/skills/designing-theme/assets/theme/assets/brand-mark.svg +0 -4
  49. package/skills/designing-theme/assets/theme/assets/favicon.svg +0 -9
  50. package/skills/designing-theme/assets/theme/palettes/github/highlight-dark.theme +0 -213
  51. package/skills/designing-theme/assets/theme/palettes/github/highlight-light.theme +0 -213
  52. package/skills/designing-theme/assets/theme/palettes/github/meta.md +0 -38
  53. package/skills/designing-theme/assets/theme/palettes/github/theme-dark.scss +0 -35
  54. package/skills/designing-theme/assets/theme/palettes/github/theme-light.scss +0 -34
  55. package/skills/designing-theme/assets/theme/palettes/github/tokens.css +0 -160
@@ -50,11 +50,11 @@ pre:not(.sourceCode) code {
50
50
  }
51
51
  pre.sourceCode code > span { line-height: var(--code-line-height); }
52
52
 
53
- /* GitHub 风格高亮只区分颜色,不用额外字重强调命令名或输出 token。 */
53
+ /* 高亮只区分颜色,不用额外字重强调命令名或输出 token。 */
54
54
  pre.sourceCode code span { font-weight: 400; }
55
55
 
56
56
  /*
57
- * 颜色只由 GitHub 风格的语义 token 提供。不要按字符、位置或命令名
57
+ * 颜色只由语义 token 提供。不要按字符、位置或命令名
58
58
  * 覆盖 span,否则同一行的括号、版本号和普通文本会出现突兀的颜色切换。
59
59
  */
60
60
  /* 语言代码块和普通文本代码块共享布局;只有语言代码块保留语义 token。 */
@@ -206,6 +206,88 @@ pre.sourceCode code > span:hover { background-color: var(--line-hover-bg); }
206
206
  }
207
207
  .code-copy-button-checked { opacity: 1; color: var(--link-color); }
208
208
 
209
+ /* ---------- 代码工具(code-tools) ----------
210
+ 浮在代码块右上角的「代码」按钮与下拉菜单来自 Bootstrap,默认 16px 灰蓝字、
211
+ 无本轮语义;接到令牌:次要色 → 悬停主色,菜单与分隔线用卡片层令牌。 */
212
+ .code-tools-button {
213
+ color: var(--text-secondary) !important;
214
+ font-family: var(--ui-font);
215
+ font-size: 0.8125rem;
216
+ line-height: 1.4;
217
+ padding: 0.15rem 0.45rem;
218
+ border-radius: var(--radius-sm);
219
+ background: transparent;
220
+ }
221
+ .code-tools-button:hover,
222
+ .code-tools-button:focus-visible {
223
+ color: var(--body-color) !important;
224
+ background: var(--surface-raised);
225
+ }
226
+ .code-tools-menu {
227
+ border: 1px solid var(--card-border);
228
+ border-radius: var(--radius-md);
229
+ background: var(--surface-raised);
230
+ box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
231
+ font-family: var(--ui-font);
232
+ font-size: 0.875rem;
233
+ padding: 0.25rem;
234
+ }
235
+ .code-tools-menu .dropdown-item {
236
+ color: var(--body-color);
237
+ border-radius: var(--radius-sm);
238
+ padding: 0.3rem 0.55rem;
239
+ }
240
+ .code-tools-menu .dropdown-item:hover {
241
+ background: var(--surface-raised);
242
+ color: var(--body-color);
243
+ }
244
+ .code-tools-menu .dropdown-divider {
245
+ border-top-color: var(--card-border);
246
+ }
247
+
248
+ /* ---------- 代码标注(code-annotation) ----------
249
+ Quarto 自带的标注样式是 Bootstrap 默认:gutter 一块浅灰底、行号是主色圆点,
250
+ 暗色下浅灰块会发亮、圆点色与本书强调色不同源。这里只接令牌:gutter 透明、
251
+ 行内编号与注释列表编号共用动作色描边,注释正文走 14px 次要色。 */
252
+ .code-annotation-gutter,
253
+ .code-annotation-gutter-bg {
254
+ background-color: transparent;
255
+ }
256
+ #quarto-document-content code.sourceCode .code-annotation-anchor,
257
+ #quarto-document-content .code-annotation-container-grid dt {
258
+ display: inline-flex;
259
+ align-items: center;
260
+ justify-content: center;
261
+ min-width: 1.15rem;
262
+ height: 1.15rem;
263
+ border: 1px solid var(--accent);
264
+ border-radius: 999px;
265
+ background: transparent;
266
+ color: var(--accent);
267
+ font-family: var(--ui-font);
268
+ font-size: 0.6875rem;
269
+ font-weight: 400;
270
+ line-height: 1;
271
+ text-decoration: none;
272
+ }
273
+ #quarto-document-content code.sourceCode .code-annotation-anchor {
274
+ margin-right: 0.4rem;
275
+ }
276
+ .code-annotation-container-grid {
277
+ margin: 0.6rem 0 1.5rem;
278
+ }
279
+ .code-annotation-container-grid dt {
280
+ border-color: var(--text-secondary);
281
+ color: var(--text-secondary);
282
+ font-family: var(--ui-font);
283
+ }
284
+ .code-annotation-container-grid dd {
285
+ margin: 0 0 0.45rem;
286
+ color: var(--text-secondary);
287
+ font-size: 0.875rem;
288
+ line-height: 1.65;
289
+ }
290
+
209
291
  /* 打印时横向滚动不存在,屏幕上的 white-space: pre 会把 100 列截掉;
210
292
  打印恢复折行,屏幕规则不动。 */
211
293
  @media print {
@@ -1,6 +1,6 @@
1
1
  /* dsh-quarto-book Quarto 主题 · 正文内容(表格 / 引用 / 正文组件与排版;自 common.css 拆分) */
2
2
 
3
- /* ---------- 表格(冷灰 docs:无外框、表头底线 + 行 hairline) ---------- */
3
+ /* ---------- 表格(booktabs:顶/底粗线、表头细线,无行线与竖线) ---------- */
4
4
  .table {
5
5
  --bs-table-hover-bg: transparent;
6
6
  /* 表体与正文同档:表格字号一旦小于正文,正文里嵌表格就会出现两次字级跳变,
@@ -17,11 +17,11 @@
17
17
  font-variant-numeric: tabular-nums;
18
18
  }
19
19
  .table > :not(caption) > * > * {
20
- padding: 0.5rem 1rem;
20
+ padding: 0.55rem 0.9rem;
21
21
  vertical-align: baseline;
22
- border-bottom: 1px solid var(--table-hairline);
22
+ border-bottom: 0;
23
23
  }
24
- /* 首尾列贴边(docs 表格无左右内边距) */
24
+ /* 首尾列贴边,让表格与正文左缘对齐 */
25
25
  .table > :not(caption) > * > :first-child {
26
26
  padding-inline-start: 0;
27
27
  }
@@ -31,9 +31,15 @@
31
31
  .table thead th {
32
32
  background-color: transparent;
33
33
  font-weight: 600;
34
- font-size: 0.8125rem;
34
+ /* 表头比表体小 1px(17px → 15px),层级靠字重与字号,不靠比顶线更粗的线。 */
35
+ font-size: 0.9375rem;
35
36
  text-align: left;
36
37
  padding-top: 0;
38
+ padding-bottom: 0.45rem;
39
+ border-top: 1px solid var(--table-border);
40
+ border-bottom: 1px solid var(--table-border);
41
+ }
42
+ .table > tbody > tr:last-child > * {
37
43
  border-bottom: 1px solid var(--table-border);
38
44
  }
39
45
 
@@ -59,55 +65,151 @@
59
65
  padding-inline-end: 0;
60
66
  }
61
67
 
62
- /* ---------- 引用块(> 标记,用于「注意」等提示;GitHub markdown-body 灰风:灰边 + 灰字,无彩色底) ---------- */
68
+ /* 表题:Pandoc 输出 <caption>,Bootstrap 默认把它放表下(caption-side: bottom),
69
+ 这里统一提到表上、左对齐,与图注一样小一号。 */
70
+ #quarto-document-content .table > caption {
71
+ caption-side: top;
72
+ text-align: left;
73
+ font-size: 0.875rem;
74
+ line-height: 1.65;
75
+ color: var(--text-secondary);
76
+ padding: 0 0 0.5rem;
77
+ }
78
+
79
+ /* 斑马纹压平:书籍表格靠表头线与列距,不靠交替底色(打印时还要 print-color-adjust)。 */
80
+ #quarto-document-content .table-striped > tbody > tr:nth-of-type(odd) > * {
81
+ background-color: transparent;
82
+ }
83
+
84
+ /* 任务列表:checkbox 跟强调色,不加卡片。 */
85
+ #quarto-document-content input[type="checkbox"] {
86
+ accent-color: var(--action-color);
87
+ margin-inline-end: 0.4em;
88
+ }
89
+
90
+ /* 脚注:比正文小一档(17px → 14px),顶部一条通栏发丝线与正文分开。 */
91
+ #quarto-document-content .footnotes {
92
+ margin-top: 3rem;
93
+ padding-top: 1rem;
94
+ border-top: 1px solid var(--card-border);
95
+ font-size: 0.875rem;
96
+ line-height: 1.7;
97
+ color: var(--text-secondary);
98
+ }
99
+ #quarto-document-content .footnotes ol {
100
+ padding-inline-start: 1.25rem;
101
+ margin-bottom: 0;
102
+ }
103
+ #quarto-document-content .footnotes li + li {
104
+ margin-top: 0.35rem;
105
+ }
106
+ #quarto-document-content .footnotes a {
107
+ color: var(--text-secondary);
108
+ }
109
+
110
+ /* ---------- 引用块(上下各一条通栏发丝线 + 正文色,无底色、无竖线;书籍引文而非灰卡) ----------
111
+ 横线规则:全书正文里的分隔一律是「通栏 1px 卡片发丝线」,与表格线、顶栏底边同一档颜色;
112
+ 引用块左右贯通正文列,靠这两条线界定范围,不再用左侧 2px 竖条(竖条与通栏规则相斥)。 */
63
113
  blockquote,
64
114
  blockquote.blockquote {
65
- font-size: 0.9375rem; /* 略小于正文(次要提示定位),并压掉 Quarto .blockquote 命中的 Bootstrap 1.25rem */
66
- margin: 1.375rem 0;
67
- border-left: 3px solid var(--quote-border);
68
- background-color: var(--quote-bg);
69
- color: var(--text-secondary);
70
- padding: 0 1rem;
115
+ font-size: inherit;
116
+ margin: 1.75rem 0;
117
+ /* Quarto 默认给引用块画 4px 左竖条,这里显式清零,否则上下横线之外还挂着一根竖墙。 */
118
+ border: 0;
119
+ border-top: 1px solid var(--card-border);
120
+ border-bottom: 1px solid var(--card-border);
121
+ background-color: transparent;
122
+ color: var(--body-color);
123
+ padding: 1.1rem 0 1.15rem;
71
124
  font-style: normal;
72
125
  }
73
- /* 分隔线(---)样式与节奏统一在下方「正文排版」段定义(docs 风:每个小节标题前一条细线,上方 3.375rem) */
74
126
 
75
127
  /* ---------- 正文组件润色 ---------- */
76
- /* 正文链接:强调色 + 细下划线 */
128
+ /* 正文链接:常态与正文同色 + 下划线;hover 才转为 accent,underline 用 action 色 */
77
129
  #quarto-document-content a {
78
130
  color: var(--text-link);
79
131
  text-decoration: underline;
80
132
  text-decoration-color: var(--text-underline);
81
133
  text-decoration-thickness: 1px;
82
- text-underline-offset: 0.2em;
134
+ text-underline-offset: 0.18em;
83
135
  }
84
136
  #quarto-document-content a:hover {
85
- color: var(--link-color);
86
- text-decoration-color: var(--link-underline);
137
+ color: var(--link-hover-color);
138
+ text-decoration-color: var(--action-color);
87
139
  }
88
- /* 图片 / 图:圆角 + 细边 + 居中图注 */
140
+ /* 图片 / 图:小圆角 + 细边 + 居中图注 */
89
141
  #quarto-document-content img:not(.no-border) {
90
- border-radius: var(--radius-lg);
142
+ border-radius: var(--radius-sm);
91
143
  border: 1px solid var(--code-border);
92
144
  max-width: 100%;
93
145
  }
94
- #quarto-document-content figure figcaption {
146
+ #quarto-document-content figure figcaption,
147
+ #quarto-document-content .quarto-float-caption,
148
+ #quarto-document-content .figure-caption {
95
149
  color: var(--text-secondary);
96
- font-size: 0.88rem;
150
+ font-size: 0.875rem;
151
+ line-height: 1.65;
97
152
  text-align: center;
98
153
  margin-top: 0.5rem;
99
154
  }
155
+ /* MathJax:行内公式默认缩到正文的 94%,夹在中文里会显得「小一号」;
156
+ 拉到 1em 与正文同档,display 公式单独给上下呼吸。 */
157
+ /* MathJax 会把 94% 写进 mjx-container 的行内 style,样式表必须 !important 才压得住。 */
158
+ #quarto-document-content mjx-container {
159
+ font-size: 1em !important;
160
+ }
161
+ mjx-container[display="true"] {
162
+ margin: 1.3rem 0;
163
+ }
164
+
165
+ /* 源码模态(code-tools):Bootstrap 默认 1000px,平板宽度下会顶满整屏。
166
+ 这里在 ≥576px 时封顶并留出 1rem 边距;更窄沿用 Bootstrap 的 .5rem 边距。 */
167
+ @media (min-width: 576px) {
168
+ #quarto-embedded-source-code-modal .modal-dialog {
169
+ max-width: min(1000px, calc(100vw - 2rem));
170
+ }
171
+ }
172
+
173
+ /* 图片灯箱(GLightbox,format.html.lightbox: true 时启用)
174
+ 默认遮罩 0.7 黑、页面图注会从图片后面透出来,读起来像「标签贴错位置」;
175
+ 这里加深遮罩把图单独抬出来,关闭/翻页按钮统一成白描边胶囊。 */
176
+ .glightbox-container .goverlay {
177
+ background: rgba(0, 0, 0, 0.86);
178
+ }
179
+ .glightbox-container .gbtn {
180
+ background: rgba(0, 0, 0, 0.45);
181
+ border-radius: 999px;
182
+ }
183
+ .glightbox-container .gbtn:hover,
184
+ .glightbox-container .gbtn:focus-visible {
185
+ background: rgba(0, 0, 0, 0.7);
186
+ }
187
+ .glightbox-container .gbtn svg path {
188
+ fill: #fff;
189
+ }
190
+ .glightbox-container .gslide-image img {
191
+ border-radius: var(--radius-sm);
192
+ }
193
+ /* 透明底的 SVG(品牌标记、图表)在深色遮罩上会「消失」:给矢量图垫白卡,
194
+ 位图不加任何装饰,避免给照片套白边。 */
195
+ .glightbox-container .gslide-image img[src$=".svg"],
196
+ .glightbox-container .gslide-image img[src*=".svg?"] {
197
+ background: #fff;
198
+ padding: 0.9rem;
199
+ box-sizing: border-box;
200
+ }
201
+
100
202
  /* jupyter 单元的图必须用 IPython.display.HTML 输出保持 SVG 内联:image/svg+xml 输出会被
101
203
  Quarto 外置成 <img>,无法继承站点 data-bs-theme 明暗与文档字体。text/html 输出不被
102
204
  Quarto 识别为图像,fig-cap 退化为图后一个裸 <p>,这里按 figcaption 同款图注样式居中。 */
103
205
  #quarto-document-content .cell-output-display > svg.coords-grid + p {
104
206
  color: var(--text-secondary);
105
- font-size: 0.88rem;
207
+ font-size: 0.875rem;
106
208
  text-align: center;
107
209
  margin-top: 0.5rem;
108
210
  }
109
211
  /* mermaid / dot 图表样式见 mermaid.css(SVG 居中规则已迁入) */
110
- /* 坐标图:GitHub 文档图的做法是抬起一块浅底、不加实线外框。
212
+ /* 坐标图:常见文档图的做法是抬起一块浅底、不加实线外框。
111
213
  内联 SVG 用 currentColor,跟着正文颜色走;独立 svg 文件再用
112
214
  prefers-color-scheme 兜住系统明暗。 */
113
215
  #quarto-document-content :is(figure, .cell-output-display) svg.coords-grid {
@@ -118,7 +220,7 @@ blockquote.blockquote {
118
220
  height: auto;
119
221
  color: var(--body-color);
120
222
  background: var(--surface-raised);
121
- border-radius: var(--radius-md);
223
+ border-radius: var(--radius-sm);
122
224
  padding: 0.75rem;
123
225
  box-sizing: border-box;
124
226
  }
@@ -127,6 +229,15 @@ blockquote.blockquote {
127
229
  #quarto-document-content section :is(.code-copy-outer-scaffold, .code-with-filename, pre) + :is(p, ul, ol) {
128
230
  font-family: var(--ui-font);
129
231
  }
232
+ /* 行内代码遇到无空格的类型名(std::array<std::array<CellType, 3>, 3>)时,
233
+ 窄屏会把正文列顶宽;此时允许行内代码换行,桌面保持原样。 */
234
+ @media (max-width: 575.98px) {
235
+ #quarto-document-content :is(p, li, dd, td, th) code {
236
+ white-space: pre-wrap;
237
+ overflow-wrap: anywhere;
238
+ }
239
+ }
240
+
130
241
  /* 键盘键 */
131
242
  #quarto-document-content kbd {
132
243
  font-family: var(--mono-font);
@@ -157,23 +268,28 @@ dd {
157
268
  color: var(--text-secondary);
158
269
  }
159
270
  #quarto-document-content details.answer-disclosure {
160
- border: 1px solid var(--card-border);
161
- border-radius: var(--radius-md);
162
- padding: 0.6rem 1rem;
163
- margin: 1.2rem 0;
271
+ border: 0;
272
+ border-top: 1px solid var(--card-border);
273
+ border-bottom: 1px solid var(--card-border);
274
+ border-radius: 0;
275
+ background: transparent;
276
+ padding: 0.7rem 0;
277
+ margin: 1.4rem 0;
164
278
  }
165
279
  /* 摘要文字用正文色;折叠三角显式着色——部分浏览器的 marker 不跟随文字色,
166
280
  暗色底上会以黑色渲染导致消失。 */
167
281
  #quarto-document-content details.answer-disclosure > summary {
168
282
  cursor: pointer;
169
283
  color: var(--body-color);
284
+ font-size: 0.9375rem;
285
+ line-height: 1.5;
170
286
  }
171
287
  #quarto-document-content details.answer-disclosure > summary::marker,
172
288
  #quarto-document-content details.answer-disclosure > summary::before {
173
289
  color: var(--body-color);
174
290
  }
175
291
  #quarto-document-content details.answer-disclosure[open] > summary {
176
- margin-bottom: 0.5rem;
292
+ margin-bottom: 0.6rem;
177
293
  }
178
294
 
179
295
  /* ---------- 正文排版 ---------- */
@@ -201,19 +317,19 @@ html {
201
317
  ::selection {
202
318
  background-color: var(--selection-bg);
203
319
  }
204
- /* 键盘导航焦点可见 */
320
+ /* 键盘导航焦点可见:用 action 色,不把正文链接染蓝 */
205
321
  :focus-visible {
206
- outline: 2px solid var(--link-color);
322
+ outline: 2px solid var(--action-color);
207
323
  outline-offset: 2px;
208
324
  border-radius: 2px;
209
325
  }
210
- /* 列表项间距:li+li 0.625rem、嵌套列表上距 0.625rem(docs 节奏;仅正文内容,不碰侧栏) */
326
+ /* 列表项间距:li+li 0.5rem、嵌套列表上距 0.5rem(仅正文内容,不碰侧栏) */
211
327
  #quarto-document-content li + li {
212
- margin-top: 0.625rem;
328
+ margin-top: 0.5rem;
213
329
  }
214
330
  #quarto-document-content li > ul,
215
331
  #quarto-document-content li > ol {
216
- margin-top: 0.625rem;
332
+ margin-top: 0.5rem;
217
333
  }
218
334
  /* 列表 marker(圆点/序号):显式用次要文字色,暗色底上浏览器默认 marker 可能
219
335
  以黑色渲染导致消失。 */
@@ -262,7 +378,7 @@ code {
262
378
  text-autospace: no-autospace;
263
379
  }
264
380
 
265
- /* GitHub Markdown 正文约束:普通段落使用正文列的实际宽度,组件不撑破三栏布局。
381
+ /* Markdown 正文约束:普通段落使用正文列的实际宽度,组件不撑破三栏布局。
266
382
  页面列宽由 Quarto grid 与 --content-width 决定;不要再用 75ch 对段落做第二次限宽。 */
267
383
  #quarto-document-content {
268
384
  max-width: min(100%, var(--content-width));
@@ -278,7 +394,7 @@ code {
278
394
  #quarto-document-content hr {
279
395
  border: 0;
280
396
  border-top: 1px solid var(--card-border);
281
- margin: 2rem 0;
397
+ margin: 2.5rem 0;
282
398
  opacity: 1;
283
399
  }
284
400
  /* 锚点 / 深链跳转后的目标标题轻微高亮,便于定位(复用行 hover 的浅强调底) */
@@ -1,61 +1,114 @@
1
- /* dsh-quarto-book Quarto 主题 · 首页落地页(Hero / 卡片网格;自 common.css 拆分) */
1
+ /* dsh-quarto-book Quarto 主题 · 首页落地页(Hero / 目录网格;书籍式编辑排版) */
2
2
 
3
- /* ---------- 首页落地页:Hero + 功能卡片 ---------- */
3
+ /* ---------- 首页落地页:Hero + 目录 ---------- */
4
4
  /* Hero 复用 #title-block-header(h1 + description 副标题)
5
5
  —— 间距控制点(关键):
6
6
  · 标题→描述:本规则 margin-top
7
7
  注意:Bootstrap 自带 #title-block-header.quarto-title-block.default .description { margin-top:0 }
8
8
  (特异性 1,3,0)会压过低特异性 #title-block-header .description(1,1,0),
9
- 故此处必须用【同等特异性】选择器才能生效;否则改 margin-top 一律无效(之前 20rem 不生效即此因)。
10
- · 描述→hero 卡片:本规则 margin-bottom(与 .feature-grid margin-top 折叠取大值,须同步改才生效) */
9
+ 故此处必须用【同等特异性】选择器才能生效。
10
+ · 描述→目录网格:本规则 margin-bottom(与 .feature-grid margin-top 折叠取大值,须同步改才生效) */
11
11
  #title-block-header.quarto-title-block.default .description {
12
12
  font-size: 1.125rem;
13
13
  text-align: left; /* 与左对齐标题一致(覆盖默认 theme 居中) */
14
- margin-top: 1.5rem; /* 标题→描述:空一行(gitcn hero mt-3 放宽) */
15
- margin-bottom: 0.6rem; /* 描述→卡片:收紧(须与 .feature-grid 顶边距同步改) */
14
+ margin-top: 1.5rem; /* 标题→描述:留一行 */
15
+ margin-bottom: 0.6rem; /* 描述→目录:收紧 */
16
16
  }
17
17
  .feature-grid {
18
18
  display: grid;
19
- /* 桌面端固定两列;单卡也保留半行宽度,与双卡保持一致。
20
- 半行宽度沿用 calc((100% - 1.25rem) / 2) 的既有布局契约。 */
21
- grid-template-columns: repeat(2, minmax(0, calc((100% - 1.25rem) / 2)));
22
- gap: 1.25rem; /* 卡片间距对齐 gitcn(~20px) */
23
- margin: 0.6rem 0 1rem; /* 顶部 0.9rem → 0.6rem,与描述下边距折叠后整体 0.6rem */
19
+ /* 两栏目录;栏距比卡片内边距宽一档,让两栏的文本列互不干扰 */
20
+ grid-template-columns: repeat(2, minmax(0, 1fr));
21
+ gap: 0 2.5rem;
22
+ margin: 0.9rem 0 1.5rem;
23
+ counter-reset: landing-card;
24
24
  }
25
- /* 首页各分组(## 准备 / ## 语言核心)下方引导段:灰字小一号,对齐 gitcn 分组描述;
25
+ /* 只有一张卡(当前游戏)时占满整行,右侧不再留半行空白;
26
+ 多卡(后续棋类)仍按两栏目录排。 */
27
+ .feature-grid:has(> .landing-card:only-child) {
28
+ grid-template-columns: 1fr;
29
+ }
30
+ /* 单张「当前游戏」是首页的主目录条目:把序号放大成版式锚点,
31
+ 标题、提要列在中间,动作留在右下,避免整行只有左侧一小段文字。 */
32
+ .feature-grid:has(> .landing-card:only-child) .landing-card {
33
+ grid-template-columns: 3rem minmax(0, 1fr) auto;
34
+ grid-template-areas:
35
+ "index title cta"
36
+ "index desc cta";
37
+ column-gap: 1.25rem;
38
+ row-gap: 0.45rem;
39
+ padding: 1.35rem 0 1.5rem;
40
+ }
41
+ .feature-grid:has(> .landing-card:only-child) .landing-card::before {
42
+ font-size: 1.75rem;
43
+ letter-spacing: 0;
44
+ line-height: 1;
45
+ padding-top: 0.15rem;
46
+ opacity: 1;
47
+ }
48
+ .feature-grid:has(> .landing-card:only-child) .landing-card h3 {
49
+ font-size: 1.375rem;
50
+ }
51
+ .feature-grid:has(> .landing-card:only-child) .landing-card p {
52
+ font-size: 1rem;
53
+ max-width: 46ch;
54
+ }
55
+ /* 首页各分组(## 准备 / ## 语言核心)下方引导段:灰字小一号;
26
56
  作用域限定首页(:has(.hero-eyebrow)),内容页引言保持正文色不受影响 */
27
57
  #quarto-document-content:has(.hero-eyebrow) section.level2 > p:first-of-type {
28
58
  color: var(--text-secondary);
29
59
  font-size: 0.9375rem;
30
- line-height: 1.5;
31
- margin: 0 0 1.25rem;
60
+ line-height: 1.6;
61
+ margin: 0 0 1rem;
32
62
  }
33
- /* 首页专用卡片(与正文内容完全隔离的组件,高特异性确保标题加粗+描述灰必生效) */
63
+ /* 首页目录条目:书页目录的一行。
64
+ 左侧是序号、标题、提要,右侧是动作;顶线分隔,不画卡片底色。 */
34
65
  .landing-card {
35
- display: block;
36
- background: var(--card-bg);
37
- border: 1px solid var(--card-border);
38
- border-radius: var(--radius-lg);
39
- padding: 1.35rem 1.5rem;
66
+ display: grid;
67
+ grid-template-columns: minmax(0, 1fr) auto;
68
+ grid-template-areas:
69
+ "index index"
70
+ "title cta"
71
+ "desc cta";
72
+ column-gap: 2rem;
73
+ row-gap: 0.35rem;
74
+ align-items: start;
75
+ background: transparent;
76
+ border: 0;
77
+ border-top: 1px solid var(--card-border);
78
+ border-radius: 0;
79
+ padding: 1.1rem 0 1.35rem;
40
80
  transition: var(--transition);
41
- min-height: 100%; /* 两卡并排时等高,避免短卡显得挤 */
81
+ min-height: 0;
42
82
  box-sizing: border-box;
43
83
  }
84
+ /* 目录序号:小号等宽数字,像纸书目录前的 01/02 */
85
+ .landing-card::before {
86
+ counter-increment: landing-card;
87
+ content: counter(landing-card, decimal-leading-zero);
88
+ grid-area: index;
89
+ font-family: var(--mono-font);
90
+ font-size: 1.25rem;
91
+ letter-spacing: 0;
92
+ line-height: 1.1;
93
+ padding-top: 0.1rem;
94
+ color: var(--text-secondary);
95
+ opacity: 1;
96
+ }
44
97
  .landing-card:hover {
45
- border-color: var(--card-hover-border);
46
- background-color: var(--surface-raised);
47
- box-shadow: var(--card-shadow);
98
+ border-top-color: var(--accent);
99
+ background-color: transparent;
100
+ box-shadow: none;
48
101
  }
49
102
  .landing-card:focus-within {
50
- border-color: var(--accent);
103
+ border-top-color: var(--accent);
51
104
  outline: 2px solid var(--accent);
52
- outline-offset: 2px;
105
+ outline-offset: 3px;
53
106
  }
54
107
  #quarto-document-content .landing-card h3 {
108
+ grid-area: title;
55
109
  margin-top: 0;
56
- margin-bottom: 0.5rem;
110
+ margin-bottom: 0;
57
111
  font-size: 1.0625rem;
58
- /* 单字面字体 + font-synthesis: none 下 600 不会变粗;卡片标题靠字号与边框区分 */
59
112
  color: var(--body-color);
60
113
  }
61
114
  #quarto-document-content .landing-card h3 a {
@@ -64,19 +117,36 @@
64
117
  text-decoration: none;
65
118
  }
66
119
  .landing-card h3 a:hover {
67
- color: var(--accent);
120
+ color: var(--link-hover-color);
68
121
  text-decoration: none;
69
122
  }
70
123
  #quarto-document-content .landing-card p {
124
+ grid-area: desc;
125
+ max-width: 54ch;
71
126
  margin-bottom: 0;
72
- color: var(--text-secondary); /* 描述灰字(对齐 gitcn) */
127
+ color: var(--text-secondary);
73
128
  font-size: 0.9375rem;
74
- line-height: 1.5;
129
+ line-height: 1.7;
130
+ }
131
+ /* Pandoc 会把 `[进入井字棋 →]{.cta}` 包进 <p>;网格项因此是段落而不是链接。
132
+ 把带 .cta 的段落放到 cta 区,链接本体再恢复字号。 */
133
+ #quarto-document-content .landing-card p:has(> a.cta) {
134
+ grid-area: cta;
135
+ align-self: end;
136
+ justify-self: end;
137
+ max-width: none;
138
+ margin: 0;
139
+ font-size: 0;
140
+ line-height: 1;
75
141
  }
76
- /* 未撰写章节:弱化 + "规划中" 角标 */
142
+ #quarto-document-content .landing-card p:has(> a.cta) > a.cta {
143
+ font-size: 0.8125rem;
144
+ }
145
+ /* 未撰写章节:弱化 + "规划中" 文字标记 */
77
146
  .landing-card.coming-soon {
78
- background-color: var(--surface-raised);
79
- border-color: var(--card-border);
147
+ background-color: transparent;
148
+ border-top-color: var(--card-border);
149
+ opacity: 0.7;
80
150
  }
81
151
  .landing-card.coming-soon h3,
82
152
  .landing-card.coming-soon h3 a,
@@ -86,34 +156,38 @@
86
156
  }
87
157
  .landing-card.coming-soon::after {
88
158
  content: "规划中";
89
- display: inline-block;
90
- margin-top: 0.7rem;
91
- font-size: 0.72rem;
159
+ grid-area: cta;
160
+ align-self: end;
161
+ justify-self: end;
162
+ font-size: 0.6875rem;
163
+ letter-spacing: 0.08em;
92
164
  color: var(--text-secondary);
93
- border: 1px solid var(--card-border);
94
- border-radius: 6px;
95
- padding: 0.05rem 0.55rem;
96
165
  }
97
166
 
98
- /* 主题卡 CTA:对齐 gitcn 的「开始学习 →」蓝链;块级 + 上留白,确保与描述分行 */
167
+ /* 目录 CTA:条目右下的动作,墨色下划线,hover 才转 accent */
99
168
  #quarto-document-content .landing-card a.cta {
100
- display: block;
101
- margin-top: 0.75rem;
102
- font-size: 0.875rem;
103
- font-weight: 600;
169
+ grid-area: cta;
170
+ align-self: end;
171
+ justify-self: end;
172
+ display: inline-block;
173
+ margin-top: 0;
174
+ font-size: 0.8125rem;
175
+ font-weight: 500;
176
+ white-space: nowrap;
104
177
  color: var(--link-color);
105
- text-decoration: none;
106
- }
107
- .landing-card a.cta:hover {
108
178
  text-decoration: underline;
109
179
  text-decoration-color: var(--link-underline);
110
- text-underline-offset: 0.2em;
180
+ text-underline-offset: 0.18em;
181
+ }
182
+ .landing-card a.cta:hover {
183
+ color: var(--link-hover-color);
184
+ text-decoration-color: var(--action-color);
111
185
  }
112
186
  /* 落地页分组标题与卡片的间距节奏
113
187
  Quarto 把 h2 包进 section.level2,不能用「主容器直属 h2」选择器 */
114
188
  #quarto-document-content > h2 + .feature-grid,
115
189
  #quarto-document-content section.level2 > h2 + .feature-grid {
116
- margin-top: 0.4rem;
190
+ margin-top: 0.9rem;
117
191
  }
118
192
  /* 分组引导段(h2 下首段)与卡片网格:略收紧,避免两卡一行时上下空档过大 */
119
193
  #quarto-document-content section.level2 > p:first-of-type + .feature-grid {
@@ -173,10 +247,34 @@ body.homepage .landing-card,
173
247
  gap: 1rem;
174
248
  }
175
249
  .landing-card {
176
- padding: 1.1rem 1.15rem;
250
+ padding: 1rem 0 1.25rem;
251
+ }
252
+ /* 窄屏单卡:动作挪到提要下方,提要不再被右侧 CTA 挤成一条窄栏 */
253
+ .feature-grid:has(> .landing-card:only-child) .landing-card {
254
+ grid-template-columns: 2.5rem minmax(0, 1fr);
255
+ grid-template-areas:
256
+ "index title"
257
+ "index desc"
258
+ "index cta";
259
+ column-gap: 1rem;
260
+ row-gap: 0.4rem;
261
+ }
262
+ .feature-grid:has(> .landing-card:only-child) .landing-card::before {
263
+ font-size: 1.5rem;
264
+ padding-top: 0.1rem;
265
+ }
266
+ .feature-grid:has(> .landing-card:only-child) .landing-card h3 {
267
+ font-size: 1.25rem;
268
+ }
269
+ .feature-grid:has(> .landing-card:only-child) .landing-card p {
270
+ font-size: 0.9375rem;
271
+ max-width: none;
272
+ }
273
+ .feature-grid:has(> .landing-card:only-child) .landing-card p:has(> a.cta) {
274
+ justify-self: end;
177
275
  }
178
276
  }
179
277
  body.homepage .landing-card h3 a,
180
278
  #quarto-document-content:has(> #title-block-header:first-child + .feature-grid) .landing-card h3 a {
181
- color: var(--body-color); /* 卡片标题非蓝链,与 hero 配色统一 */
279
+ color: var(--body-color); /* 目录标题不是动作色,与 hero 配色统一 */
182
280
  }