]> git.openstreetmap.org Git - rails.git/blob - app/assets/stylesheets/common.scss
Add dark mode overrides for Bootstrap table variants
[rails.git] / app / assets / stylesheets / common.scss
1 @import "parameters";
2 @import "bootstrap";
3 @import "rails_bootstrap_forms";
4
5 /* Styles common to large and small screens */
6
7 /* Default rules for the body of every page */
8
9 body {
10   font-size: $typeheight;
11 }
12
13 p > img {
14   width: auto;
15   max-width: 100%;
16 }
17
18 small, aside {
19   font-size: 12px;
20 }
21
22 time[title] {
23   text-decoration: underline dotted;
24 }
25
26 #container { position: relative; }
27
28 .small_icon {
29   vertical-align: middle;
30   margin-right: $lineheight * 0.25;
31 }
32
33 /* Rules for icons */
34
35 .icon {
36   display: inline-block;
37   vertical-align: top;
38   width: 20px;
39   height: 20px;
40   background: transparent image-url("sprite.svg") no-repeat 0 0;
41   text-indent: -9999px;
42   overflow: hidden;
43 }
44
45 .icon.search      { /*rtl:ignore*/ background-position: 0 0; }
46 .icon.donate      { /*rtl:ignore*/ background-position: -20px 0; }
47 .icon.zoomin      { /*rtl:ignore*/ background-position: -40px 0; }
48 .icon.zoomout     { /*rtl:ignore*/ background-position: -60px 0; }
49 .icon.geolocate   { /*rtl:ignore*/ background-position: -80px 0; }
50 .active .icon.geolocate   { /*rtl:ignore*/ background-position: -80px -20px; }
51 .icon.layers      { /*rtl:ignore*/ background-position: -100px 0; }
52 .icon.key         { /*rtl:ignore*/ background-position: -120px 0; }
53 .icon.share       { /*rtl:ignore*/ background-position: -140px 0; }
54 .icon.clipboard   { /*rtl:ignore*/ background-position: -160px 0; }
55 .icon.link        { /*rtl:ignore*/ background-position: -180px 0; }
56 .icon.close       { /*rtl:ignore*/ background-position: -200px 0; }
57 .icon.close:hover { /*rtl:ignore*/ background-position: -200px -20px; }
58 .icon.check       { /*rtl:ignore*/ background-position: -220px 0; }
59 .icon.note        { /*rtl:ignore*/ background-position: -240px 0; }
60 .icon.note.grey   { /*rtl:ignore*/ background-position: -240px -20px; }
61 .icon.query       { /*rtl:ignore*/ background-position: -260px 0; }
62
63 /* Utility for de-emphasizing content */
64
65 .text-muted a {
66   color: $blue;
67 }
68
69 /* Bootstrap contextual table classes overrides in dark mode */
70
71 @include color-mode(dark) {
72   .table-primary {
73     --bs-table-bg: rgb(var(--bs-primary-rgb), .25);
74   }
75   .table-secondary {
76     --bs-table-bg: rgb(var(--bs-secondary-rgb), .25);
77   }
78   .table-primary, .table-secondary {
79     --bs-table-color: initial;
80     border-color: inherit;
81   }
82 }
83
84 /* Rules for the header */
85
86 #menu-icon {
87   display: none;
88   position: absolute;
89   top: 0;
90   right: 0;
91   background: image-url("menu-icon.png") no-repeat;
92   background-size: 30px 30px;
93   width: 30px;
94   height: 30px;
95   margin: 14px 10px 0 0;
96   opacity: 0.6;
97 }
98
99 @include color-mode(dark) {
100   #menu-icon {
101     filter: invert(1);
102   }
103 }
104
105 header {
106   height: $headerHeight;
107   position: relative;
108   font-size: 14px;
109
110   h1, nav, nav > ul, nav > ul > li {
111     display: inline-block;
112   }
113
114   > * {
115     height: 100%;
116     padding: $lineheight * 0.5;
117   }
118
119   img.logo {
120     margin-top: -2px;
121   }
122
123   h1 {
124     font-size: 18px;
125     line-height: 1.2;
126     padding-top: 15px;
127   }
128
129   .btn {
130     font-size: 14px;
131   }
132
133   nav.primary {
134     margin-right: auto;
135   }
136 }
137
138 nav.primary {
139   & > .btn-group .btn-outline-primary {
140     @include button-outline-variant($green, $color-hover: $white, $active-color: $white);
141   }
142
143   .disabled {
144     .btn-outline-primary {
145       color: $grey;
146       cursor: default;
147
148       .caret {
149         border-top-color: $grey;
150       }
151
152       &:hover {
153         background-color: lighten($green, 30%);
154       }
155     }
156   }
157
158   // Small tweaks to the toggle to stop the primary colour showing through
159   // when the menu is shown
160   .show > .btn-outline-primary.dropdown-toggle {
161     background-color: $green;
162     border-color: $green;
163
164     &:focus {
165       box-shadow: 0 0 0 0.2rem fade-out($green, 0.5);
166     }
167   }
168 }
169
170 nav.secondary {
171   .nav-link {
172     padding: 0.2rem;
173   }
174
175   #inboxanchor {
176     background-color: lighten($grey, 10%);
177   }
178 }
179
180 nav.primary, nav.secondary {
181   .dropdown-item {
182     &:hover, &:active {
183       background-color: $green;
184       color: white;
185     }
186   }
187 }
188
189 #compact-secondary-nav {
190   display: none;
191 }
192
193 body.compact-nav {
194   #compact-secondary-nav {
195     display: inline-block;
196   }
197   .compact-hide {
198     display: none;
199   }
200 }
201
202 body.small-nav {
203   #menu-icon {
204     display: block;
205   }
206
207   header {
208     flex-direction: column;
209     height: auto;
210     min-height: $headerHeight;
211
212     &.closed nav {
213       display: none;
214     }
215
216     .search_forms {
217       display: block;
218     }
219   }
220
221   #sidebar .search_forms,
222   #edit_tab,
223   #export_tab {
224     display: none;
225   }
226
227   nav.primary {
228     margin-right: 0;
229     padding: 0;
230
231     .btn-group {
232       width: 100%;
233       padding: 10px;
234     }
235   }
236
237   nav.secondary {
238     .user-menu, .login-menu {
239       width: 100%;
240     }
241   }
242
243   #compact-secondary-nav {
244     display: none;
245   }
246
247   .compact-hide {
248     display: inline-block;
249   }
250
251   .overlay-sidebar #sidebar .welcome {
252     display: none;
253   }
254
255   .overlay-sidebar #sidebar #banner {
256     display: none;
257   }
258 }
259
260 /* Utility for styling notification numbers */
261
262 .count-number {
263   background: lighten($green, 30%);
264   color: $gray-800;
265   font-weight: $font-weight-normal;
266 }
267
268 /* Rules for Leaflet maps */
269
270 .leaflet-top.leaflet-right,
271 .leaflet-top.leaflet-left {
272   height: 100%;
273   column-gap: 10px;
274   display: flex;
275   flex-direction: column;
276   flex-wrap: wrap-reverse;
277 }
278
279 .leaflet-control .control-button {
280   display: block;
281   height: 40px;
282   width: 40px;
283   background-color: #333;
284   background-color: rgba(0,0,0,.6);
285   outline: none;
286
287   &:hover,
288   &:focus {
289     background-color: black;
290   }
291
292   &.disabled,
293   &.leaflet-disabled {
294     background-color: #333;
295     background-color: rgba(0,0,0,.5);
296     cursor: default;
297   }
298
299   &.active {
300     background-color: $vibrant-green;
301   }
302
303   &-first {
304     border-start-start-radius: 4px;
305   }
306
307   &-last {
308     border-end-start-radius: 4px;
309     margin-bottom: 10px;
310   }
311
312   .icon {
313     margin: 10px;
314   }
315 }
316
317 /* Rules for the sidebar and main map area */
318
319 .map-layout {
320   #content {
321     overflow: hidden;
322     position: absolute;
323     top: $headerHeight;
324     bottom: 0;
325     width: 100%;
326   }
327
328   #sidebar, #map {
329     position: relative;
330     height: 100%;
331     overflow-x: hidden;
332     overflow-y: auto;
333   }
334
335   #sidebar {
336     float: left;
337     width: $sidebarWidth;
338
339     #sidebar_loader {
340       display: none;
341     }
342   }
343
344   .overlay-sidebar #sidebar {
345     position: absolute;
346     height: auto;
347     overflow: hidden;
348
349     #banner {
350       display: block;
351     }
352
353     .welcome {
354       display: block;
355     }
356
357     #sidebar_content {
358       display: none;
359     }
360   }
361
362   .welcome {
363     display: none;
364   }
365
366   #banner {
367     display: none;
368
369     img {
370       display: block;
371       width: $sidebarWidth;
372     }
373   }
374
375   #map {
376     height: 100%;
377     overflow: hidden;
378
379     &.query-active {
380       cursor: help;
381     }
382
383     &.query-disabled {
384       cursor: not-allowed;
385     }
386
387     .leaflet-marker-draggable {
388       cursor: move;
389     }
390   }
391
392   #map-ui {
393     display: none;
394     position: relative;
395     float: right;
396     width: 250px;
397     height: 100%;
398     overflow: auto;
399   }
400 }
401
402 @include media-breakpoint-down(md) {
403   body.map-layout {
404     #sidebar, #map {
405       position: relative;
406       overflow-x: hidden;
407       width: 100%;
408       height: 50%;
409     }
410
411     #map-ui {
412       width: 100%;
413       height: 50%;
414       overflow-y: scroll;
415     }
416
417     .overlay-sidebar {
418       #sidebar {
419         position: absolute;
420         width: 350px;
421         height: auto;
422         overflow: hidden;
423       }
424
425       #map, #map-ui {
426         height: 100%;
427       }
428     }
429   }
430 }
431
432 .layers-ui {
433   .base-layers > * {
434     height: 56px;
435
436     > .btn {
437       --bs-btn-border-color: var(--bs-body-bg);
438     }
439     > .btn:hover {
440       --bs-btn-border-color: var(--bs-primary-border-subtle);
441     }
442   }
443
444   .overlay-layers {
445     p {
446       font-size: 13px;
447       margin-bottom: 8px;
448     }
449     li.disabled { color: $darkgrey; }
450   }
451 }
452
453 .share-ui {
454   #mapnik_scale {
455     width: 100px;
456   }
457 }
458
459 .leaflet-top {
460   top: 10px !important;
461   .leaflet-control {
462     margin-right: 0px !important;
463     margin-top: 0px !important;
464   }
465 }
466
467 .leaflet-popup-scrolled {
468   padding-right: $lineheight;
469   border-bottom: 0px !important;
470   border-top: 0px !important;
471 }
472
473 .leaflet-popup-content-wrapper {
474   border-radius: 4px !important;
475 }
476
477 /* Rules for attribution text under the main map shown on printouts */
478
479 .donate-attr { color: darken($green, 10%) !important; }
480
481 /* Rules for the sidebar */
482
483 #browse_status {
484   input {
485     display: block;
486     margin-left: auto;
487     margin-right: auto;
488   }
489 }
490
491 /* Temporary label size override until we remove site-wide font customisation */
492
493 form {
494   label {
495     font-size: 16px;
496   }
497   .col-form-label {
498     font-size: 16px;
499   }
500 }
501
502 /* Stop bootstrap 5 from floating legends when they don't need to be */
503 legend {
504   float: none;
505 }
506
507 /* Override the text colour for primary and secondary buttons, to match our
508    bootstrap 4 colours. Note this has accessibility issues, which is why
509    bootstrap 5 calculates black as the appropriate colour, and we should
510    reconsider our colours at some point with that in mind. */
511
512 .btn-primary {
513   @include button-variant($primary, $primary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
514 }
515
516 .btn-secondary {
517   @include button-variant($secondary, $secondary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
518 }
519
520 .btn-outline-secondary {
521   @include button-outline-variant($secondary, $color-hover: $white, $active-color: $white);
522 }
523
524 /* Rules for the search and direction forms */
525
526 header .search_forms,
527 .directions_form {
528   display: none;
529 }
530
531 /* Rules for search sidebar */
532
533 #sidebar .search_results_entry {
534   ul li.selected {
535     background: $list-highlight;
536   }
537
538   .search_more .loader {
539     display: none;
540   }
541 }
542
543 /* Rules for routing */
544
545 div.direction {
546   background-image: image-url('routing-sprite.png');
547   width: 20px;
548   height: 20px;
549   background-repeat: no-repeat;
550 }
551 @for $i from 0 through 25 {
552 div.direction.i#{$i} { background-position: #{($i)*-20}px 0px; }
553 }
554
555 @include color-mode(dark) {
556   div.direction {
557     filter: invert(1);
558   }
559 }
560
561 td.distance {
562     font-size: x-small;
563 }
564 tr.turn {
565     cursor: pointer;
566 }
567 tr.turn:hover {
568     background: $list-highlight;
569 }
570
571 .routing_marker { width: 15px; cursor: move; }
572
573 .browse_status {
574   display: none;
575 }
576
577 /* Rules for the history sidebar */
578
579 #sidebar .changesets {
580   li {
581     &.selected { background: $list-highlight; }
582     /* color is derived from changeset bbox fillColor in history.js */
583
584     a.stretched-link > span, a:not(.stretched-link), [title] {
585       position: relative;
586       z-index: 2; /* needs to be higher than Bootstrap's stretched link ::after z-index */
587     }
588   }
589
590   .changeset_more .loader {
591     display: none;
592     width: 100%;
593   }
594 }
595
596 /* Rules for the browse sidebar */
597
598 #sidebar_content {
599   .browse-section {
600     padding-bottom: $spacer;
601     margin-bottom: $spacer;
602     border-bottom: 1px solid $grey;
603
604     h4:first-child {
605       word-wrap: break-word;
606     }
607   }
608
609   .browse-section:last-of-type {
610     border-bottom: none;
611   }
612
613   .browse-tag-list {
614     table-layout: fixed;
615     white-space: pre-wrap;
616
617     tr:last-child th, tr:last-child td {
618       border-bottom: 0;
619     }
620   }
621
622   .note-description {
623     overflow: hidden;
624     margin: 0 0 10px 10px;
625   }
626
627   .query-results {
628     display: none;
629
630     ul {
631       li {
632         &.query-result {
633           cursor: pointer;
634         }
635
636         &.selected {
637           background: $list-highlight;
638         }
639       }
640     }
641   }
642 }
643
644 /* Bootstrap buttons don't have any vertical margin, so
645    they touch when adjacent buttons wrap onto a new line
646    e.g. wide form buttons on a narrow sidebar */
647
648 .btn-wrapper {
649   > .btn {
650     margin-bottom: $spacer * 0.25;
651   }
652 }
653
654 /* Force LTR/RTL alignment for placeholder text */
655
656 .form-control::placeholder {
657   text-align: left;
658 }
659
660 /* Rules for export sidebar */
661
662 .export_form {
663   .export_area_inputs,
664   .export_button {
665     text-align: center;
666   }
667
668   .export_area_inputs {
669     margin-bottom: $spacer;
670     input[type="text"] {
671       width: 100px;
672       text-align: center;
673     }
674   }
675
676   .export_boxy {
677     > * {
678         margin: -1px;
679     }
680     #minlon {
681       /*rtl:ignore*/ float: left;
682     }
683     #maxlon {
684       /*rtl:ignore*/ float: right;
685     }
686   }
687 }
688
689 /* Rules for edit pages */
690
691 .site-edit {
692   #content {
693     position: absolute;
694     top: $headerHeight;
695     bottom: 0;
696     width: 100%;
697   }
698 }
699
700 /* Rules for non-map content pages */
701
702 .content-inner {
703   position: relative;
704   max-width: 960px;
705   margin: auto;
706   padding: $lineheight;
707 }
708
709 /* Overrides for pages that use new layout conventions */
710
711 .header-illustration {
712   background-position: 0 0;
713   background-repeat: no-repeat;
714   position: relative;
715   min-height: 200px;
716   width: 100%;
717   left: 0;
718   bottom: 0;
719
720   &.new-user-main {
721     background-image: image-url("sign-up-illustration.png");
722   }
723
724   &.confirm-main {
725     background-image: image-url("confirm-illustration.png");
726   }
727
728   &.new-user-terms {
729     background-image: image-url("terms-illustration.png");
730   }
731
732   &.new-user-arm {
733     height: 110px;
734     width: 130px;
735     left: 280px;
736     top: 180px;
737     background-image: image-url("sign-up-illustration-arm.png");
738     position: absolute;
739     z-index: 100;
740     pointer-events: none;
741   }
742 }
743
744 [dir=rtl] .header-illustration {
745   transform: scaleX(-1);
746
747   h1 {
748     transform: scaleX(-1);
749   }
750 }
751
752 /* Rules for small maps in content areas */
753
754 .content_map {
755   height: 200px;
756   margin-bottom: $lineheight;
757 }
758
759 @include media-breakpoint-up(md) {
760   .content_map {
761     height: 400px;
762   }
763 }
764
765 /* Rules for the user map */
766
767 .content_map .leaflet-popup-content {
768   margin: $spacer;
769   min-height: 50px;
770 }
771
772 /* Rules for user popups on maps */
773
774 .user_popup {
775   min-width: 200px;
776   p {
777     padding: 0 0 5px 0;
778     margin: 0 0 0 60px;
779     font-size: 12px;
780   }
781 }
782
783 /* Rules for the diary entry page */
784
785 .diary_entries {
786   #map {
787     height: 400px;
788     display: none;
789   }
790   .diary-comment .col-auto {
791     width: 62px;
792   }
793   .diary-comment .col {
794     max-width: 690px;
795   }
796 }
797
798 /* Rules for the account confirmation page */
799
800 .users-terms {
801   .legale {
802     padding: $lineheight;
803     margin-bottom: $lineheight;
804     overflow: auto;
805     height: 20em;
806
807     li {
808       list-style: inherit;
809     }
810
811     ol ol {
812       list-style-type: lower-alpha;
813     }
814   }
815 }
816
817 /* Rules for messages pages */
818
819 .messages {
820   .inbox-row {
821     background: $offwhite;
822   }
823
824   .inbox-row-unread td {
825     background: #CBEEA7;
826   }
827 }
828
829 .search_form {
830   .describe_location {
831     font-size: 10px;
832   }
833 }
834
835 /* Rules for user images */
836
837 img.user_image {
838   max-width: 100px;
839   max-height: 100px;
840 }
841
842 img.user_thumbnail {
843   max-width: 50px;
844   max-height: 50px;
845 }
846
847 img.user_thumbnail_tiny {
848   width: 25px;
849   height: 25px;
850   object-fit: contain;
851 }
852
853 /* General styles for action lists / subnavs */
854
855 nav.secondary-actions {
856   margin-left: -11px;
857   overflow: hidden;
858   > ul {
859     display: flex;
860     flex-direction: row;
861     flex-wrap: wrap;
862     margin-bottom: 0;
863     margin-left: -1px;
864     padding: 0;
865     > li {
866       flex-basis: auto;
867       list-style: none;
868       border-left: 1px solid $grey;
869       padding-left: $lineheight * 0.5;
870       margin-right: $lineheight * 0.5;
871       margin-bottom: $lineheight * 0.125;
872     }
873   }
874 }
875
876 div.secondary-actions {
877   padding: 10px;
878   text-align: center;
879 }
880
881 /* Rules for rich text */
882
883 .richtext,
884 .prose {
885   code {
886     background: var(--bs-secondary-bg);
887     padding: 2px 3px;
888   }
889
890   pre {
891     background: var(--bs-secondary-bg);
892     padding: 2px 3px;
893     white-space: pre-wrap;
894
895     code {
896       padding: 0;
897     }
898   }
899
900   img {
901     padding: $lineheight;
902     background-color: var(--bs-tertiary-bg);
903     display: block;
904     max-width: 100%;
905     margin: auto;
906   }
907
908   blockquote {
909     border-left: $lineheight solid var(--bs-tertiary-bg);
910     padding-left: $lineheight;
911     margin: 0;
912     color: var(--bs-secondary-color);
913   }
914 }
915
916 /* Rules for the "Welcome" page */
917 .site-welcome, .site-fixthemap {
918   .sprite {
919     background-image: image-url("welcome-sprite.png");
920     background-size: 500px 250px;
921     display: block;
922   }
923
924   .sprite.small {
925     width: 50px;
926     height: 50px;
927   }
928
929   .sprite.x {
930     /*rtl:ignore*/ background-position: -50px 0;
931   }
932
933   .sprite.term {
934     margin-right: 10px;
935     vertical-align: middle;
936   }
937
938   .sprite.node {
939     /*rtl:ignore*/ background-position: -100px 0;
940   }
941
942   .sprite.way {
943     /*rtl:ignore*/ background-position: -150px 0;
944   }
945
946   .sprite.tag {
947     /*rtl:ignore*/ background-position: -200px 0;
948   }
949
950   .sprite.editor {
951     /*rtl:ignore*/ background-position: -250px 0;
952   }
953
954   .sprite.question {
955     /*rtl:ignore*/ background-position: -300px 0;
956   }
957
958   .sprite.rules {
959     /*rtl:ignore*/ background-position: -350px 0;
960   }
961
962   .icon.note {
963     background-color: #333;
964     border-radius: 4px;
965   }
966 }
967
968 .site-about #content {
969   .content-inner {
970     max-width: 760px;
971   }
972
973   .attr {
974     margin-top: -20px;
975
976     h1 {
977       span {
978         color: $vibrant-green;
979       }
980     }
981
982     .user-image {
983       height: 150px;
984       background-position: 0 50%;
985       background-repeat: no-repeat;
986       background-image: image-url('about/osm.png');
987       background-size: cover;
988       background-color: $vibrant-green;
989     }
990
991     .byosm {
992       background: $vibrant-green;
993     }
994
995     .byosm span {
996       display: inline-block;
997       width: 1em;
998       margin-left: -1em;
999     }
1000   }
1001
1002   .icon {
1003     width: 30px;
1004     height: 30px;
1005     background: 40px 40px image-url('about/sprite.png') no-repeat;
1006
1007     &.local {
1008       /*rtl:ignore*/
1009       background-position: 0px 0px;
1010     }
1011     &.community {
1012       /*rtl:ignore*/
1013       background-position: 0px -40px;
1014     }
1015     &.open {
1016       /*rtl:ignore*/
1017       background-position: 0px -80px;
1018     }
1019     &.partners {
1020       /*rtl:ignore*/
1021       background-position: 0px -120px;
1022     }
1023     &.infringement {
1024       /*rtl:ignore*/
1025       background-position: 0px -160px;
1026     }
1027     &.legal {
1028       /*rtl:ignore*/
1029       background-position: -45px -160px;
1030     }
1031   }
1032 }
1033
1034 /* Rules for tabs inside secondary background sections */
1035
1036 .bg-body-secondary .nav-tabs {
1037   --bs-border-color: var(--bs-secondary-border-subtle);
1038   --bs-secondary-bg: var(--bs-secondary-border-subtle);
1039   margin-bottom: -1px;
1040 }
1041
1042 /* Rules for traces */
1043
1044 img.trace_image {
1045   mix-blend-mode: darken;
1046 }
1047
1048 @include color-mode(dark) {
1049   img.trace_image {
1050     filter: invert(1);
1051     mix-blend-mode: lighten;
1052   }
1053 }
1054
1055 @import 'browse';