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