plates-render 0.2.0

The document-to-HTML half of plates: what a published page looks like.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
/* The default stylesheet.
 *
 * The eleven colour variables and the four typography variables below are the
 * *contract*: `appearance::ColorPalette` and `appearance::TypographySettings`
 * write exactly these names, and `html::css` appends what they write after this
 * file. Every rule here therefore reads a variable rather than a literal, and
 * the dark values live in a bare `@media (prefers-color-scheme: dark) { :root }`
 * so a caller's override — which has the same shape and comes later — wins.
 *
 * Names that begin `--_` are this file's own, derived from the contract with
 * `color-mix` so that a caller who supplies only an accent still gets tints,
 * rules and focus rings in their own colour.
 */

:root {
    /* ── Contract: colour ── */
    --bg: #fafaf9;
    --text: #14181f;
    --text-muted: #5b6674;
    /* blue-600 rather than blue-500: 5.2:1 on the page background, so link text
       clears WCAG AA where the lighter blue did not. */
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #e3e5e9;
    --code-bg: #f2f3f5;
    --surface-bg: rgba(255, 255, 255, 0.95);
    --surface-border: rgba(15, 23, 42, 0.08);
    --surface-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
    --divider-color: rgba(15, 23, 42, 0.1);

    /* ── Contract: typography ── */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-size: 16px;
    --line-height: 1.7;
    /* ~72 characters in the default stack: the top of the comfortable range for
       running prose, and wide enough that a fenced code line rarely scrolls. */
    --content-max-width: 44rem;

    /* ── Local ── */
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
    --line-height-tight: 1.25;
    --sidebar-width: 16rem;
    /* How far down anything under the fixed nav toggle has to start. The button
       is 0.75rem from the top and a little over 2.3rem tall, so this clears it
       with room to spare. The drawer and the page both read it, because the
       button floats over both and a change to its size must move both. Only
       consulted below the nav breakpoint, where the button is shown. */
    --nav-toggle-clear: 4.5rem;
    --page-pad-x: 1.5rem;
    --radius: 0.5rem;
    --radius-sm: 0.3rem;
    --_accent-tint: color-mix(in oklab, var(--accent) 10%, transparent);
    --_accent-tint-strong: color-mix(in oklab, var(--accent) 22%, transparent);
    --_accent-rule: color-mix(in oklab, var(--accent) 45%, transparent);
    /* An underline that reads as one without competing with the text over it. */
    --_faint-underline: color-mix(in oklab, currentColor 35%, transparent);

    /* Syntax highlighting. Literals rather than mixes of `--accent`: a palette
       derived from one hue is a palette whose colours are hard to tell apart,
       which is the one thing highlighting exists to do. Chosen against
       `--code-bg` rather than `--bg`, since that is what they are read on, and
       kept above 4.5:1 on it so a comment is still text and not decoration.
       File-local like every other `--_` name, and overridable by a caller's
       sheet on the same terms. */
    --_syn-comment: #6a7580;
    --_syn-string: #0a7040;
    --_syn-keyword: #9526a0;
    --_syn-entity: #2b62d9;
    --_syn-constant: #98590a;
    --_syn-support: #016a99;
    --_syn-invalid: #c02617;

    /* Let the user agent paint scrollbars, checkboxes and text fields to match
       the mode. Without it a dark page keeps light scrollbars and a light
       task-list checkbox, which is what the two palettes here are for.
       It follows the *preference*, not the palette — so a caller who overrides
       `--bg` and friends for one mode only, pinning a light page in a browser
       set to dark, should pin `color-scheme` alongside it. */
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Not pure black against near-white: the softened pair cuts the halation
           that makes long reading on an OLED display tiring. */
        --bg: #0e1015;
        --text: #e6eaf0;
        --text-muted: #9aa5b4;
        --accent: #7cb0fb;
        --accent-hover: #a9cbfd;
        --border: #2b3341;
        --code-bg: #171b23;
        --surface-bg: rgba(23, 27, 35, 0.95);
        --surface-border: rgba(255, 255, 255, 0.1);
        --surface-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.4);
        --divider-color: rgba(255, 255, 255, 0.1);

        --_syn-comment: #7f8b99;
        --_syn-string: #9ece6a;
        --_syn-keyword: #c678dd;
        --_syn-entity: #7aa2f7;
        --_syn-constant: #e0af68;
        --_syn-support: #56b6c2;
        --_syn-invalid: #f7768e;
    }
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--text);
    background: var(--bg);
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 2.5rem var(--page-pad-x) 5rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* A long URL, a long identifier or a wide inline code span must not push
       the page sideways; only the elements that scroll on purpose do. */
    overflow-wrap: break-word;
}

::selection {
    background: var(--_accent-tint-strong);
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Anchor jumps land clear of the top of the window rather than flush against
   it, and clear of the fixed nav button on a narrow screen. */
:target,
.content :is(h1, h2, h3, h4, h5, h6) {
    scroll-margin-top: 2rem;
}

/* ── Content typography ── */

a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: from-font;
}

a:hover {
    color: var(--accent-hover);
}

/* A link whose target isn't published for this audience: kept as text so the
   page reads naturally, but visibly inert (muted, dotted underline). */
.unpublished-link {
    color: var(--text-muted);
    text-decoration: underline dotted;
    text-underline-offset: 2px;
    cursor: not-allowed;
}

.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
    margin-top: 2.5rem;
    margin-bottom: 0.5rem;
    line-height: var(--line-height-tight);
    letter-spacing: -0.011em;
    font-weight: 650;
    text-wrap: balance;
}

/* A whole scale, so that h4–h6 stay headings. Left to the user agent, h5 and h6
   come out *smaller* than the body text they introduce. */
.content h1 { font-size: 2.1rem; letter-spacing: -0.02em; }
.content h2 { font-size: 1.55rem; }
.content h3 { font-size: 1.25rem; }
.content h4 { font-size: 1.08rem; }
.content h5 { font-size: 1rem; }
.content h6 {
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Whatever opens the body opens it: no leading gap above the first element,
   whichever element that turns out to be. */
.content > :first-child {
    margin-top: 0;
}

.content p {
    margin: 1rem 0;
    text-wrap: pretty;
}

.content ul, .content ol {
    margin: 1rem 0;
    padding-left: 1.6rem;
}

.content li {
    margin: 0.3rem 0;
}

.content li > ul, .content li > ol {
    margin: 0.3rem 0;
}

.content dl {
    margin: 1rem 0;
}

.content dt {
    font-weight: 650;
    margin-top: 1rem;
}

.content dd {
    margin: 0.25rem 0 0 1.6rem;
    color: var(--text-muted);
}

.content pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.55;
    font-size: 0.875em;
    tab-size: 4;
}

.content code {
    background: var(--code-bg);
    /* Tight horizontally: a wider inset reads as a space before the comma or
       colon that so often follows an inline `code` span. */
    padding: 0.15em 0.3em;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
    font-family: var(--font-mono);
}

.content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* ── Syntax highlighting ──
 *
 * `plates_render::syntax` emits a class per atom of the Sublime scope it
 * matched, each prefixed `plates-`: `keyword.control.rust` arrives as
 * `plates-keyword plates-control plates-rust`. So these select the *first*
 * atom, which is the one that names what a token is.
 *
 * Two things decide the order of the rules below, and both are load-bearing:
 *
 * 1. Every selector here is one class, so they all have the same specificity
 *    and the last matching rule wins. A scope's atoms overlap — the `"` opening
 *    a string is `punctuation.definition.string.begin`, carrying *both*
 *    `plates-punctuation` and `plates-string` — so the rule that should win
 *    goes later. Punctuation is therefore first: a quote inside a string reads
 *    as string, a `//` inside a comment reads as comment, and neither is left
 *    a different colour from the token it belongs to.
 *
 * 2. `plates-meta` is deliberately absent. `meta.function` wraps a whole
 *    function, signature and body together, so colouring it would flood
 *    everything nested inside with one colour and undo the rest of this block.
 *
 * Scoped to `.plates-highlighted` — the class the pass adds only to blocks it
 * actually coloured — so a fence in a language no grammar covers keeps the
 * plain `<pre>` treatment above rather than half of this one.
 */
.content pre code.plates-highlighted .plates-punctuation { color: var(--_syn-comment); }
.content pre code.plates-highlighted .plates-keyword,
.content pre code.plates-highlighted .plates-storage { color: var(--_syn-keyword); }
.content pre code.plates-highlighted .plates-entity,
.content pre code.plates-highlighted .plates-variable { color: var(--_syn-entity); }
.content pre code.plates-highlighted .plates-support { color: var(--_syn-support); }
.content pre code.plates-highlighted .plates-constant { color: var(--_syn-constant); }
.content pre code.plates-highlighted .plates-string { color: var(--_syn-string); }
.content pre code.plates-highlighted .plates-comment { color: var(--_syn-comment); font-style: italic; }
.content pre code.plates-highlighted .plates-invalid { color: var(--_syn-invalid); }

.content kbd {
    font-family: var(--font-mono);
    font-size: 0.8em;
    padding: 0.15em 0.4em;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--code-bg);
}

/* Not italic: a pull quote is often several sentences, and a run of italic that
   long is harder to read than the text around it. The rule and the tint mark it
   instead. */
.content blockquote {
    border-left: 3px solid var(--_accent-rule);
    margin: 1.5rem 0;
    padding: 0.25rem 0 0.25rem 1.25rem;
    color: var(--text-muted);
}

.content blockquote > :first-child { margin-top: 0; }
.content blockquote > :last-child { margin-bottom: 0; }

/* `width: max-content` with `max-width: 100%` is what makes a table that does
   not fit scroll *inside itself* rather than widening the page. It costs the
   full-bleed look for a table that would have fitted, which is the cheaper of
   the two — a clipped table is unreadable, a narrow one is not. */
.content table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.94em;
    line-height: 1.5;
}

.content th, .content td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.55rem 0.9rem;
    text-align: left;
    vertical-align: top;
}

.content th {
    background: none;
    font-weight: 650;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.content tbody tr:last-child td {
    border-bottom: none;
}

.content th:first-child, .content td:first-child { padding-left: 0; }
.content th:last-child, .content td:last-child { padding-right: 0; }

.content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.content figure {
    margin: 1.5rem 0;
}

.content figcaption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

.content details {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.content summary {
    cursor: pointer;
    font-weight: 600;
}

.content details[open] > summary {
    margin-bottom: 0.5rem;
}

/* ── Layout misc ── */

nav.toc {
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2.5rem;
}

nav.toc h2 {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

nav.toc ul {
    margin: 0;
    padding-left: 1.25rem;
}

nav.toc li {
    margin: 0.35rem 0;
}

hr,
.content hr {
    border: none;
    border-top: 1px solid var(--divider-color);
    margin: 3rem 0;
}

section {
    margin-bottom: 2rem;
}

footer {
    margin-top: 4rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--divider-color);
    color: var(--text-muted);
    font-size: 0.875rem;
}

footer p {
    margin: 0;
}

footer a {
    color: var(--text-muted);
    text-decoration-color: var(--_faint-underline);
}

footer a:hover {
    color: var(--accent);
    text-decoration-color: currentColor;
}

/* ── Site navigation sidebar ── */

.nav-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1010;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text);
    box-shadow: var(--surface-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    line-height: 1;
}

.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 2.5rem 0.75rem 3rem;
    border-right: 1px solid var(--divider-color);
    background: var(--bg);
    z-index: 1000;
    font-size: 0.9rem;
    line-height: 1.45;
}

/* The sidebar is fixed, so the page it sits beside is offset by *padding on the
   body*: that holds whatever the shell puts inside it, including a template's
   own markup, rather than depending on one wrapper element existing.
   `body.has-site-nav`, not `.has-site-nav body` — the class is on the body, and
   an element is not its own descendant. */
body.has-site-nav {
    max-width: none;
    padding-left: calc(var(--sidebar-width) + var(--page-pad-x));
}

/* …and the measure moves down to the column, which centres in what is left. */
.has-site-nav .site-content {
    max-width: var(--content-max-width);
    margin-inline: auto;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* A guide line down each nested level: at three levels deep the indent alone
   stops being legible. */
.nav-list .nav-list {
    margin-left: 0.75rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--divider-color);
}

.nav-list li {
    margin: 0.05rem 0;
}

.nav-list a {
    display: block;
    padding: 0.3rem 0.55rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-list a:hover {
    background: var(--code-bg);
    color: var(--text);
}

.nav-current > a {
    background: var(--_accent-tint);
    color: var(--accent);
    font-weight: 600;
}

.nav-ancestor > a {
    color: var(--text);
    font-weight: 500;
}

/* ── Breadcrumbs (single parent link, and the full trail) ── */

.breadcrumb,
.breadcrumbs {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb a,
.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumbs a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.breadcrumb-sep {
    margin: 0 0.4rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* ── Responsive ── */

@media (max-width: 60rem) {
    .nav-toggle {
        display: block;
    }

    /* The drawer slides out *underneath* the toggle, so its own first item
       needs the same clearance the page gets: at the desktop padding the root
       entry sat behind the button. */
    .site-nav {
        padding-top: var(--nav-toggle-clear);
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .site-nav.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
    }

    /* Clear the fixed toggle button, which would otherwise sit on top of the
       first heading. */
    body.has-site-nav {
        padding-left: var(--page-pad-x);
        padding-top: var(--nav-toggle-clear);
    }
}

/* Only the frame tightens on a phone. The body size is deliberately left alone:
   the old rule set `font-size: 15px` on the body, which threw away whatever a
   caller had put in `--font-size` — and 16px is the size at which iOS stops
   zooming a focused field anyway. */
@media (max-width: 600px) {
    :root {
        --page-pad-x: 1.1rem;
    }

    body {
        padding-top: 1.5rem;
    }

    .content h1 { font-size: 1.75rem; }
    .content h2 { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    :root {
        --bg: #fff;
        --text: #000;
        --text-muted: #444;
    }

    .site-nav, .nav-toggle { display: none; }

    body.has-site-nav {
        padding-left: 0;
        padding-top: 0;
    }

    body {
        max-width: none;
        font-size: 11pt;
    }

    .content pre, .content table, .content blockquote, .content img {
        break-inside: avoid;
    }

    .content :is(h1, h2, h3) {
        break-after: avoid;
    }
}

/* ── Colored highlights ── */

.highlight-mark {
    background: none;
    padding: 0.1em 0.2em;
    border-radius: 0.2em;
    /* The user agent forces `color: MarkText` — near-black — on `<mark>`, which
       is unreadable on the dark-mode swatches below. */
    color: inherit;
}

.highlight-red { background: oklch(0.92 0.12 25); }
.highlight-orange { background: oklch(0.93 0.1 60); }
.highlight-yellow { background: oklch(0.95 0.12 95); }
.highlight-green { background: oklch(0.92 0.08 145); }
.highlight-cyan { background: oklch(0.92 0.08 195); }
.highlight-blue { background: oklch(0.88 0.1 250); }
.highlight-violet { background: oklch(0.9 0.1 300); }
.highlight-pink { background: oklch(0.93 0.1 350); }
.highlight-brown { background: oklch(0.88 0.06 60); }
.highlight-grey { background: oklch(0.9 0 0); }

@media (prefers-color-scheme: dark) {
    .highlight-red { background: oklch(0.35 0.12 25); }
    .highlight-orange { background: oklch(0.38 0.1 60); }
    .highlight-yellow { background: oklch(0.42 0.12 95); }
    .highlight-green { background: oklch(0.38 0.08 145); }
    .highlight-cyan { background: oklch(0.38 0.08 195); }
    .highlight-blue { background: oklch(0.35 0.1 250); }
    .highlight-violet { background: oklch(0.38 0.1 300); }
    .highlight-pink { background: oklch(0.4 0.1 350); }
    .highlight-brown { background: oklch(0.38 0.06 60); }
    .highlight-grey { background: oklch(0.4 0 0); }
}

/* ── Spoilers ── */

.spoiler-mark {
    cursor: pointer;
    border-radius: 0.2em;
    padding: 0.1em 0.3em;
    transition: background 0.2s, color 0.2s;
}

.spoiler-hidden {
    background: var(--text);
    color: transparent;
    user-select: none;
}

.spoiler-revealed {
    background: var(--code-bg);
    color: var(--text);
}

/* ── Footnotes ──
 *
 * Two spellings, because two engines have rendered these pages. comrak used
 * `.footnotes` / `.footnote-ref`; twig, which replaced it so Djot and HTML
 * could be published at all, uses the DPUB-ARIA roles (`doc-endnotes`,
 * `doc-noteref`, `doc-backlink`). Both are styled so a site published before
 * that change and one published after look the same — the CSS is served fresh
 * on every publish, but the pages in a namespace are not all re-rendered.
 */

.footnotes,
[role="doc-endnotes"] {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--divider-color);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* twig opens its endnotes section with its own rule; the section's border-top
   above is already the separator, so a second one reads as a double line. */
[role="doc-endnotes"] > hr {
    display: none;
}

.footnotes ol,
[role="doc-endnotes"] ol {
    padding-left: 1.5rem;
}

.footnotes li,
[role="doc-endnotes"] li {
    margin: 0.5rem 0;
}

/* Jumping to a note is a jump to a one-line target in a page of small grey
   text; without this the reader has to find it again by eye. */
.footnotes li:target,
[role="doc-endnotes"] li:target {
    background: var(--_accent-tint);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 0.4rem var(--_accent-tint);
}

.footnote-ref a, .footnotes a,
a[role="doc-noteref"], [role="doc-endnotes"] a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.footnote-ref a:hover, .footnotes a:hover,
a[role="doc-noteref"]:hover, [role="doc-endnotes"] a:hover {
    text-decoration: underline;
}

sup.footnote-ref,
a[role="doc-noteref"] sup {
    font-size: 0.75em;
    line-height: 0;
    vertical-align: super;
}

/* The return arrow sits immediately after the note's last word otherwise. */
a[role="doc-backlink"],
.footnotes .footnote-backref {
    margin-left: 0.4em;
    text-decoration: none;
}

/* ── Generated index ──
 *
 * The markup `site::synthesize_index` writes for a site with no authored front
 * page: a `<ul>` of entries, optionally inside a `<section>` per group.
 */

.entry-group {
    margin-bottom: 2.5rem;
}

.entry-group h2 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--divider-color);
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Qualified with `.content` throughout, so that these outweigh the `.content
   ul` / `.content li` / `.content pre` rules above — which are more specific
   than a bare class and would otherwise put the list indent and the code-block
   border back. */
.content .entry-list,
.entry-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.content .entry-list li,
.entry-list li {
    margin: 0.75rem 0;
    padding-left: 0;
}

.entry-list a {
    text-decoration: none;
    font-weight: 550;
}

.entry-list a:hover {
    text-decoration: underline;
}

.entry-description {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── Task lists ──
 *
 * twig marks the list rather than each item (`<ul class="task-list">`), so the
 * bullet has to be removed on the list and the indent given back by hand. The
 * selector is qualified with `.content` so that it outweighs `.content ul`,
 * which would otherwise keep the ordinary list indent it sets.
 */

.content .task-list,
.task-list {
    list-style: none;
    padding-left: 0.15rem;
}

.content .task-list li,
.task-list li {
    padding-left: 0;
}

.task-list input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: var(--accent);
    vertical-align: baseline;
}

/* ── Embedded islands ──
 *
 * An HTML attachment embedded with `![alt](page.html)`. The `min-height` and
 * the final height both come from the tag — authored via `{height=…}`, then
 * measured by the resize bridge — so nothing here may set a height.
 */

.diaryx-island {
    display: block;
    width: 100%;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color-scheme: light dark;
}

/* ── Unrendered bodies ──
 *
 * A body the parser refused, shown as escaped source rather than dropped. It is
 * a failure the reader can see, so it is marked as one instead of passing for
 * an ordinary code block.
 */

.content .diaryx-unrendered,
.diaryx-unrendered {
    background: var(--code-bg);
    border: none;
    border-left: 3px solid var(--text-muted);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 0.9em;
    line-height: 1.5;
}