:root {
  --background: #050506;
  --panel: rgb(14 14 17 / 0.9);
  --panel-border: rgb(255 255 255 / 0.14);
  --text: #e8e8ec;
  --link: #7ff3ff;
  --focus: #7ff3ff;
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  color-scheme: dark;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--background);
}

#map {
  position: fixed;
  inset: 0;
}

.panel {
  position: absolute;
  left: 10px;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.6);
  padding: 8px 12px;
}

.panel summary {
  cursor: pointer;
  font-weight: 600;
}

.panel :focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.info {
  top: 10px;
  max-width: min(20rem, calc(100vw - 80px));
}

.info h1 {
  display: inline;
  font-size: 1rem;
  margin: 0;
}

.info p {
  margin: 0.6em 0 0;
}

.info a {
  color: var(--link);
}

.legend {
  bottom: 20px;
}

/*
 * The gradient uses the year stops of the fill-color expression in app.js,
 * placed on a scale from 1885 (0%) to 2025 (100%).
 */
.ramp {
  width: 180px;
  margin-top: 6px;
}

.ramp-bar {
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(to right,
      #30fbff 0%,
      #74d5fe 25%,
      #8eabff 39.29%,
      #b986fa 50%,
      #ed7cfa 57.14%,
      #fd29ec 64.29%,
      #ff8cf4 78.57%,
      #ffc8fb 89.29%,
      #fff4fe 100%);
  background: linear-gradient(to right in lab,
      #30fbff 0%,
      #74d5fe 25%,
      #8eabff 39.29%,
      #b986fa 50%,
      #ed7cfa 57.14%,
      #fd29ec 64.29%,
      #ff8cf4 78.57%,
      #ffc8fb 89.29%,
      #fff4fe 100%);
}

.ramp-labels {
  position: relative;
  height: 1.6em;
}

.ramp-labels span {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
}

.ramp-labels span::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 1px;
  height: 3px;
  background: var(--text);
}

.ramp-labels .y1900 { left: 10.71%; }
.ramp-labels .y1950 { left: 46.43%; }
.ramp-labels .y2000 { left: 82.14%; }

.legend ul {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.swatch {
  flex: none;
  width: 14px;
  height: 14px;
  border: 1px solid #6b6b70;
}

/* The color matches UNKNOWN in app.js. */
.unknown { background: #3a3a3d; }

/* Match MapLibre's popup and controls to the dark panels. */
.maplibregl-popup-content {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.6);
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: var(--panel);
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: var(--panel);
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: var(--panel);
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: var(--panel);
}

.maplibregl-ctrl-group:not(:empty) {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.6);
}

.maplibregl-ctrl-group button + button {
  border-top-color: var(--panel-border);
}

.maplibregl-ctrl button .maplibregl-ctrl-icon {
  filter: invert(1);
}

.maplibregl-ctrl button:not(:disabled):hover {
  background-color: rgb(255 255 255 / 0.08);
}

@media (max-width: 600px) {
  :root {
    font-size: 12px;
  }

  .panel {
    padding: 6px 10px;
  }

  .legend {
    bottom: 10px;
  }

  .legend li {
    margin: 2px 0;
  }

  .ramp {
    width: 150px;
  }

  .swatch {
    width: 12px;
    height: 12px;
  }
}
