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