summaryrefslogtreecommitdiffstats
path: root/toolkit/themes/shared/aboutReader.css
blob: eeeddbb21ab64bf6fc190fa48c1705acaead5b12 (plain)
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
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Avoid adding ID selector rules in this style sheet, since they could
 * inadvertently match elements in the article content. */

:root {
  --grey-90-a10: rgba(12, 12, 13, 0.1);
  --grey-90-a20: rgba(12, 12, 13, 0.2);
  --grey-30: #d7d7db;
  --light-theme-background: #fff;
  --light-theme-foreground: rgb(21, 20, 26);
  --dark-theme-background: rgb(28, 27, 34);
  --dark-theme-foreground: rgb(251, 251, 254);
  --body-padding: 64px;
  --font-size: 12;
  --content-width: 22em;
  --line-height: 1.6em;
  --text-alignment: start;
  --word-spacing: 0;
  --letter-spacing: 0;
}

body {
  --main-background: var(--light-theme-background);
  --main-foreground: var(--light-theme-foreground);
  --primary-color: rgb(0, 97, 224);
  --toolbar-border: var(--grey-90-a20);
  --toolbar-transparent-border: transparent;
  --toolbar-box-shadow: var(--grey-90-a10);
  --toolbar-button-background: transparent;
  --toolbar-button-background-hover: rgba(207, 207, 216, 0.66);
  --toolbar-button-foreground-hover: var(--icon-fill);
  --toolbar-button-background-active: rgb(207, 207, 216);
  --toolbar-button-foreground-active: var(--primary-color);
  --toolbar-button-border: transparent;
  --toolbar-button-border-hover: var(--toolbar-button-border);
  --toolbar-button-border-active: var(--toolbar-button-border);
  --tooltip-background: var(--toolbar-button-background-active);
  --tooltip-foreground: var(--icon-fill);
  --tooltip-border: transparent;
  --popup-background: #fff;
  --popup-border: rgba(0, 0, 0, 0.12);
  --popup-line: var(--grey-30);
  --popup-shadow: rgba(49, 49, 49, 0.3);
  --popup-button-background: rgba(207, 207, 216, 0.33);
  --popup-button-foreground: var(--main-foreground);
  --popup-button-selected-foreground: var(--color-gray-05);
  --popup-button-background-hover: var(--toolbar-button-background-hover);
  --popup-button-foreground-hover: var(--main-foreground);
  --popup-button-background-active: var(--toolbar-button-background-active);
  --popup-button-border: rgba(0, 0, 0, 0.2);
  --selected-background: rgba(0, 97, 224, 0.3);
  --outline-focus-color: var(--primary-color);
  --font-value-background: rgb(240, 240, 244);
  --font-value-border: var(--grey-30);
  --icon-fill: rgb(91, 91, 102);
  --icon-disabled-fill: rgba(91, 91, 102, 0.4);
  --text-selected-background: var(--selected-background);
  --text-selected-foreground: inherit;
  --link-foreground: var(--primary-color);
  --link-selected-background: var(--selected-background);
  --link-selected-foreground: #333;
  --visited-link-foreground: #b5007f;
  --custom-theme-background: var(--color-white);
  --custom-theme-foreground: var(--color-gray-100);
  --custom-theme-unvisited-links: var(--color-blue-50);
  --custom-theme-visited-links: #321C64;
  --custom-theme-selection-highlight: #FFFFCC;
  /* light colours */
}

body.sepia {
  --main-background: rgb(244, 236, 216);
  --main-foreground: rgb(91, 70, 54);
  --toolbar-border: var(--main-foreground);
  --icon-fill: var(--main-foreground);
  --icon-disabled-fill: rgba(91, 70, 54, 0.4);
}

body.gray {
  --main-background: var(--grey-30);
  --main-foreground: var(--light-theme-foreground);
  --toolbar-border: var(--main-foreground);
  --icon-fill: var(--main-foreground);
}

body.dark,
body.contrast {
  --toolbar-box-shadow: black;
  --toolbar-button-background-hover: rgb(82, 82, 94);
  --toolbar-button-background-active: rgb(91, 91, 102);
  --popup-background: rgb(66, 65, 77);
  --popup-button-border: rgba(255, 255, 255, 0.2);
  --popup-line: rgba(249, 249, 250, 0.1);
  --popup-button-background: rgb(43, 42, 51);
  --font-value-background: rgba(249, 249, 250, 0.15);
  --font-value-border: #656468;
  --icon-disabled-fill: rgba(251, 251, 254, 0.4);
  --link-selected-foreground: #fff;
  --visited-link-foreground: #e675fd;
  --selected-background: rgba(0, 221, 255, 0.3);
  --popup-button-selected-foreground: var(--color-gray-100);
  /* dark colours */

  .moz-reader-block-img {
    filter: brightness(0.8) contrast(1.2);
  }
}

body.dark {
  --main-background: var(--dark-theme-background);
  --main-foreground: var(--dark-theme-foreground);
  --primary-color: rgb(0, 221, 255);
  --toolbar-border: rgba(249, 249, 250, 0.2);
  --icon-fill: rgb(251, 251, 254);
}

body.contrast {
  --main-background: #000000;
  --main-foreground: #fff;
  --primary-color: #D6B4FD;
  --toolbar-border: #FFEE32;
  --icon-fill: #FFEE32;
}

body.custom {
  --main-background: var(--custom-theme-background);
  --main-foreground: var(--custom-theme-foreground);
  --link-foreground: var(--custom-theme-unvisited-links);
  --visited-link-foreground: var(--custom-theme-visited-links);
  --popup-button-foreground: var(--light-theme-foreground);
  --popup-button-foreground-hover: var(--light-theme-foreground);
  --tooltip-foreground: var(--light-theme-foreground);
  --toolbar-border: var(--main-foreground);
  --icon-fill: var(--main-foreground);
  --icon-disabled-fill: rgba(91, 91, 102, 0.4);
}

body.hcm {
  --main-background: Canvas;
  --main-foreground: CanvasText;
  --primary-color: SelectedItem;
  --toolbar-border: CanvasText;
   /* We need a true transparent but in HCM this would compute to an actual color,
      so select the page's background color instead: */
  --toolbar-transparent-border: Canvas;
  --toolbar-box-shadow: Canvas;
  --toolbar-button-background: ButtonFace;
  --toolbar-button-background-hover: SelectedItem;
  --toolbar-button-foreground-hover: SelectedItemText;
  --toolbar-button-background-active: SelectedItemText;
  --toolbar-button-foreground-active: SelectedItem;
  --toolbar-button-border: ButtonText;
  --toolbar-button-border-hover: SelectedItemText;
  --toolbar-button-border-active: SelectedItem;
  --tooltip-background: Canvas;
  --tooltip-foreground: CanvasText;
  --tooltip-border: CanvasText;
  --popup-background: Canvas;
  --popup-border: CanvasText;
  --popup-line: CanvasText;
  --popup-button-background: ButtonFace;
  --popup-button-foreground: ButtonText;
  --popup-button-background-hover: ButtonText;
  --popup-button-foreground-hover: ButtonFace;
  --popup-button-background-active: ButtonText;
  --popup-button-border: ButtonText;
  --selected-background: Canvas;
  --outline-focus-color: CanvasText;
  --font-value-background: Canvas;
  --font-value-border: CanvasText;
  --icon-fill: ButtonText;
  --icon-disabled-fill: GrayText;
  --text-selected-background: SelectedItem;
  --text-selected-foreground: SelectedItemText;
  --popup-button-selected-foreground: SelectedItemText;
  --link-foreground: LinkText;
  --link-selected-background: SelectedItem;
  --link-selected-foreground: SelectedItemText;
  --visited-link-foreground: VisitedText;
}

body.hcm .colors-dropdown {
  /* Hide entire colors menu when HCM is on. */
  display: none;
}

body {
  margin: 0;
  padding: var(--body-padding);
  background-color: var(--main-background);
  color: var(--main-foreground);
}

body.loaded {
  transition: color 0.4s, background-color 0.4s;
}

*::selection {
  background-color: var(--text-selected-background);
  color: var(--text-selected-foreground);
}

a {
  border-radius: 2px;
}

a::selection {
  background-color: var(--link-selected-background);
  color: var(--link-selected-foreground);
}

a:focus-visible {
  outline: 2px solid var(--outline-focus-color);
  outline-offset: 1px;
}

body.sans-serif {
  font-family: Helvetica, Arial, sans-serif;
}

body.serif {
  font-family: Georgia, "Times New Roman", serif;
}

/* Override some controls and content styles based on color scheme */

blockquote {
  border-inline-start: 2px solid var(--main-foreground) !important;
}

.color-scheme-buttons {
  .light-button,
  .auto-button {
    color: var(--light-theme-foreground);
    background-color: var(--light-theme-background);
  }

  @media (prefers-color-scheme: dark) {
    .auto-button {
      color: var(--dark-theme-foreground);
      background-color: var(--dark-theme-background);
    }
  }

  .dark-button {
    color: var(--dark-theme-foreground);
    background-color: var(--dark-theme-background);
  }

  .sepia-button {
    color: #5b4636;
    background-color: #f4ecd8;
  }
}

/* Loading/error message */

.reader-message {
  margin-top: 40px;
  display: none;
  text-align: center;
  width: 100%;
  font-size: 0.9em;
}

/* Detector element to see if we're at the top of the doc or not. */
.top-anchor {
  position: absolute;
  top: 0;
  width: 0;
  height: 5px;
  pointer-events: none;
}

/* Header */

.header {
  text-align: start;
  display: none;
}

.domain {
  font-size: 0.9em;
  line-height: 1.48em;
  padding-bottom: 4px;
  font-family: Helvetica, Arial, sans-serif;
  text-decoration: underline var(--main-foreground) !important;
  color: var(--link-foreground);
}

.header > h1 {
  font-size: 1.6em;
  line-height: 1.25em;
  width: 100%;
  margin: 30px 0;
  padding: 0;
}

.header > .credits {
  font-size: 0.9em;
  line-height: 1.48em;
  margin: 0 0 10px;
  padding: 0;
  font-style: italic;
}

.header > .meta-data {
  font-size: 0.65em;
  margin: 0 0 15px;
}

.reader-estimated-time {
  text-align: match-parent;
}

/* Controls toolbar */

.toolbar-container {
  position: sticky;
  z-index: 2;
  top: 32px;
  height: 0; /* take up no space, so body is at the top. */

  /* As a stick container, we're positioned relative to the body. Move us to
   * the edge of the viewport using margins, and take the width of
   * the body padding into account for calculating our width.
   */
  margin-inline-start: calc(-1 * var(--body-padding));
  width: max(var(--body-padding), calc((100% - var(--content-width)) / 2 + var(--body-padding)));
  font-size: var(--font-size); /* Needed to ensure `em` units match, is reset for .reader-controls */
}

.toolbar {
  padding-block: 16px;
  border: 1px solid var(--toolbar-border);
  border-radius: 6px;
  box-shadow: 0 2px 8px var(--toolbar-box-shadow);

  width: 32px; /* basic width, without padding/border */

  /* padding should be 16px, except if there's not enough space for that, in
   * which case use half the available space for padding (=25% on each side).
   * The 34px here is the width + borders. We use a variable because we need
   * to know this size for the margin calculation.
   */
  --inline-padding: min(16px, calc(25% - 0.25 * 34px));
  padding-inline: var(--inline-padding);

  /* Keep a maximum of 96px distance to the body, but center once the margin
   * gets too small. We need to set the start margin, however...
   * To center, we'd want 50% of the container, but we'd subtract half our
   * own width (16px) and half the border (1px) and the inline padding.
   * When the other margin would be 96px, we want 100% - 96px - the complete
   * width of the actual toolbar (34px + 2 * padding)
   */
  margin-inline-start: max(calc(50% - 17px - var(--inline-padding)), calc(100% - 96px - 34px - 2 * var(--inline-padding)));

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, "Helvetica Neue", sans-serif;
  list-style: none;
  user-select: none;

  /* Set focus outlines to the primary color without having to specify it
   * per each element. */
  accent-color: var(--primary-color);
}

@media (prefers-reduced-motion: no-preference) {
  .toolbar {
    transition-property: border-color, box-shadow;
    transition-duration: 250ms;
  }

  .toolbar .toolbar-button {
    transition-property: opacity;
    transition-duration: 250ms;
  }

  .toolbar-container.scrolled > .toolbar:not(:hover, :focus-within) {
    border-color: var(--toolbar-transparent-border);
    box-shadow: 0 2px 8px transparent;
  }

  .toolbar-container.scrolled > .toolbar:not(:hover, :focus-within) > .reader-controls:not(.dropdown-open) .toolbar-button {
    opacity: 0.6;
  }

  .toolbar-container.transition-location {
    transition-duration: 250ms;
    transition-property: width;
  }
}

.toolbar-container.overlaps .toolbar-button {
  opacity: 0.1;
}

.dropdown-open .toolbar {
  border-color: var(--toolbar-transparent-border);
  box-shadow: 0 2px 8px transparent;
}

.reader-controls {
  /* We use `em`s above this node to get it to the right size. However,
   * the UI inside the toolbar should use a fixed, smaller size. */
  font-size: 11px;
}

button {
  -moz-context-properties: fill;
  color: var(--main-foreground);
  fill: var(--icon-fill);
}

button:disabled {
  /* !important to override other uses of `fill` where the specificity there is greater. */
  fill: var(--icon-disabled-fill) !important;
}

.toolbar button::-moz-focus-inner {
  border: 0;
}

.toolbar-button {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--toolbar-button-border);
  border-radius: 4px;
  margin: 4px 0;
  background-color: var(--toolbar-button-background);
  background-size: 16px 16px;
  background-position: center;
  background-repeat: no-repeat;
}

.toolbar-button:hover {
  background-color: var(--toolbar-button-background-hover);
  border-color: var(--toolbar-button-border-hover);
  fill: var(--toolbar-button-foreground-hover);
}

.open .toolbar-button,
.toolbar-button:hover:active {
  background-color: var(--toolbar-button-background-active);
  color: var(--toolbar-button-foreground-active);
  border-color: var(--toolbar-button-border-active);
  fill: var(--toolbar-button-foreground-active);
}

.toolbar-button:focus-visible {
  outline: 2px solid var(--outline-focus-color);
  outline-offset: 2px;
}

.hover-label {
  position: relative;
  inset-inline-start: 36px;
  line-height: 16px;
  white-space: pre; /* make sure we don't wrap */
  background-color: var(--tooltip-background);
  color: var(--tooltip-foreground);
  padding: 4px 8px;
  border: 1px solid var(--tooltip-border);
  border-radius: 2px;
  visibility: hidden;
  pointer-events: none;
  /* Put above .dropdown .dropdown-popup, which has z-index: 1000. */
  z-index: 1001;
}

/* Show the hover tooltip on non-dropdown buttons. */
.toolbar-button:not(.dropdown-toggle):hover > .hover-label,
.toolbar-button:not(.dropdown-toggle):focus-visible > .hover-label,
/* Show the hover tooltip for dropdown buttons unless its dropdown is open. */
:not(.open) > li > .dropdown-toggle:hover > .hover-label,
:not(.open) > li > .dropdown-toggle:focus-visible > .hover-label {
  visibility: visible;
}

.dropdown {
  text-align: center;
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.dropdown li {
  margin: 0;
  padding: 0;
}

/* Popup */

.dropdown .dropdown-popup {
  text-align: start;
  position: absolute;
  inset-inline-start: 32px;
  z-index: 1000;
  background-color: var(--popup-background);
  visibility: hidden;
  border-radius: 4px;
  border: 1px solid var(--popup-border);
  box-shadow: 0 0 10px 0 var(--popup-shadow);
  top: var(--space-xsmall);

  h2 {
    font-size: var(--font-size-large);
    font-weight: var(--font-weight-bold);
    color: var(--popup-button-foreground);
    margin-block: var(--space-large);
  }

  hr {
    width: 100%;
    margin: 0;
    border: none;
    border-top: 1px solid var(--popup-line);
  }
}

.open > .dropdown-popup {
  visibility: visible;
}

/* Font style popup */

.radio-button {
  /* We visually hide these, but we keep them around so they can be focused
   * and changed by interacting with them via the label, or the keyboard, or
   * assistive technology.
   */
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.radiorow,
.buttonrow {
  display: flex;
  align-content: center;
  justify-content: center;
}

.content-width-value,
.font-size-value,
.line-height-value {
  box-sizing: border-box;
  width: 36px;
  height: 20px;
  line-height: 18px;
  display: flex;
  justify-content: center;
  align-content: center;
  margin: auto;
  border-radius: 10px;
  border: 1px solid var(--font-value-border);
  color: var(--popup-button-foreground);
  background-color: var(--font-value-background);
}

.buttonrow > button {
  border: 0;
  height: 60px;
  width: 90px;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  fill: var(--popup-button-foreground);
}

.buttonrow > button:enabled:hover {
  background-color: var(--popup-button-background-hover);
  fill: var(--popup-button-foreground-hover);
}

.buttonrow > button:enabled:hover:active {
  background-color: var(--popup-button-background-active);
}

.buttonrow > button:enabled:focus-visible {
  outline: 2px solid var(--outline-focus-color);
  outline-offset: -2px;
}

.style-dropdown .radiorow:not(:last-child),
.style-dropdown .buttonrow:not(:last-child) {
  border-bottom: 1px solid var(--popup-line);
}

.radiorow > label {
  position: relative;
  box-sizing: border-box;
  border: 2px solid var(--popup-button-border);
}

.radiorow > label[checked] {
  border: 2px solid var(--link-selected-foreground);
}

.radiorow > label:hover {
  background-color: var(--popup-button-background-hover);
  color: var(--popup-button-foreground-hover);
}

.radiorow > input[type=radio]:focus-visible + label {
  outline: 2px solid var(--primary-color);
  outline-offset: var(--focus-outline-offset);
  z-index: 1;
}

.font-type-buttons > label {
  height: 64px;
  width: 105px;
  /* Slightly more space between these items. */
  margin: 10px;
  /* Center the Sans-serif / Serif labels */
  text-align: center;
  background-size: 63px 39px;
  background-repeat: no-repeat;
  background-position: center 18px;
  background-color: var(--popup-button-background);
  color: var(--popup-button-foreground);
  fill: currentColor;
  -moz-context-properties: fill;
  /* This mostly matches baselines, but because of differences in font
   * baselines between serif and sans-serif, this isn't always enough. */
  line-height: 1;
  padding-top: 2px;
  border-radius: 2px;
}

.font-type-buttons {
  > label:first-of-type {
    margin-inline-start: var(--space-large);
  }

  > label:last-of-type {
    margin-inline-end: var(--space-large);
  }
}

.font-type-buttons > label[checked] {
  background-color: var(--selected-background);
}

.sans-serif-button {
  font-family: Helvetica, Arial, sans-serif;
  background-image: url("chrome://global/skin/reader/RM-Sans-Serif.svg");
}

/* Tweak padding to match the baseline on mac */
:root[platform=macosx] .sans-serif-button {
  padding-top: 3px;
}

.serif-button {
  font-family: Georgia, "Times New Roman", serif;
  background-image: url("chrome://global/skin/reader/RM-Serif.svg");
}

body.hcm .color-scheme-buttons {
  /* Disallow selecting themes when HCM is on. */
  display: none;
}

.color-scheme-buttons > label {
  padding: 12px;
  height: 34px;
  font-size: 12px;
  /* Center the labels horizontally as well as vertically */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* We want 10px between items, but there's no margin collapsing in flexbox. */
  margin: 10px 5px;
  border-radius: 2px;
  border-color: var(--popup-border);
}

.color-scheme-buttons > input:first-child + label {
  margin-inline-start: 10px;
}

.color-scheme-buttons > label:last-child {
  margin-inline-end: 10px;
}

/* Improved text and layout menu popup */

#text-layout-controls {
  display: flex;
  flex-direction: column;
  width: 340px;
  padding: var(--space-large);
  font-size: 15px;
}

.accordion-header {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;

  .chevron-icon {
    background-image: url("chrome://global/skin/icons/arrow-down.svg");
    background-position: center;
    background-repeat: no-repeat;
    -moz-context-properties: fill;
    fill: currentColor;
    height: var(--size-item-large);
    width: var(--size-item-large);

    #about-reader-advanced-layout[open] & {
      background-image: url("chrome://global/skin/icons/arrow-up.svg");
    }
  }
}

.slider-container {
  width: calc(100% - var(--space-xsmall));
  padding-bottom: var(--space-large);
}

.text-alignment-buttons {
  margin-top: var(--space-small);
  gap: var(--space-xxsmall);

  > label {
    display: flex;
    flex: 1;
    min-height: var(--button-min-height);
    background-repeat: no-repeat;
    background-position: center;
    background-color: var(--popup-button-background);
    color: var(--popup-button-foreground);
    -moz-context-properties: fill;
    fill: currentColor;
    border: none;

    /* border radius does not target class because button order
     * can be opposite in RTL */
    &:first-of-type {
      border-start-start-radius: var(--border-radius-small);
      border-end-start-radius: var(--border-radius-small);
    }

    &:last-of-type {
      border-start-end-radius: var(--border-radius-small);
      border-end-end-radius: var(--border-radius-small);
    }

    &.left-align-button {
      background-image: url("chrome://global/skin/reader/align-left-20.svg");
    }

    &.center-align-button {
      background-image: url("chrome://global/skin/reader/align-center-20.svg");
    }

    &.right-align-button {
      background-image: url("chrome://global/skin/reader/align-right-20.svg");
    }

    &[checked] {
      background-color: var(--primary-color);
      border: none;
      color: var(--popup-button-selected-foreground);
    }

    body.hcm & {
      border: 1px solid var(--popup-button-border);
    }
  }
}

/* Separate colors menu popup */

#color-controls {
  padding-block-end: var(--space-large);
  width: 400px;
}

#about-reader-colors-menu-header {
  margin-inline: var(--space-large) 0;
}

button-group {
  display: flex;
  font-size: var(--font-size-small);
}

button[is="named-deck-button"] {
  background: none;
  color: var(--popup-button-foreground);
  border: 1px var(--popup-button-border);
  border-style: solid none;
  padding: var(--space-small);
  flex-basis: 50%;

  &[selected] {
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
  }
}

.custom-colors-selection {
  display: flex;
  flex-direction: column;
  gap: var(--space-small);
  padding: var(--space-large);
  list-style-type: none;
  font-size: var(--font-size-root);
  color: var(--popup-button-foreground);
}

.colors-menu-color-scheme-buttons {
  flex-wrap: wrap;
  margin-block-start: var(--space-small);
}

.colors-menu-color-scheme-buttons > label {
  height: 48px;
  width: calc(50% - 21px);
  font-size: var(--font-size-root);
  color: var(--popup-button-foreground);
  border: 1px solid var(--popup-button-border);
  border-radius: var(--border-radius-small);
  /* Center content vertically and justify left horizontally */
  display: inline-flex;
  align-items: center;
  justify-content: start;
  margin: var(--space-xsmall);
}

.colors-menu-color-scheme-buttons > label:before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: var(--border-radius-circle);
  outline: 1px solid var(--popup-button-border);
  margin: 0 10px 0 12px;
}

.colors-menu-color-scheme-buttons {
  .auto-button:before {
    background: linear-gradient(to right, var(--light-theme-background) 50%, var(--dark-theme-background) 50%);;
  }

  .light-button:before {
    background-color: var(--light-theme-background);
  }

  .dark-button:before {
    background-color: var(--dark-theme-background);
  }

  .sepia-button:before {
    background-color: #f4ecd8;
  }

  .contrast-button:before {
    background-color: #000000;
  }

  .gray-button:before {
    background-color: var(--grey-30);
  }
}

.custom-colors-reset-button {
  display: block;
  background: none;
  border: none;
  padding: 0 var(--space-large);
  color: var(--primary-color);
  text-decoration: underline;
  font-size: var(--font-size-root);
  cursor: pointer;
}

/* Toolbar icons */

.close-button {
  background-image: url("chrome://global/skin/icons/close.svg");
}

.style-button {
  background-image: url("chrome://global/skin/reader/RM-Type-Controls-24x24.svg");
}

.improved-style-button {
  background-image: url("chrome://global/skin/reader/RM-Type-Controls-24x24.svg");
}

.colors-button {
  background-image: url("chrome://mozapps/skin/extensions/category-themes.svg");
}

.minus-button {
  background-size: 18px 18px;
  background-image: url("chrome://global/skin/reader/RM-Minus-24x24.svg");
}

.plus-button {
  background-size: 18px 18px;
  background-image: url("chrome://global/skin/reader/RM-Plus-24x24.svg");
}

.content-width-minus-button {
  background-size: 42px 16px;
  background-image: url("chrome://global/skin/reader/RM-Content-Width-Minus-42x16.svg");
}

.content-width-plus-button {
  background-size: 44px 16px;
  background-image: url("chrome://global/skin/reader/RM-Content-Width-Plus-44x16.svg");
}

.line-height-minus-button {
  background-size: 34px 14px;
  background-image: url("chrome://global/skin/reader/RM-Line-Height-Minus-38x14.svg");
}

.line-height-plus-button {
  background-size: 34px 24px;
  background-image: url("chrome://global/skin/reader/RM-Line-Height-Plus-38x24.svg");
}

/* Mirror the line height buttons if the article is RTL. */
.reader-controls[articledir="rtl"] .line-height-minus-button,
.reader-controls[articledir="rtl"] .line-height-plus-button {
  transform: scaleX(-1);
}

@media print {
  .toolbar {
    display: none !important;
  }
}

/* Article content */

/* Note that any class names from the original article that we want to match on
 * must be added to CLASSES_TO_PRESERVE in ReaderMode.sys.mjs, so that
 * Readability.js doesn't strip them out */

.container {
  margin: 0 auto;
  font-size: var(--font-size);
  max-width: var(--content-width);
  line-height: var(--line-height);
  text-align: var(--text-alignment);
  word-spacing: var(--word-spacing);
  letter-spacing: var(--letter-spacing);

  .header {
    text-align: var(--text-alignment);
  }
}

pre {
  font-family: inherit;
}

.moz-reader-content {
  display: none;
  font-size: 1em;
}

@media print {
  .moz-reader-content p,
  .moz-reader-content code,
  .moz-reader-content pre,
  .moz-reader-content blockquote,
  .moz-reader-content ul,
  .moz-reader-content ol,
  .moz-reader-content li,
  .moz-reader-content figure,
  .moz-reader-content .wp-caption {
    margin: 0 0 10px !important;
    padding: 0 !important;
  }
}

.moz-reader-content h1,
.moz-reader-content h2,
.moz-reader-content h3 {
  font-weight: bold;
}

.moz-reader-content h1 {
  font-size: 1.6em;
  line-height: 1.25em;
}

.moz-reader-content h2 {
  font-size: 1.2em;
  line-height: 1.51em;
}

.moz-reader-content h3 {
  font-size: 1em;
  line-height: 1.66em;
}

.moz-reader-content a:link {
  text-decoration: underline;
  font-weight: normal;
}

.moz-reader-content a:link,
.moz-reader-content a:link:hover,
.moz-reader-content a:link:active {
  color: var(--link-foreground);
}

.moz-reader-content a:visited {
  color: var(--visited-link-foreground);
}

.moz-reader-content * {
  max-width: 100%;
  height: auto;
}

.moz-reader-content p,
.moz-reader-content p,
.moz-reader-content code,
.moz-reader-content pre,
.moz-reader-content blockquote,
.moz-reader-content ul,
.moz-reader-content ol,
.moz-reader-content li,
.moz-reader-content figure,
.moz-reader-content .wp-caption {
  margin: -10px -10px calc(8px + var(--line-height) * 0.4);
  padding: 10px;
  border-radius: 5px;
}

.moz-reader-content li {
  margin-bottom: 0;
}

.moz-reader-content li > ul,
.moz-reader-content li > ol {
  margin-bottom: -10px;
}

.moz-reader-content p > img:only-child,
.moz-reader-content p > a:only-child > img:only-child,
.moz-reader-content .wp-caption img,
.moz-reader-content figure img {
  display: block;
}

.moz-reader-content img[moz-reader-center] {
  margin-inline: auto;
}

.moz-reader-content .caption,
.moz-reader-content .wp-caption-text
.moz-reader-content figcaption {
  font-size: 0.9em;
  line-height: 1.48em;
  font-style: italic;
}

.moz-reader-content pre {
  white-space: pre-wrap;
}

.moz-reader-content blockquote {
  padding: 0;
  padding-inline-start: 16px;
}

.moz-reader-content ul,
.moz-reader-content ol {
  padding: 0;
}

.moz-reader-content ul {
  padding-inline-start: 30px;
  list-style: disc;
}

.moz-reader-content ol {
  padding-inline-start: 30px;
}

table,
th,
td {
  border: 1px solid currentColor;
  border-collapse: collapse;
  padding: 6px;
  vertical-align: top;
}

table {
  margin: 5px;
}

/* Visually hide (but don't display: none) screen reader elements */
.moz-reader-content .visually-hidden,
.moz-reader-content .visuallyhidden,
.moz-reader-content .sr-only {
  display: inline-block;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  border-width: 0;
}

/* Hide elements with common "hidden" class names */
.moz-reader-content .hidden,
.moz-reader-content .invisible {
  display: none;
}

/* Enforce wordpress and similar emoji/smileys aren't sized to be full-width,
 * see bug 1399616 for context. */
.moz-reader-content img.wp-smiley,
.moz-reader-content img.emoji {
  display: inline-block;
  border-width: 0;
  /* height: auto is implied from `.moz-reader-content *` rule. */
  width: 1em;
  margin: 0 .07em;
  padding: 0;
}

.reader-show-element {
  display: initial;
}

/* Provide extra spacing for images that may be aided with accompanying element such as <figcaption> */
.moz-reader-block-img:not(:last-child) {
  margin-block-end: 12px;
}

.moz-reader-wide-table {
  overflow-x: auto;
  display: block;
}

pre code {
  background-color: var(--main-background);
  border: 1px solid var(--main-foreground);
  display: block;
  overflow: auto;
}