@fest-lib/fl-ui 0.1.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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/dist/assets/OPFS.uniform.worker-Ddx6J_37.js +2982 -0
  4. package/dist/fl-ui.js +16004 -0
  5. package/dist/font-registry-BWosB92f.js +271 -0
  6. package/package.json +104 -0
  7. package/src/styles/font-loader.ts +224 -0
  8. package/src/styles/font-registry.ts +275 -0
  9. package/src/styles/fonts/_index.scss +8 -0
  10. package/src/styles/fonts/_inter.scss +171 -0
  11. package/src/styles/index.scss +2 -0
  12. package/src/styles/index.ts +33 -0
  13. package/src/styles/layers.scss +1 -0
  14. package/src/styles/patch-global-native-controls.scss +13 -0
  15. package/src/styles/scripts/encode-fonts.ts +172 -0
  16. package/src/styles/skins/thin/Thin.ts +13 -0
  17. package/src/styles/ui/_bar.scss +271 -0
  18. package/src/styles/ui/_buttons.scss +215 -0
  19. package/src/styles/ui/_color.scss +3 -0
  20. package/src/styles/ui/_colorize.scss +5 -0
  21. package/src/styles/ui/_content.scss +169 -0
  22. package/src/styles/ui/_essentials-options.scss +2 -0
  23. package/src/styles/ui/_essentials.scss +705 -0
  24. package/src/styles/ui/_explorer-content.scss +362 -0
  25. package/src/styles/ui/_explorer.scss +237 -0
  26. package/src/styles/ui/_forms-bare-host-elements.scss +25 -0
  27. package/src/styles/ui/_forms-options.scss +2 -0
  28. package/src/styles/ui/_forms.scss +280 -0
  29. package/src/styles/ui/_forms_misc.scss +201 -0
  30. package/src/styles/ui/_gridbox.scss +298 -0
  31. package/src/styles/ui/_home-host.scss +179 -0
  32. package/src/styles/ui/_index.scss +22 -0
  33. package/src/styles/ui/_launcher-typography.scss +31 -0
  34. package/src/styles/ui/_layers.scss +48 -0
  35. package/src/styles/ui/_layout.scss +3 -0
  36. package/src/styles/ui/_markdown.scss +1636 -0
  37. package/src/styles/ui/_modal.scss +258 -0
  38. package/src/styles/ui/_motion.scss +3 -0
  39. package/src/styles/ui/_native-host-button-chrome.scss +31 -0
  40. package/src/styles/ui/_orientation-functions.scss +274 -0
  41. package/src/styles/ui/_orientbox.scss +97 -0
  42. package/src/styles/ui/_scrollbar.scss +257 -0
  43. package/src/styles/ui/_shared-overlays.scss +16 -0
  44. package/src/styles/ui/_sidebar.scss +477 -0
  45. package/src/styles/ui/_speed-dial.scss +47 -0
  46. package/src/styles/ui/_tables.scss +28 -0
  47. package/src/styles/ui/_tabs.scss +406 -0
  48. package/src/styles/ui/_taskbar.scss +215 -0
  49. package/src/styles/ui/_toolbars.scss +165 -0
  50. package/src/styles/ui/_typography.scss +11 -0
  51. package/src/styles/ui/_utils.scss +8 -0
  52. package/src/styles/ui/_variables.scss +45 -0
  53. package/src/styles/ui/_viewport.scss +469 -0
  54. package/src/styles/ui/_window-frame.scss +658 -0
  55. package/src/styles/ui/home-host-apply.scss +10 -0
@@ -0,0 +1,1636 @@
1
+ /* stylelint-disable scss/at-else-empty-line-before */
2
+ /* stylelint-disable at-rule-empty-line-before */
3
+
4
+ /*
5
+ * markdown-viewer.scss — optimized/refactored
6
+ *
7
+ * Стратегия:
8
+ * - @layer: tokens → markdown → overrides → print → print-breaks
9
+ * (каждый следующий слой побеждает предыдущий без !important)
10
+ * - light-dark() + color-scheme: inherit — вместо двух @media prefers-color-scheme
11
+ * - @each по SCSS-map для heading-размеров (одно место правды)
12
+ * - %img-align placeholder — устраняет 7-кратный повтор [align] / [width] / [height]
13
+ * - @mixin img-base / code-reset / print-reset — DRY для print/screen
14
+ * - container queries вместо @media width там, где поддерживается
15
+ * - logical properties везде (inline-size, block-size, inset-*)
16
+ * - color-mix(in oklab, …) для полупрозрачных границ
17
+ * - print: grayscale через filter: grayscale(1) только на img/svg
18
+ * - !important только там, где реально нужно бороться с внешним JS-стилем
19
+ */
20
+
21
+ @use "../../../../veela.css/src/scss/core/misc/config" as config;
22
+ @use "../../../../veela.css/src/scss/core/misc/tokens" as tokens;
23
+ @use "../../../../veela.css/src/scss/core/misc/mixins" as mixins;
24
+
25
+ @use "sass:map";
26
+ @use "sass:list";
27
+ @import "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";
28
+ @layer tokens, markdown, overrides, print, print-breaks;
29
+
30
+ /* ─── Animations ──────────────────────────────────────────────────────────── */
31
+
32
+ @keyframes spin {
33
+ to {
34
+ transform: rotate(360deg);
35
+ }
36
+ }
37
+
38
+ @keyframes fade-in {
39
+ from {
40
+ opacity: 0;
41
+ translate: 0 10px;
42
+ }
43
+
44
+ to {
45
+ opacity: 1;
46
+ }
47
+ }
48
+
49
+ /* ─── Page ────────────────────────────────────────────────────────────────── */
50
+
51
+ @page {
52
+ size: a4;
53
+ margin: #{config.md-config("page", "margin")};
54
+
55
+ @bottom-center {
56
+ content: counter(page);
57
+ font-family: var(--print-font-family-sans);
58
+ font-size: 10pt;
59
+ }
60
+
61
+ @top-right {
62
+ content: "UC";
63
+ font-family: var(--print-font-family-sans);
64
+ font-size: 10pt;
65
+ }
66
+ }
67
+
68
+ @page :first {
69
+ margin-block: 2cm 2.5cm;
70
+ margin-inline: 2cm;
71
+ }
72
+
73
+ @page :left {
74
+ margin-inline: 2cm;
75
+ }
76
+
77
+ @page :right {
78
+ margin-inline: 2cm;
79
+ }
80
+
81
+ /* Named pages */
82
+ @page narrow {
83
+ size: a5 portrait;
84
+ margin: 1.5cm;
85
+ }
86
+
87
+ @page wide {
88
+ size: a4 landscape;
89
+ margin: 2cm;
90
+ }
91
+
92
+ @page letter {
93
+ size: letter;
94
+ margin: 2.5cm 2cm;
95
+ }
96
+
97
+ @page legal {
98
+ size: legal;
99
+ margin: 2.5cm 2cm;
100
+ }
101
+
102
+ @page professional {
103
+ size: a4;
104
+ margin: 2.5cm 2cm;
105
+ marks: crop cross;
106
+ bleed: .25cm;
107
+ }
108
+
109
+ @page booklet {
110
+ size: a5;
111
+ margin: 1.5cm;
112
+ }
113
+
114
+ @page draft {
115
+ size: a4;
116
+ margin: 2cm 1.5cm;
117
+ }
118
+
119
+ /* ─── Local helpers (file-scope) ──────────────────────────────────────────── */
120
+
121
+ /* Heading sizes: одна точка правды */
122
+ $_h-sizes: (
123
+ h1: (screen: 2em, print: 2em),
124
+ h2: (screen: 1.5em, print: 1.5em),
125
+ h3: (screen: 1.25em, print: 1.25em),
126
+ h4: (screen: 1em, print: 1em),
127
+ h5: (screen: .875em, print: .875em),
128
+ h6: (screen: .85em, print: .85em),
129
+ );
130
+
131
+ /* Placeholder: img [align] / [width] / [height] */
132
+ %img-align {
133
+ &[align="right"] {
134
+ margin-inline-start: auto;
135
+ padding-inline-start: 20px;
136
+ }
137
+
138
+ &[align="left"] {
139
+ margin-inline-end: auto;
140
+ padding-inline-end: 20px;
141
+ }
142
+
143
+ &[align="center"] {
144
+ margin-inline: auto;
145
+ }
146
+
147
+ &[width] {
148
+ inline-size: attr(width px, auto);
149
+ }
150
+
151
+ &[height] {
152
+ block-size: attr(height px, auto);
153
+ }
154
+ }
155
+
156
+ /* Mixin: базовые img-свойства */
157
+ @mixin img-base($margin: var(--space-lg) 0, $radius: var(--radius-md)) {
158
+ max-inline-size: stretch;
159
+ inline-size: fit-content;
160
+ block-size: auto;
161
+ object-fit: contain;
162
+ object-position: center;
163
+ margin: $margin;
164
+ border-radius: $radius;
165
+
166
+ @extend %img-align;
167
+ }
168
+
169
+ /* Mixin: сброс code внутри pre */
170
+ @mixin code-in-pre {
171
+ padding: 0;
172
+ margin: 0;
173
+ background: transparent;
174
+ border: 0;
175
+ border-radius: 0;
176
+ font-size: inherit;
177
+ color: inherit;
178
+ white-space: pre;
179
+ word-wrap: normal;
180
+ block-size: max-content !important;
181
+ max-block-size: none !important;
182
+ inline-size: stretch;
183
+ max-inline-size: stretch;
184
+ min-inline-size: fit-content;
185
+ overflow: hidden !important;
186
+ overflow-inline: hidden !important;
187
+ overflow-block: hidden !important;
188
+ content-visibility: visible !important;
189
+ contain: none !important;
190
+ position: relative !important;
191
+ }
192
+
193
+ /* Mixin: md-vars (CSS custom properties для цветовой схемы) */
194
+ @mixin md-vars($mode: auto) {
195
+ @if $mode == auto {
196
+ --md-fg-default: #{config.md-light-dark("text")};
197
+ --md-fg-muted: #{config.md-light-dark("text-muted")};
198
+ --md-fg-accent: #{config.md-light-dark("accent")};
199
+ --md-bg-default: #{config.md-light-dark("bg")};
200
+ --md-bg-subtle: #{config.md-light-dark("bg-subtle")};
201
+ --md-bg-code: #{config.md-light-dark("code-bg")};
202
+ --md-border-default: #{config.md-light-dark("border")};
203
+ --md-border-subtle: #{config.md-light-dark("border-subtle")};
204
+ }
205
+
206
+ @else {
207
+ --md-fg-default: #{config.md-color("text", $mode)};
208
+ --md-fg-muted: #{config.md-color("text-muted", $mode)};
209
+ --md-fg-accent: #{config.md-color("accent", $mode)};
210
+ --md-bg-default: #{config.md-color("bg", $mode)};
211
+ --md-bg-subtle: #{config.md-color("bg-subtle", $mode)};
212
+ --md-bg-code: #{config.md-color("code-bg", $mode)};
213
+ --md-border-default: #{config.md-color("border", $mode)};
214
+ --md-border-subtle: #{config.md-color("border-subtle", $mode)};
215
+ }
216
+
217
+ --md-font-body: #{config.md-config("font", "body")};
218
+ --md-font-mono: #{config.md-config("font", "mono")};
219
+ --md-radius: #{config.md-config("shape", "border-radius")};
220
+ }
221
+
222
+ /* ═══════════════════════════════════════════════════════════════════════════
223
+ LAYER: tokens
224
+ ═══════════════════════════════════════════════════════════════════════════ */
225
+
226
+ @layer tokens {
227
+
228
+ :root,
229
+ :host,
230
+ :scope {
231
+ --print-font-family: var(--font-family-serif,
232
+ "Times New Roman", "Liberation Serif", "Noto Serif", serif);
233
+ --print-font-family-sans: var(--font-family-sans,
234
+ "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
235
+ --print-font-mono: var(--font-family-mono,
236
+ "Monaco", "Menlo", "Ubuntu Mono", "Liberation Mono", monospace);
237
+
238
+ --print-text-color: light-dark(#1a1a1a, #f3f4f6);
239
+ --print-bg: light-dark(#fff, #111827);
240
+ --print-border-color: light-dark(#d1d5db, #374151);
241
+ --print-link-color: light-dark(#2563eb, #60a5fa);
242
+ }
243
+ }
244
+
245
+ /* ═══════════════════════════════════════════════════════════════════════════
246
+ LAYER: markdown (screen + shared)
247
+ ═══════════════════════════════════════════════════════════════════════════ */
248
+
249
+ @layer markdown {
250
+
251
+ /* Токены корневого элемента */
252
+ @include tokens.markdown-root-props();
253
+
254
+ @media print {
255
+ /* ── html / body ── */
256
+ :where(html, body):has(:where(#{tokens.$selectors}):not([hidden])) {
257
+ box-sizing: border-box;
258
+ margin: 0;
259
+ padding: 0;
260
+ inline-size: 100%;
261
+ block-size: max-content;
262
+ min-block-size: max(100%, 100cqb);
263
+ max-block-size: none;
264
+ overflow: auto;
265
+ background-color: transparent;
266
+ color-scheme: inherit;
267
+ display: block;
268
+ container-type: inline-size;
269
+ touch-action: manipulation;
270
+ user-select: text;
271
+
272
+ *,
273
+ *::before,
274
+ *::after {
275
+ box-sizing: border-box;
276
+ }
277
+ }
278
+ }
279
+
280
+ /* ── Корневой markdown-контейнер ── */
281
+ :where(#{tokens.$selectors}):not(.katex, .footnote-ref, .footnote-backref) {
282
+ @include md-vars(auto);
283
+ @include mixins.md-surface-root(start);
284
+ @include mixins.md-scrollbars();
285
+
286
+ color-scheme: inherit;
287
+ font-family: var(--md-font-body, var(--print-font-family));
288
+ font-size: #{config.md-config("font", "size-base")};
289
+ line-height: #{config.md-config("layout", "line-height")};
290
+ font-weight: 400;
291
+ color: var(--md-fg-default);
292
+
293
+ display: flex;
294
+ flex: 1;
295
+ flex-direction: column;
296
+ block-size: stretch;
297
+ overflow: auto;
298
+ padding: var(--space-2xl) var(--space-xl);
299
+ background: var(--color-surface);
300
+ box-shadow: none;
301
+ transition: box-shadow var(--motion-normal);
302
+ overflow-wrap: break-word;
303
+ word-wrap: break-word;
304
+ text-rendering: optimizeLegibility;
305
+ -webkit-font-smoothing: antialiased;
306
+ -moz-osx-font-smoothing: grayscale;
307
+ text-align: start;
308
+ contain: inline-size layout paint style;
309
+ container-type: inline-size;
310
+ isolation: isolate;
311
+ box-shadow: none !important;
312
+
313
+ &, & * {
314
+ user-select: auto;
315
+ -webkit-user-drag: none;
316
+ -webkit-touch-callout: default;
317
+ -webkit-tap-highlight-color: transparent;
318
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
319
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
320
+ }
321
+
322
+ &:hover {
323
+ box-shadow: var(--elev-2);
324
+ }
325
+
326
+ &:focus-within {
327
+ outline: none;
328
+ box-shadow: var(--focus-ring, var(--elev-2));
329
+ }
330
+
331
+ @container (max-inline-size: 768px) {
332
+ border-radius: var(--radius-lg);
333
+ box-shadow: none;
334
+ padding: var(--space-xl) var(--space-lg);
335
+ }
336
+
337
+ /* ── Headings ── */
338
+ h1,
339
+ h2,
340
+ h3,
341
+ h4,
342
+ h5,
343
+ h6 {
344
+ margin-block: 1.5em .5em;
345
+ font-weight: 600;
346
+ line-height: 1.25;
347
+ color: var(--md-fg-default);
348
+ letter-spacing: -.015em;
349
+
350
+ &:first-child {
351
+ margin-block-start: 0;
352
+ }
353
+
354
+ tt,
355
+ code {
356
+ font-size: inherit;
357
+ font-family: var(--md-font-mono);
358
+ }
359
+ }
360
+
361
+ /* Генерируем font-size для каждого уровня из одной map */
362
+ @each $tag, $sizes in $_h-sizes {
363
+ #{$tag} {
364
+ font-size: map.get($sizes, screen);
365
+ }
366
+ }
367
+
368
+ h1,
369
+ h2 {
370
+ padding-block-end: .3em;
371
+ border-block-end: 1px solid var(--md-border-subtle);
372
+ }
373
+
374
+ h6 {
375
+ color: var(--md-fg-muted);
376
+ }
377
+
378
+ /* ── Paragraph ── */
379
+ p {
380
+ margin-block: 0 1rem;
381
+
382
+ &:last-child {
383
+ margin-block-end: 0;
384
+ }
385
+ }
386
+
387
+ /* ── Links ── */
388
+ a {
389
+ color: var(--md-fg-accent);
390
+ text-decoration: underline;
391
+ text-decoration-thickness: 1px;
392
+ text-underline-offset: 2px;
393
+ background-color: transparent;
394
+ transition: color var(--motion-fast), text-decoration-thickness var(--motion-fast);
395
+
396
+ &:hover {
397
+ text-decoration-thickness: 2px;
398
+ }
399
+
400
+ &:not([href]) {
401
+ color: inherit;
402
+ text-decoration: none;
403
+ }
404
+
405
+ &:focus-visible {
406
+ outline: none;
407
+ border-radius: var(--radius-sm);
408
+ box-shadow: var(--focus-ring);
409
+ }
410
+ }
411
+
412
+ /* ── Lists ── */
413
+ ul,
414
+ ol {
415
+ margin-block: 0 1rem;
416
+ padding-inline-start: 2em;
417
+
418
+ ol,
419
+ ul {
420
+ margin-block: 0;
421
+ }
422
+
423
+ @container (max-inline-size: 480px) {
424
+ padding-inline-start: var(--space-xl);
425
+ }
426
+ }
427
+
428
+ li {
429
+ word-break: normal;
430
+ overflow-wrap: break-word;
431
+ margin-block-end: .25em;
432
+
433
+ &:last-child {
434
+ margin-block-end: 0;
435
+ }
436
+
437
+ & + li {
438
+ margin-block-start: .25em;
439
+ }
440
+
441
+ & > p {
442
+ margin-block-start: 1rem;
443
+ }
444
+ }
445
+
446
+ ul {
447
+ list-style-type: disc;
448
+
449
+ ul {
450
+ list-style-type: circle;
451
+
452
+ ul {
453
+ list-style-type: square;
454
+ }
455
+ }
456
+ }
457
+
458
+ ol {
459
+ list-style-type: decimal;
460
+
461
+ &[type="a"] {
462
+ list-style-type: lower-alpha;
463
+ }
464
+
465
+ &[type="A"] {
466
+ list-style-type: upper-alpha;
467
+ }
468
+
469
+ &[type="i"] {
470
+ list-style-type: lower-roman;
471
+ }
472
+
473
+ &[type="I"] {
474
+ list-style-type: upper-roman;
475
+ }
476
+ }
477
+
478
+ /* ── Blockquote ── */
479
+ blockquote {
480
+ margin: 0 0 1rem;
481
+ padding: 0 1em;
482
+ color: var(--md-fg-muted);
483
+ border-inline-start: .25em solid var(--md-border-default);
484
+ font-style: italic;
485
+
486
+ & > :first-child {
487
+ margin-block-start: 0;
488
+ }
489
+
490
+ & > :last-child {
491
+ margin-block-end: 0;
492
+ }
493
+ }
494
+
495
+ /* ── Code & Pre ── */
496
+ code,
497
+ kbd,
498
+ pre,
499
+ samp,
500
+ tt {
501
+ font-family: var(--md-font-mono);
502
+ font-size: 1em;
503
+ }
504
+
505
+ code:not(pre code),
506
+ tt:not(pre tt),
507
+ samp:not(pre samp) {
508
+ padding: .2em .4em;
509
+ font-size: 85%;
510
+ background-color: var(--md-bg-code);
511
+ border-radius: 6px;
512
+ }
513
+
514
+ pre {
515
+ flex-grow: 1 !important;
516
+ flex-shrink: 0 !important;
517
+ flex-basis: max-content !important;
518
+ margin-block: 0 1rem;
519
+ padding: 1rem;
520
+ font-size: 85%;
521
+ line-height: 1.45;
522
+ background-color: var(--md-bg-code);
523
+ border-radius: 6px;
524
+ inline-size: stretch;
525
+ max-inline-size: stretch;
526
+ block-size: max-content !important;
527
+ max-block-size: none !important;
528
+ min-block-size: max(100%, 100cqb) !important;
529
+ min-inline-size: fit-content;
530
+ overflow: hidden !important;
531
+ overflow-inline: hidden !important;
532
+ overflow-block: hidden !important;
533
+ content-visibility: visible !important;
534
+ position: relative !important;
535
+
536
+ code,
537
+ tt {
538
+ @include code-in-pre;
539
+ }
540
+ }
541
+
542
+ /* ── Table ── */
543
+ table {
544
+ display: table;
545
+ inline-size: fit-content;
546
+ max-inline-size: stretch;
547
+ margin-block-end: 1rem;
548
+ border-spacing: 0;
549
+ border-collapse: collapse;
550
+ overflow: auto;
551
+ contain: inline-size layout paint style;
552
+ container-type: inline-size;
553
+ block-size: max-content;
554
+
555
+ tbody,
556
+ thead {
557
+ inline-size: fit-content;
558
+ max-inline-size: stretch;
559
+ block-size: max-content;
560
+ }
561
+
562
+ th,
563
+ td {
564
+ padding: 6px 13px;
565
+ border: 1px solid var(--md-border-default);
566
+ text-align: start;
567
+ vertical-align: top;
568
+ overflow-wrap: break-word;
569
+ overflow: hidden;
570
+ inline-size: fit-content;
571
+ max-inline-size: stretch;
572
+ block-size: max-content;
573
+ }
574
+
575
+ th {
576
+ font-weight: 600;
577
+ background-color: var(--md-bg-subtle);
578
+ block-size: max-content;
579
+ }
580
+
581
+ tr {
582
+ background-color: var(--md-bg-default);
583
+ border-block-start: 1px solid var(--md-border-subtle);
584
+ block-size: max-content;
585
+ &:nth-child(2n) {
586
+ background-color: var(--md-bg-subtle);
587
+ }
588
+ }
589
+
590
+ img {
591
+ @include img-base(0, 0);
592
+
593
+ background-color: transparent;
594
+ }
595
+ }
596
+
597
+ /* ── HR ── */
598
+ hr {
599
+ box-sizing: content-box;
600
+ overflow: hidden;
601
+ margin-block: 24px;
602
+ block-size: .25em;
603
+ padding: 0;
604
+ border: 0;
605
+ background-color: var(--md-border-default);
606
+
607
+ &::before {
608
+ display: table;
609
+ content: "";
610
+ }
611
+
612
+ &::after {
613
+ display: table;
614
+ clear: both;
615
+ content: "";
616
+ }
617
+ }
618
+
619
+ /* ── Images ── */
620
+ img {
621
+ @include img-base();
622
+
623
+ box-sizing: content-box;
624
+ background-color: transparent;
625
+ border-style: none;
626
+ }
627
+
628
+ /* ── KBD ── */
629
+ kbd {
630
+ display: inline-block;
631
+ padding: 3px 5px;
632
+ font-size: 11px;
633
+ line-height: 10px;
634
+ color: var(--md-fg-default);
635
+ vertical-align: middle;
636
+ background-color: var(--md-bg-subtle);
637
+ border: 1px solid var(--md-border-default);
638
+ border-radius: 6px;
639
+ box-shadow: inset 0 -1px 0 var(--md-border-default);
640
+ }
641
+
642
+ /* ── DL ── */
643
+ dl {
644
+ padding: 0;
645
+ margin-block: var(--space-lg) 0;
646
+
647
+ dt {
648
+ padding: 0;
649
+ margin-block-start: 1rem;
650
+ font-size: 1em;
651
+ font-style: italic;
652
+ font-weight: 600;
653
+ color: var(--md-fg-default);
654
+ }
655
+
656
+ dd {
657
+ padding: 0 1rem;
658
+ margin-block-end: 1rem;
659
+ margin-inline-start: 0;
660
+ color: var(--color-on-surface-variant, var(--md-fg-muted));
661
+ }
662
+ }
663
+
664
+ /* ── Details / Summary ── */
665
+ details {
666
+ display: block;
667
+
668
+ summary {
669
+ display: list-item;
670
+ cursor: pointer;
671
+
672
+ h1,
673
+ h2,
674
+ h3,
675
+ h4,
676
+ h5,
677
+ h6 {
678
+ display: inline-block;
679
+ vertical-align: middle;
680
+ margin: 0;
681
+ padding-block-end: 0;
682
+ border-block-end: 0;
683
+ }
684
+ }
685
+ }
686
+
687
+ /* ── Math ── */
688
+ math {
689
+ math-style: compact;
690
+ math-shift: compact;
691
+ math-depth: auto-add;
692
+ inline-size: fit-content;
693
+ max-inline-size: stretch;
694
+ }
695
+
696
+ /* ── Span / SVG ── */
697
+ span {
698
+ inline-size: fit-content;
699
+ max-inline-size: stretch;
700
+ }
701
+
702
+ svg {
703
+ inline-size: fit-content !important;
704
+ max-inline-size: stretch !important;
705
+ contain: strict;
706
+ }
707
+
708
+ /* ── Checkbox ── */
709
+ input[type="checkbox"] {
710
+ margin-inline-end: var(--space-sm);
711
+ accent-color: var(--color-primary, var(--md-fg-accent));
712
+ }
713
+
714
+ /* ── Task list ── */
715
+ .task-list-item {
716
+ list-style-type: none;
717
+
718
+ input[type="checkbox"] {
719
+ margin: 0 .2em .25em -1.6em;
720
+ vertical-align: middle;
721
+ }
722
+ }
723
+
724
+ /* ── Footnotes ── */
725
+ .footnotes {
726
+ margin-block-start: 2rem;
727
+ font-size: .75em;
728
+ color: var(--md-fg-muted);
729
+ border-block-start: 1px solid var(--md-border-default);
730
+
731
+ ol {
732
+ padding-inline-start: 1.5em;
733
+ }
734
+
735
+ li {
736
+ position: relative;
737
+
738
+ &:target {
739
+ color: var(--md-fg-default);
740
+ }
741
+
742
+ &:target::before {
743
+ content: "";
744
+ pointer-events: none;
745
+ position: absolute;
746
+ inset: -8px -8px -8px -24px;
747
+ border: 2px solid var(--md-fg-accent);
748
+ border-radius: 6px;
749
+ }
750
+ }
751
+ }
752
+
753
+ .footnote-ref a {
754
+ color: var(--md-fg-accent);
755
+ font-size: .8em;
756
+ vertical-align: super;
757
+ }
758
+
759
+ /* ── Markdown Alerts ── */
760
+ .markdown-alert {
761
+ margin-block-end: 1rem;
762
+ padding: .5rem 1rem;
763
+ border-inline-start: .25em solid var(--md-border-default);
764
+
765
+ &.markdown-alert-note { border-color: var(--md-fg-accent); }
766
+ &.markdown-alert-important { border-color: #8250df; }
767
+ &.markdown-alert-warning { border-color: #bf8700; }
768
+ &.markdown-alert-tip { border-color: #1a7f37; }
769
+ &.markdown-alert-caution { border-color: #d1242f; }
770
+
771
+ &.markdown-alert-title,
772
+ .markdown-alert-title{
773
+ display: flex;
774
+ align-items: center;
775
+ margin-block-end: .5rem;
776
+ font-weight: 600;
777
+ line-height: 1;
778
+
779
+ .octicon {
780
+ margin-inline-end: .5rem;
781
+ }
782
+ }
783
+ }
784
+
785
+ /* ── Octicon / g-emoji ── */
786
+ .octicon {
787
+ display: inline-block;
788
+ fill: currentColor;
789
+ vertical-align: text-bottom;
790
+ }
791
+
792
+ g-emoji {
793
+ display: inline-block;
794
+ min-inline-size: 1ch;
795
+ font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
796
+ font-size: 1em;
797
+ font-style: normal;
798
+ font-weight: 400;
799
+ line-height: 1;
800
+ vertical-align: -.075em;
801
+
802
+ img {
803
+ inline-size: 1em;
804
+ block-size: 1em;
805
+ object-fit: contain;
806
+ }
807
+ }
808
+
809
+ /* ── Anchor links ── */
810
+ .anchor {
811
+ float: inline-start;
812
+ padding-inline-end: 4px;
813
+ margin-inline-start: -20px;
814
+ line-height: 1;
815
+
816
+ &:focus {
817
+ outline: none;
818
+ }
819
+ }
820
+
821
+ .octicon-link {
822
+ visibility: hidden;
823
+ color: var(--md-fg-muted);
824
+ opacity: .5;
825
+
826
+ &:hover {
827
+ opacity: 1;
828
+ }
829
+ }
830
+
831
+ :is(h1, h2, h3, h4, h5, h6):hover .anchor .octicon-link {
832
+ visibility: visible;
833
+ }
834
+
835
+ /* ── Prettylights (light) ── */
836
+ .pl-c { color: #6e7781; }
837
+ .pl-c1 { color: #0550ae; }
838
+ .pl-k { color: #cf222e; }
839
+ .pl-s { color: #0a3069; }
840
+ .pl-v { color: #953800; }
841
+ .pl-en { color: #8250df; }
842
+
843
+ /* ── KaTeX ── */
844
+ .katex {
845
+ color: var(--md-fg-default);
846
+ font-size: 1.1em;
847
+ text-align: start;
848
+ }
849
+
850
+ /* ── Viewer UI ── */
851
+ .viewer-header {
852
+ display: none;
853
+ }
854
+
855
+ /* скрыт по умолчанию, показывается только на screen */
856
+ }
857
+
858
+ /* ── Viewer components (вне markdown-selector) ── */
859
+ .markdown-viewer-content {
860
+ animation: fade-in .3s ease-out;
861
+ }
862
+
863
+ .markdown-viewer-raw {
864
+ margin: 0;
865
+ padding: var(--space-xl);
866
+ overflow: auto;
867
+ background: var(--color-surface);
868
+ color: var(--color-on-surface);
869
+ font-family: var(--print-font-mono);
870
+ font-size: var(--text-sm, .875rem);
871
+ line-height: 1.5;
872
+ white-space: pre;
873
+ tab-size: 2;
874
+ }
875
+
876
+ .viewer-header {
877
+ display: flex;
878
+ align-items: center;
879
+ justify-content: space-between;
880
+ flex-shrink: 0;
881
+ gap: var(--space-lg);
882
+ padding: var(--space-lg) var(--space-xl);
883
+ background: var(--color-surface-container-high);
884
+
885
+ @container (max-inline-size: 768px) {
886
+ gap: var(--space-md);
887
+ padding: var(--space-md) var(--space-lg);
888
+ }
889
+
890
+ @container (max-inline-size: 480px) {
891
+ flex-direction: column;
892
+ align-items: stretch;
893
+ gap: var(--space-sm);
894
+ }
895
+
896
+ h3 {
897
+ margin: 0;
898
+ font-size: var(--text-xl, 1.25rem);
899
+ font-weight: 600;
900
+ line-height: 1.25;
901
+ letter-spacing: -.025em;
902
+ }
903
+
904
+ .viewer-actions {
905
+ display: flex;
906
+ align-items: center;
907
+ gap: var(--space-sm);
908
+ flex-wrap: wrap;
909
+
910
+ @container (max-inline-size: 360px) {
911
+ overflow-inline: auto;
912
+ overflow-block: hidden;
913
+ padding-block-end: var(--space-xs);
914
+ scrollbar-width: none;
915
+
916
+ &::-webkit-scrollbar {
917
+ display: none;
918
+ }
919
+ }
920
+ }
921
+ }
922
+
923
+ .viewer-btn {
924
+ position: relative;
925
+ display: inline-flex;
926
+ align-items: center;
927
+ gap: var(--space-xs);
928
+ min-block-size: 44px;
929
+ padding: 0px;
930
+ border: none;
931
+ border-radius: var(--radius-lg);
932
+ background: var(--color-surface-container);
933
+ color: var(--color-on-surface);
934
+ font-size: var(--text-sm, .875rem);
935
+ font-weight: 500;
936
+ white-space: nowrap;
937
+ cursor: pointer;
938
+ transition: background var(--motion-fast), box-shadow var(--motion-fast), translate var(--motion-fast);
939
+
940
+ &:hover {
941
+ background: var(--color-surface-container-highest);
942
+ translate: 0 -1px;
943
+ box-shadow: var(--elev-1);
944
+ }
945
+
946
+ &:active {
947
+ translate: 0;
948
+ box-shadow: none;
949
+ }
950
+
951
+ &:focus-visible {
952
+ outline: none;
953
+ box-shadow: var(--focus-ring);
954
+ }
955
+
956
+ &.btn-icon {
957
+ padding: var(--space-sm);
958
+
959
+ ui-icon {
960
+ flex-shrink: 0;
961
+ transition: color var(--motion-fast);
962
+ }
963
+
964
+ &:hover ui-icon {
965
+ color: var(--color-primary);
966
+ }
967
+
968
+ @container (max-inline-size: 640px) {
969
+ padding: var(--space-xs);
970
+
971
+ .btn-text {
972
+ display: none;
973
+ }
974
+ }
975
+ }
976
+
977
+ &.loading {
978
+ opacity: .7;
979
+ pointer-events: none;
980
+
981
+ &::after {
982
+ content: "";
983
+ inline-size: 16px;
984
+ block-size: 16px;
985
+ margin-inline-start: var(--space-xs);
986
+ border: 2px solid transparent;
987
+ border-block-start-color: currentColor;
988
+ border-radius: 50%;
989
+ animation: spin 1s linear infinite;
990
+ }
991
+ }
992
+ }
993
+
994
+ /* Prettylights dark */
995
+ @media (prefers-color-scheme: dark) {
996
+ :where(#{tokens.$selectors}):not(.katex, .footnote-ref, .footnote-backref) {
997
+ .pl-c { color: #8b949e; }
998
+ .pl-c1 { color: #79c0ff; }
999
+ .pl-k { color: #ff7b72; }
1000
+ .pl-s { color: #a5d6ff; }
1001
+ .pl-v { color: #ffa657; }
1002
+ .pl-en { color: #d2a8ff; }
1003
+ }
1004
+ }
1005
+
1006
+ /* ── content-visibility для скрытых/dragging ── */
1007
+ [data-hidden] :where(#{tokens.$selectors}),
1008
+ [data-dragging] :where(#{tokens.$selectors}) {
1009
+ color-scheme: inherit;
1010
+ content-visibility: auto !important;
1011
+ }
1012
+
1013
+ [data-dragging] :where(#{tokens.$selectors}) :where(*) {
1014
+ content-visibility: auto !important;
1015
+ }
1016
+
1017
+ /* ── Наследование children ── */
1018
+ @include mixins.md-children-inherit(":where(#{tokens.$selectors}):not(.katex, .footnote-ref, .footnote-backref) *");
1019
+
1020
+ /* ── Screen: viewer-header показываем ── */
1021
+ @media screen {
1022
+ :where(#{tokens.$selectors}):not(.katex, .footnote-ref, .footnote-backref) {
1023
+ .viewer-header {
1024
+ display: flex;
1025
+ }
1026
+ }
1027
+ }
1028
+ }
1029
+
1030
+ /* ═══════════════════════════════════════════════════════════════════════════
1031
+ LAYER: overrides (screen-specific code colors + KaTeX)
1032
+ ═══════════════════════════════════════════════════════════════════════════ */
1033
+
1034
+ @layer overrides {
1035
+
1036
+ /* KaTeX — вне media, всегда */
1037
+ :is(.katex, .katex:not(:has(math)) *, .katex :not(math) *:not(math)) {
1038
+ font-variant: normal;
1039
+ font-variant-caps: normal;
1040
+ font-variant-ligatures: normal;
1041
+ text-transform: none;
1042
+ font-family: "Noto Sans Math", "Cambria Math", "STIX Two Math", "Latin Modern Math",
1043
+ var(--print-font-family), serif;
1044
+ }
1045
+
1046
+ .katex math {
1047
+ font-variant: normal;
1048
+ font-variant-caps: normal;
1049
+ font-variant-ligatures: normal;
1050
+ text-transform: none;
1051
+ math-style: compact;
1052
+ math-shift: compact;
1053
+ math-depth: auto-add;
1054
+ }
1055
+
1056
+ .footnote-ref,
1057
+ .footnote-backref {
1058
+ font-variant-emoji: text;
1059
+ font-variant-numeric: tabular-nums;
1060
+ font-variant-ligatures: common-ligatures;
1061
+ font-variant-caps: normal;
1062
+ inline-size: fit-content;
1063
+ max-inline-size: stretch;
1064
+ text-align: start;
1065
+
1066
+ * {
1067
+ inline-size: fit-content;
1068
+ max-inline-size: stretch;
1069
+ text-align: start;
1070
+ }
1071
+ }
1072
+
1073
+ @media screen {
1074
+ :where(#{tokens.$selectors}):not(.katex, .footnote-ref, .footnote-backref) {
1075
+ --md-code-inline-bg: color-mix(in oklab, var(--md-bg-code) 88%, var(--md-bg-default));
1076
+ --md-code-inline-fg: var(--md-fg-default);
1077
+ --md-code-block-bg: var(--md-bg-code);
1078
+ --md-code-block-fg: var(--md-fg-default);
1079
+ --md-code-block-border: color-mix(in oklab, var(--md-border-default) 60%, transparent);
1080
+
1081
+ text-rendering: auto;
1082
+ -webkit-font-smoothing: auto;
1083
+ -moz-osx-font-smoothing: auto;
1084
+ color-scheme: inherit !important;
1085
+
1086
+ &, & * {
1087
+ user-select: auto;
1088
+ -webkit-user-drag: none;
1089
+ -webkit-touch-callout: default;
1090
+ -webkit-tap-highlight-color: transparent;
1091
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
1092
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
1093
+ }
1094
+
1095
+ p,
1096
+ li,
1097
+ blockquote,
1098
+ td,
1099
+ th {
1100
+ text-align: start;
1101
+ hyphens: manual;
1102
+ }
1103
+
1104
+ code:not(pre code),
1105
+ tt:not(pre tt),
1106
+ samp:not(pre samp) {
1107
+ background: var(--md-code-inline-bg);
1108
+ color: var(--md-code-inline-fg);
1109
+ border: 0;
1110
+ box-shadow: none;
1111
+ }
1112
+
1113
+ pre {
1114
+ background: var(--md-code-block-bg);
1115
+ color: var(--md-code-block-fg);
1116
+ border: 1px solid var(--md-code-block-border);
1117
+ box-shadow: none;
1118
+
1119
+ code,
1120
+ tt,
1121
+ samp {
1122
+ background: transparent;
1123
+ border: 0;
1124
+ box-shadow: none;
1125
+ color: inherit;
1126
+ }
1127
+ }
1128
+ }
1129
+ }
1130
+ }
1131
+
1132
+ /* ═══════════════════════════════════════════════════════════════════════════
1133
+ LAYER: print
1134
+ ═══════════════════════════════════════════════════════════════════════════ */
1135
+
1136
+ @layer print {
1137
+ @media print {
1138
+ /* html / body reset */
1139
+ :where(:root, html, body) {
1140
+ color-scheme: light;
1141
+ container-type: normal;
1142
+ contain: none;
1143
+ background-color: #fff !important;
1144
+ font-family: var(--print-font-family);
1145
+ font-variant-emoji: text;
1146
+ font-size: 12pt;
1147
+ line-height: 1.4;
1148
+ color: #111;
1149
+ margin: 0;
1150
+ padding: 0;
1151
+ border: none;
1152
+ box-shadow: none;
1153
+ -webkit-print-color-adjust: economy;
1154
+ print-color-adjust: economy;
1155
+ scrollbar-width: none;
1156
+ overflow: visible !important;
1157
+ }
1158
+
1159
+ body {
1160
+ block-size: max-content !important;
1161
+ max-block-size: none !important;
1162
+ min-block-size: max(100%, 100cqb) !important;
1163
+ inline-size: 100% !important;
1164
+ max-inline-size: 100% !important;
1165
+ zoom: 1 !important;
1166
+ scale: 1 !important;
1167
+ transform: none !important;
1168
+ text-align: start;
1169
+ }
1170
+
1171
+ /* KaTeX в print */
1172
+ :is(.katex, .katex:not(:has(math)) *, .katex :not(math) *:not(math)) {
1173
+ font-family: "Noto Sans Math", "Cambria Math", "STIX Two Math", "Latin Modern Math",
1174
+ var(--print-font-family), serif;
1175
+ font-variant: normal;
1176
+ font-variant-caps: normal;
1177
+ font-variant-ligatures: normal;
1178
+ text-transform: none;
1179
+ }
1180
+
1181
+ /* ── Markdown root в print ── */
1182
+ :where(#{tokens.$selectors}):not(.katex, .footnote-ref, .footnote-backref) {
1183
+ @include md-vars(light);
1184
+
1185
+ color-scheme: light;
1186
+ color: #111;
1187
+ background: #fff;
1188
+ font-family: var(--print-font-family);
1189
+ font-variant-emoji: text;
1190
+ display: block !important;
1191
+ flex: none !important;
1192
+ block-size: max-content !important;
1193
+ min-block-size: max(100%, 100cqb) !important;
1194
+ max-block-size: none !important;
1195
+ inline-size: 100%;
1196
+ max-inline-size: 100%;
1197
+ contain: none;
1198
+ container-type: normal;
1199
+ overflow: visible !important;
1200
+ scrollbar-width: none;
1201
+ margin: 0;
1202
+ padding: 0;
1203
+ border: none;
1204
+ box-shadow: none;
1205
+ -webkit-font-smoothing: antialiased;
1206
+ -moz-osx-font-smoothing: grayscale;
1207
+
1208
+ /* Сброс фонов/теней для всех дочерних */
1209
+ * {
1210
+ background-color: transparent;
1211
+ box-shadow: none;
1212
+ text-shadow: none;
1213
+ font-variant-emoji: text;
1214
+ max-inline-size: 100%;
1215
+ box-sizing: border-box;
1216
+ }
1217
+
1218
+ /* Скрываем UI */
1219
+ .viewer-header,
1220
+ .viewer-btn,
1221
+ .btn {
1222
+ display: none !important;
1223
+ }
1224
+
1225
+ /* ── Headings ── */
1226
+ h1,
1227
+ h2,
1228
+ h3,
1229
+ h4,
1230
+ h5,
1231
+ h6 {
1232
+ color: #111;
1233
+ font-weight: 700;
1234
+ line-height: 1.25;
1235
+ orphans: 2;
1236
+ widows: 2;
1237
+ -webkit-font-smoothing: antialiased;
1238
+ -moz-osx-font-smoothing: grayscale;
1239
+
1240
+ &:first-child {
1241
+ margin-block-start: 0;
1242
+ }
1243
+ }
1244
+
1245
+ /* Размеры heading в print — те же em, база 12pt */
1246
+ @each $tag, $sizes in $_h-sizes {
1247
+ #{$tag} {
1248
+ font-size: map.get($sizes, print);
1249
+ }
1250
+ }
1251
+
1252
+ h1,
1253
+ h2 {
1254
+ padding-block-end: .3em;
1255
+ border-block-end: 1px solid #ccc;
1256
+ }
1257
+
1258
+ h6 {
1259
+ color: #555;
1260
+ }
1261
+
1262
+ /* ── Paragraph / inline ── */
1263
+ p,
1264
+ li {
1265
+ color: #111;
1266
+ orphans: 3;
1267
+ widows: 3;
1268
+ text-align: justify;
1269
+ hyphens: auto;
1270
+ -webkit-font-smoothing: antialiased;
1271
+ -moz-osx-font-smoothing: grayscale;
1272
+ }
1273
+
1274
+ strong,
1275
+ b {
1276
+ font-weight: 700 !important;
1277
+ color: #111 !important;
1278
+ filter: none;
1279
+ }
1280
+
1281
+ em,
1282
+ i {
1283
+ font-style: italic !important;
1284
+ color: #111 !important;
1285
+ filter: none;
1286
+ }
1287
+
1288
+ a {
1289
+ color: #333 !important;
1290
+ text-decoration: underline !important;
1291
+ word-break: break-word;
1292
+ overflow-wrap: break-word;
1293
+ -webkit-font-smoothing: antialiased;
1294
+ -moz-osx-font-smoothing: grayscale;
1295
+
1296
+ &[href]::after {
1297
+ content: none !important;
1298
+ }
1299
+
1300
+ /* не печатаем URL */
1301
+ }
1302
+
1303
+ /* ── Code / Pre ── */
1304
+ code,
1305
+ pre,
1306
+ pre code,
1307
+ tt,
1308
+ samp {
1309
+ font-family: var(--print-font-mono);
1310
+ background: #f5f5f5;
1311
+ color: #111;
1312
+ filter: grayscale(1);
1313
+ -webkit-font-smoothing: antialiased;
1314
+ -moz-osx-font-smoothing: grayscale;
1315
+ }
1316
+
1317
+ code:not(pre code) {
1318
+ padding: .125em .25em;
1319
+ border-radius: .25em;
1320
+ border: 1px solid #ddd;
1321
+ word-break: break-word;
1322
+ overflow-wrap: break-word;
1323
+ hyphens: none;
1324
+ inline-size: stretch;
1325
+ max-inline-size: stretch;
1326
+ block-size: max-content !important;
1327
+ max-block-size: none !important;
1328
+ min-inline-size: fit-content;
1329
+ overflow: hidden !important;
1330
+ overflow-inline: hidden !important;
1331
+ overflow-block: hidden !important;
1332
+ content-visibility: visible !important;
1333
+ contain: none !important;
1334
+ position: relative !important;
1335
+ }
1336
+
1337
+ pre {
1338
+ flex-grow: 1 !important;
1339
+ flex-shrink: 0 !important;
1340
+ flex-basis: max-content !important;
1341
+ padding: 1rem;
1342
+ border: 1px solid #ccc;
1343
+ border-radius: .5rem;
1344
+ white-space: pre-wrap;
1345
+ word-wrap: break-word;
1346
+ orphans: 1;
1347
+ widows: 1;
1348
+ margin-block: 1.2em;
1349
+ inline-size: stretch;
1350
+ max-inline-size: stretch;
1351
+ block-size: max-content !important;
1352
+ max-block-size: none !important;
1353
+ min-inline-size: fit-content;
1354
+ overflow: hidden !important;
1355
+ overflow-inline: hidden !important;
1356
+ overflow-block: hidden !important;
1357
+ content-visibility: visible !important;
1358
+ position: relative !important;
1359
+
1360
+ code {
1361
+ @include code-in-pre;
1362
+
1363
+ background: transparent;
1364
+ border: 0;
1365
+ }
1366
+ }
1367
+
1368
+ /* ── Blockquote ── */
1369
+ blockquote {
1370
+ background: #fafafa;
1371
+ border-inline-start: 4px solid #999;
1372
+ color: #333;
1373
+ padding: .8em 1.2em;
1374
+ margin-block: 1.2em;
1375
+ font-style: italic;
1376
+ orphans: 2;
1377
+ widows: 2;
1378
+ filter: grayscale(1);
1379
+ -webkit-font-smoothing: antialiased;
1380
+ -moz-osx-font-smoothing: grayscale;
1381
+ }
1382
+
1383
+ /* ── Table ── */
1384
+ table {
1385
+ display: table;
1386
+ inline-size: 100% !important;
1387
+ max-inline-size: 100%;
1388
+ border-collapse: collapse;
1389
+ border: 1px solid #999;
1390
+ table-layout: fixed;
1391
+ word-wrap: break-word;
1392
+ overflow-wrap: break-word;
1393
+ margin-block: 1.2em;
1394
+ orphans: 1;
1395
+ widows: 1;
1396
+ filter: grayscale(1);
1397
+ }
1398
+
1399
+ th,
1400
+ td {
1401
+ border: 1px solid #999;
1402
+ padding: .5em .75em;
1403
+ text-align: start;
1404
+ vertical-align: top;
1405
+ color: #111;
1406
+ overflow-wrap: break-word;
1407
+ overflow: hidden;
1408
+ inline-size: fit-content;
1409
+ max-inline-size: stretch;
1410
+ block-size: max-content;
1411
+ }
1412
+
1413
+ th {
1414
+ background: #e5e5e5;
1415
+ font-weight: 600;
1416
+ color: #333;
1417
+ }
1418
+
1419
+ /* ── HR ── */
1420
+ hr {
1421
+ border: none;
1422
+ border-block-start: 1px solid #ccc;
1423
+ margin-block: 2em;
1424
+ block-size: 0;
1425
+ filter: grayscale(1);
1426
+ }
1427
+
1428
+ /* ── Images ── */
1429
+ img {
1430
+ @include img-base(1em auto, 0);
1431
+ display: block;
1432
+ filter: grayscale(1);
1433
+ image-rendering: pixelated;
1434
+ }
1435
+
1436
+ /* ── SVG ── */
1437
+ svg {
1438
+ filter: grayscale(1);
1439
+
1440
+ * {
1441
+ fill: currentColor !important;
1442
+ stroke: currentColor !important;
1443
+ }
1444
+ }
1445
+
1446
+ /* ── Lists ── */
1447
+ ul,
1448
+ ol {
1449
+ padding-inline-start: 1.5rem;
1450
+ list-style-position: outside;
1451
+ orphans: 2;
1452
+ widows: 2;
1453
+ margin-block-end: 1em;
1454
+ }
1455
+
1456
+ li::marker {
1457
+ color: #666 !important;
1458
+ }
1459
+
1460
+ /* ── Misc ── */
1461
+ input,
1462
+ textarea,
1463
+ select {
1464
+ border: 1px solid #999 !important;
1465
+ background: #fff !important;
1466
+ color: #111 !important;
1467
+ filter: grayscale(1);
1468
+ }
1469
+
1470
+ .highlight,
1471
+ .mark {
1472
+ background: #e6e6e6 !important;
1473
+ filter: grayscale(1);
1474
+ }
1475
+
1476
+ .footnote,
1477
+ .reference {
1478
+ border-block-start: 1px solid #ccc !important;
1479
+ background: transparent !important;
1480
+ }
1481
+
1482
+ .katex {
1483
+ color: #111 !important;
1484
+ filter: grayscale(1);
1485
+ }
1486
+
1487
+ pre[class*="language-"] {
1488
+ background: #f8f8f8 !important;
1489
+ filter: grayscale(1);
1490
+
1491
+ * {
1492
+ filter: grayscale(1);
1493
+ }
1494
+ }
1495
+
1496
+ /* ── Named pages ── */
1497
+ .print-narrow {
1498
+ page: narrow;
1499
+ }
1500
+
1501
+ .print-wide {
1502
+ page: wide;
1503
+ }
1504
+
1505
+ .print-letter {
1506
+ page: letter;
1507
+ }
1508
+
1509
+ .print-legal {
1510
+ page: legal;
1511
+ }
1512
+
1513
+ .print-professional {
1514
+ page: professional;
1515
+ }
1516
+
1517
+ .print-booklet {
1518
+ page: booklet;
1519
+ }
1520
+
1521
+ .print-draft {
1522
+ page: draft;
1523
+ }
1524
+
1525
+ /* ── First/last child margins ── */
1526
+ & > *:first-child {
1527
+ margin-block-start: 0;
1528
+ }
1529
+
1530
+ & > *:last-child {
1531
+ margin-block-end: 0;
1532
+ }
1533
+ }
1534
+
1535
+ /* print-view / print-content */
1536
+ .print-view {
1537
+ inline-size: 100%;
1538
+ block-size: 100cqb;
1539
+ margin: 0;
1540
+ padding: 0;
1541
+ overflow-inline: hidden;
1542
+ }
1543
+
1544
+ .print-content {
1545
+ inline-size: 100%;
1546
+ box-sizing: border-box;
1547
+ padding: 2rem;
1548
+ margin: 0;
1549
+ font-size: 14pt;
1550
+ line-height: 1.6;
1551
+ text-align: justify;
1552
+ hyphens: auto;
1553
+ word-wrap: break-word;
1554
+ overflow-wrap: break-word;
1555
+ }
1556
+ }
1557
+ }
1558
+
1559
+ /* ═══════════════════════════════════════════════════════════════════════════
1560
+ LAYER: print-breaks
1561
+ ═══════════════════════════════════════════════════════════════════════════ */
1562
+
1563
+ @layer print-breaks {
1564
+ @media print {
1565
+ /* Базовые правила для всех блочных элементов */
1566
+ :where(h1, h2, h3, h4, h5, h6, p, pre, table, img, blockquote, hr) {
1567
+ break-before: auto;
1568
+ break-after: auto;
1569
+ break-inside: avoid;
1570
+ }
1571
+
1572
+ /* Строки и ячейки — не разрывать */
1573
+ li,
1574
+ tr {
1575
+ break-inside: avoid;
1576
+ }
1577
+
1578
+ /* Заголовки не отрываются от следующего контента */
1579
+ :where(h1, h2, h3, h4, h5, h6) {
1580
+ &:has(+ :where(p, ul, ol, li, table, blockquote, pre, code)) {
1581
+ break-after: avoid;
1582
+ }
1583
+ }
1584
+
1585
+ /* Параграфы/списки держатся вместе */
1586
+ :where(p, :is(h1, h2, h3, h4, h5, h6)):has(+ :where(ul, ol)) {
1587
+ break-after: avoid !important;
1588
+ }
1589
+
1590
+ :where(p, :is(h1, h2, h3, h4, h5, h6)) + :where(ul, ol) {
1591
+ break-before: avoid !important;
1592
+ }
1593
+
1594
+ :where(h1, h2, h3, h4, h5, h6):has(+ :where(table, pre, code, blockquote)) {
1595
+ break-after: avoid !important;
1596
+ }
1597
+
1598
+ :where(h1, h2, h3, h4, h5, h6) + :where(table, pre, code, blockquote) {
1599
+ break-before: avoid !important;
1600
+ }
1601
+
1602
+ /* HR перед заголовком → разрыв страницы */
1603
+ hr:has(+ :where(h1, h2, h3, h4, h5, h6, p, pre, table, img, blockquote)) {
1604
+ break-after: page !important;
1605
+ }
1606
+
1607
+ /* Первый h1 не разрывается перед собой */
1608
+ h1:first-of-type {
1609
+ break-before: avoid;
1610
+ }
1611
+
1612
+ /* Утилиты ручного разрыва */
1613
+ :where(.pb, .np, .pagebreak, .newpage, .page-break, .new-page) {
1614
+ background-color: transparent;
1615
+
1616
+ @include mixins.md-break(auto, auto, page);
1617
+ }
1618
+
1619
+ .print-chapter {
1620
+ break-before: page;
1621
+ }
1622
+
1623
+ .print-section {
1624
+ break-before: avoid;
1625
+ }
1626
+
1627
+ /* Первый/последний дочерний */
1628
+ :where(:heading, p, ol, ul) > :first-child {
1629
+ margin-block-start: 0;
1630
+ }
1631
+
1632
+ :where(:heading, p, ol, ul) > :last-child {
1633
+ margin-block-end: 0;
1634
+ }
1635
+ }
1636
+ }