/*
 * The map, its legend, markers, hover text and controls
 * (components/_map.scss), converted to plain CSS (ADR-0007), with
 * mapbox-gl's `mapboxgl-` classes renamed to MapLibre's `maplibregl-`.
 */

/* The hover text, on devices that can hover. It fades in and out (the old
   `menu-fade` transition). */
.map-overlay {
  position: fixed;
  display: none;
  top: 50%;
  left: 50%;
  text-align: center;
  transform: translate(-50%, -50%);
  z-index: 99999;
  font-size: var(--font-size-very-large);
  line-height: 0.9;
  pointer-events: none;
  width: 100%;
  color: white;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
  max-width: calc(100% - 2em);
  margin-left: auto;
  margin-right: auto;

  @media (hover: hover) {
    display: block;
    opacity: 1;
    transition: opacity var(--transition-default), display var(--transition-default) allow-discrete;

    @starting-style {
      opacity: 0;
    }

    &[hidden] {
      display: none;
      opacity: 0;
    }
  }
}

.map-bg {
  position: fixed;
  z-index: 1;
  inset: 0;
  color: var(--color-bg);
}

.legend {
  position: fixed;
  bottom: calc(var(--spacing-m) * 2.5);
  left: var(--spacing-m);
  z-index: 2;
  list-style-type: none;
  padding: 0;
  margin: 0;
  padding-left: 1.5em;
  line-height: 1.8;

  /* The countries; paragraphStyle('small') */
  ul {
    padding: 0;
    margin: 0;
    list-style-type: none;
    font-size: var(--font-size-small);
    letter-spacing: 0.03em;
    font-weight: 200;
    margin-bottom: 1em;

    li {
      cursor: pointer;
      transition: opacity var(--transition-default);

      &:hover {
        opacity: 0.5;
      }
    }
  }

  /* The countries are buttons now, reset to look like the old text and,
     as the old list items were, as wide as the list. */
  button {
    display: block;
    width: 100%;
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    text-align: inherit;
    cursor: inherit;
  }
}

.legend--kotm,
.legend--audiowalk {
  position: relative;

  &::before {
    content: '';
    width: 1em;
    height: 1em;
    border-radius: 100%;
    position: absolute;
    top: 0;
    left: -1.5em;
    transform: translate(0, 0.3em);
  }
}

.legend--kotm::before {
  background-color: var(--color-marker);
}

.legend--audiowalk::before {
  background-color: var(--color-line);
}

#map {
  width: 100%;
  height: 100%;

  .marker {
    width: 30px;
    height: 30px;
    background-color: var(--color-marker);
    border-radius: 100%;
    cursor: pointer !important;
    font-family: 'Futura', sans-serif !important;
    transition: width var(--transition-fast), height var(--transition-fast);

    &:hover {
      width: 40px;
      height: 40px;
    }
  }

  .marker--line {
    width: 20px;
    height: 20px;
    background-color: var(--color-line);

    @media (hover: hover) {
      &:hover {
        width: 30px !important;
        height: 30px !important;
      }
    }
  }
}

/* The Mapbox wordmark (assets/js/map-controls.js), as mapbox-gl drew it. */
.mapbox-logo {
  width: 88px;
  height: 23px;
  margin: 0 0 -4px -4px;
  display: block;
  background-repeat: no-repeat;
  background-image: url('../images/mapbox-logo.svg');
  cursor: pointer;
  overflow: hidden;
}

.maplibregl-ctrl-bottom-left .maplibregl-ctrl {
  margin: 0 0 var(--spacing-s) var(--spacing-m) !important;
}

.maplibregl-ctrl-geolocate {
  @media (hover: hover) {
    transition: opacity var(--transition-fast);

    &:hover {
      opacity: var(--opacity);
    }
  }

  .maplibregl-ctrl-icon {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzEiIGhlaWdodD0iMzEiIHZpZXdCb3g9IjAgMCAzMSAzMSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMxIDBMMTUuNSAzMUwxMS42MjUgMTkuMzc1TDAgMTUuNUwzMSAwWiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==') !important;
  }
}

.maplibregl-ctrl-bottom-right .maplibregl-ctrl {
  margin: 0 1rem 1rem 0 !important;

  &.maplibregl-ctrl-attrib {
    @media screen and (min-width: 640px) {
      margin: 0 !important;
      background-color: rgba(0, 0, 0, 0) !important;
      font-size: 9px;
      letter-spacing: 0.06em;
    }

    .maplibregl-ctrl-attrib-inner {
      color: white !important;
      opacity: 0.8;

      a {
        color: inherit;
      }
    }
  }
}

/* mapbox-gl's compact attribution took the site's `box-sizing: border-box`,
   so its "i" button stood 4 px out below it; MapLibre's is content-box. */
.maplibregl-ctrl-attrib.maplibregl-compact {
  box-sizing: border-box;
}

.maplibregl-ctrl-attrib .mapbox-improve-map {
  font-weight: 700;
  margin-left: 2px;
}

.maplibregl-ctrl-group {
  background: none !important;
  border-radius: 0 !important;
}
