/* there for screen readers, invisible on screen */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tool-main {
  width: 100%;
}

.map-titlebar {
  justify-content: space-between;
}

.map-frame {
  position: relative;
  overflow: hidden;
  box-shadow: var(--sunken);
  background: #000;
}

.map-access {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  padding: 5px;
  box-shadow: var(--raised), var(--drop);
  background: var(--site-surface);
  transform: translateY(calc(-100% - 12px));
}

.map-access:focus-within {
  transform: translateY(0);
}

.map-access label {
  color: var(--site-ink);
  font-size: 0.72rem;
}

.map-access select {
  min-width: 200px;
  max-width: 40vw;
}

#map {
  width: 100%;
  height: min(680px, calc(100dvh - 210px));
  min-height: 160px;
  background: #000;
}

.map-status {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 500;
  width: min(280px, 85%);
  margin: 0;
  padding: 10px 14px;
  box-shadow: var(--raised), var(--drop);
  background: var(--site-surface);
  color: var(--site-red);
  font-family: monospace;
  line-height: 1.4;
  text-align: center;
  transform: translate(-50%, -50%);
}

.map-status[hidden] {
  display: none;
}

.leaflet-container {
  background: #000;
  font-family: monospace;
}

.map-base-tiles {
  filter: grayscale(0.7) brightness(0.5) contrast(1.15) sepia(0.15) hue-rotate(-8deg);
}

.map-label-tiles {
  filter: grayscale(1) brightness(0.85) contrast(1.3);
}

.leaflet-control-zoom a {
  width: 26px !important;
  height: 26px !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: var(--raised) !important;
  background: var(--site-surface) !important;
  color: var(--site-ink) !important;
  font-family: monospace;
  font-size: 16px !important;
  line-height: 26px !important;
}

.leaflet-control-zoom a:hover {
  background: #1a1a1a !important;
}

.leaflet-bar {
  border: 0 !important;
}

.leaflet-control-zoom,
.leaflet-control-attribution {
  border-radius: 0 !important;
}

.leaflet-control-attribution {
  box-shadow: var(--raised);
  background: rgb(192 192 192 / 0.92) !important;
  color: #333;
  font-size: 10px !important;
  line-height: 1.4;
}

.leaflet-control-attribution a {
  color: var(--site-red) !important;
}

.pin-mark {
  display: block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: var(--site-red);
  box-shadow:
    0 0 0 1px var(--site-surface),
    1px 1px 0 rgb(0 0 0 / 0.7);
  transform: rotate(45deg);
}

.map-pin {
  display: grid;
  place-items: center;
  background: transparent;
  cursor: pointer;
}

.map-pin .pin-mark {
  width: 12px;
  height: 12px;
}

.map-pin:focus-visible {
  outline: none;
}

.map-pin:focus-visible .pin-mark {
  box-shadow:
    0 0 0 3px var(--site-surface),
    0 0 0 5px var(--site-ink);
  transform: rotate(45deg) scale(1.15);
}

.leaflet-tooltip {
  padding: 3px 6px;
  border: 0;
  border-radius: 0;
  box-shadow: var(--raised);
  background: var(--site-surface);
  color: var(--site-ink);
  font-family: monospace;
  font-size: 0.72rem;
}

.leaflet-tooltip-top::before {
  border-top-color: #444;
}

/* the record card sits in the middle of the map, over everything, and
   scrolls inside itself rather than growing past the pane */
.monster-card-overlay {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgb(0 0 0 / 0.6);
}

/* an explicit display would otherwise beat the browser's [hidden] rule and
   leave the closed overlay covering the map, eating every pin click */
.monster-card-overlay[hidden] {
  display: none;
}

.monster-card {
  position: relative;
  width: min(340px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 14px 15px 14px;
  background: var(--site-surface);
  box-shadow: var(--raised), var(--drop);
}

.monster-card-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  min-height: 26px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.monster-card:focus {
  outline: 2px dotted var(--site-ink);
  outline-offset: 2px;
}

.monster-card h3 {
  margin: 0 26px 8px 0;
  color: var(--site-red);
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.2;
}

.monster-card-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  margin-bottom: 8px;
  padding: 5px 6px;
  box-shadow: var(--sunken);
  background: #000;
  font-size: 0.75rem;
}

.monster-card-meta dt {
  color: var(--site-ink);
  font-weight: bold;
}

.monster-card-meta dd {
  margin: 0;
  color: var(--site-ink);
}

.monster-card-story {
  margin: 0;
  color: var(--site-ink);
  font-size: 0.85rem;
  line-height: 1.42;
}

/* no fixed height and no cropping - a tall illustration stays tall, since
   cutting the creature's head off defeats the point of showing it */
.monster-card-image {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 9px;
  box-shadow: var(--sunken);
}

.monster-card-credit {
  margin: 4px 0 0;
  color: var(--site-deep);
  font-family: monospace;
  font-size: 0.62rem;
  line-height: 1.3;
}

.monster-card-credit a {
  color: inherit;
}

.monster-card-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.monster-card-source {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  color: var(--site-ink) !important;
  font-size: 0.75rem;
  font-weight: bold;
  text-decoration: underline;
  text-align: center;
}

@media only screen and (max-width: 800px) {
  #map {
    height: min(560px, calc(100dvh - 170px));
    min-height: 160px;
  }

  .leaflet-popup-content {
    width: min(260px, 68vw) !important;
  }
}

@media only screen and (max-width: 480px) {
  .map-access {
    right: 6px;
    left: 6px;
    max-width: none;
    flex-wrap: wrap;
  }

  .map-access label {
    flex-basis: 100%;
  }

  .map-access select {
    min-width: 0;
    max-width: none;
    flex: 1;
  }
}
