/* general page styles */
body {
  margin: 0;
  padding: 0;
}

body,
.mapboxgl-map {
  font-family: 'Open Sans', sans-serif;
}

ul {
  list-style-type: none;
  padding-left: 0;
}

p {
  margin: 0;
}

.is-hidden {
  display: none;
}

.fade {
  z-index: 0;
  opacity: 0;
  -webkit-transition: opacity .15s linear;
  -o-transition: opacity .15s linear;
  transition: opacity .15s linear;
}

.fade.in {
  z-index: 10;
  opacity: 1;
}

/*
sidebar base
*/
.yahmaps-sidebar {
  z-index: 10;
  position: absolute;
  display: none;
  top: 0;
  right: 0;
  height: 0;
  background-color: white;
  border-radius: 4px;
}

.yahmaps-sidebar.is-open {
  display: block;
  /* Allow gap for vertical-alignment w controls */
  height: calc(100vh - 3.125rem);
  margin: 10px 10px 0 0;
  overflow-y: auto;
}

/* map layout */
#map {
  z-index: 1;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

/*
map controls
*/
.mapboxgl-ctrl-bottom-left {
  bottom: 30px !important;
}

.mapboxgl-ctrl-group {
  box-shadow: none;
  -moz-box-shadow: none;
  -webkit-box-shadow: none;
}

.mapboxgl-ctrl-group > .yahmaps-ctrl-check-toggle {
  position: relative;
  width: 100%;
  padding: 0.1em 2.5em 0.25em 1em;
  margin: 0;
  font-size: 12pt;
  text-align: left;
}

.yahmaps-ctrl-check-toggle::after {
  transition: background-image 0.2s;
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 1em;
  background-color: #333333;
  background-image: url(images/checkbox.svg);
  background-position: center;
  background-size: cover;
  border-radius: 0.1875rem;
}

.yahmaps-ctrl-check-toggle.is-active::after {
  transition: background-image 0.2s;
  background-image: url(images/checkbox_active.svg);
}

/*
map layer toggle bar control
*/
.yahmaps-ctrl-layer-toggle-bar > .yahmaps-ctrl-layer-toggle-bar-button {
  position: relative;
  display: inline-block;
  width: auto;
  border-top: 0;
  border-bottom: 0;
}

.yahmaps-ctrl-layer-toggle-bar-button::after {
  position: absolute;
  top: 0.55em;
  right: 1em;
}

/*
map places control
*/
.yahmaps-ctrl-places {
  overflow: visible !important;
}

.yahmaps-ctrl-places > .yahmaps-ctrl-places-trigger {
  clear: both;
  display: block;
  width: initial;
  padding: 0.5em 0 0.5em 1em;
  background-color: white;
  border-radius: 4px;
  font-size: 12pt;
  cursor: pointer;
}

.yahmaps-ctrl-places-trigger::before {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1.25rem;
  margin-right: 0.5em;
  background-color: none;
  background-image: url(images/hamburger.svg);
  background-position: center;
  background-size: 1rem 1rem;
  background-repeat: no-repeat;
  vertical-align: sub;
}

.yahmaps-ctrl-places-trigger:hover,
.yahmaps-ctrl-places-trigger:active {
  background-color: #F3F3F3;
}

.yahmaps-ctrl-places-menu {
  visibility: hidden;
  display: block;
  margin-left: 0 !important;
  border-radius: 4px;
  /*
    Hack to force Webkit to to re-render when visibility set to hidden.
    Fixes bug where places menu would not close on Safari, even though
    the .is-open class was being correctly toggled.
    Solution taken from https://stackoverflow.com/a/21947628
   */
  transform: translateZ(0);
}

.yahmaps-ctrl-places-menu.is-open {
  display: block;
  visibility: visible;
  overflow: visible;
}

.mapboxgl-ctrl-group > .yahmaps-ctrl-places-item {
  max-width: 7.8125rem;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  background-color: white;
  cursor: pointer;
}

.yahmaps-ctrl-places-item:first-of-type {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.yahmaps-ctrl-places-item:last-of-type {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

.yahmaps-ctrl-places-item::after {
  position: absolute;
  right: 1em;
  top: 40%;
}

.yahmaps-ctrl-places-item:hover,
.yahmaps-ctrl-places-item:active,
.yahmaps-ctrl-places-item.is-active {
  background-color: rgba(0,0,0,0.05);
}


/*
map pitch toggle control
*/
.yahmaps-ctrl-pitchtoggle::before {
  content: "3D";
  font-size: 1rem;
}

.yahmaps-ctrl-pitchtoggle.is-pitched::before {
  content: "2D";
}

/*
map legend toggle control
mobile info toggle control
*/
.yahmaps-ctrl-legend::before,
.yahmaps-ctrl-mobile-info::before {
  content: "";
  display: inline-block;
  width: 1.875rem;
  height: 1.875rem;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 0.1875rem;
}

.yahmaps-ctrl-legend::before {
  background-image: url('images/btn-legend.svg');
}

.yahmaps-ctrl-mobile-info::before {
  background-image: url('images/btn-mobile.svg');
}

.yahmaps-ctrl-legend-title,
.yahmaps-ctrl-mobile-info-title,
.yahmaps-ctrl-bookmarks-title {
  margin: 10px 2.75rem 10px 10px;
  font-size: 0.875rem;
  font-weight: bold;
  line-height: 1.5rem;
}

.yahmaps-ctrl-legend-image,
.yahmaps-ctrl-mobile-info-image {
  width: 100%;
}

@media only screen and (max-width: 49.99rem) {
  button.yahmaps-ctrl-legend,
  button.yahmaps-ctrl-mobile-info,
  button.yahmaps-ctrl-bookmarks-toggle {
    display: none;
  }

  .yahmaps-ctrl-bookmarks.is-open,
  .yahmaps-ctrl-legend-sidebar.is-open,
  .yahmaps-ctrl-mobile-info-sidebar.is-open {
    display: none;
  }
}

/*
map attribution control
*/
.map-attribution {
  z-index: 10;
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 0.3125rem 0.5rem;
  background-color: rgba(255, 255, 255, 0.5);
}

.map-attribution > span {
  text-decoration: none;
}

.map-attribution > span:not(:first-child):before {
  content: " | ";

}

/*
link bar
*/

.yahmaps-ctrl-link-bar {
  display: flex;
  justify-content: stretch;
  position: absolute;
  right: 2.5rem;
}

.yahmaps-ctrl-link-bar-item {
  height: 30px;
  padding: 0;
  color: inherit;
  text-decoration: none;
}

button.yahmaps-ctrl-link-bar-button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding-left: 0.625rem;
  padding-right: 0.625rem;
  background-color: white;
  border: none;
  border-right: 1px solid #ddd;
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
}

.yahmaps-ctrl-link-bar-item:last-of-type > button.yahmaps-ctrl-link-bar-button {
  border-right: none;
}

button.yahmaps-ctrl-link-bar-button:hover {
  background-color: #F3F3F3;
}

/* external-link icon */
button.yahmaps-ctrl-link-bar-button:after {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0.1875rem;
  margin-left: 0.375rem;
  background-image: url('./images/external-link.svg');
  background-size: contain;
  background-repeat: no-repeat;
}

/*
bookmarks
*/
.yahmaps-ctrl-bookmarks-toggle::before {
  content: "";
  display: inline-block;
  width: 1.875rem;
  height: 1.875rem;
  background-image: url('images/btn-bookmarks.svg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 0.1875rem;
}

.yahmaps-ctrl-bookmarks {
  height: calc(100vh - 3.125rem);
  background-color: white;
  overflow-y: auto;
}

.yahmaps-ctrl-bookmarks-legend > img {
  display: block;
  max-width: 100%;
}

.yahmaps-ctrl-bookmarks-item {
  padding: 0.25rem 0.375rem 0.375rem;
  color: inherit;
  cursor: pointer;
}

.yahmaps-ctrl-bookmarks-item-title {
  font-size: 1.09375rem;
  font-weight: bold;
}

.yahmaps-ctrl-bookmarks-item-description {
  font-size: 0.859375rem;
  line-height: initial;
}

.yahmaps-ctrl-bookmarks-item-image {
  width: 100%;
  max-width: 100%;
}

.yahmaps-ctrl-bookmarks-item-title ~ .yahmaps-ctrl-bookmarks-item-image {
  margin-top: 0.25rem;
}

/*
attribution popup
*/
.attribution-popup-open,
.disclaimer-popup-open {
  cursor: pointer;
}

.attribution-popup,
.disclaimer-popup {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 40em;
  margin: auto;
  padding: 2rem;
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
  text-align: justify;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}

.disclaimer-popup-close {
  margin-top: 16px;
  padding: 0.25em 0.5em;
  font-family: inherit;
  font-size: inherit;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
}

.attribution-popup-icon-close,
.disclaimer-popup-icon-close,
.yahmaps-ctrl-legend-icon-close,
.yahmaps-ctrl-mobile-info-icon-close,
.yahmaps-ctrl-bookmarks-icon-close,
.yahmaps-feature-popup-icon-close {
  position: absolute;
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  background-color: white;
  background-image: url(images/close.svg);
  background-position: center;
  background-size: cover;
  border: none;
  outline: none;
  cursor: pointer;
}

.attribution-popup-icon-close,
.disclaimer-popup-icon-close {
  top: 1rem;
  right: 1rem;
}

.yahmaps-ctrl-bookmarks-icon-close,
.yahmaps-ctrl-legend-icon-close,
.yahmaps-ctrl-mobile-info-icon-close,
.yahmaps-feature-popup-icon-close {
  top: 10px;
  right: 5px;
}

@media only screen and (min-width: 31.25rem) {
  .attribution-popup,
  .disclaimer-popup {
    bottom: initial;
    max-height: calc(100vh - 12rem);
    margin-top: 4rem;
  }
}

/*
map feature popup
*/

.mapboxgl-popup-content {
  padding: 0;
}

.yahmaps-feature-popup {
  box-sizing: border-box;
  padding: 1.25rem;
  max-width: 100%;
  background-color: white;
  border-radius: 4px;
}

.yahmaps-feature-popup-icon-close {
  top: 1.1875rem;
  right: 1.25rem;
}

.yahmaps-feature-popup-title {
  margin: 0 0 10px;
  font-size: 0.875rem;
  font-weight: bold;
  line-height: 1.5rem;
}

.yahmaps-feature-popup-content {
  width: 100%;
}

.yahmaps-feature-popup-link {
  display: block;
  font-size: 0.6875rem;
  word-wrap: break-word;
  word-break: break-all;
}

/*
map attribute popup
*/

.yahmaps-attribute-popup {
  box-sizing: border-box;
  padding: 0.625rem;
  max-width: 100%;
  background-color: white;
  border-radius: 4px;
}

.yahmaps-attribute-popup-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: bold;
  line-height: 1.5rem;
}

.yahmaps-attribute-popup-content {
  width: 100%;
}

/*
GL not supported message
*/
.no-gl {
  z-index: 10;
  padding: 1em;
}

.no-gl.is-hidden {
  z-index: 0;
}
