]> git.openstreetmap.org Git - rails.git/blob - app/assets/stylesheets/common.scss
Dim map tiles in dark mode
[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: transparentize(lighten($green, 25%), .25);
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 @include color-mode(dark) {
478   .leaflet-tile-container,
479   .mapkey-table-entry td:first-child > * {
480     filter: brightness(.8);
481   }
482 }
483
484 /* Rules for attribution text under the main map shown on printouts */
485
486 .donate-attr { color: darken($green, 10%) !important; }
487
488 /* Rules for the sidebar */
489
490 #browse_status {
491   input {
492     display: block;
493     margin-left: auto;
494     margin-right: auto;
495   }
496 }
497
498 /* Temporary label size override until we remove site-wide font customisation */
499
500 form {
501   label {
502     font-size: 16px;
503   }
504   .col-form-label {
505     font-size: 16px;
506   }
507 }
508
509 /* Stop bootstrap 5 from floating legends when they don't need to be */
510 legend {
511   float: none;
512 }
513
514 /* Override the text colour for primary and secondary buttons, to match our
515    bootstrap 4 colours. Note this has accessibility issues, which is why
516    bootstrap 5 calculates black as the appropriate colour, and we should
517    reconsider our colours at some point with that in mind. */
518
519 .btn-primary {
520   @include button-variant($primary, $primary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
521 }
522
523 .btn-secondary {
524   @include button-variant($secondary, $secondary, $color: $white, $hover-color: $white, $active-color: $white, $disabled-color: $white);
525 }
526
527 .btn-outline-secondary {
528   @include button-outline-variant($secondary, $color-hover: $white, $active-color: $white);
529 }
530
531 /* Rules for the search and direction forms */
532
533 header .search_forms,
534 .directions_form {
535   display: none;
536 }
537
538 .search_form {
539   .describe_location {
540     font-size: 10px;
541   }
542 }
543
544 /* Rules for search sidebar */
545
546 #sidebar .search_results_entry {
547   ul li.selected {
548     background: $list-highlight;
549   }
550
551   .search_more .loader {
552     display: none;
553   }
554 }
555
556 /* Rules for routing */
557
558 div.direction {
559   background-image: image-url('routing-sprite.png');
560   width: 20px;
561   height: 20px;
562   background-repeat: no-repeat;
563 }
564 @for $i from 0 through 25 {
565 div.direction.i#{$i} { background-position: #{($i)*-20}px 0px; }
566 }
567
568 @include color-mode(dark) {
569   div.direction {
570     filter: invert(1);
571   }
572 }
573
574 td.distance {
575     font-size: x-small;
576 }
577 tr.turn {
578     cursor: pointer;
579 }
580
581 .routing_marker { width: 15px; cursor: move; }
582
583 .browse_status {
584   display: none;
585 }
586
587 /* Rules for the history sidebar */
588
589 #sidebar .changesets {
590   li {
591     &.selected { background: $list-highlight; }
592     /* color is derived from changeset bbox fillColor in history.js */
593
594     a.stretched-link > span, a:not(.stretched-link), [title] {
595       position: relative;
596       z-index: 2; /* needs to be higher than Bootstrap's stretched link ::after z-index */
597     }
598   }
599
600   .changeset_more .loader {
601     display: none;
602     width: 100%;
603   }
604 }
605
606 /* Rules for the browse sidebar */
607
608 #sidebar_content {
609   .browse-section {
610     padding-bottom: $spacer;
611     margin-bottom: $spacer;
612     border-bottom: 1px solid $grey;
613
614     h4:first-child {
615       word-wrap: break-word;
616     }
617   }
618
619   .browse-section:last-of-type {
620     border-bottom: none;
621   }
622
623   .browse-tag-list {
624     table-layout: fixed;
625     white-space: pre-wrap;
626
627     tr:last-child th, tr:last-child td {
628       border-bottom: 0;
629     }
630   }
631
632   .note-description {
633     overflow: hidden;
634     margin: 0 0 10px 10px;
635   }
636
637   .query-results {
638     display: none;
639
640     ul {
641       li {
642         &.query-result {
643           cursor: pointer;
644         }
645
646         &.selected {
647           background: $list-highlight;
648         }
649       }
650     }
651   }
652 }
653
654 /* Bootstrap buttons don't have any vertical margin, so
655    they touch when adjacent buttons wrap onto a new line
656    e.g. wide form buttons on a narrow sidebar */
657
658 .btn-wrapper {
659   > .btn {
660     margin-bottom: $spacer * 0.25;
661   }
662 }
663
664 /* Force LTR/RTL alignment for placeholder text */
665
666 .form-control::placeholder {
667   text-align: left;
668 }
669
670 /* Rules for export sidebar */
671
672 .export_form {
673   .export_area_inputs {
674     input[type="text"] {
675       width: 100px;
676     }
677   }
678
679   .export_boxy {
680     > * {
681         margin: -1px;
682     }
683     #minlon {
684       /*rtl:ignore*/ float: left;
685     }
686     #maxlon {
687       /*rtl:ignore*/ float: right;
688     }
689   }
690 }
691
692 /* Rules for edit pages */
693
694 .site-edit {
695   #content {
696     position: absolute;
697     top: $headerHeight;
698     bottom: 0;
699     width: 100%;
700   }
701 }
702
703 /* Rules for non-map content pages */
704
705 .content-inner {
706   position: relative;
707   max-width: 960px;
708   margin: auto;
709   padding: $lineheight;
710 }
711
712 /* Overrides for pages that use new layout conventions */
713
714 .header-illustration {
715   background-position: 0 0;
716   background-repeat: no-repeat;
717   position: relative;
718   min-height: 200px;
719   width: 100%;
720   left: 0;
721   bottom: 0;
722
723   &.new-user-main {
724     background-image: image-url("sign-up-illustration.png");
725   }
726
727   &.confirm-main {
728     background-image: image-url("confirm-illustration.png");
729   }
730
731   &.new-user-terms {
732     background-image: image-url("terms-illustration.png");
733   }
734
735   &.new-user-arm {
736     height: 110px;
737     width: 130px;
738     left: 280px;
739     top: 180px;
740     background-image: image-url("sign-up-illustration-arm.png");
741     position: absolute;
742     z-index: 100;
743     pointer-events: none;
744   }
745 }
746
747 [dir=rtl] .header-illustration {
748   transform: scaleX(-1);
749
750   h1 {
751     transform: scaleX(-1);
752   }
753 }
754
755 /* Rules for small maps in content areas */
756
757 .content_map {
758   height: 200px;
759   margin-bottom: $lineheight;
760 }
761
762 @include media-breakpoint-up(md) {
763   .content_map {
764     height: 400px;
765   }
766 }
767
768 /* Rules for the user map */
769
770 .content_map .leaflet-popup-content {
771   margin: $spacer;
772   min-height: 50px;
773 }
774
775 /* Rules for user popups on maps */
776
777 .user_popup {
778   min-width: 200px;
779   p {
780     padding: 0 0 5px 0;
781     margin: 0 0 0 60px;
782     font-size: 12px;
783   }
784 }
785
786 /* Rules for the diary entry page */
787
788 .diary_entries {
789   #map {
790     height: 400px;
791     display: none;
792   }
793   .diary-comment .col-auto {
794     width: 62px;
795   }
796   .diary-comment .col {
797     max-width: 690px;
798   }
799 }
800
801 /* Rules for the account confirmation page */
802
803 .users-terms {
804   .legale {
805     padding: $lineheight;
806     margin-bottom: $lineheight;
807     overflow: auto;
808     height: 20em;
809
810     li {
811       list-style: inherit;
812     }
813
814     ol ol {
815       list-style-type: lower-alpha;
816     }
817   }
818 }
819
820 /* Rules for messages pages */
821
822 .messages {
823   .inbox-row-unread td {
824     background: #CBEEA7;
825   }
826 }
827
828 /* Rules for user images */
829
830 img.user_image {
831   max-width: 100px;
832   max-height: 100px;
833 }
834
835 img.user_thumbnail {
836   max-width: 50px;
837   max-height: 50px;
838 }
839
840 img.user_thumbnail_tiny {
841   width: 25px;
842   height: 25px;
843   object-fit: contain;
844 }
845
846 /* General styles for action lists / subnavs */
847
848 nav.secondary-actions {
849   margin-left: -11px;
850   overflow: hidden;
851   > ul {
852     display: flex;
853     flex-direction: row;
854     flex-wrap: wrap;
855     margin-bottom: 0;
856     margin-left: -1px;
857     padding: 0;
858     > li {
859       flex-basis: auto;
860       list-style: none;
861       border-left: 1px solid $grey;
862       padding-left: $lineheight * 0.5;
863       margin-right: $lineheight * 0.5;
864       margin-bottom: $lineheight * 0.125;
865     }
866   }
867 }
868
869 div.secondary-actions {
870   padding: 10px;
871   text-align: center;
872 }
873
874 /* Rules for rich text */
875
876 .richtext {
877   code {
878     background: var(--bs-secondary-bg);
879     padding: 2px 3px;
880   }
881
882   pre {
883     background: var(--bs-secondary-bg);
884     padding: 2px 3px;
885     white-space: pre-wrap;
886
887     code {
888       padding: 0;
889     }
890   }
891
892   img {
893     padding: $lineheight;
894     background-color: var(--bs-tertiary-bg);
895     display: block;
896     max-width: 100%;
897     margin: auto;
898   }
899
900   blockquote {
901     border-left: $lineheight solid var(--bs-tertiary-bg);
902     padding-left: $lineheight;
903     margin: 0;
904     color: var(--bs-secondary-color);
905   }
906 }
907
908 /* Rules for the "Welcome" page */
909 .site-welcome, .site-fixthemap {
910   .sprite {
911     background-image: image-url("welcome-sprite.png");
912     background-size: 500px 250px;
913     display: block;
914   }
915
916   .sprite.small {
917     width: 50px;
918     height: 50px;
919   }
920
921   .sprite.x {
922     /*rtl:ignore*/ background-position: -50px 0;
923   }
924
925   .sprite.term {
926     margin-right: 10px;
927     vertical-align: middle;
928   }
929
930   .sprite.node {
931     /*rtl:ignore*/ background-position: -100px 0;
932   }
933
934   .sprite.way {
935     /*rtl:ignore*/ background-position: -150px 0;
936   }
937
938   .sprite.tag {
939     /*rtl:ignore*/ background-position: -200px 0;
940   }
941
942   .sprite.editor {
943     /*rtl:ignore*/ background-position: -250px 0;
944   }
945
946   .sprite.question {
947     /*rtl:ignore*/ background-position: -300px 0;
948   }
949
950   .sprite.rules {
951     /*rtl:ignore*/ background-position: -350px 0;
952   }
953
954   .icon.note {
955     background-color: #333;
956     border-radius: 4px;
957   }
958 }
959
960 .site-about #content {
961   .content-inner {
962     max-width: 760px;
963   }
964
965   .attr {
966     margin-top: -20px;
967
968     h1 {
969       span {
970         color: $vibrant-green;
971       }
972     }
973
974     .user-image {
975       height: 150px;
976       background-position: 0 50%;
977       background-repeat: no-repeat;
978       background-image: image-url('about/osm.png');
979       background-size: cover;
980       background-color: $vibrant-green;
981     }
982
983     .byosm {
984       background: $vibrant-green;
985     }
986
987     .byosm span {
988       display: inline-block;
989       width: 1em;
990       margin-left: -1em;
991     }
992   }
993
994   .icon {
995     width: 30px;
996     height: 30px;
997     background: 40px 40px image-url('about/sprite.png') no-repeat;
998
999     &.local {
1000       /*rtl:ignore*/
1001       background-position: 0px 0px;
1002     }
1003     &.community {
1004       /*rtl:ignore*/
1005       background-position: 0px -40px;
1006     }
1007     &.open {
1008       /*rtl:ignore*/
1009       background-position: 0px -80px;
1010     }
1011     &.partners {
1012       /*rtl:ignore*/
1013       background-position: 0px -120px;
1014     }
1015     &.infringement {
1016       /*rtl:ignore*/
1017       background-position: 0px -160px;
1018     }
1019     &.legal {
1020       /*rtl:ignore*/
1021       background-position: -45px -160px;
1022     }
1023   }
1024 }
1025
1026 /* Rules for tabs inside secondary background sections */
1027
1028 .bg-body-secondary .nav-tabs {
1029   --bs-border-color: var(--bs-secondary-border-subtle);
1030   --bs-secondary-bg: var(--bs-secondary-border-subtle);
1031   margin-bottom: -1px;
1032 }
1033
1034 /* Rules for traces */
1035
1036 img.trace_image {
1037   mix-blend-mode: darken;
1038 }
1039
1040 @include color-mode(dark) {
1041   img.trace_image {
1042     filter: invert(1);
1043     mix-blend-mode: lighten;
1044   }
1045 }
1046
1047 @import 'browse';