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