@import 'https://api.mapbox.com/mapbox-gl-js/v2.5.1/mapbox-gl.css';

* {
  box-sizing: border-box;
}
html,
body {
  overflow: hidden;
  margin: 0;
  padding: 0;
  color: #fff;
  background-color: #333;
  text-size-adjust: none;
}
body,
input,
button,
select,
textarea {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  font-size: 14px;
}
svg {
  fill: currentColor;
}

.ib {
  display: inline-block;
}

.badge {
  display: inline-block;
  text-align: center;
  width: 16px;
  height: 16px;
  line-height: 16px;
  font-size: 12px;
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 123123px;
  text-decoration: none;
  font-weight: bold;
  vertical-align: middle;
}

.circle {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 123123px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  vertical-align: middle;
  transition: 0.3s background-color;
}

.close {
  float: right;
  border: 0;
  margin: 0;
  padding: 3px;
  width: 24px;
  height: 24px;
  border-radius: 123123px;
  text-align: center;
  color: #fff;
  background-color: rgba(255, 255, 255, 0.3);
  font-weight: bold;
  font-size: 14px;
  line-height: 0;
  cursor: pointer;
  outline: 0;
  margin: 0 0 4px 4px;
  transition: 0.3s background-color ease-in-out;
}
.close:hover {
  background-color: rgba(255, 255, 255, 0.5);
}
.close:active {
  opacity: 0.5;
}

#modal {
  z-index: 50;
  content: '';
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: 0.3s opacity ease-in-out;
}
body.modal #modal {
  opacity: 1;
  pointer-events: auto;
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  transition: 0.3s all ease-in-out;
  pointer-events: none;
}
#map.loaded {
  pointer-events: auto;
}
body.modal #map {
  transform: translateY(-15%);
}

#map:after {
  content: '🌳 Loading trees...';
  display: inline-block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 16px;
  border-radius: 123123px;
  background-color: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-weight: bold;
  font-size: 2em;
  white-space: nowrap;
  animation: loadingTrees 1s linear both infinite alternate;
  transition: 1s all ease;
  pointer-events: none;
}
#map.loaded:after {
  opacity: 0;
  animation: none;
}
@keyframes loadingTrees {
  0% {
    opacity: 0.1;
  }
  100% {
    opacity: 1;
  }
}

#map canvas {
  cursor: crosshair !important;
}

.mapboxgl-control-container {
  transition: 0.3s filter ease-in-out;
}
body.modal .mapboxgl-control-container {
  filter: blur(20px);
}
.mapboxgl-ctrl-group {
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 123123px;
}
@supports (
  (-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
) {
  .mapboxgl-ctrl-group {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px) saturate(3);
  }
}
.mapboxgl-ctrl-group button {
  opacity: 0.8;
  width: 36px;
  height: 36px;
}
.mapboxgl-ctrl-top-right {
  top: 55px;
  transform: translate(100%);
  opacity: 0;
  transition: all 0.6s ease-in-out;
}
#map.loaded .mapboxgl-ctrl-top-right {
  opacity: 1;
  transform: translate(0);
}
.mapboxgl-ctrl-custom-pitch {
  font-weight: bold;
  font-size: 15px;
  letter-spacing: -0.5px;
  transition: all 0.3s ease;
}
.active .mapboxgl-ctrl-custom-pitch {
  color: #fff;
  background-color: dodgerblue !important;
}
.mapboxgl-ctrl-custom-pitch span {
  display: block;
}

@supports (top: max(1px)) {
  .mapboxgl-ctrl-top-right {
    right: max(0px, env(safe-area-inset-right));
  }
}

#layers-button {
  outline: 0;
  border: 0;
  padding: 12px;
  margin: 0;
  position: absolute;
  top: 8px;
  right: 8px;
  cursor: pointer;
  background-color: rgba(0, 128, 0, 0.2);
  border: 2px solid rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(5px) saturate(3);
  backdrop-filter: blur(5px) saturate(3);
  color: #fff;
  border-radius: 123123px;
  line-height: 0;
  transition: all 0.3s ease;
}
@supports (left: max(0px)) {
  #layers-button {
    right: max(8px, env(safe-area-inset-right));
  }
}
#layers-button:hover {
  border-color: rgba(0, 128, 0, 0.5);
}
#layers-button svg {
  transition: 0.3s transform ease-in-out;
  vertical-align: middle;
}
#layers-button:hover svg {
  transform: rotate(30deg);
}
#layers-button svg {
  animation: wiggle 1s 5s ease-in-out;
}
@-webkit-keyframes wiggle {
  0% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-25deg);
  }
  50% {
    transform: rotate(25deg);
  }
  75% {
    transform: rotate(-25deg);
  }
  100% {
    transform: rotate(0);
  }
}
@keyframes wiggle {
  0% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-25deg);
  }
  50% {
    transform: rotate(25deg);
  }
  75% {
    transform: rotate(-25deg);
  }
  100% {
    transform: rotate(0);
  }
}

header h1 {
  margin: 0;
  padding: 0;
  font-weight: bold;
  font-size: 1.1em;
  position: fixed;
  top: 25px;
  right: 64px;
  white-space: nowrap;
  text-shadow: 0 2px #000;
  margin-right: 0.3em;
  animation: poof 1s 5s ease-in both;
}
@-webkit-keyframes poof {
  50% {
    opacity: 0.1;
  }
  100% {
    opacity: 0;
    transform: translateX(100%);
  }
}
@keyframes poof {
  50% {
    opacity: 0.1;
  }
  100% {
    opacity: 0;
    transform: translateX(100%);
  }
}

#layers {
  z-index: 200;
  color: #fff;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 12px;
  background-color: rgba(0, 0, 0, 0.8);
  line-height: 1.4em;
  transition: 0.3s transform ease-in-out;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5),
    inset 1px 1px rgb(255, 255, 255, 0.15),
    inset -1px -1px rgb(255, 255, 255, 0.15);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#layers .flex {
  margin: auto;
  max-width: 400px;
  max-height: 75vh;
  min-height: 300px;
  display: flex;
  flex-direction: column;
}
#layers[hidden] {
  display: block;
  transform: translate3d(0, 100%, 0);
}
#layers h1 {
  margin: 0 0 0.5em;
  padding: 0;
  font-size: 1.5em;
}
#layers a {
  color: #fff;
}
#layers .pills {
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 123123px;
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  flex-shrink: 0;
}
#layers .pills li {
  margin: 0;
  padding: 0;
  display: block;
  flex: 1;
}
#layers .pills a {
  display: block;
  text-decoration: none;
  padding: 5px 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.8);
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  font-size: 0.9em;
}
#layers .pills li:first-of-type a {
  border-left: 0;
}
#layers .pills a:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.2);
}
#layers .pills a:active {
  background-color: rgba(255, 255, 255, 0.4);
}
#layers .pills a.selected {
  color: #000;
  background-color: #fff;
}
#layers span {
  display: inline-block;
}
#layers .legend {
  display: none;
  margin-top: 8px;
  flex: 1;
}
#layers .legend.scrollable {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  padding: 4px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.1)
  );
}
#layers .legend.selected {
  display: block;
}
#layers .legend table {
  width: 100%;
}
#layers .legend .right {
  text-align: right;
}
#layers .gradient {
  background-origin: border-box !important;
  border-radius: 123123px;
  border: 3px solid rgba(0, 0, 0, 0.6);
  width: 100%;
  height: 14px;
  margin: 2px 0;
}
#layers .info {
  opacity: 0.7;
}
#layers .label-left {
  float: left;
}
#layers .label-right {
  text-align: right;
}
#layers .global-legend {
  font-size: 13px;
  text-align: center;
  margin-top: 5px;
  padding: 5px 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 7px;
}
#layers .global-legend > span {
  display: inline-block;
  margin-right: 0.5em;
  font-size: 20px;
  zoom: 0.5;
}
#layers .global-legend img {
  vertical-align: -5px;
}
#layers .attribution {
  color: slategray;
  padding-top: 5px;
  font-size: 0.8em;
}
#layers .attribution a {
  color: rgba(255, 255, 255, 0.7);
  display: inline-block;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
#layers .attribution a:hover {
  border-color: rgba(255, 255, 255, 0.7);
}

#card {
  z-index: 100;
  position: fixed;
  right: 0;
  bottom: 0;
  width: 100%;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.85);
  padding: 12px;
  transition: 0.3s all ease-in-out;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.15);
}
@supports (top: max(1px)) {
  #card {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
#card:not(.selected):hover {
  cursor: pointer;
  background-color: rgba(45, 45, 45, 0.85);
}
#card.selected {
  border-top: 3px solid dodgerblue;
  border-right: 3px solid dodgerblue;
  border-left: 3px solid dodgerblue;
  box-shadow: 0 0 30px #000;
  background-color: #000;
}
#card[hidden] {
  display: block;
  transform: translateY(150%);
}
#card .close {
  display: none;
}
#card.selected .close {
  display: block;
}
body.modal #card {
  opacity: 0.2;
}
#card .img {
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  filter: saturate(1.2) brightness(1.2);
  width: 100%;
  height: 0;
  padding-bottom: 37.5%;
  margin: 8px 0;
  border-radius: 6px;
  transition: 0.3s filter ease-in-out;
}
#card a:hover .img {
  filter: none;
}
#card h1 {
  font-size: 1.1em;
  margin: 0;
  padding: 0;
  line-height: 1.3;
}
#card .common {
  color: lightslategray;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25em;
}
#card .common b {
  color: #fff;
  font-weight: normal;
}
#card .common.expand {
  white-space: normal;
}
#card table {
  clear: both;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin: 0.5em 0 0;
  border-spacing: 0;
}
#card thead th {
  text-transform: uppercase;
  font-weight: normal;
  text-align: left;
  color: lightslategray;
  font-size: 11px;
}
#card tbody td {
  font-family: monospace;
  font-weight: bold;
  padding-right: 0.5em;
  font-size: 12px;
}
#card .footer-buttons {
  margin-top: 8px;
}
#card .footer-buttons a {
  display: inline-block;
  padding: 6px 12px;
  border: 3px solid dodgerblue;
  border-radius: 123123px;
  color: dodgerblue;
  text-decoration: none;
  font-weight: bold;
  line-height: 1.2;
}
#card .footer-buttons a:first-child {
  margin-right: 10px;
}
#card .footer-buttons a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
#card .footer-buttons a:active {
  opacity: 0.5;
}
#card .footer-buttons a > * {
  pointer-events: none;
}

#legend-family > a {
  margin: 1px;
  text-decoration: none;
  padding: 0.25em 0.6em;
  border-radius: 4em;
}
#legend-family > a:hover {
  background-color: rgba(255, 255, 255, 0.5);
}
#legend-family > a.selected {
  color: #000;
  background-color: #fff;
}
#legend-family > a:active {
  background-color: rgba(255, 255, 255, 0.2);
}

#rendering-mode {
  opacity: 0.75;
  font-size: 10px;
  padding: 12px;
  margin: 6px -12px -12px;
  background-color: rgba(229, 255, 0, 0.171);
  line-height: 1.05;
  border-radius: 3px;
}

@media (orientation: landscape) {
  #layers {
    top: 0;
    height: 100vh;
    max-width: 320px;
  }
  #layers[hidden] {
    transform: translateX(-100%);
  }
  #layers .flex {
    height: 100%;
  }
  body.modal #map {
    transform: translateY(0);
  }
}

@media (min-width: 416px) {
  /* 400 + 8 + 8 */
  #card {
    right: 8px;
    max-width: 400px;
  }
  @supports (top: max(1px)) {
    #card {
      right: max(8px, env(safe-area-inset-right));
    }
  }
  .show-m {
    display: inline;
  }
}

@media (min-width: 1100px) and (min-height: 600px) {
  .mapboxgl-ctrl-top-right {
    top: 0;
  }
  #layers-button,
  #modal,
  #layers .close {
    display: none;
  }
  #layers {
    top: 8px;
    left: 8px;
    height: auto;
    bottom: auto;
    border-radius: 18px;
    max-width: 320px;
    overflow-x: auto;
  }
  #layers .flex {
    min-height: 0;
  }
  #layers .flex {
    height: auto;
  }
  #layers .legend.scrollable {
    transition: max-height 0.3s 0.3s ease-in;
    min-height: 5em;
    max-height: 25vh;
  }
  #layers .legend.scrollable:hover {
    max-height: 70vh;
  }
  #layers[hidden] {
    transform: translateY(0);
  }
}

@supports (
  (-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
) {
  #layers,
  #card {
    background-color: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(20px) saturate(3);
    backdrop-filter: blur(20px) saturate(3);
  }
}
