@dita-viewer/core 0.2.0 → 0.2.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.
@@ -1,1157 +1,1157 @@
1
- /*
2
- * dita-core: host-neutral stylesheet for rendered DITA content.
3
- *
4
- * Derived from the VS Code DITA Viewer's media/styles.css (lines 14-905 and the DITAMAP tree section, the
5
- * topic-content rules, plus the .ditamap outline tree and reltable rules; book/site chrome stays with the VS Code host).
6
- * Differences from that file, and nothing else:
7
- * - every --vscode-* reference became a --dita-* host token (see TOKENS.md),
8
- * so the sheet no longer knows which application is hosting it;
9
- * - :root / .vscode-dark selectors also match a Shadow DOM host
10
- * (:host / :host([data-scheme="dark"]));
11
- * - `body` rules became `.dita-body`, `html.dv-conref-hot` became
12
- * `:host(.dv-conref-hot)`;
13
- * - the two #c0392b literals in .hazardstatement now use
14
- * --color-danger-border (identical value by default).
15
- * A host supplies colours, fonts and sizes by defining the --dita-* tokens
16
- * (and may override the --color-* palette); it never edits this file.
17
- */
18
- @layer dv-base, wh-compat;
19
- @layer dv-base {
20
- :host, :root {
21
- --body-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
22
- --code-font: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
23
- --line-height: 1.6;
24
- --max-width: 900px;
25
- --color-border: #ddd;
26
- --table-border: #999;
27
- --color-note-bg: #f0f7ff;
28
- --color-warning-bg: #fffbf0;
29
- --color-danger-bg: #fef2f2;
30
- --color-important-bg: #f8f4ff;
31
- --color-tip-bg: #f0fdf4;
32
- --color-note-border: #4a90d9;
33
- --color-warning-border: #e6a23c;
34
- --color-danger-border: #c0392b;
35
- --color-important-border: #8e44ad;
36
- --color-tip-border: #27ae60;
37
- /* Bound directly to VS Code's own live theme variable (falls back to a
38
- light gray if it's ever unavailable) so this always tracks the real,
39
- current theme instead of relying on a manually-computed .vscode-dark
40
- class that can go stale relative to the actual active theme. */
41
- --color-code-bg: var(--dita-code-bg, #f8f8f8);
42
- --color-link: #2b6cb0;
43
- --color-code-lang-bg: var(--dita-code-inline-bg, #e8e8e8);
44
- --color-profiling-bg: #eaf7c9;
45
- --color-profiling-border: #b8d878;
46
- --color-profiling-label-bg: #8fb84e;
47
- --color-profiling-label-text: #2a3a12;
48
- --color-indexterm-chip-bg: #e6f0fa;
49
- --color-indexterm-chip-text: #2c5282;
50
- --color-menucascade-arrow: #767676;
51
- }
52
-
53
- .vscode-dark, :host([data-scheme="dark"]) {
54
- --color-border: #555;
55
- --table-border: #777;
56
- --color-note-bg: #1a2633;
57
- --color-warning-bg: #33281a;
58
- --color-danger-bg: #331a1a;
59
- --color-important-bg: #261a33;
60
- --color-tip-bg: #1a3326;
61
- --color-link: #6ab0f3;
62
- --color-code-bg: var(--dita-code-bg, #555);
63
- --color-code-lang-bg: var(--dita-code-inline-bg, #666);
64
- --color-profiling-bg: #3a4a1f;
65
- --color-profiling-border: #5a7530;
66
- --color-profiling-label-bg: #6b8f39;
67
- --color-profiling-label-text: #eef7dc;
68
- --color-indexterm-chip-bg: #1f2f42;
69
- --color-indexterm-chip-text: #9dc4ea;
70
- --color-menucascade-arrow: #aaaaaa;
71
- }
72
-
73
- .dita-body {
74
- font-family: var(--body-font);
75
- font-size: 1em;
76
- line-height: var(--line-height);
77
- max-width: var(--max-width);
78
- margin: 0 auto;
79
- padding: 2rem 1.5rem;
80
- color: var(--dita-fg);
81
- }
82
-
83
- /* Every source edit swaps this div's entire innerHTML in one mutation
84
- (see #dita-content-root's 'updateContent' message handler, shared by
85
- DitaViewerProvider.ts and MapViewerProvider.ts) -- not a small, targeted
86
- change the browser's default CSS Scroll Anchoring is designed for (it
87
- tries to auto-compensate scrollTop to keep whatever it picks as the
88
- "anchor node" visually fixed when content changes near the viewport).
89
- When virtually the entire subtree is replaced at once, the previous
90
- anchor node is gone and whatever the browser picks as a replacement has
91
- no reliable relationship to what was actually on screen, so its
92
- compensation can shift scroll position in ways that don't correspond to
93
- anything real -- consistent with the reported "typing edits far from
94
- the current scroll position occasionally causes an unexplained extra
95
- scroll shift" behavior. Turning it off here means scrollTop simply
96
- stays exactly where it was as a fixed number across the swap, which is
97
- what both providers' content-only update already assumes; the
98
- extension's own explicit logic (applyHighlightLine, scrollToLine -- the
99
- topic viewer only, map view has no scroll-sync of its own) is the only
100
- thing that should ever intentionally move it. */
101
- #dita-content-root {
102
- overflow-anchor: none;
103
- }
104
-
105
- /* In-place mode switch (toolbar-persistence work): added to the OLD content
106
- root by the mode button's click handler the instant it fires, since its
107
- own label flips immediately while the new stage is still being rendered
108
- asynchronously on the host side (getModeToggleScript). Gives that gap a
109
- visible "switching" state instead of the button and the page silently
110
- disagreeing for a moment. Needs no matching removal -- applyModeStage
111
- (MapViewerProvider.ts) discards this exact node once the new stage lands
112
- and inserts a fresh, undimmed one in its place. */
113
- #dita-content-root.mode-switching {
114
- opacity: 0.5;
115
- transition: opacity 0.1s ease-out;
116
- pointer-events: none;
117
- /* Positioning context for .dita-mode-switch-overlay below -- scoped to
118
- this class rather than added unconditionally so it never affects
119
- #dita-content-root's normal (non-switching) layout. */
120
- position: relative;
121
- }
122
-
123
- /* getModeToggleScript's delayed "still switching" overlay: only appended if
124
- a switch takes longer than its 400ms grace period (see that script's own
125
- comment for why), as a child of the OLD #dita-content-root, so it is
126
- scoped to the content area alone -- the toolbar above it stays fully
127
- visible and interactive throughout, which is the entire point of the
128
- in-place-switch work this belongs to. .dita-loading-spinner is the same
129
- spinner the full-reload path's book-mode placeholder uses
130
- (MapViewerProvider.ts's generateLoadingHtml); here it is a small overlay
131
- instead of a full-page one. */
132
- .dita-mode-switch-overlay {
133
- position: absolute;
134
- inset: 0;
135
- display: flex;
136
- flex-direction: column;
137
- align-items: center;
138
- justify-content: center;
139
- gap: 12px;
140
- color: var(--dita-fg-muted, #999);
141
- }
142
-
143
- /* Topic article */
144
- .topic > h1:first-child { margin-top: 0; }
145
-
146
- /* Short description */
147
- .shortdesc {
148
- background: var(--color-note-bg);
149
- color: var(--dita-fg-muted, var(--dita-fg));
150
- padding: 0.75rem 1rem;
151
- border-radius: 4px;
152
- font-size: 1.05em;
153
- line-height: 1.6;
154
- }
155
-
156
- /* Headings */
157
- h1, h2, h3, h4, h5, h6 {
158
- margin-top: 1.5em;
159
- margin-bottom: 0.5em;
160
- font-weight: 600;
161
- }
162
-
163
- h1 { font-size: 1.8em; border-bottom: 2px solid var(--color-border); padding-bottom: 0.3em; }
164
- h2 { font-size: 1.5em; }
165
- h3 { font-size: 1.3em; }
166
- h4 { font-size: 1.15em; }
167
-
168
- /* Paragraphs */
169
- p { margin: 0.75em 0; }
170
-
171
- /* Note boxes */
172
- .note {
173
- border-left: 4px solid var(--color-note-border);
174
- background: var(--color-note-bg);
175
- color: var(--dita-fg);
176
- padding: 0.75rem 1rem;
177
- margin: 1rem 0;
178
- border-radius: 0 4px 4px 0;
179
- }
180
-
181
- .note__label { font-weight: 600; text-transform: capitalize; }
182
- /* The note text sits in .note__body for the benefit of WebHelp-style css. In
183
- the own shell it stays inline, so the label and the text share a line as
184
- they always did (a block here pushes the text onto its own line). */
185
- .dita-body:not(.wh_topic_page) .note__body { display: inline; }
186
- .note--warning { border-left-color: var(--color-warning-border); background: var(--color-warning-bg); }
187
- .note--danger { border-left-color: var(--color-danger-border); background: var(--color-danger-bg); }
188
- .note--important { border-left-color: var(--color-important-border); background: var(--color-important-bg); }
189
- .note--tip { border-left-color: var(--color-tip-border); background: var(--color-tip-bg); }
190
-
191
- /* Conref'd content: anything pulled in by conref / conkeyref / conrefend.
192
- Oxygen's Author mode paints it with a gray background and puts a jump
193
- button in the top-left corner; a flat opaque gray fights VS Code's themes
194
- (and the note/section tints underneath), so this is a translucent neutral
195
- that composes with whatever is behind it, plus a thin leading bar that
196
- stays visible on dark themes where a faint tint nearly vanishes.
197
- All of it is drawn as background layers on the element itself -- no
198
- ::before/::after (profiling already owns those on li/ul/ol and the
199
- non-inline elements) and no wrapper element. The renderer only emits
200
- data-conref when the preview opts in, so "Export as HTML" and the diff
201
- view never carry it. The jump icon is a background too, so it has no DOM
202
- of its own: the click zone is recomputed from the SAME custom properties
203
- below in conrefJumpScript.ts (getComputedStyle().getPropertyValue())
204
- -- the vars are the single source of truth, do not re-hardcode the
205
- numbers on either side. Padding on the block/inline variants gives the
206
- tint some air on both sides (so it reads as a chunk around the content
207
- rather than a tight underline) and keeps the leading bar (flush with
208
- the inner-border edge) clear of the first glyph. */
209
- :host, :root {
210
- --color-conref-bg: rgba(128, 128, 128, 0.13);
211
- --color-conref-bar: rgba(128, 128, 128, 0.55);
212
- /* Oxygen paints the reuse badge as a few OPEN horizontal strokes (lines of
213
- text), not a filled/closed page rectangle -- strokes read as airy chrome on
214
- the translucent tint, whereas a solid glyph competes with content and, on
215
- dark themes, a white fill glowed. Three lines (not four) keep it lighter;
216
- the last runs a touch longer and gets a small right arrowhead so the same
217
- gesture means "jump to source". Light-mode grays below; .vscode-dark
218
- (after this block) lifts them so the strokes stay legible on dark. */
219
- --conref-jump-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Cg%20fill='none'%20stroke='%239c9c9c'%20stroke-width='1'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M2%204h7M2%208h7M2%2012h9'/%3E%3Cpath%20d='M9.5%2010.5l1.8%201.5-1.8%201.5'%20stroke='%23808080'/%3E%3C/g%3E%3C/svg%3E");
220
- /* Geometry read by both the paint rules below and the webview hit-test
221
- in conrefJumpScript.ts. Change here, both sides move together. */
222
- --conref-bar-width: 3px;
223
- --conref-icon-block-size: 16px;
224
- --conref-icon-block-offset: 3px;
225
- --conref-icon-cell-size: 15px;
226
- --conref-icon-cell-offset: 2px;
227
- --conref-icon-inline-size: 11px;
228
- --conref-icon-inline-offset: 1px;
229
- /* Inline slot: the padding-right reserved on the element so the icon
230
- sits clear of the trailing glyph. Derives as
231
- offset + size + 1px visual gap, but kept as a flat token so the
232
- script's hit-test reads the exact same number. */
233
- --conref-icon-inline-slot: 13px;
234
- }
235
- /* Dark-mode badge: same open-line glyph, lifted to light grays so the strokes
236
- stay legible over a dark canvas without glowing. Must sit AFTER the :root
237
- block -- .vscode-dark is on <html>, the same element :root targets, so it
238
- wins on source order, not specificity. */
239
- .vscode-dark, :host([data-scheme="dark"]) {
240
- --conref-jump-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Cg%20fill='none'%20stroke='%238a8a8a'%20stroke-width='1'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M2%204h7M2%208h7M2%2012h9'/%3E%3Cpath%20d='M9.5%2010.5l1.8%201.5-1.8%201.5'%20stroke='%23a0a0a0'/%3E%3C/g%3E%3C/svg%3E");
241
- }
242
- [data-conref][data-conref] {
243
- background-repeat: no-repeat;
244
- }
245
- [data-conref="block"][data-conref] {
246
- /* top clears the icon (offset 3 + size 16 + a small gap, hardcoded to match
247
- the tokens above); left/right symmetric so the leading bar sits at
248
- the same distance from the first glyph as the right padding does
249
- from the last; bottom gives the tint some air under the text. */
250
- padding-top: 22px;
251
- padding-right: 10px;
252
- padding-bottom: 6px;
253
- padding-left: 10px;
254
- background-image:
255
- var(--conref-jump-icon),
256
- linear-gradient(var(--color-conref-bar), var(--color-conref-bar)),
257
- linear-gradient(var(--color-conref-bg), var(--color-conref-bg));
258
- background-position:
259
- var(--conref-icon-block-offset) var(--conref-icon-block-offset),
260
- left top,
261
- 0 0;
262
- background-size:
263
- var(--conref-icon-block-size) var(--conref-icon-block-size),
264
- var(--conref-bar-width) 100%,
265
- auto;
266
- }
267
- /* A list's indent IS its padding-left (ul, ol { padding-left: 1.5em }); the
268
- longhand above would flatten it to 10px and push the markers out under the
269
- bar. Keep the indent and add the same 10px of air on top. */
270
- ul[data-conref="block"][data-conref],
271
- ol[data-conref="block"][data-conref],
272
- .simple-list[data-conref="block"][data-conref] {
273
- padding-left: calc(1.5em + 10px);
274
- }
275
- /* A whole <note> reused: the generic block padding would replace .note's own
276
- 0.75rem 1rem. Keep its horizontal padding (1rem already clears the 3px bar
277
- and the icon) and bottom; only the top yields, to the icon line. */
278
- .note[data-conref="block"][data-conref] {
279
- padding: 22px 1rem 0.75rem 1rem;
280
- }
281
- [data-conref="inline"][data-conref] {
282
- /* left padding mirrors the block treatment on a smaller scale; slice
283
- (the default box-decoration-break) means only the very first line of
284
- a wrapped run gets the leading gap, which is what Oxygen shows too.
285
- padding-right is the slot; the icon hugs the right edge inside it. */
286
- padding: 0 var(--conref-icon-inline-slot) 0 3px;
287
- border-radius: 2px;
288
- background-image:
289
- var(--conref-jump-icon),
290
- linear-gradient(var(--color-conref-bg), var(--color-conref-bg));
291
- background-position:
292
- right var(--conref-icon-inline-offset) center,
293
- 0 0;
294
- background-size:
295
- var(--conref-icon-inline-size) var(--conref-icon-inline-size),
296
- auto;
297
- }
298
- [data-conref="cell"][data-conref] {
299
- /* Reserve a left gutter so the top-left badge never sits on the first
300
- glyph -- a <td>'s default 0.75rem left padding is shorter than the
301
- 16px icon, which is why the cell badge was overlapping "Cell A".
302
- Only padding-left is overridden; top/right/bottom keep the table's
303
- own 0.5rem/0.75rem so rows stay the same height and text tops stay
304
- aligned with non-reused sibling cells. */
305
- padding-left: calc(var(--conref-icon-cell-offset) + var(--conref-icon-cell-size) + 2px);
306
- background-image:
307
- var(--conref-jump-icon),
308
- linear-gradient(var(--color-conref-bg), var(--color-conref-bg));
309
- background-position:
310
- var(--conref-icon-cell-offset) var(--conref-icon-cell-offset),
311
- 0 0;
312
- background-size:
313
- var(--conref-icon-cell-size) var(--conref-icon-cell-size),
314
- auto;
315
- }
316
- /* Set by the hover hit-test in conrefJumpScript.ts while the pointer is over
317
- the icon (a background cannot take its own cursor). */
318
- :host(.dv-conref-hot) [data-conref],
319
- :host(.dv-conref-hot) [data-conref] * {
320
- cursor: pointer;
321
- }
322
- /* Keyboard / screen-reader focus for the jump badge (see conrefJumpScript.ts:
323
- renderer.ts makes every mark focusable). The badge is a background, so the
324
- ring is drawn on the element that carries it. :focus-visible, not :focus, so
325
- a pointer click that lands on the element doesn't ring it -- matching the
326
- site-nav treatment. Negative offset keeps the ring inside the tint box so it
327
- never spills onto a neighbouring block. */
328
- [data-conref][data-conref]:focus-visible {
329
- outline: 2px solid var(--dita-focus, #007fd4);
330
- outline-offset: -2px;
331
- }
332
- /* The single hidden node every reused element's aria-describedby points at
333
- (injected by conrefJumpScript.ts). It must be gone from the layout yet still
334
- present in the accessibility tree, so it is clipped rather than display:none
335
- -- display:none would remove the description screen readers announce on
336
- focus, defeating the whole affordance. */
337
- .dv-visually-hidden {
338
- position: absolute;
339
- width: 1px;
340
- height: 1px;
341
- margin: -1px;
342
- padding: 0;
343
- overflow: hidden;
344
- clip: rect(0 0 0 0);
345
- clip-path: inset(50%);
346
- white-space: nowrap;
347
- border: 0;
348
- }
349
-
350
- /* Profiling / conditional-processing attribute highlighting (props,
351
- otherprops, audience, platform, product, base, importance, rev, status).
352
- Mirrors Oxygen's default "show profiling" style: a tinted box around the
353
- profiled content with a small label naming the attribute/value that
354
- matched, rather than hiding anything. Toggled off via body.hide-profiling
355
- (see the toolbar button in DitaViewerProvider.ts) -- pure CSS, no
356
- re-render needed. */
357
- .profiled {
358
- /* .profiled applies directly to the real element (see injectBlockProfiling
359
- in renderer.ts), not a synthetic wrapper -- so we must NOT use border or
360
- padding on the left side: border takes box-model space shifting content
361
- and nested list markers, and any decoration on <li>/<ul>/<ol> visually
362
- interferes with the browser's list-marker positioning. box-shadow paints
363
- outward from the border-box edge without affecting layout, so the green
364
- highlight ring never pushes content or covers nested bullets/numbers.
365
- This box-shadow default is kept only for <li>/<ul>/<ol> (see the
366
- override right below, which switches everything else to a real
367
- border). */
368
- box-shadow: 0 0 0 1.5px var(--color-profiling-border);
369
- border-radius: 3px;
370
- background: none;
371
- padding: 0.4rem 0.6rem;
372
- margin: 0.5rem 0;
373
- }
374
- /* Every OTHER block-level profiled element (section, div, p, dl, note,
375
- ...) draws its highlight with a real border instead of the box-shadow
376
- above. Reported symptom: two independently-profiled block elements
377
- stacked directly next to each other (e.g. two sibling <section>s, each
378
- with its own profiling attribute) rendering with their left/right sides
379
- looking "not closed". box-shadow is purely a paint effect layered
380
- outside the border-box -- it has no guaranteed closed-rectangle
381
- semantics of its own the way an actual border does, and at a boundary
382
- where two elements' painted regions sit close together (their margins
383
- collapsed to the usual gap above), a thin 1.5px ring is exactly the
384
- kind of decoration where that can go visibly wrong. A real border
385
- doesn't share that ambiguity: border-left/right/top/bottom are each
386
- unconditionally part of the element's own box, drawn every time,
387
- regardless of what's rendered nearby. This is safe everywhere except
388
- <li>/<ul>/<ol> -- border-radius/border don't affect list-marker
389
- positioning on any other element, and for a block element with the
390
- default width: auto, adding a border doesn't change its outer width
391
- either (the browser narrows the content area to compensate, same as it
392
- already does for padding). */
393
- .profiled:not(li):not(ul):not(ol):not(tr):not(.profiled--inline) {
394
- box-shadow: none;
395
- border: 1.5px solid var(--color-profiling-border);
396
- }
397
- /* <li>/<ul>/<ol> can't take the same real-border treatment above -- border
398
- is real box-model space, and shifting an <li>'s own border-box shifts
399
- where the browser hangs its list-marker, per the comment on .profiled
400
- itself. box-shadow (and, tried next, outline) turned out not to be
401
- reliable substitutes: both are paint-only effects layered outside the
402
- border-box, and reported symptoms kept recurring on <li> specifically
403
- whenever it had a block-level child like <p> inside it (plain
404
- text-only <li>s were fine) -- e.g. box-shadow's the exact thing that
405
- was going wrong for section before switching it to border, and outline
406
- reproduced the identical "right side won't close" symptom for a
407
- profiled <li> containing a <p>, plus introduced a new "crossing lines"
408
- regression that plain border sidesteps.
409
- Sidestepping the question of exactly which decoration property is safe
410
- in this Chromium build for a list-item box with block children: draw
411
- the ring with a real border, but on an absolutely-positioned ::before
412
- pseudo-element instead of on the <li> itself. An absolutely-positioned
413
- element is taken out of normal flow entirely, so it cannot move the
414
- list-marker (nothing about the <li>'s own box model changed -- no new
415
- border, no new padding, nothing the marker-positioning algorithm could
416
- react to) while still being a literal border on a literal box, with
417
- the same unambiguous every-side-drawn-every-time guarantee that fixed
418
- section. It also can't fragment across the <li>'s own wrapped lines the
419
- way an inline element's decoration can: this pseudo-element covers the
420
- <li>'s box exactly once, top to bottom, regardless of how many lines
421
- its content wraps to internally -- which is what rules out the
422
- crossing-lines regression outline introduced. */
423
- .profiled:is(li, ul, ol) {
424
- position: relative;
425
- box-shadow: none;
426
- }
427
- .profiled:is(li, ul, ol)::before {
428
- content: '';
429
- position: absolute;
430
- top: 0;
431
- right: 0;
432
- bottom: 0;
433
- left: 0;
434
- border: 1.5px solid var(--color-profiling-border);
435
- border-radius: 3px;
436
- pointer-events: none;
437
- }
438
- .profiled--inline {
439
- display: inline;
440
-
441
- padding: 0 0.2rem;
442
- margin: 0;
443
- border-radius: 2px;
444
- /* Deliberately NOT setting a custom line-height or box-decoration-break
445
- here (both were tried and reverted). box-decoration-break: clone
446
- closed the box on both sides at a line wrap, but the reference tool
447
- this preview is meant to match (Oxygen) leaves it open on purpose --
448
- previous line's trailing edge unclosed, next line's leading edge
449
- unclosed -- which is just the CSS default (slice) already gives us
450
- for free. And the extra line-height added to keep clone's padding
451
- from bleeding into neighbouring lines pushed up *every* line this
452
- element touches, including plain single-line usage, making profiled
453
- phrases visibly taller/inconsistent with surrounding text -- worse
454
- than the problem it was solving. Staying with the plain defaults here
455
- keeps single-line height consistent everywhere and matches Oxygen's
456
- open-sided wrap look. */
457
- }
458
- .profiled--inline .profiling-label {
459
- float: none;
460
- position: static;
461
- display: inline-flex;
462
- align-items: center;
463
- margin-left: 0.3em;
464
- vertical-align: middle;
465
- }
466
- /* No special containment here for the trailing .profiling-chip (unlike
467
- .profiled block-level handling below): earlier attempts to reserve
468
- vertical room via padding+line-height, or to shrink the chip itself to
469
- fit, both traded one visible problem for another (crossing borders on
470
- wrapped lines, or a chip that looks flatter/smaller than every other
471
- .profiling-chip elsewhere). Left at CSS defaults, matching Oxygen's own
472
- rendering and keeping height consistent whether or not this element
473
- happens to wrap. */
474
- /* Clearfix: .profiling-label below is `float: right` so it can share the
475
- last line with short content (see the comment on .profiling-label) --
476
- but a float is intentionally excluded from its containing block's own
477
- height calculation unless that container is cleared or establishes a
478
- new block formatting context, and .profiled does neither on its own.
479
- When the label doesn't fit on the same line as the preceding text (long
480
- or wrapping content) it drops to a line of its own below -- and without
481
- this rule, .profiled's box-shadow border is sized from the non-floated
482
- text alone, so it closes *before* that dropped line: the label then
483
- visually sits outside/below its own green box, and can bleed into the
484
- top margin of the very next .profiled sibling, breaking what should be
485
- two clean, separate borders. The classic content:""; display:table;
486
- clear:both idiom forces an (invisible) trailing box that clears the
487
- float, so .profiled's own height -- and therefore its border -- always
488
- extends down to actually contain the label. Scoped away from
489
- .profiled--inline (label is float:none there, nothing to clear) and
490
- away from tr.profiled (a <tr> doesn't render ::after reliably, and its
491
- own label lives inside a <td> which already establishes its own block
492
- formatting context and needs no help containing floats).
493
- */
494
- .profiled:not(.profiled--inline):not(tr)::after {
495
- content: '';
496
- display: table;
497
- clear: both;
498
- }
499
- /* float rather than a dedicated bottom-padding + position:absolute slot:
500
- the box no longer has to reserve a fixed amount of vertical space for
501
- the label regardless of how little content actually needs it (a
502
- single-line profiled step/bullet used to look disproportionately tall,
503
- with a big empty gap between the text and the label sitting below it).
504
- Floating right lets the label sit on the *same* line as short content
505
- for free, while still correctly dropping to its own line -- and staying
506
- right-aligned there, matching Oxygen's convention and the ditamap tree
507
- view's own box (see mapTypeMap.ts) -- whenever the preceding content is
508
- itself block-level (a nested list, a wrapped multi-line paragraph) and
509
- doesn't leave room on the same line. .profiled--inline above overrides
510
- this back to float:none, since a label attached to an inline phrase
511
- (ph/b/i/xref/...) needs to sit immediately next to that phrase
512
- mid-sentence, not escape to the edge of the whole paragraph. */
513
- .profiling-label {
514
- float: right;
515
- display: flex;
516
- gap: 0.3rem;
517
- flex-wrap: wrap;
518
- margin-left: 0.5em;
519
- }
520
- .profiling-chip {
521
- background: var(--color-profiling-label-bg);
522
- color: var(--color-profiling-label-text);
523
- font-size: 0.7em;
524
- font-weight: 600;
525
- padding: 0.05rem 0.4rem;
526
- border-radius: 3px;
527
- white-space: nowrap;
528
- }
529
- .profiling-chip__value { font-weight: 400; }
530
- /* Index term chips: small inline markers showing an authored <indexterm>'s
531
- term path right where it appears in the running text -- not a compiled,
532
- sorted back-of-book index (see the comment on topic/indexterm's renderer
533
- in baseTypeMap.ts for why: sorting only makes sense for scripts with a
534
- stable alphabetic/stroke order, so a generated index page would be
535
- meaningless for e.g. Chinese content). Deliberately understated (smaller,
536
- lower-contrast than profiling-chip) since these appear far more densely
537
- in typical content than profiling markers do, and shouldn't compete with
538
- the actual text for attention. */
539
- .indexterm-chip {
540
- display: inline-block;
541
- background: var(--color-indexterm-chip-bg);
542
- color: var(--color-indexterm-chip-text);
543
- font-size: 0.72em;
544
- padding: 0.02rem 0.35rem;
545
- border-radius: 3px;
546
- white-space: nowrap;
547
- margin: 0 0.15em;
548
- cursor: default;
549
- }
550
- .indexterm-chip--ref { font-style: italic; }
551
- .indexterm-chip__see { font-style: italic; opacity: 0.85; }
552
- .dita-body.hide-profiling .profiled {
553
- background: none;
554
- box-shadow: none;
555
- padding: 0;
556
- margin: 0;
557
- }
558
- /* The general reset above zeroes padding on every side, including left --
559
- correct for everything else profiling touches, but a profiled ul/ol
560
- relies on that left padding for its own children's marker gutter (see
561
- ul.profiled/ol.profiled above), not just for the now-hidden box. Without
562
- restoring it here, turning Flags off would silently break nested-list
563
- indentation for exactly the same reason it broke with the box visible,
564
- just conditionally instead of always. */
565
- .dita-body.hide-profiling ul.profiled,
566
- .dita-body.hide-profiling ol.profiled {
567
- padding-left: 1.5em;
568
- }
569
- .dita-body.hide-profiling .profiled--inline { display: inline; }
570
- .dita-body.hide-profiling .profiling-label { display: none; }
571
-
572
- /* Phase 2 (the filter panel): actually hides content, unlike the toggle
573
- above which only hides the highlight decoration. !important because
574
- this needs to override whatever display value .profiled/.profiled--inline
575
- set, and nothing else in this stylesheet should ever legitimately want
576
- to re-show something the person explicitly filtered out. */
577
- .profile-filtered-out { display: none !important; }
578
-
579
- /* Lists */
580
- ul, ol { padding-left: 1.5em; }
581
- li { margin: 0.25em 0; }
582
- /* Profiling on list elements: box-shadow doesn't affect layout, but the
583
- generic .profiled padding still overrides the base padding-left both
584
- rules above rely on. li's own padding-left is normally 0 (a plain li's
585
- marker-gutter comes entirely from its *parent* ul/ol's padding, not
586
- from the li itself) -- .profiled's shorthand would otherwise add
587
- 0.6rem there, shifting a profiled li's text right of its plain
588
- siblings, so it's zeroed back out. ul/ol are the opposite case: their
589
- own padding-left of 1.5em IS the marker gutter their own <li> children
590
- need, so when the ul/ol itself is profiled, that 1.5em has to be
591
- restored (not just zeroed) or its children's markers lose their
592
- reserved space entirely and the whole nested list stops looking nested
593
- at all. The top/bottom padding is kept so the box-shadow ring has
594
- breathing room above and below the content either way. */
595
- li.profiled { padding-left: 0; }
596
- ul.profiled, ol.profiled { padding-left: 1.5em; }
597
- .simple-list { list-style: none; padding-left: 1.5em; }
598
-
599
- /* Definition lists */
600
- dl { margin: 1em 0; }
601
- .dlentry { margin: 0.5em 0; }
602
- dt { font-weight: 600; margin-top: 0.5em; }
603
- dd { margin-left: 1.5em; }
604
-
605
- /* Tables */
606
- table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95em; border: 2px solid var(--table-border); }
607
- table th, table td { border: 1px solid var(--table-border); padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; overflow-wrap: break-word; }
608
- table th { background: var(--color-code-bg); color: var(--dita-fg); font-weight: 600; }
609
-
610
- /* Profiling on table rows: the generic .profiled treatment below (box-
611
- shadow ring + padding + margin) is built for ordinary block content and
612
- doesn't fit a <tr> living inside this table's border-collapse: collapse
613
- model. box-shadow paints independently of the collapsed border grid, so
614
- a ring drawn straight on a row can drift out of alignment with the
615
- row's actual cell edges (the "green block is offset" symptom), and two
616
- separately-profiled adjacent rows each painting their own independent
617
- ring don't share one continuous edge the way collapsed borders do,
618
- leaving a visible gap/seam between them (the "border between rows is
619
- incomplete" symptom). Coloring each cell's own border instead works
620
- *with* border-collapse: a shared edge between two profiled rows merges
621
- down to a single line, same as any other collapsed border, so
622
- consecutive profiled rows read as one unbroken green outline. */
623
- tr.profiled {
624
- box-shadow: none;
625
- padding: 0;
626
- margin: 0;
627
- background: none;
628
- }
629
- tr.profiled > td,
630
- tr.profiled > th {
631
- border-color: var(--color-profiling-border);
632
- }
633
- .dita-body.hide-profiling tr.profiled > td,
634
- .dita-body.hide-profiling tr.profiled > th {
635
- border-color: var(--table-border);
636
- }
637
-
638
- /* CALS tables whose <colgroup> carries real colwidth hints (see
639
- baseTypeMap.ts's 'topic/table' renderer): with the default 'auto' table
640
- layout those widths are only a hint, and a column with a long unbroken
641
- run of CJK text (or any content wider than the column's proportional
642
- share) can force the browser to redistribute space away from a
643
- short-content column regardless of what colwidth says -- symptom: a
644
- narrow first column with a couple characters ends up wide, and a long
645
- multi-paragraph second column ends up squeezed. 'fixed' makes colgroup
646
- widths authoritative and independent of content. overflow-wrap above
647
- keeps long unbroken content from overflowing its now content-independent
648
- column. */
649
- .cals-table--fixed-layout { table-layout: fixed; }
650
-
651
- /* Simpletables are meant to be lighter-weight than CALS tables */
652
- .simple-table th, .simple-table td { padding: 0.4rem 0.6rem; }
653
- .simple-table th { background: transparent; border-bottom-width: 2px; }
654
-
655
- /* Foreign content (MathML, embedded SVG) — DITA doesn't signal whether a
656
- <mathml>/<foreign> block is meant inline or as its own line the way
657
- <image>'s @placement does, so this stays in normal inline flow by
658
- default; a small margin just keeps it from crowding adjacent text. */
659
- .foreign-content { margin: 0 0.15em; }
660
-
661
- /* Images */
662
- /* --dita-scale is the only remaining size hint here, driven by the DITA
663
- source's own @scale attribute -- it sizes the image relative to its OWN
664
- natural pixel dimensions via 'zoom'. Per-image display sizing (separate
665
- from @scale, and not tied to the DITA source at all) is applied at
666
- runtime as an inline width/max-width on the specific <img>, via the
667
- per-image zoom controls injected by the webview script -- see
668
- .dita-img-wrap / .dita-img-toolbar below. */
669
- img { max-width: 100%; height: auto; border-radius: 4px; vertical-align: middle; cursor: zoom-in; zoom: var(--dita-scale, 1); }
670
- .image-break { display: block; margin: 1rem 0; }
671
- img[data-load-error] { cursor: default; }
672
-
673
- /* Per-image zoom/maximize toolbar: a small overlay pinned to the image's
674
- own top-right corner, shown on hover (or keyboard focus-within, for
675
- accessibility) rather than a page-wide toolbar, since the control now
676
- only ever affects the one image it's attached to. Wrapper is an inline
677
- <span>, not a <div>, so it stays validly nestable inside inline DITA
678
- contexts like <p> without forcing a block break. */
679
- .dita-img-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
680
- .dita-img-toolbar {
681
- position: absolute; top: 4px; right: 4px; z-index: 10;
682
- display: flex; gap: 2px;
683
- opacity: 0; pointer-events: none; transition: opacity 0.15s;
684
- }
685
- .dita-img-wrap:hover .dita-img-toolbar,
686
- .dita-img-wrap:focus-within .dita-img-toolbar {
687
- opacity: 1; pointer-events: auto;
688
- }
689
- .dita-img-btn {
690
- padding: 1px 5px; border-radius: 3px; line-height: 1.5; font-size: 12px; cursor: pointer;
691
- border: 1px solid var(--dita-border, #555);
692
- background: var(--dita-bg, rgba(30, 30, 30, 0.85));
693
- color: var(--dita-fg, #eee);
694
- }
695
- .dita-img-btn:hover { opacity: 0.85; }
696
-
697
- /* Custom right-click "Copy Image" menu (see contextmenu handling in the
698
- webview script) -- styled to read as a native-ish context menu using
699
- VS Code's own menu theme tokens, since a real OS context menu isn't
700
- available consistently across every host this extension runs in. */
701
- .dita-img-ctxmenu {
702
- position: fixed; z-index: 100000;
703
- background: var(--dita-bg-elevated, var(--dita-bg, #1e1e1e));
704
- border: 1px solid var(--dita-border, #454545);
705
- border-radius: 4px;
706
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
707
- padding: 2px;
708
- min-width: 140px;
709
- }
710
- .dita-img-ctxmenu-item {
711
- display: block; width: 100%; text-align: left;
712
- padding: 4px 10px; border: none; border-radius: 3px;
713
- font-size: 13px; cursor: pointer;
714
- background: transparent;
715
- color: var(--dita-fg, #ccc);
716
- }
717
- .dita-img-ctxmenu-item:hover,
718
- .dita-img-ctxmenu-item:focus {
719
- background: var(--dita-hover-bg, #2a2d2e);
720
- color: var(--dita-selected-fg, var(--dita-fg, #ccc));
721
- outline: none;
722
- }
723
- .dita-img-ctxmenu-item:disabled { cursor: default; opacity: 0.7; }
724
- /* Group divider for the sidebar's multi-item context menu (see
725
- getSiteOpenSourceScript), matching how a native menu separates groups. */
726
- .dita-img-ctxmenu-sep {
727
- height: 1px; margin: 2px 4px;
728
- background: var(--dita-border, #454545);
729
- }
730
-
731
- /* Transient feedback pill for the lightbox's Ctrl+C copy path, which has
732
- no menu item of its own to update the way the right-click menu does. */
733
- .dita-img-toast {
734
- position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%);
735
- z-index: 100001;
736
- background: var(--dita-bg-elevated, var(--dita-bg, #1e1e1e));
737
- border: 1px solid var(--dita-border, #454545);
738
- color: var(--dita-fg, #ccc);
739
- padding: 6px 14px; border-radius: 4px; font-size: 13px;
740
- /* UI chrome, not document content: stays sans-serif regardless of the
741
- reading-font toggle (Serif is a common choice there, and a serif toast
742
- reads noticeably slower for a quick transient message). */
743
- font-family: var(--dita-font, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
744
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
745
- max-width: 92vw;
746
- /* Kept to one line: a short toast that wraps to two is more disruptive
747
- to read at a glance than one that's simply not padded to a fixed box
748
- width. The message itself is kept short enough to fit in the common
749
- case; text-overflow is only a safety net for an unusually long locale
750
- string or width-option label. */
751
- white-space: nowrap;
752
- overflow: hidden;
753
- text-overflow: ellipsis;
754
- text-align: center;
755
- }
756
- /* For feedback tied to a top-of-page control (the width dropdown): a
757
- bottom toast is easy to miss entirely, or costs a big jump down to
758
- notice, right after the user's focus and click just landed at the top. */
759
- .dita-img-toast--top { bottom: auto; top: 48px; }
760
-
761
- /* Figures */
762
- /* Left-aligned rather than centered: a fig's image should sit flush with
763
- the surrounding body text's left edge (and, inside a list item, with the
764
- li's text rather than its marker), matching how DITA authors read
765
- figures in Oxygen. figure has no left/right margin of its own, so this
766
- naturally follows whatever indent its containing block already has. */
767
- figure { margin: 1.5rem 0; text-align: left; }
768
- figcaption { font-style: italic; margin-top: 0.2rem; font-size: 0.95em; text-align: left; }
769
-
770
- /* Code blocks */
771
- pre.codeblock, pre.preformatted {
772
- background: var(--color-code-bg);
773
- color: var(--dita-fg);
774
- border: 1px solid var(--color-border);
775
- border-radius: 4px;
776
- padding: 1rem;
777
- overflow-x: auto;
778
- font-family: var(--code-font);
779
- font-size: 0.9em;
780
- line-height: 1.5;
781
- position: relative;
782
- }
783
-
784
- /* Wraps a codeblock that has a language label. This element -- not the
785
- <pre> itself -- is what .codeblock-lang is positioned against: <pre>
786
- has overflow-x:auto for wide code, and an absolutely-positioned child of
787
- a scrolling box scrolls along with its content, so the label used to
788
- drift out of view as soon as the code was scrolled horizontally.
789
- .codeblock-wrap sits outside that scrolling area, so the label stays
790
- pinned to the visible top-right corner regardless of scroll position. */
791
- .codeblock-wrap {
792
- position: relative;
793
- }
794
-
795
- .codeblock-lang {
796
- font-family: var(--code-font);
797
- font-size: 0.72em;
798
- background: var(--color-code-lang-bg);
799
- color: var(--dita-fg);
800
- padding: 0.1em 0.5em;
801
- border-radius: 0 3px 0 3px;
802
- position: absolute;
803
- top: 0;
804
- right: 0;
805
- pointer-events: none;
806
- }
807
-
808
- code {
809
- font-family: var(--code-font);
810
- font-size: 0.9em;
811
- color: var(--dita-fg);
812
- background: var(--color-code-bg);
813
- padding: 0.15em 0.3em;
814
- border-radius: 3px;
815
- }
816
-
817
- pre code { background: none; padding: 0; border-radius: 0; }
818
-
819
- /* Links */
820
- .xref { color: var(--color-link); text-decoration: none; }
821
- .xref:hover { text-decoration: underline; }
822
- .xref-external { font-style: italic; font-size: 0.9em; opacity: 0.7; }
823
- .link { color: var(--color-link); text-decoration: none; }
824
- .link:hover { text-decoration: underline; }
825
-
826
- /* Inline formatting */
827
- .keyword { font-weight: 500; }
828
- .term { font-style: italic; border-bottom: 1px dotted; }
829
- /* Phrase span only: the highlight domain (b/i/u/tt/sup/sub/line-through/overline) now also carries the html5 `ph` token and must not be dimmed. overline is the one hi-d member rendered as a <span>, so it is excluded here too. */
830
- span.ph:not(.unresolved-keyref):not(.overline) { opacity: 0.8; }
831
- .overline { text-decoration: overline; }
832
- .unresolved-keyref { opacity: 1; color: #e67e22; border: 1px dashed #e67e22; padding: 0 0.3em; border-radius: 3px; cursor: help; }
833
-
834
- /* User Interface domain */
835
- .uicontrol { font-weight: 500; color: var(--dita-link); }
836
- .menucascade .uicontrol + .uicontrol::before { content: ' › '; color: var(--color-menucascade-arrow); font-weight: normal; }
837
- .wintitle { font-style: italic; font-weight: 600; }
838
- .filepath { font-family: var(--code-font); font-size: 0.9em; padding: 0.1em 0.3em; background: var(--color-code-bg); border-radius: 3px; color: var(--dita-fg); }
839
- .userinput { font-family: var(--code-font); font-size: 0.9em; padding: 0.1em 0.3em; background: var(--color-code-bg); border-radius: 3px; border: 1px dashed var(--color-border); color: var(--dita-fg); }
840
- .systemoutput { font-family: var(--code-font); font-size: 0.9em; padding: 0.1em 0.3em; background: var(--color-code-bg); border-radius: 3px; color: var(--dita-fg); }
841
- .apiname { font-family: var(--code-font); font-size: 0.9em; font-weight: 500; }
842
- .parmname { font-family: var(--code-font); font-size: 0.9em; font-style: italic; }
843
- .option { font-family: var(--code-font); font-size: 0.9em; color: var(--color-link); }
844
- .cmdname { font-family: var(--code-font); font-size: 0.9em; font-weight: 600; }
845
- .varname { font-family: var(--code-font); font-size: 0.9em; font-style: italic; color: var(--color-link); }
846
- .msgnum { font-family: var(--code-font); font-size: 0.85em; padding: 0.1em 0.3em; border: 1px solid var(--color-border); border-radius: 3px; }
847
- /* msgph: the variable/substitutable portion of a message (OASIS DITA 1.3.2,
848
- sec. 3.2.7.2) -- semantically a varname-like placeholder embedded in
849
- message text, not plain prose. Previously fell through to no dedicated
850
- rule and rendered indistinguishable from surrounding text. */
851
- .msgph { font-family: var(--code-font); font-size: 0.9em; font-style: italic; padding: 0 0.2em; color: var(--color-link); }
852
-
853
- /* Programming domain */
854
- .codeph { font-family: var(--code-font); font-size: 0.9em; background: var(--color-code-bg); padding: 0.1em 0.3em; border-radius: 3px; color: var(--dita-fg); }
855
- .synph { font-family: var(--code-font); font-size: 0.9em; }
856
- .kwd { font-weight: 600; font-family: var(--code-font); }
857
- .var { font-style: italic; font-family: var(--code-font); }
858
- .oper { font-weight: 600; color: var(--color-link); }
859
- .sep { color: var(--color-border); }
860
- .delim { font-weight: 600; color: var(--color-link); }
861
- .syntaxdiagram { border: 1px solid var(--color-border); border-radius: 4px; padding: 1rem; margin: 1rem 0; overflow-x: auto; }
862
- .synblk { background: var(--color-code-bg); color: var(--dita-fg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.75rem; margin: 0.5rem 0; overflow-x: auto; font-family: var(--code-font); font-size: 0.9em; }
863
- .synnote { font-size: 0.9em; margin: 0.5rem 0; padding: 0.5rem; border-left: 3px solid var(--color-border); }
864
- .fragment { font-family: var(--code-font); font-size: 0.9em; }
865
- .fragref { font-family: var(--code-font); font-size: 0.9em; color: var(--color-link); }
866
-
867
- /* Software domain */
868
- .screen { background: var(--color-code-bg); color: var(--dita-fg); border: 1px solid var(--color-border); border-radius: 4px; padding: 1rem; overflow-x: auto; font-family: var(--code-font); font-size: 0.9em; line-height: 1.5; white-space: pre-wrap; }
869
- .msgph { font-family: var(--code-font); font-size: 0.9em; }
870
- .msgblock { background: var(--color-code-bg); color: var(--dita-fg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.75rem; font-family: var(--code-font); font-size: 0.9em; white-space: pre-wrap; }
871
-
872
- /* Body elements */
873
- .lines { background: var(--color-code-bg); color: var(--dita-fg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.75rem 1rem; font-family: var(--code-font); font-size: 0.9em; line-height: 1.5; white-space: pre-wrap; }
874
- .fn { font-size: 0.75em; vertical-align: super; cursor: help; color: var(--color-link); }
875
- cite { font-style: italic; }
876
- .boolean { font-family: var(--code-font); font-size: 0.9em; font-weight: 500; }
877
- .tm { font-size: 0.75em; vertical-align: super; }
878
- .body-div { margin: 0.75rem 0; }
879
- .section-div { margin: 0.75rem 0; }
880
- .figgroup { margin: 0.75rem 0; }
881
-
882
- /* Parameter lists */
883
- .parml { margin: 1em 0; }
884
- .plentry { margin: 0.5em 0; }
885
- .pt { font-weight: 600; font-family: var(--code-font); font-size: 0.95em; margin-top: 0.5em; }
886
- .pd { margin-left: 1.5em; }
887
-
888
- /* Abbreviation / Glossary */
889
- .abbreviated-form { border-bottom: 1px dotted var(--color-border); cursor: help; }
890
- .glossterm { font-weight: 600; font-style: italic; }
891
- .glossdef { margin-left: 1.5em; }
892
- .glossentry { margin: 1em 0; }
893
-
894
- /* Hazard */
895
- .hazardstatement { border-left: 4px solid var(--color-danger-border); background: var(--color-danger-bg); color: var(--dita-fg); padding: 0.75rem 1rem; margin: 1rem 0; border-radius: 0 4px 4px 0; }
896
- .typeofhazard { font-weight: 600; color: var(--color-danger-border); }
897
- .howtoavoid { margin: 0.5rem 0; }
898
- .consequence { margin: 0.5rem 0; }
899
-
900
- /* Other */
901
-
902
- /* Related links */
903
- .related-links { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }
904
- .related-links h2 { font-size: 1.1em; margin-top: 0; }
905
-
906
- /* Quotes */
907
- blockquote { border-left: 3px solid var(--color-border); margin: 1rem 0; padding: 0.5rem 1rem; font-style: italic; }
908
- q { font-style: italic; }
909
-
910
- /* Section spacing */
911
- section, .example { margin: 1.5rem 0; }
912
-
913
- /* ── DITAMAP tree view ── */
914
-
915
- .ditamap-container {
916
- padding: 0 0.5rem;
917
- }
918
-
919
- .map-title {
920
- font-size: 1.6em;
921
- font-weight: 600;
922
- margin: 0 0 1rem 0;
923
- padding-bottom: 0.3em;
924
- border-bottom: 2px solid var(--color-border);
925
- }
926
-
927
- /* BookMap title page: mainbooktitle headline with booktitlealt/subtitle beneath */
928
- .book-titlepage {
929
- margin: 0 0 1.25rem 0;
930
- padding-bottom: 0.4em;
931
- border-bottom: 2px solid var(--color-border);
932
- }
933
-
934
- .book-titlepage .map-title {
935
- margin: 0;
936
- padding-bottom: 0;
937
- border-bottom: none;
938
- font-size: 1.9em;
939
- }
940
-
941
- .book-subtitle {
942
- margin: 0.2em 0 0 0;
943
- font-size: 1.05em;
944
- font-style: italic;
945
- opacity: 0.75;
946
- }
947
-
948
- /* ── Book view: a whole .ditamap's topics on one page ── */
949
-
950
- .dita-book {
951
- padding: 0 0.5rem;
952
- }
953
-
954
- .dita-book-titlepage {
955
- margin: 0 0 2rem 0;
956
- }
957
-
958
- .dita-book-title {
959
- margin: 0;
960
- font-size: 1.9em;
961
- font-weight: 600;
962
- }
963
-
964
- .dita-book-topic {
965
- margin: 0 0 2.5rem 0;
966
- padding-bottom: 2rem;
967
- border-bottom: 1px solid var(--dita-border, currentColor);
968
- }
969
-
970
- .dita-book-topic:last-child {
971
- border-bottom: none;
972
- }
973
-
974
- /* BookMap division label above a topic's own title ("Chapter 1", "第 1 章"). */
975
- .dita-book-role {
976
- margin: 0 0 0.35rem 0;
977
- font-size: 0.78em;
978
- font-weight: 600;
979
- letter-spacing: 0.05em;
980
- text-transform: uppercase;
981
- color: var(--dita-fg-muted, inherit);
982
- }
983
-
984
- .dita-book-division {
985
- margin: 2.5rem 0 1rem 0;
986
- }
987
-
988
- .dita-book-division-title {
989
- margin: 0;
990
- }
991
-
992
- .dita-book-missing,
993
- .dita-book-error {
994
- margin: 1rem 0;
995
- padding: 0.5rem 0.75rem;
996
- border-left: 3px solid var(--dita-border, currentColor);
997
- color: var(--dita-fg-muted, inherit);
998
- }
999
-
1000
- /* ── Site view: one topic per page, with a host-rendered sidebar ── */
1001
-
1002
- /* One page beside a sidebar is not a full-pane reading page: start it at the
1003
- same top padding as the host's sidebar header instead of the 2rem reading
1004
- padding on .dita-body, so the page and sidebar line up. */
1005
- .dita-body.dita-body--site {
1006
- padding-top: 0.75rem;
1007
- }
1008
-
1009
- .dita-site-page {
1010
- padding: 0 0.5rem;
1011
- }
1012
-
1013
- /* BookMap division label above the page's own title ("Chapter 1", "第 1 章"). */
1014
- .dita-site-role {
1015
- margin: 0 0 0.35rem 0;
1016
- font-size: 0.78em;
1017
- font-weight: 600;
1018
- letter-spacing: 0.05em;
1019
- text-transform: uppercase;
1020
- color: var(--dita-fg-muted, inherit);
1021
- }
1022
-
1023
- .dita-site-empty,
1024
- .dita-site-missing,
1025
- .dita-site-error {
1026
- margin: 1rem 0;
1027
- padding: 0.5rem 0.75rem;
1028
- border-left: 3px solid var(--dita-border, currentColor);
1029
- color: var(--dita-fg-muted, inherit);
1030
- }
1031
-
1032
- .dita-site-missing code {
1033
- background: var(--dita-code-inline-bg, var(--dita-code-bg, transparent));
1034
- color: inherit;
1035
- }
1036
-
1037
- .map-tree {
1038
- list-style: none;
1039
- padding-left: 1.2em;
1040
- margin: 0.25em 0;
1041
- }
1042
-
1043
- .map-tree--inline {
1044
- padding-left: 0;
1045
- }
1046
-
1047
- .map-tree-item {
1048
- margin: 0.15em 0;
1049
- padding: 0.25em 0.4em;
1050
- }
1051
-
1052
- .map-tree-item--nav {
1053
- cursor: pointer;
1054
- border-radius: 4px;
1055
- margin-left: -0.4em;
1056
- transition: background-color 0.1s ease;
1057
- }
1058
-
1059
- .map-tree-item--nav:hover {
1060
- background-color: var(--dita-hover-bg, rgba(128, 128, 128, 0.1));
1061
- }
1062
-
1063
- .map-tree-item--keydef {
1064
- opacity: 0.7;
1065
- }
1066
-
1067
- .map-tree-item--head {
1068
- font-weight: 600;
1069
- }
1070
-
1071
- .map-tree-item--group {
1072
- border-left: 2px solid var(--color-border);
1073
- padding-left: 0.5em;
1074
- }
1075
-
1076
- .map-tree-icon {
1077
- margin-right: 0.35em;
1078
- font-size: 0.9em;
1079
- user-select: none;
1080
- }
1081
-
1082
- /* BookMap role badge (Chapter / Appendix / Part …) */
1083
- .map-tree-badge {
1084
- display: inline-block;
1085
- margin-right: 0.45em;
1086
- padding: 0.05em 0.45em;
1087
- border-radius: 3px;
1088
- font-size: 0.72em;
1089
- font-weight: 600;
1090
- letter-spacing: 0.03em;
1091
- text-transform: uppercase;
1092
- color: var(--color-link);
1093
- border: 1px solid currentColor;
1094
- opacity: 0.85;
1095
- vertical-align: 0.1em;
1096
- user-select: none;
1097
- }
1098
-
1099
- .map-tree-link {
1100
- color: var(--color-link);
1101
- text-decoration: none;
1102
- display: inline-flex;
1103
- align-items: center;
1104
- }
1105
-
1106
- .map-tree-link:hover {
1107
- text-decoration: underline;
1108
- }
1109
-
1110
- .map-tree-label {
1111
- vertical-align: middle;
1112
- }
1113
-
1114
- .map-tree-label--keydef {
1115
- font-style: italic;
1116
- color: var(--dita-fg);
1117
- }
1118
-
1119
- .map-tree-label--head {
1120
- font-weight: 600;
1121
- }
1122
-
1123
- /* Reltable */
1124
- .map-reltable {
1125
- margin-top: 1.5rem;
1126
- padding-top: 1rem;
1127
- border-top: 1px solid var(--color-border);
1128
- }
1129
-
1130
- .map-reltable-title {
1131
- font-size: 1.1em;
1132
- margin: 0 0 0.5rem 0;
1133
- }
1134
-
1135
- .map-reltable-table {
1136
- width: 100%;
1137
- border-collapse: collapse;
1138
- }
1139
-
1140
- .relheader th {
1141
- font-weight: 600;
1142
- background: var(--color-code-bg);
1143
- color: var(--dita-fg);
1144
- padding: 0.4rem 0.6rem;
1145
- border: 1px solid var(--color-border);
1146
- }
1147
-
1148
- .relrow td {
1149
- padding: 0.4rem 0.6rem;
1150
- border: 1px solid var(--color-border);
1151
- }
1152
-
1153
- .relcell-content {
1154
- display: block;
1155
- }
1156
-
1157
- } /* @layer dv-base */
1
+ /*
2
+ * dita-core: host-neutral stylesheet for rendered DITA content.
3
+ *
4
+ * Derived from the VS Code DITA Viewer's media/styles.css (lines 14-905 and the DITAMAP tree section, the
5
+ * topic-content rules, plus the .ditamap outline tree and reltable rules; book/site chrome stays with the VS Code host).
6
+ * Differences from that file, and nothing else:
7
+ * - every --vscode-* reference became a --dita-* host token (see TOKENS.md),
8
+ * so the sheet no longer knows which application is hosting it;
9
+ * - :root / .vscode-dark selectors also match a Shadow DOM host
10
+ * (:host / :host([data-scheme="dark"]));
11
+ * - `body` rules became `.dita-body`, `html.dv-conref-hot` became
12
+ * `:host(.dv-conref-hot)`;
13
+ * - the two #c0392b literals in .hazardstatement now use
14
+ * --color-danger-border (identical value by default).
15
+ * A host supplies colours, fonts and sizes by defining the --dita-* tokens
16
+ * (and may override the --color-* palette); it never edits this file.
17
+ */
18
+ @layer dv-base, wh-compat;
19
+ @layer dv-base {
20
+ :host, :root {
21
+ --body-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
22
+ --code-font: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
23
+ --line-height: 1.6;
24
+ --max-width: 900px;
25
+ --color-border: #ddd;
26
+ --table-border: #999;
27
+ --color-note-bg: #f0f7ff;
28
+ --color-warning-bg: #fffbf0;
29
+ --color-danger-bg: #fef2f2;
30
+ --color-important-bg: #f8f4ff;
31
+ --color-tip-bg: #f0fdf4;
32
+ --color-note-border: #4a90d9;
33
+ --color-warning-border: #e6a23c;
34
+ --color-danger-border: #c0392b;
35
+ --color-important-border: #8e44ad;
36
+ --color-tip-border: #27ae60;
37
+ /* Bound directly to VS Code's own live theme variable (falls back to a
38
+ light gray if it's ever unavailable) so this always tracks the real,
39
+ current theme instead of relying on a manually-computed .vscode-dark
40
+ class that can go stale relative to the actual active theme. */
41
+ --color-code-bg: var(--dita-code-bg, #f8f8f8);
42
+ --color-link: #2b6cb0;
43
+ --color-code-lang-bg: var(--dita-code-inline-bg, #e8e8e8);
44
+ --color-profiling-bg: #eaf7c9;
45
+ --color-profiling-border: #b8d878;
46
+ --color-profiling-label-bg: #8fb84e;
47
+ --color-profiling-label-text: #2a3a12;
48
+ --color-indexterm-chip-bg: #e6f0fa;
49
+ --color-indexterm-chip-text: #2c5282;
50
+ --color-menucascade-arrow: #767676;
51
+ }
52
+
53
+ .vscode-dark, :host([data-scheme="dark"]) {
54
+ --color-border: #555;
55
+ --table-border: #777;
56
+ --color-note-bg: #1a2633;
57
+ --color-warning-bg: #33281a;
58
+ --color-danger-bg: #331a1a;
59
+ --color-important-bg: #261a33;
60
+ --color-tip-bg: #1a3326;
61
+ --color-link: #6ab0f3;
62
+ --color-code-bg: var(--dita-code-bg, #555);
63
+ --color-code-lang-bg: var(--dita-code-inline-bg, #666);
64
+ --color-profiling-bg: #3a4a1f;
65
+ --color-profiling-border: #5a7530;
66
+ --color-profiling-label-bg: #6b8f39;
67
+ --color-profiling-label-text: #eef7dc;
68
+ --color-indexterm-chip-bg: #1f2f42;
69
+ --color-indexterm-chip-text: #9dc4ea;
70
+ --color-menucascade-arrow: #aaaaaa;
71
+ }
72
+
73
+ .dita-body {
74
+ font-family: var(--body-font);
75
+ font-size: 1em;
76
+ line-height: var(--line-height);
77
+ max-width: var(--max-width);
78
+ margin: 0 auto;
79
+ padding: 2rem 1.5rem;
80
+ color: var(--dita-fg);
81
+ }
82
+
83
+ /* Every source edit swaps this div's entire innerHTML in one mutation
84
+ (see #dita-content-root's 'updateContent' message handler, shared by
85
+ DitaViewerProvider.ts and MapViewerProvider.ts) -- not a small, targeted
86
+ change the browser's default CSS Scroll Anchoring is designed for (it
87
+ tries to auto-compensate scrollTop to keep whatever it picks as the
88
+ "anchor node" visually fixed when content changes near the viewport).
89
+ When virtually the entire subtree is replaced at once, the previous
90
+ anchor node is gone and whatever the browser picks as a replacement has
91
+ no reliable relationship to what was actually on screen, so its
92
+ compensation can shift scroll position in ways that don't correspond to
93
+ anything real -- consistent with the reported "typing edits far from
94
+ the current scroll position occasionally causes an unexplained extra
95
+ scroll shift" behavior. Turning it off here means scrollTop simply
96
+ stays exactly where it was as a fixed number across the swap, which is
97
+ what both providers' content-only update already assumes; the
98
+ extension's own explicit logic (applyHighlightLine, scrollToLine -- the
99
+ topic viewer only, map view has no scroll-sync of its own) is the only
100
+ thing that should ever intentionally move it. */
101
+ #dita-content-root {
102
+ overflow-anchor: none;
103
+ }
104
+
105
+ /* In-place mode switch (toolbar-persistence work): added to the OLD content
106
+ root by the mode button's click handler the instant it fires, since its
107
+ own label flips immediately while the new stage is still being rendered
108
+ asynchronously on the host side (getModeToggleScript). Gives that gap a
109
+ visible "switching" state instead of the button and the page silently
110
+ disagreeing for a moment. Needs no matching removal -- applyModeStage
111
+ (MapViewerProvider.ts) discards this exact node once the new stage lands
112
+ and inserts a fresh, undimmed one in its place. */
113
+ #dita-content-root.mode-switching {
114
+ opacity: 0.5;
115
+ transition: opacity 0.1s ease-out;
116
+ pointer-events: none;
117
+ /* Positioning context for .dita-mode-switch-overlay below -- scoped to
118
+ this class rather than added unconditionally so it never affects
119
+ #dita-content-root's normal (non-switching) layout. */
120
+ position: relative;
121
+ }
122
+
123
+ /* getModeToggleScript's delayed "still switching" overlay: only appended if
124
+ a switch takes longer than its 400ms grace period (see that script's own
125
+ comment for why), as a child of the OLD #dita-content-root, so it is
126
+ scoped to the content area alone -- the toolbar above it stays fully
127
+ visible and interactive throughout, which is the entire point of the
128
+ in-place-switch work this belongs to. .dita-loading-spinner is the same
129
+ spinner the full-reload path's book-mode placeholder uses
130
+ (MapViewerProvider.ts's generateLoadingHtml); here it is a small overlay
131
+ instead of a full-page one. */
132
+ .dita-mode-switch-overlay {
133
+ position: absolute;
134
+ inset: 0;
135
+ display: flex;
136
+ flex-direction: column;
137
+ align-items: center;
138
+ justify-content: center;
139
+ gap: 12px;
140
+ color: var(--dita-fg-muted, #999);
141
+ }
142
+
143
+ /* Topic article */
144
+ .topic > h1:first-child { margin-top: 0; }
145
+
146
+ /* Short description */
147
+ .shortdesc {
148
+ background: var(--color-note-bg);
149
+ color: var(--dita-fg-muted, var(--dita-fg));
150
+ padding: 0.75rem 1rem;
151
+ border-radius: 4px;
152
+ font-size: 1.05em;
153
+ line-height: 1.6;
154
+ }
155
+
156
+ /* Headings */
157
+ h1, h2, h3, h4, h5, h6 {
158
+ margin-top: 1.5em;
159
+ margin-bottom: 0.5em;
160
+ font-weight: 600;
161
+ }
162
+
163
+ h1 { font-size: 1.8em; border-bottom: 2px solid var(--color-border); padding-bottom: 0.3em; }
164
+ h2 { font-size: 1.5em; }
165
+ h3 { font-size: 1.3em; }
166
+ h4 { font-size: 1.15em; }
167
+
168
+ /* Paragraphs */
169
+ p { margin: 0.75em 0; }
170
+
171
+ /* Note boxes */
172
+ .note {
173
+ border-left: 4px solid var(--color-note-border);
174
+ background: var(--color-note-bg);
175
+ color: var(--dita-fg);
176
+ padding: 0.75rem 1rem;
177
+ margin: 1rem 0;
178
+ border-radius: 0 4px 4px 0;
179
+ }
180
+
181
+ .note__label { font-weight: 600; text-transform: capitalize; }
182
+ /* The note text sits in .note__body for the benefit of WebHelp-style css. In
183
+ the own shell it stays inline, so the label and the text share a line as
184
+ they always did (a block here pushes the text onto its own line). */
185
+ .dita-body:not(.wh_topic_page) .note__body { display: inline; }
186
+ .note--warning { border-left-color: var(--color-warning-border); background: var(--color-warning-bg); }
187
+ .note--danger { border-left-color: var(--color-danger-border); background: var(--color-danger-bg); }
188
+ .note--important { border-left-color: var(--color-important-border); background: var(--color-important-bg); }
189
+ .note--tip { border-left-color: var(--color-tip-border); background: var(--color-tip-bg); }
190
+
191
+ /* Conref'd content: anything pulled in by conref / conkeyref / conrefend.
192
+ Oxygen's Author mode paints it with a gray background and puts a jump
193
+ button in the top-left corner; a flat opaque gray fights VS Code's themes
194
+ (and the note/section tints underneath), so this is a translucent neutral
195
+ that composes with whatever is behind it, plus a thin leading bar that
196
+ stays visible on dark themes where a faint tint nearly vanishes.
197
+ All of it is drawn as background layers on the element itself -- no
198
+ ::before/::after (profiling already owns those on li/ul/ol and the
199
+ non-inline elements) and no wrapper element. The renderer only emits
200
+ data-conref when the preview opts in, so "Export as HTML" and the diff
201
+ view never carry it. The jump icon is a background too, so it has no DOM
202
+ of its own: the click zone is recomputed from the SAME custom properties
203
+ below in conrefJumpScript.ts (getComputedStyle().getPropertyValue())
204
+ -- the vars are the single source of truth, do not re-hardcode the
205
+ numbers on either side. Padding on the block/inline variants gives the
206
+ tint some air on both sides (so it reads as a chunk around the content
207
+ rather than a tight underline) and keeps the leading bar (flush with
208
+ the inner-border edge) clear of the first glyph. */
209
+ :host, :root {
210
+ --color-conref-bg: rgba(128, 128, 128, 0.13);
211
+ --color-conref-bar: rgba(128, 128, 128, 0.55);
212
+ /* Oxygen paints the reuse badge as a few OPEN horizontal strokes (lines of
213
+ text), not a filled/closed page rectangle -- strokes read as airy chrome on
214
+ the translucent tint, whereas a solid glyph competes with content and, on
215
+ dark themes, a white fill glowed. Three lines (not four) keep it lighter;
216
+ the last runs a touch longer and gets a small right arrowhead so the same
217
+ gesture means "jump to source". Light-mode grays below; .vscode-dark
218
+ (after this block) lifts them so the strokes stay legible on dark. */
219
+ --conref-jump-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Cg%20fill='none'%20stroke='%239c9c9c'%20stroke-width='1'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M2%204h7M2%208h7M2%2012h9'/%3E%3Cpath%20d='M9.5%2010.5l1.8%201.5-1.8%201.5'%20stroke='%23808080'/%3E%3C/g%3E%3C/svg%3E");
220
+ /* Geometry read by both the paint rules below and the webview hit-test
221
+ in conrefJumpScript.ts. Change here, both sides move together. */
222
+ --conref-bar-width: 3px;
223
+ --conref-icon-block-size: 16px;
224
+ --conref-icon-block-offset: 3px;
225
+ --conref-icon-cell-size: 15px;
226
+ --conref-icon-cell-offset: 2px;
227
+ --conref-icon-inline-size: 11px;
228
+ --conref-icon-inline-offset: 1px;
229
+ /* Inline slot: the padding-right reserved on the element so the icon
230
+ sits clear of the trailing glyph. Derives as
231
+ offset + size + 1px visual gap, but kept as a flat token so the
232
+ script's hit-test reads the exact same number. */
233
+ --conref-icon-inline-slot: 13px;
234
+ }
235
+ /* Dark-mode badge: same open-line glyph, lifted to light grays so the strokes
236
+ stay legible over a dark canvas without glowing. Must sit AFTER the :root
237
+ block -- .vscode-dark is on <html>, the same element :root targets, so it
238
+ wins on source order, not specificity. */
239
+ .vscode-dark, :host([data-scheme="dark"]) {
240
+ --conref-jump-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Cg%20fill='none'%20stroke='%238a8a8a'%20stroke-width='1'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M2%204h7M2%208h7M2%2012h9'/%3E%3Cpath%20d='M9.5%2010.5l1.8%201.5-1.8%201.5'%20stroke='%23a0a0a0'/%3E%3C/g%3E%3C/svg%3E");
241
+ }
242
+ [data-conref][data-conref] {
243
+ background-repeat: no-repeat;
244
+ }
245
+ [data-conref="block"][data-conref] {
246
+ /* top clears the icon (offset 3 + size 16 + a small gap, hardcoded to match
247
+ the tokens above); left/right symmetric so the leading bar sits at
248
+ the same distance from the first glyph as the right padding does
249
+ from the last; bottom gives the tint some air under the text. */
250
+ padding-top: 22px;
251
+ padding-right: 10px;
252
+ padding-bottom: 6px;
253
+ padding-left: 10px;
254
+ background-image:
255
+ var(--conref-jump-icon),
256
+ linear-gradient(var(--color-conref-bar), var(--color-conref-bar)),
257
+ linear-gradient(var(--color-conref-bg), var(--color-conref-bg));
258
+ background-position:
259
+ var(--conref-icon-block-offset) var(--conref-icon-block-offset),
260
+ left top,
261
+ 0 0;
262
+ background-size:
263
+ var(--conref-icon-block-size) var(--conref-icon-block-size),
264
+ var(--conref-bar-width) 100%,
265
+ auto;
266
+ }
267
+ /* A list's indent IS its padding-left (ul, ol { padding-left: 1.5em }); the
268
+ longhand above would flatten it to 10px and push the markers out under the
269
+ bar. Keep the indent and add the same 10px of air on top. */
270
+ ul[data-conref="block"][data-conref],
271
+ ol[data-conref="block"][data-conref],
272
+ .simple-list[data-conref="block"][data-conref] {
273
+ padding-left: calc(1.5em + 10px);
274
+ }
275
+ /* A whole <note> reused: the generic block padding would replace .note's own
276
+ 0.75rem 1rem. Keep its horizontal padding (1rem already clears the 3px bar
277
+ and the icon) and bottom; only the top yields, to the icon line. */
278
+ .note[data-conref="block"][data-conref] {
279
+ padding: 22px 1rem 0.75rem 1rem;
280
+ }
281
+ [data-conref="inline"][data-conref] {
282
+ /* left padding mirrors the block treatment on a smaller scale; slice
283
+ (the default box-decoration-break) means only the very first line of
284
+ a wrapped run gets the leading gap, which is what Oxygen shows too.
285
+ padding-right is the slot; the icon hugs the right edge inside it. */
286
+ padding: 0 var(--conref-icon-inline-slot) 0 3px;
287
+ border-radius: 2px;
288
+ background-image:
289
+ var(--conref-jump-icon),
290
+ linear-gradient(var(--color-conref-bg), var(--color-conref-bg));
291
+ background-position:
292
+ right var(--conref-icon-inline-offset) center,
293
+ 0 0;
294
+ background-size:
295
+ var(--conref-icon-inline-size) var(--conref-icon-inline-size),
296
+ auto;
297
+ }
298
+ [data-conref="cell"][data-conref] {
299
+ /* Reserve a left gutter so the top-left badge never sits on the first
300
+ glyph -- a <td>'s default 0.75rem left padding is shorter than the
301
+ 16px icon, which is why the cell badge was overlapping "Cell A".
302
+ Only padding-left is overridden; top/right/bottom keep the table's
303
+ own 0.5rem/0.75rem so rows stay the same height and text tops stay
304
+ aligned with non-reused sibling cells. */
305
+ padding-left: calc(var(--conref-icon-cell-offset) + var(--conref-icon-cell-size) + 2px);
306
+ background-image:
307
+ var(--conref-jump-icon),
308
+ linear-gradient(var(--color-conref-bg), var(--color-conref-bg));
309
+ background-position:
310
+ var(--conref-icon-cell-offset) var(--conref-icon-cell-offset),
311
+ 0 0;
312
+ background-size:
313
+ var(--conref-icon-cell-size) var(--conref-icon-cell-size),
314
+ auto;
315
+ }
316
+ /* Set by the hover hit-test in conrefJumpScript.ts while the pointer is over
317
+ the icon (a background cannot take its own cursor). */
318
+ :host(.dv-conref-hot) [data-conref],
319
+ :host(.dv-conref-hot) [data-conref] * {
320
+ cursor: pointer;
321
+ }
322
+ /* Keyboard / screen-reader focus for the jump badge (see conrefJumpScript.ts:
323
+ renderer.ts makes every mark focusable). The badge is a background, so the
324
+ ring is drawn on the element that carries it. :focus-visible, not :focus, so
325
+ a pointer click that lands on the element doesn't ring it -- matching the
326
+ site-nav treatment. Negative offset keeps the ring inside the tint box so it
327
+ never spills onto a neighbouring block. */
328
+ [data-conref][data-conref]:focus-visible {
329
+ outline: 2px solid var(--dita-focus, #007fd4);
330
+ outline-offset: -2px;
331
+ }
332
+ /* The single hidden node every reused element's aria-describedby points at
333
+ (injected by conrefJumpScript.ts). It must be gone from the layout yet still
334
+ present in the accessibility tree, so it is clipped rather than display:none
335
+ -- display:none would remove the description screen readers announce on
336
+ focus, defeating the whole affordance. */
337
+ .dv-visually-hidden {
338
+ position: absolute;
339
+ width: 1px;
340
+ height: 1px;
341
+ margin: -1px;
342
+ padding: 0;
343
+ overflow: hidden;
344
+ clip: rect(0 0 0 0);
345
+ clip-path: inset(50%);
346
+ white-space: nowrap;
347
+ border: 0;
348
+ }
349
+
350
+ /* Profiling / conditional-processing attribute highlighting (props,
351
+ otherprops, audience, platform, product, base, importance, rev, status).
352
+ Mirrors Oxygen's default "show profiling" style: a tinted box around the
353
+ profiled content with a small label naming the attribute/value that
354
+ matched, rather than hiding anything. Toggled off via body.hide-profiling
355
+ (see the toolbar button in DitaViewerProvider.ts) -- pure CSS, no
356
+ re-render needed. */
357
+ .profiled {
358
+ /* .profiled applies directly to the real element (see injectBlockProfiling
359
+ in renderer.ts), not a synthetic wrapper -- so we must NOT use border or
360
+ padding on the left side: border takes box-model space shifting content
361
+ and nested list markers, and any decoration on <li>/<ul>/<ol> visually
362
+ interferes with the browser's list-marker positioning. box-shadow paints
363
+ outward from the border-box edge without affecting layout, so the green
364
+ highlight ring never pushes content or covers nested bullets/numbers.
365
+ This box-shadow default is kept only for <li>/<ul>/<ol> (see the
366
+ override right below, which switches everything else to a real
367
+ border). */
368
+ box-shadow: 0 0 0 1.5px var(--color-profiling-border);
369
+ border-radius: 3px;
370
+ background: none;
371
+ padding: 0.4rem 0.6rem;
372
+ margin: 0.5rem 0;
373
+ }
374
+ /* Every OTHER block-level profiled element (section, div, p, dl, note,
375
+ ...) draws its highlight with a real border instead of the box-shadow
376
+ above. Reported symptom: two independently-profiled block elements
377
+ stacked directly next to each other (e.g. two sibling <section>s, each
378
+ with its own profiling attribute) rendering with their left/right sides
379
+ looking "not closed". box-shadow is purely a paint effect layered
380
+ outside the border-box -- it has no guaranteed closed-rectangle
381
+ semantics of its own the way an actual border does, and at a boundary
382
+ where two elements' painted regions sit close together (their margins
383
+ collapsed to the usual gap above), a thin 1.5px ring is exactly the
384
+ kind of decoration where that can go visibly wrong. A real border
385
+ doesn't share that ambiguity: border-left/right/top/bottom are each
386
+ unconditionally part of the element's own box, drawn every time,
387
+ regardless of what's rendered nearby. This is safe everywhere except
388
+ <li>/<ul>/<ol> -- border-radius/border don't affect list-marker
389
+ positioning on any other element, and for a block element with the
390
+ default width: auto, adding a border doesn't change its outer width
391
+ either (the browser narrows the content area to compensate, same as it
392
+ already does for padding). */
393
+ .profiled:not(li):not(ul):not(ol):not(tr):not(.profiled--inline) {
394
+ box-shadow: none;
395
+ border: 1.5px solid var(--color-profiling-border);
396
+ }
397
+ /* <li>/<ul>/<ol> can't take the same real-border treatment above -- border
398
+ is real box-model space, and shifting an <li>'s own border-box shifts
399
+ where the browser hangs its list-marker, per the comment on .profiled
400
+ itself. box-shadow (and, tried next, outline) turned out not to be
401
+ reliable substitutes: both are paint-only effects layered outside the
402
+ border-box, and reported symptoms kept recurring on <li> specifically
403
+ whenever it had a block-level child like <p> inside it (plain
404
+ text-only <li>s were fine) -- e.g. box-shadow's the exact thing that
405
+ was going wrong for section before switching it to border, and outline
406
+ reproduced the identical "right side won't close" symptom for a
407
+ profiled <li> containing a <p>, plus introduced a new "crossing lines"
408
+ regression that plain border sidesteps.
409
+ Sidestepping the question of exactly which decoration property is safe
410
+ in this Chromium build for a list-item box with block children: draw
411
+ the ring with a real border, but on an absolutely-positioned ::before
412
+ pseudo-element instead of on the <li> itself. An absolutely-positioned
413
+ element is taken out of normal flow entirely, so it cannot move the
414
+ list-marker (nothing about the <li>'s own box model changed -- no new
415
+ border, no new padding, nothing the marker-positioning algorithm could
416
+ react to) while still being a literal border on a literal box, with
417
+ the same unambiguous every-side-drawn-every-time guarantee that fixed
418
+ section. It also can't fragment across the <li>'s own wrapped lines the
419
+ way an inline element's decoration can: this pseudo-element covers the
420
+ <li>'s box exactly once, top to bottom, regardless of how many lines
421
+ its content wraps to internally -- which is what rules out the
422
+ crossing-lines regression outline introduced. */
423
+ .profiled:is(li, ul, ol) {
424
+ position: relative;
425
+ box-shadow: none;
426
+ }
427
+ .profiled:is(li, ul, ol)::before {
428
+ content: '';
429
+ position: absolute;
430
+ top: 0;
431
+ right: 0;
432
+ bottom: 0;
433
+ left: 0;
434
+ border: 1.5px solid var(--color-profiling-border);
435
+ border-radius: 3px;
436
+ pointer-events: none;
437
+ }
438
+ .profiled--inline {
439
+ display: inline;
440
+
441
+ padding: 0 0.2rem;
442
+ margin: 0;
443
+ border-radius: 2px;
444
+ /* Deliberately NOT setting a custom line-height or box-decoration-break
445
+ here (both were tried and reverted). box-decoration-break: clone
446
+ closed the box on both sides at a line wrap, but the reference tool
447
+ this preview is meant to match (Oxygen) leaves it open on purpose --
448
+ previous line's trailing edge unclosed, next line's leading edge
449
+ unclosed -- which is just the CSS default (slice) already gives us
450
+ for free. And the extra line-height added to keep clone's padding
451
+ from bleeding into neighbouring lines pushed up *every* line this
452
+ element touches, including plain single-line usage, making profiled
453
+ phrases visibly taller/inconsistent with surrounding text -- worse
454
+ than the problem it was solving. Staying with the plain defaults here
455
+ keeps single-line height consistent everywhere and matches Oxygen's
456
+ open-sided wrap look. */
457
+ }
458
+ .profiled--inline .profiling-label {
459
+ float: none;
460
+ position: static;
461
+ display: inline-flex;
462
+ align-items: center;
463
+ margin-left: 0.3em;
464
+ vertical-align: middle;
465
+ }
466
+ /* No special containment here for the trailing .profiling-chip (unlike
467
+ .profiled block-level handling below): earlier attempts to reserve
468
+ vertical room via padding+line-height, or to shrink the chip itself to
469
+ fit, both traded one visible problem for another (crossing borders on
470
+ wrapped lines, or a chip that looks flatter/smaller than every other
471
+ .profiling-chip elsewhere). Left at CSS defaults, matching Oxygen's own
472
+ rendering and keeping height consistent whether or not this element
473
+ happens to wrap. */
474
+ /* Clearfix: .profiling-label below is `float: right` so it can share the
475
+ last line with short content (see the comment on .profiling-label) --
476
+ but a float is intentionally excluded from its containing block's own
477
+ height calculation unless that container is cleared or establishes a
478
+ new block formatting context, and .profiled does neither on its own.
479
+ When the label doesn't fit on the same line as the preceding text (long
480
+ or wrapping content) it drops to a line of its own below -- and without
481
+ this rule, .profiled's box-shadow border is sized from the non-floated
482
+ text alone, so it closes *before* that dropped line: the label then
483
+ visually sits outside/below its own green box, and can bleed into the
484
+ top margin of the very next .profiled sibling, breaking what should be
485
+ two clean, separate borders. The classic content:""; display:table;
486
+ clear:both idiom forces an (invisible) trailing box that clears the
487
+ float, so .profiled's own height -- and therefore its border -- always
488
+ extends down to actually contain the label. Scoped away from
489
+ .profiled--inline (label is float:none there, nothing to clear) and
490
+ away from tr.profiled (a <tr> doesn't render ::after reliably, and its
491
+ own label lives inside a <td> which already establishes its own block
492
+ formatting context and needs no help containing floats).
493
+ */
494
+ .profiled:not(.profiled--inline):not(tr)::after {
495
+ content: '';
496
+ display: table;
497
+ clear: both;
498
+ }
499
+ /* float rather than a dedicated bottom-padding + position:absolute slot:
500
+ the box no longer has to reserve a fixed amount of vertical space for
501
+ the label regardless of how little content actually needs it (a
502
+ single-line profiled step/bullet used to look disproportionately tall,
503
+ with a big empty gap between the text and the label sitting below it).
504
+ Floating right lets the label sit on the *same* line as short content
505
+ for free, while still correctly dropping to its own line -- and staying
506
+ right-aligned there, matching Oxygen's convention and the ditamap tree
507
+ view's own box (see mapTypeMap.ts) -- whenever the preceding content is
508
+ itself block-level (a nested list, a wrapped multi-line paragraph) and
509
+ doesn't leave room on the same line. .profiled--inline above overrides
510
+ this back to float:none, since a label attached to an inline phrase
511
+ (ph/b/i/xref/...) needs to sit immediately next to that phrase
512
+ mid-sentence, not escape to the edge of the whole paragraph. */
513
+ .profiling-label {
514
+ float: right;
515
+ display: flex;
516
+ gap: 0.3rem;
517
+ flex-wrap: wrap;
518
+ margin-left: 0.5em;
519
+ }
520
+ .profiling-chip {
521
+ background: var(--color-profiling-label-bg);
522
+ color: var(--color-profiling-label-text);
523
+ font-size: 0.7em;
524
+ font-weight: 600;
525
+ padding: 0.05rem 0.4rem;
526
+ border-radius: 3px;
527
+ white-space: nowrap;
528
+ }
529
+ .profiling-chip__value { font-weight: 400; }
530
+ /* Index term chips: small inline markers showing an authored <indexterm>'s
531
+ term path right where it appears in the running text -- not a compiled,
532
+ sorted back-of-book index (see the comment on topic/indexterm's renderer
533
+ in baseTypeMap.ts for why: sorting only makes sense for scripts with a
534
+ stable alphabetic/stroke order, so a generated index page would be
535
+ meaningless for e.g. Chinese content). Deliberately understated (smaller,
536
+ lower-contrast than profiling-chip) since these appear far more densely
537
+ in typical content than profiling markers do, and shouldn't compete with
538
+ the actual text for attention. */
539
+ .indexterm-chip {
540
+ display: inline-block;
541
+ background: var(--color-indexterm-chip-bg);
542
+ color: var(--color-indexterm-chip-text);
543
+ font-size: 0.72em;
544
+ padding: 0.02rem 0.35rem;
545
+ border-radius: 3px;
546
+ white-space: nowrap;
547
+ margin: 0 0.15em;
548
+ cursor: default;
549
+ }
550
+ .indexterm-chip--ref { font-style: italic; }
551
+ .indexterm-chip__see { font-style: italic; opacity: 0.85; }
552
+ .dita-body.hide-profiling .profiled {
553
+ background: none;
554
+ box-shadow: none;
555
+ padding: 0;
556
+ margin: 0;
557
+ }
558
+ /* The general reset above zeroes padding on every side, including left --
559
+ correct for everything else profiling touches, but a profiled ul/ol
560
+ relies on that left padding for its own children's marker gutter (see
561
+ ul.profiled/ol.profiled above), not just for the now-hidden box. Without
562
+ restoring it here, turning Flags off would silently break nested-list
563
+ indentation for exactly the same reason it broke with the box visible,
564
+ just conditionally instead of always. */
565
+ .dita-body.hide-profiling ul.profiled,
566
+ .dita-body.hide-profiling ol.profiled {
567
+ padding-left: 1.5em;
568
+ }
569
+ .dita-body.hide-profiling .profiled--inline { display: inline; }
570
+ .dita-body.hide-profiling .profiling-label { display: none; }
571
+
572
+ /* Phase 2 (the filter panel): actually hides content, unlike the toggle
573
+ above which only hides the highlight decoration. !important because
574
+ this needs to override whatever display value .profiled/.profiled--inline
575
+ set, and nothing else in this stylesheet should ever legitimately want
576
+ to re-show something the person explicitly filtered out. */
577
+ .profile-filtered-out { display: none !important; }
578
+
579
+ /* Lists */
580
+ ul, ol { padding-left: 1.5em; }
581
+ li { margin: 0.25em 0; }
582
+ /* Profiling on list elements: box-shadow doesn't affect layout, but the
583
+ generic .profiled padding still overrides the base padding-left both
584
+ rules above rely on. li's own padding-left is normally 0 (a plain li's
585
+ marker-gutter comes entirely from its *parent* ul/ol's padding, not
586
+ from the li itself) -- .profiled's shorthand would otherwise add
587
+ 0.6rem there, shifting a profiled li's text right of its plain
588
+ siblings, so it's zeroed back out. ul/ol are the opposite case: their
589
+ own padding-left of 1.5em IS the marker gutter their own <li> children
590
+ need, so when the ul/ol itself is profiled, that 1.5em has to be
591
+ restored (not just zeroed) or its children's markers lose their
592
+ reserved space entirely and the whole nested list stops looking nested
593
+ at all. The top/bottom padding is kept so the box-shadow ring has
594
+ breathing room above and below the content either way. */
595
+ li.profiled { padding-left: 0; }
596
+ ul.profiled, ol.profiled { padding-left: 1.5em; }
597
+ .simple-list { list-style: none; padding-left: 1.5em; }
598
+
599
+ /* Definition lists */
600
+ dl { margin: 1em 0; }
601
+ .dlentry { margin: 0.5em 0; }
602
+ dt { font-weight: 600; margin-top: 0.5em; }
603
+ dd { margin-left: 1.5em; }
604
+
605
+ /* Tables */
606
+ table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95em; border: 2px solid var(--table-border); }
607
+ table th, table td { border: 1px solid var(--table-border); padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; overflow-wrap: break-word; }
608
+ table th { background: var(--color-code-bg); color: var(--dita-fg); font-weight: 600; }
609
+
610
+ /* Profiling on table rows: the generic .profiled treatment below (box-
611
+ shadow ring + padding + margin) is built for ordinary block content and
612
+ doesn't fit a <tr> living inside this table's border-collapse: collapse
613
+ model. box-shadow paints independently of the collapsed border grid, so
614
+ a ring drawn straight on a row can drift out of alignment with the
615
+ row's actual cell edges (the "green block is offset" symptom), and two
616
+ separately-profiled adjacent rows each painting their own independent
617
+ ring don't share one continuous edge the way collapsed borders do,
618
+ leaving a visible gap/seam between them (the "border between rows is
619
+ incomplete" symptom). Coloring each cell's own border instead works
620
+ *with* border-collapse: a shared edge between two profiled rows merges
621
+ down to a single line, same as any other collapsed border, so
622
+ consecutive profiled rows read as one unbroken green outline. */
623
+ tr.profiled {
624
+ box-shadow: none;
625
+ padding: 0;
626
+ margin: 0;
627
+ background: none;
628
+ }
629
+ tr.profiled > td,
630
+ tr.profiled > th {
631
+ border-color: var(--color-profiling-border);
632
+ }
633
+ .dita-body.hide-profiling tr.profiled > td,
634
+ .dita-body.hide-profiling tr.profiled > th {
635
+ border-color: var(--table-border);
636
+ }
637
+
638
+ /* CALS tables whose <colgroup> carries real colwidth hints (see
639
+ baseTypeMap.ts's 'topic/table' renderer): with the default 'auto' table
640
+ layout those widths are only a hint, and a column with a long unbroken
641
+ run of CJK text (or any content wider than the column's proportional
642
+ share) can force the browser to redistribute space away from a
643
+ short-content column regardless of what colwidth says -- symptom: a
644
+ narrow first column with a couple characters ends up wide, and a long
645
+ multi-paragraph second column ends up squeezed. 'fixed' makes colgroup
646
+ widths authoritative and independent of content. overflow-wrap above
647
+ keeps long unbroken content from overflowing its now content-independent
648
+ column. */
649
+ .cals-table--fixed-layout { table-layout: fixed; }
650
+
651
+ /* Simpletables are meant to be lighter-weight than CALS tables */
652
+ .simple-table th, .simple-table td { padding: 0.4rem 0.6rem; }
653
+ .simple-table th { background: transparent; border-bottom-width: 2px; }
654
+
655
+ /* Foreign content (MathML, embedded SVG) — DITA doesn't signal whether a
656
+ <mathml>/<foreign> block is meant inline or as its own line the way
657
+ <image>'s @placement does, so this stays in normal inline flow by
658
+ default; a small margin just keeps it from crowding adjacent text. */
659
+ .foreign-content { margin: 0 0.15em; }
660
+
661
+ /* Images */
662
+ /* --dita-scale is the only remaining size hint here, driven by the DITA
663
+ source's own @scale attribute -- it sizes the image relative to its OWN
664
+ natural pixel dimensions via 'zoom'. Per-image display sizing (separate
665
+ from @scale, and not tied to the DITA source at all) is applied at
666
+ runtime as an inline width/max-width on the specific <img>, via the
667
+ per-image zoom controls injected by the webview script -- see
668
+ .dita-img-wrap / .dita-img-toolbar below. */
669
+ img { max-width: 100%; height: auto; border-radius: 4px; vertical-align: middle; cursor: zoom-in; zoom: var(--dita-scale, 1); }
670
+ .image-break { display: block; margin: 1rem 0; }
671
+ img[data-load-error] { cursor: default; }
672
+
673
+ /* Per-image zoom/maximize toolbar: a small overlay pinned to the image's
674
+ own top-right corner, shown on hover (or keyboard focus-within, for
675
+ accessibility) rather than a page-wide toolbar, since the control now
676
+ only ever affects the one image it's attached to. Wrapper is an inline
677
+ <span>, not a <div>, so it stays validly nestable inside inline DITA
678
+ contexts like <p> without forcing a block break. */
679
+ .dita-img-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
680
+ .dita-img-toolbar {
681
+ position: absolute; top: 4px; right: 4px; z-index: 10;
682
+ display: flex; gap: 2px;
683
+ opacity: 0; pointer-events: none; transition: opacity 0.15s;
684
+ }
685
+ .dita-img-wrap:hover .dita-img-toolbar,
686
+ .dita-img-wrap:focus-within .dita-img-toolbar {
687
+ opacity: 1; pointer-events: auto;
688
+ }
689
+ .dita-img-btn {
690
+ padding: 1px 5px; border-radius: 3px; line-height: 1.5; font-size: 12px; cursor: pointer;
691
+ border: 1px solid var(--dita-border, #555);
692
+ background: var(--dita-bg, rgba(30, 30, 30, 0.85));
693
+ color: var(--dita-fg, #eee);
694
+ }
695
+ .dita-img-btn:hover { opacity: 0.85; }
696
+
697
+ /* Custom right-click "Copy Image" menu (see contextmenu handling in the
698
+ webview script) -- styled to read as a native-ish context menu using
699
+ VS Code's own menu theme tokens, since a real OS context menu isn't
700
+ available consistently across every host this extension runs in. */
701
+ .dita-img-ctxmenu {
702
+ position: fixed; z-index: 100000;
703
+ background: var(--dita-bg-elevated, var(--dita-bg, #1e1e1e));
704
+ border: 1px solid var(--dita-border, #454545);
705
+ border-radius: 4px;
706
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
707
+ padding: 2px;
708
+ min-width: 140px;
709
+ }
710
+ .dita-img-ctxmenu-item {
711
+ display: block; width: 100%; text-align: left;
712
+ padding: 4px 10px; border: none; border-radius: 3px;
713
+ font-size: 13px; cursor: pointer;
714
+ background: transparent;
715
+ color: var(--dita-fg, #ccc);
716
+ }
717
+ .dita-img-ctxmenu-item:hover,
718
+ .dita-img-ctxmenu-item:focus {
719
+ background: var(--dita-hover-bg, #2a2d2e);
720
+ color: var(--dita-selected-fg, var(--dita-fg, #ccc));
721
+ outline: none;
722
+ }
723
+ .dita-img-ctxmenu-item:disabled { cursor: default; opacity: 0.7; }
724
+ /* Group divider for the sidebar's multi-item context menu (see
725
+ getSiteOpenSourceScript), matching how a native menu separates groups. */
726
+ .dita-img-ctxmenu-sep {
727
+ height: 1px; margin: 2px 4px;
728
+ background: var(--dita-border, #454545);
729
+ }
730
+
731
+ /* Transient feedback pill for the lightbox's Ctrl+C copy path, which has
732
+ no menu item of its own to update the way the right-click menu does. */
733
+ .dita-img-toast {
734
+ position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%);
735
+ z-index: 100001;
736
+ background: var(--dita-bg-elevated, var(--dita-bg, #1e1e1e));
737
+ border: 1px solid var(--dita-border, #454545);
738
+ color: var(--dita-fg, #ccc);
739
+ padding: 6px 14px; border-radius: 4px; font-size: 13px;
740
+ /* UI chrome, not document content: stays sans-serif regardless of the
741
+ reading-font toggle (Serif is a common choice there, and a serif toast
742
+ reads noticeably slower for a quick transient message). */
743
+ font-family: var(--dita-font, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
744
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
745
+ max-width: 92vw;
746
+ /* Kept to one line: a short toast that wraps to two is more disruptive
747
+ to read at a glance than one that's simply not padded to a fixed box
748
+ width. The message itself is kept short enough to fit in the common
749
+ case; text-overflow is only a safety net for an unusually long locale
750
+ string or width-option label. */
751
+ white-space: nowrap;
752
+ overflow: hidden;
753
+ text-overflow: ellipsis;
754
+ text-align: center;
755
+ }
756
+ /* For feedback tied to a top-of-page control (the width dropdown): a
757
+ bottom toast is easy to miss entirely, or costs a big jump down to
758
+ notice, right after the user's focus and click just landed at the top. */
759
+ .dita-img-toast--top { bottom: auto; top: 48px; }
760
+
761
+ /* Figures */
762
+ /* Left-aligned rather than centered: a fig's image should sit flush with
763
+ the surrounding body text's left edge (and, inside a list item, with the
764
+ li's text rather than its marker), matching how DITA authors read
765
+ figures in Oxygen. figure has no left/right margin of its own, so this
766
+ naturally follows whatever indent its containing block already has. */
767
+ figure { margin: 1.5rem 0; text-align: left; }
768
+ figcaption { font-style: italic; margin-top: 0.2rem; font-size: 0.95em; text-align: left; }
769
+
770
+ /* Code blocks */
771
+ pre.codeblock, pre.preformatted {
772
+ background: var(--color-code-bg);
773
+ color: var(--dita-fg);
774
+ border: 1px solid var(--color-border);
775
+ border-radius: 4px;
776
+ padding: 1rem;
777
+ overflow-x: auto;
778
+ font-family: var(--code-font);
779
+ font-size: 0.9em;
780
+ line-height: 1.5;
781
+ position: relative;
782
+ }
783
+
784
+ /* Wraps a codeblock that has a language label. This element -- not the
785
+ <pre> itself -- is what .codeblock-lang is positioned against: <pre>
786
+ has overflow-x:auto for wide code, and an absolutely-positioned child of
787
+ a scrolling box scrolls along with its content, so the label used to
788
+ drift out of view as soon as the code was scrolled horizontally.
789
+ .codeblock-wrap sits outside that scrolling area, so the label stays
790
+ pinned to the visible top-right corner regardless of scroll position. */
791
+ .codeblock-wrap {
792
+ position: relative;
793
+ }
794
+
795
+ .codeblock-lang {
796
+ font-family: var(--code-font);
797
+ font-size: 0.72em;
798
+ background: var(--color-code-lang-bg);
799
+ color: var(--dita-fg);
800
+ padding: 0.1em 0.5em;
801
+ border-radius: 0 3px 0 3px;
802
+ position: absolute;
803
+ top: 0;
804
+ right: 0;
805
+ pointer-events: none;
806
+ }
807
+
808
+ code {
809
+ font-family: var(--code-font);
810
+ font-size: 0.9em;
811
+ color: var(--dita-fg);
812
+ background: var(--color-code-bg);
813
+ padding: 0.15em 0.3em;
814
+ border-radius: 3px;
815
+ }
816
+
817
+ pre code { background: none; padding: 0; border-radius: 0; }
818
+
819
+ /* Links */
820
+ .xref { color: var(--color-link); text-decoration: none; }
821
+ .xref:hover { text-decoration: underline; }
822
+ .xref-external { font-style: italic; font-size: 0.9em; opacity: 0.7; }
823
+ .link { color: var(--color-link); text-decoration: none; }
824
+ .link:hover { text-decoration: underline; }
825
+
826
+ /* Inline formatting */
827
+ .keyword { font-weight: 500; }
828
+ .term { font-style: italic; border-bottom: 1px dotted; }
829
+ /* Phrase span only: the highlight domain (b/i/u/tt/sup/sub/line-through/overline) now also carries the html5 `ph` token and must not be dimmed. overline is the one hi-d member rendered as a <span>, so it is excluded here too. */
830
+ span.ph:not(.unresolved-keyref):not(.overline) { opacity: 0.8; }
831
+ .overline { text-decoration: overline; }
832
+ .unresolved-keyref { opacity: 1; color: #e67e22; border: 1px dashed #e67e22; padding: 0 0.3em; border-radius: 3px; cursor: help; }
833
+
834
+ /* User Interface domain */
835
+ .uicontrol { font-weight: 500; color: var(--dita-link); }
836
+ .menucascade .uicontrol + .uicontrol::before { content: ' › '; color: var(--color-menucascade-arrow); font-weight: normal; }
837
+ .wintitle { font-style: italic; font-weight: 600; }
838
+ .filepath { font-family: var(--code-font); font-size: 0.9em; padding: 0.1em 0.3em; background: var(--color-code-bg); border-radius: 3px; color: var(--dita-fg); }
839
+ .userinput { font-family: var(--code-font); font-size: 0.9em; padding: 0.1em 0.3em; background: var(--color-code-bg); border-radius: 3px; border: 1px dashed var(--color-border); color: var(--dita-fg); }
840
+ .systemoutput { font-family: var(--code-font); font-size: 0.9em; padding: 0.1em 0.3em; background: var(--color-code-bg); border-radius: 3px; color: var(--dita-fg); }
841
+ .apiname { font-family: var(--code-font); font-size: 0.9em; font-weight: 500; }
842
+ .parmname { font-family: var(--code-font); font-size: 0.9em; font-style: italic; }
843
+ .option { font-family: var(--code-font); font-size: 0.9em; color: var(--color-link); }
844
+ .cmdname { font-family: var(--code-font); font-size: 0.9em; font-weight: 600; }
845
+ .varname { font-family: var(--code-font); font-size: 0.9em; font-style: italic; color: var(--color-link); }
846
+ .msgnum { font-family: var(--code-font); font-size: 0.85em; padding: 0.1em 0.3em; border: 1px solid var(--color-border); border-radius: 3px; }
847
+ /* msgph: the variable/substitutable portion of a message (OASIS DITA 1.3.2,
848
+ sec. 3.2.7.2) -- semantically a varname-like placeholder embedded in
849
+ message text, not plain prose. Previously fell through to no dedicated
850
+ rule and rendered indistinguishable from surrounding text. */
851
+ .msgph { font-family: var(--code-font); font-size: 0.9em; font-style: italic; padding: 0 0.2em; color: var(--color-link); }
852
+
853
+ /* Programming domain */
854
+ .codeph { font-family: var(--code-font); font-size: 0.9em; background: var(--color-code-bg); padding: 0.1em 0.3em; border-radius: 3px; color: var(--dita-fg); }
855
+ .synph { font-family: var(--code-font); font-size: 0.9em; }
856
+ .kwd { font-weight: 600; font-family: var(--code-font); }
857
+ .var { font-style: italic; font-family: var(--code-font); }
858
+ .oper { font-weight: 600; color: var(--color-link); }
859
+ .sep { color: var(--color-border); }
860
+ .delim { font-weight: 600; color: var(--color-link); }
861
+ .syntaxdiagram { border: 1px solid var(--color-border); border-radius: 4px; padding: 1rem; margin: 1rem 0; overflow-x: auto; }
862
+ .synblk { background: var(--color-code-bg); color: var(--dita-fg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.75rem; margin: 0.5rem 0; overflow-x: auto; font-family: var(--code-font); font-size: 0.9em; }
863
+ .synnote { font-size: 0.9em; margin: 0.5rem 0; padding: 0.5rem; border-left: 3px solid var(--color-border); }
864
+ .fragment { font-family: var(--code-font); font-size: 0.9em; }
865
+ .fragref { font-family: var(--code-font); font-size: 0.9em; color: var(--color-link); }
866
+
867
+ /* Software domain */
868
+ .screen { background: var(--color-code-bg); color: var(--dita-fg); border: 1px solid var(--color-border); border-radius: 4px; padding: 1rem; overflow-x: auto; font-family: var(--code-font); font-size: 0.9em; line-height: 1.5; white-space: pre-wrap; }
869
+ .msgph { font-family: var(--code-font); font-size: 0.9em; }
870
+ .msgblock { background: var(--color-code-bg); color: var(--dita-fg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.75rem; font-family: var(--code-font); font-size: 0.9em; white-space: pre-wrap; }
871
+
872
+ /* Body elements */
873
+ .lines { background: var(--color-code-bg); color: var(--dita-fg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0.75rem 1rem; font-family: var(--code-font); font-size: 0.9em; line-height: 1.5; white-space: pre-wrap; }
874
+ .fn { font-size: 0.75em; vertical-align: super; cursor: help; color: var(--color-link); }
875
+ cite { font-style: italic; }
876
+ .boolean { font-family: var(--code-font); font-size: 0.9em; font-weight: 500; }
877
+ .tm { font-size: 0.75em; vertical-align: super; }
878
+ .body-div { margin: 0.75rem 0; }
879
+ .section-div { margin: 0.75rem 0; }
880
+ .figgroup { margin: 0.75rem 0; }
881
+
882
+ /* Parameter lists */
883
+ .parml { margin: 1em 0; }
884
+ .plentry { margin: 0.5em 0; }
885
+ .pt { font-weight: 600; font-family: var(--code-font); font-size: 0.95em; margin-top: 0.5em; }
886
+ .pd { margin-left: 1.5em; }
887
+
888
+ /* Abbreviation / Glossary */
889
+ .abbreviated-form { border-bottom: 1px dotted var(--color-border); cursor: help; }
890
+ .glossterm { font-weight: 600; font-style: italic; }
891
+ .glossdef { margin-left: 1.5em; }
892
+ .glossentry { margin: 1em 0; }
893
+
894
+ /* Hazard */
895
+ .hazardstatement { border-left: 4px solid var(--color-danger-border); background: var(--color-danger-bg); color: var(--dita-fg); padding: 0.75rem 1rem; margin: 1rem 0; border-radius: 0 4px 4px 0; }
896
+ .typeofhazard { font-weight: 600; color: var(--color-danger-border); }
897
+ .howtoavoid { margin: 0.5rem 0; }
898
+ .consequence { margin: 0.5rem 0; }
899
+
900
+ /* Other */
901
+
902
+ /* Related links */
903
+ .related-links { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }
904
+ .related-links h2 { font-size: 1.1em; margin-top: 0; }
905
+
906
+ /* Quotes */
907
+ blockquote { border-left: 3px solid var(--color-border); margin: 1rem 0; padding: 0.5rem 1rem; font-style: italic; }
908
+ q { font-style: italic; }
909
+
910
+ /* Section spacing */
911
+ section, .example { margin: 1.5rem 0; }
912
+
913
+ /* ── DITAMAP tree view ── */
914
+
915
+ .ditamap-container {
916
+ padding: 0 0.5rem;
917
+ }
918
+
919
+ .map-title {
920
+ font-size: 1.6em;
921
+ font-weight: 600;
922
+ margin: 0 0 1rem 0;
923
+ padding-bottom: 0.3em;
924
+ border-bottom: 2px solid var(--color-border);
925
+ }
926
+
927
+ /* BookMap title page: mainbooktitle headline with booktitlealt/subtitle beneath */
928
+ .book-titlepage {
929
+ margin: 0 0 1.25rem 0;
930
+ padding-bottom: 0.4em;
931
+ border-bottom: 2px solid var(--color-border);
932
+ }
933
+
934
+ .book-titlepage .map-title {
935
+ margin: 0;
936
+ padding-bottom: 0;
937
+ border-bottom: none;
938
+ font-size: 1.9em;
939
+ }
940
+
941
+ .book-subtitle {
942
+ margin: 0.2em 0 0 0;
943
+ font-size: 1.05em;
944
+ font-style: italic;
945
+ opacity: 0.75;
946
+ }
947
+
948
+ /* ── Book view: a whole .ditamap's topics on one page ── */
949
+
950
+ .dita-book {
951
+ padding: 0 0.5rem;
952
+ }
953
+
954
+ .dita-book-titlepage {
955
+ margin: 0 0 2rem 0;
956
+ }
957
+
958
+ .dita-book-title {
959
+ margin: 0;
960
+ font-size: 1.9em;
961
+ font-weight: 600;
962
+ }
963
+
964
+ .dita-book-topic {
965
+ margin: 0 0 2.5rem 0;
966
+ padding-bottom: 2rem;
967
+ border-bottom: 1px solid var(--dita-border, currentColor);
968
+ }
969
+
970
+ .dita-book-topic:last-child {
971
+ border-bottom: none;
972
+ }
973
+
974
+ /* BookMap division label above a topic's own title ("Chapter 1", "第 1 章"). */
975
+ .dita-book-role {
976
+ margin: 0 0 0.35rem 0;
977
+ font-size: 0.78em;
978
+ font-weight: 600;
979
+ letter-spacing: 0.05em;
980
+ text-transform: uppercase;
981
+ color: var(--dita-fg-muted, inherit);
982
+ }
983
+
984
+ .dita-book-division {
985
+ margin: 2.5rem 0 1rem 0;
986
+ }
987
+
988
+ .dita-book-division-title {
989
+ margin: 0;
990
+ }
991
+
992
+ .dita-book-missing,
993
+ .dita-book-error {
994
+ margin: 1rem 0;
995
+ padding: 0.5rem 0.75rem;
996
+ border-left: 3px solid var(--dita-border, currentColor);
997
+ color: var(--dita-fg-muted, inherit);
998
+ }
999
+
1000
+ /* ── Site view: one topic per page, with a host-rendered sidebar ── */
1001
+
1002
+ /* One page beside a sidebar is not a full-pane reading page: start it at the
1003
+ same top padding as the host's sidebar header instead of the 2rem reading
1004
+ padding on .dita-body, so the page and sidebar line up. */
1005
+ .dita-body.dita-body--site {
1006
+ padding-top: 0.75rem;
1007
+ }
1008
+
1009
+ .dita-site-page {
1010
+ padding: 0 0.5rem;
1011
+ }
1012
+
1013
+ /* BookMap division label above the page's own title ("Chapter 1", "第 1 章"). */
1014
+ .dita-site-role {
1015
+ margin: 0 0 0.35rem 0;
1016
+ font-size: 0.78em;
1017
+ font-weight: 600;
1018
+ letter-spacing: 0.05em;
1019
+ text-transform: uppercase;
1020
+ color: var(--dita-fg-muted, inherit);
1021
+ }
1022
+
1023
+ .dita-site-empty,
1024
+ .dita-site-missing,
1025
+ .dita-site-error {
1026
+ margin: 1rem 0;
1027
+ padding: 0.5rem 0.75rem;
1028
+ border-left: 3px solid var(--dita-border, currentColor);
1029
+ color: var(--dita-fg-muted, inherit);
1030
+ }
1031
+
1032
+ .dita-site-missing code {
1033
+ background: var(--dita-code-inline-bg, var(--dita-code-bg, transparent));
1034
+ color: inherit;
1035
+ }
1036
+
1037
+ .map-tree {
1038
+ list-style: none;
1039
+ padding-left: 1.2em;
1040
+ margin: 0.25em 0;
1041
+ }
1042
+
1043
+ .map-tree--inline {
1044
+ padding-left: 0;
1045
+ }
1046
+
1047
+ .map-tree-item {
1048
+ margin: 0.15em 0;
1049
+ padding: 0.25em 0.4em;
1050
+ }
1051
+
1052
+ .map-tree-item--nav {
1053
+ cursor: pointer;
1054
+ border-radius: 4px;
1055
+ margin-left: -0.4em;
1056
+ transition: background-color 0.1s ease;
1057
+ }
1058
+
1059
+ .map-tree-item--nav:hover {
1060
+ background-color: var(--dita-hover-bg, rgba(128, 128, 128, 0.1));
1061
+ }
1062
+
1063
+ .map-tree-item--keydef {
1064
+ opacity: 0.7;
1065
+ }
1066
+
1067
+ .map-tree-item--head {
1068
+ font-weight: 600;
1069
+ }
1070
+
1071
+ .map-tree-item--group {
1072
+ border-left: 2px solid var(--color-border);
1073
+ padding-left: 0.5em;
1074
+ }
1075
+
1076
+ .map-tree-icon {
1077
+ margin-right: 0.35em;
1078
+ font-size: 0.9em;
1079
+ user-select: none;
1080
+ }
1081
+
1082
+ /* BookMap role badge (Chapter / Appendix / Part …) */
1083
+ .map-tree-badge {
1084
+ display: inline-block;
1085
+ margin-right: 0.45em;
1086
+ padding: 0.05em 0.45em;
1087
+ border-radius: 3px;
1088
+ font-size: 0.72em;
1089
+ font-weight: 600;
1090
+ letter-spacing: 0.03em;
1091
+ text-transform: uppercase;
1092
+ color: var(--color-link);
1093
+ border: 1px solid currentColor;
1094
+ opacity: 0.85;
1095
+ vertical-align: 0.1em;
1096
+ user-select: none;
1097
+ }
1098
+
1099
+ .map-tree-link {
1100
+ color: var(--color-link);
1101
+ text-decoration: none;
1102
+ display: inline-flex;
1103
+ align-items: center;
1104
+ }
1105
+
1106
+ .map-tree-link:hover {
1107
+ text-decoration: underline;
1108
+ }
1109
+
1110
+ .map-tree-label {
1111
+ vertical-align: middle;
1112
+ }
1113
+
1114
+ .map-tree-label--keydef {
1115
+ font-style: italic;
1116
+ color: var(--dita-fg);
1117
+ }
1118
+
1119
+ .map-tree-label--head {
1120
+ font-weight: 600;
1121
+ }
1122
+
1123
+ /* Reltable */
1124
+ .map-reltable {
1125
+ margin-top: 1.5rem;
1126
+ padding-top: 1rem;
1127
+ border-top: 1px solid var(--color-border);
1128
+ }
1129
+
1130
+ .map-reltable-title {
1131
+ font-size: 1.1em;
1132
+ margin: 0 0 0.5rem 0;
1133
+ }
1134
+
1135
+ .map-reltable-table {
1136
+ width: 100%;
1137
+ border-collapse: collapse;
1138
+ }
1139
+
1140
+ .relheader th {
1141
+ font-weight: 600;
1142
+ background: var(--color-code-bg);
1143
+ color: var(--dita-fg);
1144
+ padding: 0.4rem 0.6rem;
1145
+ border: 1px solid var(--color-border);
1146
+ }
1147
+
1148
+ .relrow td {
1149
+ padding: 0.4rem 0.6rem;
1150
+ border: 1px solid var(--color-border);
1151
+ }
1152
+
1153
+ .relcell-content {
1154
+ display: block;
1155
+ }
1156
+
1157
+ } /* @layer dv-base */