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