.forecast-map-page {
  position: fixed;
  inset: 0;
  z-index: 1;
  container: map / inline-size;
}

.forecast-map-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.forecast-map-page .leaflet-container {
  background: var(--map-ocean);
  font-family: inherit;
}

.forecast-map-chrome {
  display: contents;
}

.forecast-map-panel {
  position: absolute;
  z-index: 2;
  top: 0.75rem;
  left: 0.75rem;
  width: min(26rem, calc(100% - 5.25rem));
  max-height: calc(100% - 3rem);
  overflow: visible;
}

[data-theme="dark"] .forecast-map-panel.tile {
  background: #000;
  border-color: var(--color-border);
}

.forecast-map-panel .kicker {
  margin-bottom: 0.35rem;
}

.forecast-map-panel h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.forecast-map-panel .forecast-place-tools {
  margin-top: 0.75rem;
}

.leaflet-div-icon.forecast-map-place {
  background: transparent;
  border: 0;
}

.forecast-map-place a {
  display: block;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--color-accent);
}

.forecast-map-error {
  margin-top: 0.75rem;
}

.forecast-map-panel .location-matches {
  margin-top: 0.75rem;
}

.forecast-map-panel .location-matches ul {
  max-height: min(24rem, calc(100vh - 16rem));
  overflow: auto;
}

.forecast-map-panel .location-matches h2 {
  font-size: 1rem;
}

.forecast-map-credit {
  position: absolute;
  z-index: 1;
  left: 0.75rem;
  bottom: 0.45rem;
  margin: 0;
  font-size: 0.75rem;
  color: var(--map-label);
}

.forecast-map-credit a {
  color: inherit;
}

.forecast-map-credit a:hover,
.leaflet-control-attribution a:hover,
.leaflet-control-attribution a:focus {
  text-decoration: none;
}

.forecast-map-page .leaflet-bottom.leaflet-right {
  margin-bottom: 0.25rem;
}

.forecast-map-page .leaflet-bar {
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  box-shadow: none;
  overflow: hidden;
}

.forecast-map-page .leaflet-bar a {
  background: var(--color-surface);
  color: var(--color-ink);
}

.forecast-map-page .leaflet-bar a:hover {
  background: var(--color-surface-hover);
}

.forecast-map-state-label {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--map-label);
  font-size: var(--state-label-size, 0.8125rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.forecast-map-state-label span,
.forecast-map-city-label span {
  display: block;
  width: max-content;
  text-shadow: 0 0 3px var(--map-land), 1px 0 0 var(--map-land), -1px 0 0 var(--map-land), 0 1px 0 var(--map-land), 0 -1px 0 var(--map-land);
}

.forecast-map-state-label span {
  transform: translate(-50%, -50%);
}

.forecast-map-city-label {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--map-label);
  font-size: var(--city-label-size, 0.6875rem);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.forecast-map-city-label.is-major {
  font-weight: 700;
}

.forecast-map-city-label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: currentColor;
}

.forecast-map-city-label.is-minor {
  font-weight: 300;
}

.forecast-map-city-label.is-small {
  font-weight: 200;
}

.forecast-map-city-label.is-right span {
  transform: translate(12px, -50%);
}

.forecast-map-city-label.is-left span {
  transform: translate(calc(-100% - 12px), -50%);
}

.forecast-map-city-label.is-below span {
  transform: translate(-50%, 12px);
}

.forecast-map-city-label.is-above span {
  transform: translate(-50%, calc(-100% - 12px));
}

.forecast-map-layers {
  position: absolute;
  z-index: 3;
  top: 3.25rem;
  right: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.forecast-map-layers .button {
  min-width: 4.75rem;
}

.forecast-map-swatch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  min-width: 7rem;
  font-size: 0.75rem;
}

.forecast-map-swatch input[type="color"] {
  box-sizing: border-box;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.forecast-map-swatch input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.forecast-map-swatch input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

.forecast-map-swatch input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

@media (max-width: 36rem) {
  .forecast-map-chrome {
    position: absolute;
    z-index: 2;
    top: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none;
  }

  .forecast-map-chrome > * {
    pointer-events: auto;
  }

  .forecast-map-panel {
    position: static;
    align-self: stretch;
    width: auto;
    max-height: min(70vh, calc(100% - 6rem));
  }

  .forecast-map-layers {
    position: static;
    flex: none;
  }
}

.admin-map-preview {
  position: relative;
  height: 20rem;
  margin-top: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  background: var(--map-ocean);
}

.admin-map-canvas {
  position: absolute;
  inset: 0;
}

.admin-map-preview .leaflet-container {
  background: var(--map-ocean);
  font-family: inherit;
}

.admin-map-preview .leaflet-bar {
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  box-shadow: none;
  overflow: hidden;
}

.admin-map-preview .leaflet-bar a {
  background: var(--color-surface);
  color: var(--color-ink);
}

.leaflet-div-icon.map-photo-pin {
  background: transparent;
  border: 0;
  overflow: visible;
  pointer-events: auto;
}

.map-photo-pin-photo {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  border: 2px solid #fff;
  border-radius: 0.45rem;
  background: var(--color-surface);
  box-shadow: 0 0 0 1px rgb(15 23 42 / 35%), 0 1px 3px rgb(15 23 42 / 28%);
  overflow: hidden;
}

.map-photo-pin-photo img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: cover;
}

.map-photo-pin-point {
  display: block;
  width: 0;
  height: 0;
  margin: -1px auto 0;
  border-right: 7px solid transparent;
  border-left: 7px solid transparent;
  border-top: 8px solid #fff;
  filter: drop-shadow(0 1px 1px rgb(15 23 42 / 45%));
}

.map-photo-pin-point.is-fresh {
  border-top-color: #16a34a;
}

.map-photo-pin-tag {
  position: absolute;
  z-index: 1;
  left: 1px;
  bottom: 1px;
  display: flex;
  width: 14px;
  height: 14px;
  border: 0;
  background: none;
  pointer-events: none;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px rgb(15 23 42 / 80%));
}

.map-photo-pin-tag .tag-icon {
  width: 14px;
  height: 14px;
}

.map-photo-pin-photo.is-fresh {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px #16a34a;
}

.map-photo-pin-photo.is-arriving {
  animation: map-photo-arrive 0.55s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .map-photo-pin-photo.is-arriving {
    animation: none;
  }
}

@keyframes map-photo-arrive {
  from { transform: scale(0.4); }
  to { transform: scale(1); }
}

.map-photo-filters {
  position: absolute;
  z-index: 3;
  left: 0.75rem;
  bottom: 2.4rem;
  width: max-content;
  max-width: calc(100% - 5.25rem);
  pointer-events: auto;
}

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

.map-photo-filters-toggle {
  display: none;
}

.map-photo-filters-sheet {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.35rem;
  border-radius: 0.5rem;
  background: rgb(255 255 255 / 88%);
}

[data-theme="dark"] .map-photo-filters-sheet {
  background: rgb(0 0 0 / 72%);
}

.map-photo-filters-sheet .button {
  flex: none;
  gap: 0.25rem;
}

.map-photo-filter-short {
  display: none;
}

.map-photo-filters-sheet .tag-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.forecast-radar-stage {
  container: map / inline-size;
}

.forecast-radar-stage .map-photo-filters {
  left: 0.5rem;
  bottom: 2.15rem;
  max-width: calc(100% - 1rem);
}

/* Names fit once the map is wider than 88rem. A tighter map keeps the icons, with the name on the button. */
@container map (max-width: 88rem) {
  .map-photo-filter-short {
    display: inline;
  }

  .map-photo-filter-name {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .map-photo-filters-sheet .button {
    position: relative;
    padding-inline: 0.4rem;
  }
}

/* A small map opens the list upward and closes it with Done. */
@container map (max-width: 36rem) {
  .forecast-map-page .map-photo-filters,
  .forecast-radar-stage .map-photo-filters {
    left: 0.5rem;
    right: auto;
    bottom: 2.4rem;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    width: min(16rem, calc(100% - 1rem));
    max-width: min(16rem, calc(100% - 1rem));
    overflow: visible;
  }

  .map-photo-filters-toggle {
    display: inline-flex;
  }

  .map-photo-filters-sheet {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-height: 14rem;
    margin-bottom: 0.35rem;
    overflow: auto;
  }

  .map-photo-filters.is-open .map-photo-filters-sheet {
    display: flex;
  }

  .map-photo-filters.is-open .map-photo-filter-short {
    display: none;
  }

  .map-photo-filters.is-open .map-photo-filter-name {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
  }

  .map-photo-filters.is-open .map-photo-filters-sheet .button {
    justify-content: flex-start;
    width: 100%;
    padding-inline: 0.65rem;
  }
}

.forecast-map-page .map-photo-filters[hidden],
.forecast-radar-stage .map-photo-filters[hidden] {
  display: none;
}

.map-photo-scrim {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgb(15 23 42 / 35%);
  pointer-events: auto;
}

.map-photo-card {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  display: flex;
  flex-direction: column;
  width: min(42rem, calc(100% - 1.5rem));
  max-height: calc(100% - 1rem);
  overflow: auto;
  padding: 0.5rem;
  border-radius: 0.75rem;
  background: var(--color-surface);
  box-shadow: 0 8px 24px rgb(15 23 42 / 28%);
  transform: translate(-50%, -50%);
}

.map-photo-dismiss {
  position: absolute;
  z-index: 2;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 92%);
  color: #111;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.map-photo-frame {
  position: relative;
}

.map-photo-frame img {
  display: block;
  width: 100%;
  max-height: min(70vh, 36rem);
  object-fit: contain;
  border-radius: 0.5rem;
  background: #0f172a;
}

.forecast-radar-stage .map-photo-card {
  width: min(16rem, calc(100% - 2rem));
}

.forecast-radar-stage .map-photo-frame img {
  max-height: 9rem;
}

.map-photo-nav {
  position: absolute;
  top: 0;
  width: 33.333%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: #111;
  cursor: pointer;
}

.map-photo-nav:focus-visible {
  outline: none;
}

.map-photo-nav-glyph {
  position: absolute;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 2.5rem;
  border-radius: 0.35rem;
  background: rgb(255 255 255 / 92%);
  font-size: 0.8rem;
  line-height: 1;
  transform: translateY(-50%);
  pointer-events: none;
}

.map-photo-nav:focus-visible .map-photo-nav-glyph {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.map-photo-prev {
  left: 0;
}

.map-photo-next {
  right: 0;
}

.map-photo-prev .map-photo-nav-glyph {
  left: 0.35rem;
}

.map-photo-next .map-photo-nav-glyph {
  right: 0.35rem;
}

.map-photo-label,
.map-photo-caption {
  margin: 0.4rem 0 0;
  color: var(--color-ink);
  font-size: 0.875rem;
}

.map-photo-caption {
  flex: none;
  max-height: 4.5em;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--color-muted);
}

.map-photo-visit {
  align-self: flex-start;
  margin-top: 0.5rem;
}

.forecast-radar-stage .map-photo-caption {
  max-height: 3.6em;
}

.forecast-radar-stage .map-photo-visit {
  align-self: stretch;
}
