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