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