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