/*
 * maps.css — DNR Engineering and Surveying, LLC
 * Self-contained styles for the two Leaflet maps. Falls back to literal brand
 * colours if the design-system tokens in styles.css are ever renamed.
 */

.dnr-map {
  position: relative;
  border: 1px solid var(--c-border, #d9dee6);
  border-radius: var(--radius, 10px);
  overflow: hidden;
  background: var(--c-surface-2, #f2f2f2);
}

.dnr-map__canvas {
  width: 100%;
  height: clamp(18rem, 44vw, 30rem);
  background: var(--c-surface-2, #f2f2f2);
}

.dnr-map--office .dnr-map__canvas {
  height: clamp(15rem, 34vw, 22rem);
}

/* The in-markup fallback: visible until a map actually renders over it, and
   permanently visible if JS is unavailable or the data fails to load. */
.dnr-map__fallback {
  padding: var(--space-4, 1.25rem);
}

.dnr-map__fallback.is-replaced {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.dnr-map__note {
  display: block;
  margin-top: 0.35em;
  font-size: 0.8125rem;
  color: var(--c-text-muted, #55585c);
}

.dnr-map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: var(--space-3, 0.875rem) var(--space-4, 1.25rem);
  border-top: 1px solid var(--c-border, #d9dee6);
  background: var(--c-surface, #fff);
  font-size: 0.875rem;
  color: var(--c-text, #2b2d2f);
}

.dnr-map__key {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.dnr-map__swatch {
  width: 1rem;
  height: 1rem;
  flex: none;
  border: 1px solid #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.18);
}

.dnr-map__swatch--focus { background: #e87722; }
.dnr-map__swatch--rest  { background: color-mix(in srgb, #1b365d 16%, #fff); }

/* Leaflet overrides ------------------------------------------------------ */

.dnr-map .leaflet-container {
  font: inherit;
  background: var(--c-surface-2, #f2f2f2);
}

/* Leaflet's default focus ring is invisible against our palette. */
.dnr-map .leaflet-interactive:focus-visible,
.dnr-map .leaflet-container a:focus-visible {
  outline: 3px solid var(--c-focus, #1b365d);
  outline-offset: 2px;
}

.dnr-map .leaflet-control-attribution {
  background: rgb(255 255 255 / 0.88);
  font-size: 0.6875rem;
  color: #55585c;
}

.dnr-map .leaflet-control-attribution a { color: #1b365d; }

.dnr-map .leaflet-bar a {
  color: #1b365d;
  border-bottom-color: #d9dee6;
}

.dnr-map .leaflet-tooltip {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: #1b365d;
  border: 0;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
}

.dnr-map .leaflet-tooltip-top::before  { border-top-color: #1b365d; }
.dnr-map .leaflet-tooltip-bottom::before { border-bottom-color: #1b365d; }
.dnr-map .leaflet-tooltip-left::before { border-left-color: #1b365d; }
.dnr-map .leaflet-tooltip-right::before { border-right-color: #1b365d; }

@media (prefers-reduced-motion: reduce) {
  .dnr-map .leaflet-fade-anim .leaflet-tile,
  .dnr-map .leaflet-zoom-anim .leaflet-zoom-animated {
    transition: none !important;
  }
}

/* A printed page should show the address, not a blank grey rectangle. */
@media print {
  .dnr-map__canvas { display: none; }
  .dnr-map__fallback.is-replaced {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: var(--space-4, 1.25rem);
    clip-path: none;
    white-space: normal;
  }
}
