presi-slides 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1456 @@
1
+ :root {
2
+ --color-accent: rgb(93, 144, 210);
3
+ --color-accent-inverted: rgb(255 208 0);
4
+ --color-background-header: var(--color-accent);
5
+ --color-background-page: rgb(254, 247, 241);
6
+ --color-background-card: white;
7
+ --color-background-code: #f5f2f0;
8
+ --color-backdrop: black;
9
+ --color-link-inverted: var(--color-accent-inverted);
10
+ --color-link: var(--color-accent);
11
+ --color-text: rgb(51 51 51);
12
+ --color-text-heading: var(--color-accent);
13
+ --color-text-inverted: rgb(255 255 255);
14
+ --color-warning: #ce2929;
15
+ --color-error: var(--color-warning);
16
+
17
+ --font-family-display:
18
+ Pridi, Georgia, Cambria, "Noto Serif",
19
+ "Bitstream Charter", serif;
20
+ --font-family-body:
21
+ "Merriweather Sans", Calibri, Roboto, "Segoe UI",
22
+ Ubuntu, sans-serif;
23
+ --font-family-code:
24
+ Consolas, Monaco, "Andale Mono", "Ubuntu Mono",
25
+ monospace;
26
+
27
+ --font-line-height-body: 1.375;
28
+ --font-line-height-compact: 1.125;
29
+ --font-line-height-display: 1.125;
30
+
31
+ --font-weight-light: 300;
32
+ --font-weight-normal: 400;
33
+ --font-weight-semibold: 600;
34
+ --font-weight-bold: 700;
35
+
36
+ --grid-columns: 12;
37
+
38
+ --weight-line-hairline: 0.5px;
39
+ --weight-line-fine: 1px;
40
+ --weight-line-medium: 2px;
41
+ --weight-line-heavy: 4px;
42
+
43
+ --size-spacing-small: 0.15em;
44
+ --size-spacing-medium: 0.25em;
45
+ --size-spacing-large: 0.75em;
46
+ --size-spacing-xlarge: 1.5em;
47
+
48
+ --slide-aspect-ratio: 1.778;
49
+ --slide-nominal-width: 1080;
50
+ --slide-nominal-height: calc(
51
+ var(--slide-nominal-width) /
52
+ calc(var(--slide-aspect-ratio))
53
+ );
54
+
55
+ --slide-base-measure: 36;
56
+ --slide-code-measure: 48;
57
+
58
+ --slide-overflow: hidden;
59
+
60
+ --box-overflow: visible;
61
+ }
62
+
63
+ * {
64
+ margin: 0;
65
+ box-sizing: border-box;
66
+ }
67
+ img {
68
+ max-width: 100%;
69
+ }
70
+
71
+ body {
72
+ line-height: var(--font-line-height-body);
73
+ font-family: var(--font-family-body);
74
+ }
75
+
76
+ h1,
77
+ h2,
78
+ h3,
79
+ h4,
80
+ h5,
81
+ h6,
82
+ dt,
83
+ summary {
84
+ font-family: var(--font-family-display);
85
+ line-height: var(--font-line-height-display);
86
+ }
87
+ code:not([class*="language-"]) {
88
+ display: inline-block;
89
+ font-family: var(--font-family-code);
90
+ font-size: 0.75em;
91
+ background: var(--color-background-code);
92
+ padding: 0.25em;
93
+ margin: var(--size-spacing-small);
94
+ border-radius: var(--size-spacing-small);
95
+
96
+ &.tree {
97
+ line-height: 0.9;
98
+ font-size: 100%;
99
+ }
100
+
101
+ em > & {
102
+ color: var(--color-accent);
103
+ padding-left: 0;
104
+ border-left: 0;
105
+ margin-left: -1px;
106
+ }
107
+ }
108
+ ul,
109
+ ol {
110
+ padding-left: 1em;
111
+ }
112
+ li + li {
113
+ margin-top: var(--size-spacing-medium);
114
+ }
115
+ blockquote {
116
+ width: 80%;
117
+ margin: var(--size-spacing-large) auto;
118
+ border-left: var(--weight-line-heavy) solid
119
+ var(--color-accent);
120
+ padding-left: var(--size-spacing-large);
121
+ font-size: 125%;
122
+
123
+ .attribution {
124
+ display: block;
125
+ text-align: right;
126
+ margin-left: 25%;
127
+ font-style: italic;
128
+ font-size: var(--slide-base-font-size);
129
+ }
130
+
131
+ .compact {
132
+ font-size: var(--slide-base-font-size);
133
+ }
134
+ }
135
+
136
+ p.center,
137
+ td.center {
138
+ text-align: center;
139
+ }
140
+
141
+ p.question,
142
+ p.note {
143
+ text-align: center;
144
+ text-wrap: balance;
145
+ font-family: var(--font-family-display);
146
+
147
+ &::before,
148
+ &::after {
149
+ content: " ";
150
+ display: block;
151
+ margin: 0 auto;
152
+ width: 50%;
153
+ height: var(--size-spacing-large);
154
+ }
155
+ &::before {
156
+ border-top: var(--weight-line-hairline) solid
157
+ currentColor;
158
+ }
159
+ &::after {
160
+ border-bottom: var(--weight-line-hairline) solid
161
+ currentColor;
162
+ }
163
+ }
164
+
165
+ p.question {
166
+ font-size: 200%;
167
+ }
168
+
169
+ p.note {
170
+ font-style: italic;
171
+ color: var(--color-accent);
172
+ }
173
+
174
+ pre[class*="language"]:has(code.error-message),
175
+ code.error-message[class*="language"] {
176
+ max-width: 100%;
177
+ white-space: wrap;
178
+ color: var(--color-error);
179
+ }
180
+
181
+ textarea {
182
+ font: inherit;
183
+ }
184
+ .nobr {
185
+ white-space: nowrap;
186
+ }
187
+ .hidden {
188
+ display: none;
189
+ }
190
+
191
+ details {
192
+ display: flex;
193
+ flex-direction: row;
194
+ align-content: baseline;
195
+ }
196
+
197
+ .nowrap {
198
+ white-space: nowrap;
199
+ }
200
+
201
+ slide-presi {
202
+ display: flex;
203
+ flex-direction: column;
204
+ --scale: 1;
205
+ }
206
+
207
+
208
+ slide-footer {
209
+ position: fixed;
210
+ z-index: 0;
211
+ right: var(--size-spacing-small);
212
+ bottom: var(--size-spacing-small);
213
+ left: var(--size-spacing-small);
214
+ }
215
+
216
+ slide-view {
217
+ --one-half: calc(var(--grid-columns, 12) / 2);
218
+ --one-third: calc(var(--grid-columns, 12) / 3);
219
+ --two-thirds: calc(2 * var(--grid-columns, 12) / 3);
220
+ --one-quarter: calc(var(--grid-columns, 12) / 4);
221
+ --three-quarters: calc(3 * var(--grid-columns, 12) / 4);
222
+ --one-sixth: calc(var(--grid-columns, 12) / 6);
223
+ --five-sixths: calc(5 * var(--grid-columns, 12) / 6);
224
+
225
+ --code-scaling: 1;
226
+
227
+ --grid-header-row: ;
228
+ --grid-content-rows: minmax(min-content, 1fr);
229
+ --grid-last-row: ;
230
+ --grid-template-rows: var(--grid-header-row)
231
+ var(--grid-content-rows) var(--grid-last-row);
232
+ --grid-auto-rows: minmax(min-content, auto);
233
+
234
+ display: grid;
235
+ aspect-ratio: var(--slide-aspect-ratio);
236
+ max-width: 100%;
237
+
238
+ grid-template-rows: var(--grid-template-rows);
239
+ grid-template-columns:
240
+ [start] repeat(var(--grid-columns), 1fr)
241
+ [end];
242
+ grid-auto-rows: var(--grid-auto-rows);
243
+ grid-auto-flow: dense;
244
+ gap: var(--size-spacing-medium) var(--size-spacing-large);
245
+
246
+ /* Scale the font size to match the slide size */
247
+
248
+ --slide-base-font-size: calc(
249
+ 1px * var(--scale, 1) * var(--slide-nominal-width) /
250
+ var(--slide-base-measure)
251
+ );
252
+
253
+ font-size: var(--slide-base-font-size);
254
+ padding: var(--size-spacing-large);
255
+
256
+ &:has(h1:first-child) {
257
+ --grid-header-row: min-content;
258
+ }
259
+
260
+ &:has(> :is(h2, h3) + :is(ul, ol, p, pre, blockquote)) {
261
+ --grid-content-rows: min-content auto;
262
+ }
263
+
264
+ &:has(
265
+ > :is(:first-child:not(h1), h1 + :not(h2, h3))
266
+ + :is(h2, h3)
267
+ + :is(ul, ol, p, pre, blockquote)
268
+ ) {
269
+ --grid-content-rows: 1fr min-content auto;
270
+ }
271
+
272
+ > * {
273
+ grid-column: start/end;
274
+ overflow: var(--box-overflow);
275
+ }
276
+
277
+ > *:has(.hidden:only-child) {
278
+ display: none;
279
+ }
280
+
281
+ > h1 {
282
+ font-size: 175%;
283
+ }
284
+
285
+ > * + h1 {
286
+ margin-top: var(--size-spacing-xlarge);
287
+ }
288
+ > h2 {
289
+ font-size: 133%;
290
+ }
291
+ > h3 {
292
+ font-size: 125%;
293
+ }
294
+
295
+ pre[class*="language-"] {
296
+ --code-font-size: calc(
297
+ 1px * var(--scale, 1) * var(--code-scaling) *
298
+ var(--slide-nominal-width) /
299
+ var(--slide-code-measure)
300
+ );
301
+ font-size: var(--code-font-size, 1em);
302
+ line-height: 1.25;
303
+ margin: 0;
304
+ padding: var(--size-spacing-small);
305
+ align-self: start;
306
+ overflow: var(--box-overflow);
307
+
308
+ > code {
309
+ line-height: 1;
310
+ }
311
+
312
+ > code.compact {
313
+ font-size: calc(0.75 * var(--code-font-size, 1em));
314
+ }
315
+
316
+ > code.tiny {
317
+ font-size: calc(0.625 * var(--code-font-size, 1em));
318
+ }
319
+
320
+ &:has(code.compact) {
321
+ line-height: 0.85;
322
+ }
323
+
324
+ &:has(code.tiny) {
325
+ line-height: 0.7;
326
+ }
327
+ }
328
+
329
+ > p:has(img:only-child, video:only-child) {
330
+ display: contents;
331
+
332
+ > img:only-child,
333
+ > video:only-child {
334
+ display: block;
335
+ object-fit: contain;
336
+ height: 100%;
337
+ width: 100%;
338
+ }
339
+
340
+ &.max25vh > img:only-child {
341
+ max-height: 25vh;
342
+ }
343
+ }
344
+
345
+ > :is(ul, ol) {
346
+ > li::marker {
347
+ color: var(--color-accent);
348
+ }
349
+ > li:not(:only-child) > ul {
350
+ font-size: 87.5%;
351
+ }
352
+ &:has(> li:only-child) {
353
+ list-style: none;
354
+ padding-left: 0;
355
+ }
356
+ }
357
+
358
+ > dl,
359
+ > .dl {
360
+ display: grid;
361
+ grid-template-columns: subgrid;
362
+ grid-auto-rows: min-content;
363
+ row-gap: var(--size-spacing-medium);
364
+
365
+ > :is(dt, h4) {
366
+ grid-column: 1 / span var(--one-quarter);
367
+ font-family: var(--font-family-display);
368
+ font-weight: bold;
369
+ background: white;
370
+ }
371
+ > :not(dt, h4) {
372
+ grid-column: span var(--three-quarters) / -1;
373
+ }
374
+
375
+ code.compact {
376
+ font-size: calc(0.75 * var(--code-font-size, 1em));
377
+ }
378
+
379
+ &:is(.compact, :has(dt:first-child.compact)) {
380
+ > :is(dt, h4) {
381
+ grid-column: 1 / span 2;
382
+ }
383
+ > :not(dt, h4) {
384
+ grid-column: 3 / -1;
385
+ }
386
+ }
387
+
388
+ &.full {
389
+ > :is(dt, h4) {
390
+ grid-column: 1 / span var(--three-quarters);
391
+ }
392
+ > :not(dt, h4) {
393
+ grid-column: 2 / -1;
394
+ }
395
+ }
396
+ }
397
+
398
+ > blockquote,
399
+ .question {
400
+ grid-column: 2 / -2;
401
+ align-self: center;
402
+ }
403
+
404
+ > textarea {
405
+ grid-column: 2 / -2;
406
+ }
407
+
408
+ > table {
409
+ height: fit-content;
410
+
411
+ &:has(th.compact) {
412
+ font-size: calc(
413
+ 0.875 * var(--slide-base-font-size, 1em)
414
+ );
415
+ line-height: 1;
416
+ }
417
+
418
+ &:has(th.tiny) {
419
+ font-size: calc(
420
+ 0.75 * var(--slide-base-font-size, 1em)
421
+ );
422
+ line-height: 1;
423
+ }
424
+
425
+ th {
426
+ font-family: var(--font-family-display);
427
+ line-height: 1.125;
428
+ vertical-align: bottom;
429
+ border-bottom: var(--weight-line-heavy) solid
430
+ var(--color-accent);
431
+ padding: 0 var(--size-spacing-small);
432
+ }
433
+
434
+ thead > tr:not(:has(:not(:empty))) {
435
+ display: none;
436
+ }
437
+
438
+ td {
439
+ font-size: 0.875em;
440
+ padding: var(--size-spacing-small);
441
+ position: relative;
442
+
443
+ &:first-child {
444
+ padding-left: 0;
445
+ }
446
+
447
+ &:last-child {
448
+ padding-right: 0;
449
+ }
450
+
451
+ &[colspan] {
452
+ border: var(--weight-line-medium) solid
453
+ var(--color-accent);
454
+ }
455
+
456
+ &:has(img:first-child:last-child) {
457
+ padding: 0;
458
+ }
459
+ > img {
460
+ max-height: 8em;
461
+ display: block;
462
+ margin: 0 auto;
463
+ }
464
+ > textarea {
465
+ width: 100%;
466
+ }
467
+ }
468
+
469
+ tbody > tr > :first-child {
470
+ padding-left: 0;
471
+ }
472
+
473
+ thead tr:last-child > th {
474
+ border-bottom: 2px solid #333;
475
+ }
476
+ }
477
+
478
+ > p.warning,
479
+ > aside p.warning {
480
+ grid-column: start/end;
481
+ place-self: center;
482
+ width: fit-content;
483
+ padding: var(--size-spacing-medium);
484
+ border-radius: var(--size-spacing-medium);
485
+ border: var(--weight-line-heavy) solid
486
+ var(--color-warning);
487
+
488
+ &::before {
489
+ display: inline-block;
490
+ content: "!!";
491
+ width: 1.5em;
492
+ height: 1.5em;
493
+ line-height: 1.5em;
494
+ text-align: center;
495
+ vertical-align: baseline;
496
+ border-radius: 50%;
497
+ background: var(--color-warning);
498
+ color: white;
499
+ }
500
+ }
501
+
502
+ /*&:not(:first-child)::after {
503
+ display: block;
504
+ position: absolute;
505
+ bottom: var(--size-spacing-large);
506
+ right: var(--size-spacing-large);
507
+ content: attr(data-slide-number);
508
+ font-size: 0.75em;
509
+ color: var(--color-accent);
510
+ }*/
511
+ }
512
+
513
+
514
+ @media screen {
515
+ body {
516
+ overflow: hidden;
517
+ }
518
+
519
+ slide-presi {
520
+ --wscale: calc(
521
+ var(--viewport-width, 1080) /
522
+ var(--slide-nominal-width)
523
+ );
524
+
525
+ --hscale: calc(
526
+ var(--viewport-height, 792) /
527
+ var(--slide-nominal-height)
528
+ );
529
+
530
+ --scale: min(var(--wscale), var(--hscale));
531
+
532
+ --slide-margin-vertical: calc(
533
+ (
534
+ var(--viewport-height) -
535
+ var(--slide-nominal-height) *
536
+ var(--scale, 1)
537
+ ) *
538
+ 0.5px
539
+ );
540
+
541
+ --slide-margin-horizontal: calc(
542
+ (
543
+ var(--viewport-width) -
544
+ var(--slide-nominal-width) *
545
+ var(--scale, 1)
546
+ ) *
547
+ 0.5px
548
+ );
549
+ background-color: var(--color-backdrop);
550
+ height: 100vh;
551
+ width: 100vw;
552
+ padding: var(--slide-margin-vertical)
553
+ var(--slide-margin-horizontal);
554
+ gap: calc(2 * var(--slide-margin-vertical));
555
+ overflow: hidden scroll;
556
+ scroll-snap-type: y mandatory;
557
+ }
558
+
559
+ slide-view {
560
+ color: var(--color-text);
561
+ background-color: var(--color-background-page);
562
+ border-radius: 2vw;
563
+ scroll-snap-align: center;
564
+ position: relative;
565
+ }
566
+ }
567
+
568
+
569
+
570
+ @media print {
571
+ /*@page slide {
572
+ size: 14in 8.5in;
573
+ margin: 0.5in;
574
+ }*/
575
+
576
+ slide-presi {
577
+ --viewport-width: var(--slide-nominal-width);
578
+ --viewport-height: var(--slide-nominal-height);
579
+ --scale: 1;
580
+ }
581
+
582
+ slide-view {
583
+ page: slide;
584
+ page-break-before: always;
585
+ break-before: page;
586
+ border: 1px solid black;
587
+ }
588
+
589
+ slide-footer {
590
+ display: none;
591
+ }
592
+ }
593
+
594
+ /* implicit layouts */
595
+
596
+ slide-view:not(:has(h1[layout])) {
597
+ --slide-header-template: /* empty */;
598
+ --slide-body-template: "b b b b b b b b b b b b";
599
+ --slide-footer-template: /* empty */;
600
+ --grid-template: var(--slide-header-template)
601
+ var(--slide-body-template) var(--slide-footer-template);
602
+
603
+ --grid-content-rows: minmax(75%, 1fr);
604
+
605
+ grid-template-areas: var(--grid-template);
606
+ &:has(h1:first-child) {
607
+ --slide-header-template: "h h h h h h h h h h h h";
608
+ --grid-header-row: min-content;
609
+ }
610
+
611
+ &:has(:is(footer, .note, .footer):last-child) {
612
+ --slide-footer-template: "f f f f f f f f f f f f";
613
+ --grid-last-row: min-content;
614
+ }
615
+
616
+ & > :is(h1):first-child {
617
+ grid-area: h;
618
+ }
619
+
620
+ & > :is(footer, .note, .footer):last-child {
621
+ grid-area: f;
622
+ margin: 0;
623
+ }
624
+
625
+ &
626
+ > :first-of-type:where(
627
+ ul,
628
+ ol,
629
+ dl,
630
+ table:not(:has(.full)),
631
+ blockquote,
632
+ .question,
633
+ p:not(
634
+ :has(> img:only-child),
635
+ .note,
636
+ .warning,
637
+ .footer
638
+ )
639
+ ) {
640
+ grid-area: b;
641
+ }
642
+
643
+ &
644
+ > :is(blockquote, ul, ol, dl, table):first-of-type
645
+ + :is(blockquote, ul, ol, dl, table) {
646
+ grid-area: unset;
647
+ grid-column: start/end;
648
+ }
649
+
650
+ & > p:not(.full) > img:only-child {
651
+ grid-area: i;
652
+ }
653
+
654
+ & > p:not(.full) > video:only-child {
655
+ grid-area: v;
656
+ }
657
+
658
+ & > pre:first-of-type:not(:has(.full)) {
659
+ grid-area: c;
660
+
661
+ &:has(code.center) {
662
+ justify-self: center;
663
+ }
664
+ }
665
+
666
+ /* Select a template from what the slide _has_ */
667
+
668
+ /* initial header (not h1) */
669
+ &:has(> header:first-child) {
670
+ --grid-header-row: minmax(min-content, 1fr);
671
+
672
+ > header {
673
+ display: grid;
674
+ grid-template-columns: subgrid;
675
+
676
+ > h1 {
677
+ grid-area: h;
678
+ }
679
+
680
+ > p > img:only-child {
681
+ grid-area: i;
682
+ }
683
+ }
684
+
685
+ /* image in the header */
686
+ &:has(> header:first-child > p > img:only-child) {
687
+ --slide-header-template: "h h h h h h i i i i i i";
688
+ --grid-header-row: auto;
689
+ }
690
+ }
691
+
692
+ /* initial <aside> */
693
+
694
+ &:has(
695
+ > aside:where(
696
+ first-child,
697
+ :is(h1, header):first-of-type + *
698
+ )
699
+ ) {
700
+ --slide-body-template: var(--slide-aside-template);
701
+ --slide-aside-template: "b b b b b b b b a a a a";
702
+
703
+ &:has(h1:first-child) {
704
+ --slide-header-template: "h h h h h h h h a a a a";
705
+ }
706
+
707
+ &:has(> aside + p > img:only-child) {
708
+ --slide-aside-template: "i i i i i i i i a a a a";
709
+ }
710
+
711
+ > aside {
712
+ grid-area: a;
713
+ &:has(> :only-child) {
714
+ display: contents;
715
+ }
716
+ > :is(
717
+ ul,
718
+ ol,
719
+ pre,
720
+ blockquote,
721
+ p:not(:has(> img:only-child))
722
+ ) {
723
+ grid-area: a;
724
+ }
725
+ > p:only-child > img:only-child {
726
+ grid-area: i;
727
+ }
728
+ }
729
+
730
+ > aside
731
+ + :is(
732
+ ul,
733
+ ol,
734
+ p:not(:has(> img:only-child)),
735
+ dl,
736
+ .dl,
737
+ .question
738
+ ) {
739
+ grid-area: b;
740
+ }
741
+
742
+ > aside + p > img:only-child {
743
+ grid-area: b;
744
+ }
745
+
746
+ &:has(aside + pre) {
747
+ --slide-aside-template: "c c c c c c c c a a a a";
748
+ }
749
+
750
+ /* <aside> containing image */
751
+ &:has(aside > p > img:only-child) {
752
+ --slide-aside-template: "b b b b b b b b i i i i"
753
+ "b b b b b b b b a a a a";
754
+
755
+ > aside:has(p:only-child > img:only-child) {
756
+ display: contents;
757
+ }
758
+
759
+ &:has(
760
+ :is(h1, header):first-of-type
761
+ + aside
762
+ > p:only-child
763
+ > img:only-child
764
+ ) {
765
+ --slide-header-template: "h h h h h h h h i i i i";
766
+ }
767
+
768
+ &:has(aside + pre) {
769
+ --slide-aside-template: "c c c c c c c c a a a a";
770
+ --grid-content-rows: auto
771
+ minmax(min-content, 1fr);
772
+ }
773
+ }
774
+
775
+ &:has(aside > p:only-child > img:only-child) {
776
+ --slide-aside-template: "b b b b b b b b i i i i";
777
+ &:has(aside + pre) {
778
+ --slide-aside-template: "c c c c c c c c i i i i";
779
+ }
780
+ }
781
+
782
+ /* <aside> + code */
783
+ &:has(aside + pre) {
784
+ --slide-aside-template: "c c c c c c c c a a a a";
785
+
786
+ &:has(aside > p:only-child > img:only-child) {
787
+ --slide-aside-template: "c c c c c c c c i i i i";
788
+ }
789
+ }
790
+
791
+ /* <aside> ~ footer */
792
+
793
+ &:has(aside ~ :is(footer, .note):last-child) {
794
+ --slide-footer-template: "f f f f f f f f a a a a";
795
+ }
796
+ }
797
+
798
+ /* initial image */
799
+
800
+ &:has(
801
+ > p:where(
802
+ :first-child,
803
+ :is(h1, header, aside):first-of-type + *
804
+ )
805
+ > img:only-child
806
+ ) {
807
+ --slide-body-template: "b b b b b b i i i i i i";
808
+
809
+ &:has(
810
+ > p:where(
811
+ :only-child,
812
+ :is(h1, header):first-of-type + :last-child
813
+ ),
814
+ > p:where(
815
+ :first-child,
816
+ :is(h1, header):first-of-type + *
817
+ )
818
+ + p
819
+ > img:only-child,
820
+ > p:where(
821
+ :first-child,
822
+ :is(h1, header):first-of-type + *
823
+ )
824
+ + :is(footer, .footer, .note)
825
+ ) {
826
+ --slide-body-template: "i i i i i i i i i i i i";
827
+ }
828
+
829
+ &:has(
830
+ p:where(
831
+ :first-child,
832
+ :is(h1, header):first-of-type + *
833
+ )
834
+ + *:where(
835
+ :not(
836
+ h3,
837
+ p,
838
+ blockquote,
839
+ dl,
840
+ table,
841
+ footer,
842
+ .footer,
843
+ .note
844
+ )
845
+ )
846
+ ) {
847
+ --slide-header-template: "h h h h h h h h h h h h";
848
+ --slide-body-template: "b b b b b b i i i i i i";
849
+ }
850
+
851
+ &:has(
852
+ p:where(
853
+ :first-child,
854
+ :is(h1, header):first-of-type + *
855
+ )
856
+ + *:where(ul, ol)
857
+ + pre
858
+ ) {
859
+ --slide-body-template: "b b b b b b i i i i i i"
860
+ "c c c c c c c c c c c c";
861
+ --grid-content-rows: minmax(auto, 1fr)
862
+ minmax(min-content, 1fr);
863
+ }
864
+
865
+ &:has(
866
+ p:where(
867
+ :first-child,
868
+ :is(h1, header):first-of-type + *
869
+ )
870
+ + :where(blockquote, table, .full)
871
+ ) {
872
+ --slide-header-template: "h h h h i i i i i i i i";
873
+ --slide-body-template: "h h h h i i i i i i i i"
874
+ "b b b b b b b b b b b b";
875
+ }
876
+
877
+ &:has(
878
+ p:where(
879
+ :first-child,
880
+ :is(h1, header):first-of-type + *
881
+ )
882
+ + pre
883
+ ) {
884
+ --slide-header-template: "h h h h i i i i i i i i";
885
+ --slide-body-template: "h h h h i i i i i i i i"
886
+ "c c c c c c c c c c c c";
887
+ }
888
+ }
889
+
890
+ /* initial video */
891
+
892
+ &:has(
893
+ > p:where(
894
+ :first-child,
895
+ :is(h1, header):first-of-type + *
896
+ )
897
+ > video:only-child
898
+ ) {
899
+ --slide-body-template: "b b b b v v v v v v v v";
900
+
901
+ &:has(
902
+ p:where(
903
+ :first-child,
904
+ :is(h1, header):first-of-type + *
905
+ )
906
+ + pre
907
+ ) {
908
+ --slide-body-template: "c c c c c c v v v v v v";
909
+ }
910
+ }
911
+
912
+ /* * + image */
913
+
914
+ &:has(
915
+ > *:where(
916
+ :first-child,
917
+ :is(h1, header):first-of-type + *
918
+ ):not(h1, h3, .full, table, dl, blockquote, aside)
919
+ + p
920
+ > img:only-child
921
+ ) {
922
+ --slide-body-template: "b b b b b b i i i i i i";
923
+
924
+ /* code + image */
925
+ &:has(
926
+ pre:first-child,
927
+ :is(h1, header):first-of-type + pre
928
+ ) {
929
+ --slide-body-template: "c c c c c c i i i i i i";
930
+
931
+ /* code + image + * */
932
+ &:has(pre + p + :is(ul, ol, dl)):has(
933
+ pre + p > img:only-child
934
+ ) {
935
+ --slide-body-template: "b b b b b b i i i i i i"
936
+ "b b b b b b c c c c c c";
937
+ --grid-content-rows: minmax(min-content, auto)
938
+ minmax(min-content, auto);
939
+
940
+ &:has(:is(footer, .note, .footer):last-child) {
941
+ --slide-footer-template: "f f f f f f c c c c c c";
942
+ }
943
+ }
944
+ }
945
+ }
946
+
947
+ /* initial code */
948
+ &:has(
949
+ > pre:where(
950
+ :first-child,
951
+ :is(h1, header):first-of-type + *
952
+ )
953
+ ) {
954
+ --slide-body-template: "c c c c c c c c c c c c";
955
+
956
+ &:has(
957
+ pre + :is(blockquote, table, .full, .note, footer)
958
+ ) {
959
+ --slide-body-template: "c c c c c c c c c c c c"
960
+ "b b b b b b b b b b b b";
961
+ --grid-content-rows: min-content fit-content;
962
+ }
963
+ }
964
+
965
+ /* initial code + * */
966
+
967
+ &:has(
968
+ > pre:where(
969
+ :first-child:not(h1, header),
970
+ :is(h1, header):first-of-type + *
971
+ )
972
+ + *:not(h3, .full, .note, footer)
973
+ ):not(:has(pre > .full)) {
974
+ --slide-body-template: "c c c c c c c c b b b b";
975
+ }
976
+
977
+ /* * + code*/
978
+
979
+ &:has(
980
+ > *:where(
981
+ :first-child:not(h1, header),
982
+ :is(h1, header, aside):first-of-type + *
983
+ ):not(h3, aside, table, .full, .note, footer)
984
+ + pre
985
+ ):not(:has(pre > .full)) {
986
+ --slide-body-template: "b b b b b b c c c c c c";
987
+ }
988
+
989
+ /* side-by-side sections (h3) */
990
+
991
+ &:has(> h3:nth-of-type(2)) {
992
+ --slide-code-template: ;
993
+ --slide-list-template: ;
994
+ --slide-image-template: ;
995
+ --slide-titles-template: "t t t t t t t2 t2 t2 t2 t2 t2";
996
+ --slide-body-template: var(--slide-titles-template)
997
+ var(--slide-code-template)
998
+ var(--slide-list-template)
999
+ var(--slide-image-template);
1000
+ --grid-content-rows: min-content minmax(20%, 1fr);
1001
+
1002
+ &:has(
1003
+ > h3 + p > img:only-child:not(.full),
1004
+ > h3 + :not(h3) + p > img:only-child:not(.full),
1005
+ > h3
1006
+ + :not(h3)
1007
+ + :not(h3)
1008
+ + p
1009
+ > img:only-child:not(.full)
1010
+ ) {
1011
+ --slide-image-template: "i i i i i i i2 i2 i2 i2 i2 i2";
1012
+ }
1013
+
1014
+ &:has(
1015
+ > h3 + :is(ol, ul, table),
1016
+ > h3 + pre + :is(ol, ul, table)
1017
+ ) {
1018
+ --slide-list-template: "b b b b b b b2 b2 b2 b2 b2 b2";
1019
+ }
1020
+
1021
+ &:has(> h3 + pre) {
1022
+ --slide-code-template: "c c c c c c c2 c2 c2 c2 c2 c2";
1023
+ }
1024
+
1025
+ &:has(> aside ~ h3:nth-of-type(2)) {
1026
+ --slide-titles-template: "t t t t t2 t2 t2 t2 a a a a";
1027
+ }
1028
+
1029
+ &:has(> aside ~ h3 + :is(pre, ol, ul)) {
1030
+ --slide-list-template: "b b b b b2 b2 b2 b2 a a a a";
1031
+ }
1032
+
1033
+ > h3 {
1034
+ justify-self: center;
1035
+ text-align: center;
1036
+ & + :is(ol, ul) {
1037
+ font-size: 0.875em;
1038
+ }
1039
+ }
1040
+
1041
+ > h3:first-of-type {
1042
+ grid-area: t;
1043
+ &,
1044
+ & + pre {
1045
+ + :is(
1046
+ ol,
1047
+ ul,
1048
+ table,
1049
+ p:not(
1050
+ .note,
1051
+ .footer,
1052
+ :has(> img:only-child)
1053
+ )
1054
+ ) {
1055
+ grid-area: b;
1056
+ }
1057
+ }
1058
+ &,
1059
+ &
1060
+ + :is(
1061
+ ol,
1062
+ ul,
1063
+ table,
1064
+ p:not(:has(> img:only-child))
1065
+ ) {
1066
+ + pre {
1067
+ grid-area: c;
1068
+ }
1069
+ }
1070
+ }
1071
+
1072
+ /* side-by-side w/images in each stack */
1073
+
1074
+ &:has(> h3 + * + p:not(.full) > img:only-child) {
1075
+ --grid-content-rows: min-content auto
1076
+ minmax(50%, 1fr);
1077
+ --slide-image-template: "i i i i i i i2 i2 i2 i2 i2 i2";
1078
+ }
1079
+ &:has(> h3 + p:not(.full) > img:only-child) {
1080
+ --slide-image-template: "i i i i i i i2 i2 i2 i2 i2 i2";
1081
+ }
1082
+ &:has(> aside ~ h3 + * + p:not(.full) > img:only-child),
1083
+ &:has(> aside ~ h3 + p:not(.full) > img:only-child) {
1084
+ --slide-image-template: "i i i i i2 i2 i2 i2 a a a a";
1085
+ }
1086
+
1087
+ /* code + side-by-side */
1088
+
1089
+ &:has(
1090
+ > :is(pre:first-child, h1:first-child + pre) + h3
1091
+ ) {
1092
+ --slide-code-template: "c c c c c c c c c c c c";
1093
+ --grid-content-rows: min-content min-content
1094
+ minmax(50%, 1fr);
1095
+ }
1096
+
1097
+ /* image + side-by-side */
1098
+
1099
+ &:has(
1100
+ > p:where(
1101
+ :first-child,
1102
+ :is(h1, header):first-of-type + *
1103
+ )
1104
+ > img:only-child
1105
+ ) {
1106
+ --slide-header-template: "h h h h i i i i i i i i";
1107
+ }
1108
+
1109
+ /* extra stuff after side-by-side */
1110
+
1111
+ > h3
1112
+ + *
1113
+ + :first-of-type:is(
1114
+ blockquote,
1115
+ ul,
1116
+ ol,
1117
+ dl,
1118
+ table,
1119
+ .question,
1120
+ .full
1121
+ ) {
1122
+ grid-area: unset;
1123
+ grid-column: start/end;
1124
+ }
1125
+ }
1126
+
1127
+ > h3:nth-of-type(2) {
1128
+ grid-area: t2;
1129
+ &,
1130
+ & + pre {
1131
+ + :is(
1132
+ ol,
1133
+ ul,
1134
+ table,
1135
+ p:not(.note, .footer, :has(> img:only-child))
1136
+ ) {
1137
+ grid-area: b2;
1138
+ }
1139
+ }
1140
+ &,
1141
+ & + :is(ol, ul, table, p:not(:has(> img:only-child))) {
1142
+ + pre {
1143
+ grid-area: c2;
1144
+ }
1145
+ }
1146
+ & + p,
1147
+ & + :not(h3) + p,
1148
+ & + :not(h3) + :not(h3) + p {
1149
+ &:not(.full) > img:only-child {
1150
+ grid-area: i2;
1151
+ }
1152
+ }
1153
+ }
1154
+
1155
+ /* side-by-side-by-side (one row) */
1156
+
1157
+ &:has(h3:nth-of-type(3)) {
1158
+ --slide-body-template: "t t t t t2 t2 t2 t2 t3 t3 t3 t3"
1159
+ var(--slide-code-template)
1160
+ var(--slide-list-template)
1161
+ var(--slide-image-template);
1162
+ &:has(
1163
+ > h3 + p:not(.full) > img:only-child,
1164
+ > h3 + :not(h3) + p:not(.full) > img:only-child,
1165
+ > h3
1166
+ + :not(h3)
1167
+ + :not(h3)
1168
+ + p:not(.full)
1169
+ > img:only-child
1170
+ ) {
1171
+ --slide-image-template: "i i i i i2 i2 i2 i2 i3 i3 i3 i3";
1172
+ }
1173
+
1174
+ &:has(
1175
+ > h3 + :is(ol, ul, table),
1176
+ > h3 + pre + :is(ol, ul, table)
1177
+ ) {
1178
+ --slide-list-template: "b b b b b2 b2 b2 b2 b3 b3 b3 b3";
1179
+ }
1180
+
1181
+ &:has(> h3 + pre) {
1182
+ --slide-code-template: "c c c c c2 c2 c2 c2 c3 c3 c3 c3";
1183
+ }
1184
+ }
1185
+
1186
+ > h3:nth-of-type(3) {
1187
+ grid-area: t3;
1188
+ &,
1189
+ & + pre {
1190
+ + :is(
1191
+ ol,
1192
+ ul,
1193
+ table,
1194
+ p:not(.note, .footer, :has(> img:only-child))
1195
+ ) {
1196
+ grid-area: b3;
1197
+ }
1198
+ }
1199
+ &,
1200
+ & + :is(ol, ul, table, p:not(:has(> img:only-child))) {
1201
+ + pre {
1202
+ grid-area: c3;
1203
+ }
1204
+ }
1205
+ & + p,
1206
+ & + :not(h3) + p,
1207
+ & + :not(h3) + :not(h3) + p {
1208
+ &:not(.full) > img:only-child {
1209
+ grid-area: i3;
1210
+ }
1211
+ }
1212
+ }
1213
+
1214
+ /* side-by-side-by-side-by-side (two rows) */
1215
+
1216
+ &:has(h3:nth-of-type(4)) {
1217
+ --slide-list-template-2: ;
1218
+ --slide-code-template-2: ;
1219
+ --slide-image-template-2: ;
1220
+ --slide-body-template: "t t t t t t t2 t2 t2 t2 t2 t2"
1221
+ var(--slide-code-template)
1222
+ var(--slide-list-template)
1223
+ var(--slide-image-template)
1224
+ "t3 t3 t3 t3 t3 t3 t4 t4 t4 t4 t4 t4"
1225
+ var(--slide-code-template-2)
1226
+ var(--slide-list-template-2)
1227
+ var(--slide-image-template-2);
1228
+ --grid-content-rows: min-content minmax(0, 1fr)
1229
+ min-content minmax(0, 1fr);
1230
+
1231
+ &:has(
1232
+ > h3 + p > img:only-child:not(.full),
1233
+ > h3 + :not(h3) + p > img:only-child:not(.full),
1234
+ > h3
1235
+ + :not(h3)
1236
+ + :not(h3)
1237
+ + p
1238
+ > img:only-child:not(.full)
1239
+ ) {
1240
+ --slide-image-template: "i i i i i i i2 i2 i2 i2 i2 i2";
1241
+ --slide-image-template-2: "i3 i3 i3 i3 i3 i3 i4 i4 i4 i4 i4 i4";
1242
+ }
1243
+
1244
+ &:has(
1245
+ > h3 + :is(ol, ul, table),
1246
+ > h3 + pre + :is(ol, ul, table)
1247
+ ) {
1248
+ --slide-list-template: "b b b b b b b2 b2 b2 b2 b2 b2";
1249
+ --slide-list-template-2: "b3 b3 b3 b3 b3 b3 b4 b4 b4 b4 b4 b4";
1250
+ }
1251
+
1252
+ &:has(> h3 + pre) {
1253
+ --slide-code-template: "c c c c c c c2 c2 c2 c2 c2 c2";
1254
+ --slide-code-template-2: "c3 c3 c3 c3 c3 c3 c4 c4 c4 c4 c4 c4";
1255
+ }
1256
+
1257
+ &:has(> h3 + * + p > img:only-child) {
1258
+ --grid-content-rows: min-content auto
1259
+ minmax(8em, 1fr) min-content auto
1260
+ minmax(8em, 1fr);
1261
+ }
1262
+ }
1263
+
1264
+ > h3:nth-of-type(4) {
1265
+ grid-area: t4;
1266
+ &,
1267
+ & + pre {
1268
+ + :is(
1269
+ ol,
1270
+ ul,
1271
+ table,
1272
+ p:not(.note, .footer, :has(> img:only-child))
1273
+ ) {
1274
+ grid-area: b4;
1275
+ }
1276
+ }
1277
+ &,
1278
+ & + :is(ol, ul, table, p:not(:has(> img:only-child))) {
1279
+ + pre {
1280
+ grid-area: c4;
1281
+ }
1282
+ }
1283
+ & + p,
1284
+ & + :not(h3) + p,
1285
+ & + :not(h3) + :not(h3) + p {
1286
+ &:not(.full) > img:only-child {
1287
+ grid-area: i4;
1288
+ }
1289
+ }
1290
+ }
1291
+
1292
+ &:has(h3:nth-of-type(5)) {
1293
+ --slide-body-template: "t t t t t t t2 t2 t2 t2 t2 t2"
1294
+ var(--slide-code-template)
1295
+ var(--slide-list-template)
1296
+ var(--slide-image-template)
1297
+ "t3 t3 t3 t3 t4 t4 t4 t4 t5 t5 t5 t5"
1298
+ var(--slide-code-template-2)
1299
+ var(--slide-list-template-2)
1300
+ var(--slide-image-template-2);
1301
+
1302
+ &:has(
1303
+ > h3 + p > img:only-child:not(.full),
1304
+ > h3 + :not(h3) + p > img:only-child:not(.full),
1305
+ > h3
1306
+ + :not(h3)
1307
+ + :not(h3)
1308
+ + p
1309
+ > img:only-child:not(.full)
1310
+ ) {
1311
+ --slide-image-template: "i i i i i i i2 i2 i2 i2 i2 i2";
1312
+ --slide-image-template-2: "i3 i3 i3 i3 i4 i4 i4 i4 i5 i5 i5 i5";
1313
+ }
1314
+
1315
+ &:has(
1316
+ > h3 + :is(ol, ul, table),
1317
+ > h3 + pre + :is(ol, ul, table)
1318
+ ) {
1319
+ --slide-list-template: "b b b b b b b2 b2 b2 b2 b2 b2";
1320
+ --slide-list-template-2: "b3 b3 b3 b3 b4 b4 b4 b4 b5 b5 b5 b5";
1321
+ }
1322
+
1323
+ &:has(> h3 + pre) {
1324
+ --slide-code-template: "c c c c c c c2 c2 c2 c2 c2 c2";
1325
+ --slide-code-template-2: "c3 c3 c3 c3 c4 c4 c4 c4 c5 c5 c5 c5";
1326
+ }
1327
+ }
1328
+
1329
+ > h3:nth-of-type(5) {
1330
+ grid-area: t5;
1331
+ &,
1332
+ & + pre {
1333
+ + :is(
1334
+ ol,
1335
+ ul,
1336
+ table,
1337
+ p:not(.note, .footer, :has(> img:only-child))
1338
+ ) {
1339
+ grid-area: b5;
1340
+ }
1341
+ }
1342
+ &,
1343
+ & + :is(ol, ul, table, p:not(:has(> img:only-child))) {
1344
+ + pre {
1345
+ grid-area: c5;
1346
+ }
1347
+ }
1348
+ & + p,
1349
+ & + :not(h3) + p,
1350
+ & + :not(h3) + :not(h3) + p {
1351
+ &:not(.full) > img:only-child {
1352
+ grid-area: i5;
1353
+ }
1354
+ }
1355
+ }
1356
+
1357
+ &:has(h3:nth-of-type(6)) {
1358
+ --slide-body-template: "t t t t t2 t2 t2 t2 t3 t3 t3 t3"
1359
+ var(--slide-code-template)
1360
+ var(--slide-list-template)
1361
+ var(--slide-image-template)
1362
+ "t4 t4 t4 t4 t5 t5 t5 t5 t6 t6 t6 t6"
1363
+ var(--slide-code-template-2)
1364
+ var(--slide-list-template-2)
1365
+ var(--slide-image-template-2);
1366
+
1367
+ &:has(
1368
+ > h3 + p:not(.full) > img:only-child,
1369
+ > h3 + :not(h3) + p:not(.full) > img:only-child,
1370
+ > h3
1371
+ + :not(h3)
1372
+ + :not(h3)
1373
+ + p:not(.full)
1374
+ > img:only-child
1375
+ ) {
1376
+ --slide-image-template: "i i i i i2 i2 i2 i2 i3 i3 i3 i3 ";
1377
+ --slide-image-template-2: "i4 i4 i4 i4 i5 i5 i5 i5 i6 i6 i6 i6";
1378
+ }
1379
+
1380
+ &:has(
1381
+ > h3 + :is(ol, ul, table),
1382
+ > h3 + pre + :is(ol, ul, table)
1383
+ ) {
1384
+ --slide-list-template: "b b b b b2 b2 b2 b2 b3 b3 b3 b3";
1385
+ --slide-list-template-2: "b4 b4 b4 b4 b5 b5 b5 b5 b6 b6 b6 b6";
1386
+ }
1387
+
1388
+ &:has(> h3 + pre) {
1389
+ --slide-code-template: "c c c c c2 c2 c2 c2 c3 c3 c3 c3";
1390
+ --slide-code-template-2: "c4 c4 c4 c4 c5 c5 c5 c5 c6 c6 c6 c6";
1391
+ }
1392
+ > h3:nth-of-type(6) {
1393
+ grid-area: t6;
1394
+ &,
1395
+ & + pre {
1396
+ + :is(
1397
+ ol,
1398
+ ul,
1399
+ table,
1400
+ p:not(
1401
+ .note,
1402
+ .footer,
1403
+ :has(> img:only-child)
1404
+ )
1405
+ ) {
1406
+ grid-area: b6;
1407
+ }
1408
+ }
1409
+ &,
1410
+ &
1411
+ + :is(
1412
+ ol,
1413
+ ul,
1414
+ table,
1415
+ p:not(:has(> img:only-child))
1416
+ ) {
1417
+ + pre {
1418
+ grid-area: c6;
1419
+ }
1420
+ }
1421
+ & + p,
1422
+ & + :not(h3) + p,
1423
+ & + :not(h3) + :not(h3) + p {
1424
+ &:not(.full) > img:only-child {
1425
+ grid-area: i6;
1426
+ }
1427
+ }
1428
+ }
1429
+ }
1430
+
1431
+ /* * + question */
1432
+
1433
+ &:has(:is(p, ul, ol) + .question) {
1434
+ --slide-body-template: "b b b b b b q q q q q q";
1435
+
1436
+ > :is(p, ul, ol) {
1437
+ grid-area: b;
1438
+ }
1439
+ > .question {
1440
+ grid-area: q;
1441
+ }
1442
+ }
1443
+ }
1444
+
1445
+ /* explicit layouts */
1446
+
1447
+ /* layout: title */
1448
+
1449
+ slide-view:has(h1[layout="title"]) {
1450
+ grid-template-rows: 50%;
1451
+ grid-auto-rows: auto;
1452
+
1453
+ > h1 {
1454
+ align-self: end;
1455
+ }
1456
+ }