.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  left: 0;
  position: absolute;
  top: 0;
}

.leaflet-container {
  background: $color-gray-light;
  outline: 0;
  overflow: hidden;

  .leaflet-control-attribution {
    background: transparentize($color-white, .3);
    margin: 0;
  }

  .leaflet-control-attribution,
  .leaflet-control-scale {
    font-size: 11px;
    padding: 5px;
  }

  .leaflet-marker-pane,
  .leaflet-shadow-pane,
  .leaflet-tile-pane {
    img {
      max-width: none;
    }
  }

  img {
    &.leaflet-image-layer {
      max-width: none;
    }
  }

  .leaflet-overlay-pane {
    svg {
      max-width: none;
    }
  }

  &.leaflet-touch-zoom {
    -ms-touch-action: pan-x pan-y;
    touch-action: pan-x pan-y;
  }

  &.leaflet-touch-drag {
    -ms-touch-action: pinch-zoom;

    &.leaflet-touch-drag {
      -ms-touch-action: none;
      touch-action: none;
    }
  }

  .leaflet-control-layers-toggle {
    background: $color-white;
    border-radius: 50%;
    color: $color-black;
    display: block;
    font-size: 1.6rem;
    height: 1.8em;
    line-height: 1.95;
    margin-right: 16px;
    opacity: .9;
    text-align: center;
    transition: background-color .5s, color .5s;
    width: 1.8em;

    @media screen and (max-width: map-get($grid-breakpoints, lg) - 1) {
      margin-right: -2px;
      transform: scale(.8);
    }

    &::before {
      content: '\f229';
      font-family: $font-family-icons;
      speak: none;
      text-rendering: auto;
    }
  }

  .leaflet-control-layers-expanded {
    padding: 0;

    .leaflet-control-layers-list {
      display: block;
      position: relative;
    }

    .leaflet-control-layers-toggle {
      display: none;
    }
  }
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
}

///* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari {
  .leaflet-tile {
    image-rendering: -webkit-optimize-contrast;
  }

  ///* hack that prevents hw layers "stretching" when loading new tiles */
  .leaflet-tile-container {
    -webkit-transform-origin: 0 0;
    height: 1600px;
    width: 1600px;
  }
}

.leaflet-marker-icon,
.leaflet-marker-shadow {
  display: block;
}

.leaflet-tile {
  filter: inherit;
  visibility: hidden;
}

.leaflet-tile-loaded {
  visibility: inherit;
}

.leaflet-zoom-box {
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  height: 0;
  width: 0;
  z-index: 800;
}

///* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane {
  z-index: 400;

  svg {
    -moz-user-select: none;
  }
}

.leaflet-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-map-pane {
  canvas {
    z-index: 100;
  }

  svg {
    z-index: 200;
  }
}

.leaflet-vml-shape {
  height: 1px;
  width: 1px;
}

.lvml {
  display: inline-block;
  position: absolute;
}

.leaflet-control {
  clear: both;
  float: left;
  pointer-events: auto;
  position: relative;
  z-index: 800;
}

.leaflet-top,
.leaflet-bottom {
  pointer-events: none;
  position: absolute;
  z-index: 1000;
}

.leaflet-right {
  right: 0;

  .leaflet-control {
    float: right;
  }
}

.leaflet-top {
  top: 0;

  .leaflet-control {
    margin-top: 10px;
  }
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;

  .leaflet-control {
    margin-left: 10px;
  }
}

.leaflet-fade-anim {
  .leaflet-tile {
    will-change: opacity;
  }

  .leaflet-popup {
    opacity: 0;
    transition: opacity .2s linear;
  }

  .leaflet-map-pane {
    .leaflet-popup {
      opacity: 1;
    }
  }
}

.leaflet-zoom-animated {
  transform-origin: 0 0;
}

.leaflet-zoom-anim {
  .leaflet-zoom-animated {
    transition: transform .25s cubic-bezier(0, 0, .25, 1);
    will-change: transform;
  }

  .leaflet-zoom-hide {
    visibility: hidden;
  }
}

.leaflet-zoom-anim,
.leaflet-pan-anim {
  .leaflet-tile {
    transition: none;
  }
}

.leaflet-interactive {
  cursor: pointer;
}

.leaflet-grab {
  cursor: -webkit-grab;
  cursor: -moz-grab;
}

.leaflet-crosshair {
  &,
  &.leaflet-interactive {
    cursor: crosshair;
  }
}

.leaflet-popup-pane,
.leaflet-control {
  cursor: auto;
}

.leaflet-dragging {
  .leaflet-marker-draggable,
  .leaflet-grab {
    &,
    &.leaflet-interactive {
      cursor: move;
      cursor: -webkit-grabbing;
      cursor: -moz-grabbing;
    }
  }
}

.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-tile-container {
  pointer-events: none;
}

.leaflet-pane > svg {
  path {
    pointer-events: none;

    &.leaflet-interactive {
      pointer-events: auto;
    }
  }
}

.leaflet-marker-icon,
.leaflet-image-layer {
  &.leaflet-interactive {
    pointer-events: auto;
  }
}

.leaflet-control-layers {
  &.leaflet-control {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    opacity: .8;
  }

  .leaflet-control-layers-list {
    display: none;
  }

  label {
    display: block;
  }
}

.leaflet-control-layers-scrollbar {
  overflow-y: scroll;
  padding-right: 5px;
}

.leaflet-control-layers-selector {
  display: none;

  + span {
    display: block;
    padding: 5px 0 8px 20px;

    &::before {
      border: 1px solid $color-primary;
      border-radius: 50%;
      content: ' ';
      height: 10px;
      margin: 0 0 0 -18px;
      position: absolute;
      transition: background .3s;
      width: 10px;
    }

    &:hover {
      &::before {
        background: transparentize($color-primary, .7);
      }
    }
  }

  &:checked {
    + span {
      &::before {
        background: $color-primary;
      }
    }
  }
}

.leaflet-tooltip {
  background-color: $color-white;
  border: 1px solid $color-primary;
  border-radius: 2px;
  color: $color-primary;
  font-size: 12px;
  line-height: 1.2;
  padding: 6px;
  pointer-events: none;
  position: absolute;
  user-select: none;
  white-space: nowrap;

  &.leaflet-clickable {
    cursor: pointer;
    pointer-events: auto;
  }
}

.leaflet-tooltip-top,
.leaflet-tooltip-bottom,
.leaflet-tooltip-left,
.leaflet-tooltip-right {
  &::before {
    background: transparent;
    border: 6px solid transparent;
    content: '';
    pointer-events: none;
    position: absolute;
  }
}

.leaflet-tooltip-bottom {
  margin-top: 6px;

  &::before {
    border-bottom-color: $color-white;
    margin-left: -6px;
    margin-top: -12px;
    top: 0;
  }
}

.leaflet-tooltip-top {
  margin-top: -6px;

  &::before {
    border-top-color: $color-white;
    bottom: 0;
    margin-bottom: -12px;
  }
}

.leaflet-tooltip-bottom,
.leaflet-tooltip-top {
  &::before {
    left: 50%;
    margin-left: -6px;
  }
}

.leaflet-tooltip-left {
  margin-left: -6px;

  &::before {
    border-left-color: $color-white;
    margin-right: -12px;
    right: 0;
  }
}

.leaflet-tooltip-right {
  margin-left: 6px;

  &::before {
    border-right-color: $color-white;
    left: 0;
    margin-left: -12px;
  }
}

.leaflet-tooltip-left,
.leaflet-tooltip-right {
  &::before {
    margin-top: -6px;
    top: 50%;
  }
}

.leaflet-control-layers-list {
  background: transparentize($color-white, .1);
  color: $color-gray-dark;
  padding: 10px;

  label {
    cursor: pointer;
  }
}

.leaflet-control-zoom {
  opacity: .7;
  right: 16px;
  top: 65px;

  @media screen and (max-width: map-get($grid-breakpoints, lg) - 1) {
    right: calc(100vw - 50px);
    top: -10px;
    transform: scale(.8);
  }

  a {
    background: $color-white;
    border-radius: 5px 5px 0 0;
    color: $color-black;
    display: block;
    font-size: 40px;
    height: 46px;
    text-align: center;
    transition: background-color .5s, color .5s;
    width: 46px;

    &:hover {
      color: $color-primary;
    }

    + a {
      border-radius: 0 0 5px 5px;
      border-top: 1px solid $color-gray-light;
    }
  }
}
