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