/* M&M Plastering coverage map section + footer preview. Uses the site tokens
   from site.css (:root). Leaflet's own CSS is lazy-loaded by mm-map.js, so
   every Leaflet override below is scoped under .mmmap to win on specificity. */
.mmmap {
  --mm-shadow: 0 1px 0 var(--line), 0 22px 48px -30px rgb(20 37 59 / 0.42);
  --mm-r: 3px;
}
.mmmap-head {
  max-width: 760px;
}
.mmmap-head::before {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  margin-bottom: 22px;
  background: var(--gold);
}
.mmmap-head p {
  margin-top: 18px;
  max-width: 640px;
  font-size: 19px;
}
.mmmap-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 40px;
  margin-top: 40px;
  align-items: start;
}

/* ---------- map card ---------- */
.mmmap-card {
  margin: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--mm-r);
  box-shadow: var(--mm-shadow);
  padding: 8px;
  min-width: 0;
}
.mmmap-frame {
  position: relative;
  border-radius: 2px;
  overflow: hidden;
}
.mmmap-canvas {
  position: relative;
  height: clamp(380px, 36vw, 520px);
  background: var(--wash);
  isolation: isolate;
  z-index: 0;
}
.mmmap-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.mmmap-placeholder svg {
  width: min(78%, 420px);
  height: auto;
  opacity: 0.85;
}
.mmmap-live .mmmap-placeholder {
  opacity: 0;
}
.mmmap-loadnote {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  margin: 0;
  padding: 6px 10px;
  max-width: calc(100% - 24px);
  font-size: 14px;
  color: var(--body);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--mm-r);
}
.mmmap-hint {
  position: absolute;
  inset: 0;
  z-index: 1001;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: rgb(20 37 59 / 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.mmmap-hint.on {
  opacity: 1;
}
.mmmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  padding: 11px 6px 3px;
  list-style: none;
  font-size: 14px;
  color: var(--muted);
}
.mmmap-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mmmap-legend i {
  flex: none;
  display: inline-block;
}
.mmmap-key-area {
  width: 18px;
  height: 12px;
  border: 1.5px solid var(--brass);
  background: rgb(182 151 83 / 0.22);
  border-radius: 2px;
}
.mmmap-key-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 2px white, 0 0 0 3px var(--line);
}
.mmmap-key-pin {
  width: 12px;
  height: 15px;
  background: var(--gold);
  border: 1.5px solid var(--navy);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg) scale(0.85);
}

/* ---------- Leaflet overrides ---------- */
.mmmap .leaflet-container {
  font-family: var(--bodyface);
  background: var(--wash);
}
.mmmap .leaflet-container:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: -3px;
}
.mmmap.mmmap-tiles-carto .leaflet-tile-pane {
  filter: sepia(0.14) saturate(0.85);
}
/* OSM standard tiles softened to a light, warm-grey plaster basemap */
.mmmap.mmmap-tiles-osm .leaflet-tile-pane {
  filter: grayscale(1) sepia(0.2) brightness(1.07) contrast(0.82);
}
.mmmap .mmmap-area {
  fill: var(--gold);
  fill-opacity: 0.17;
  stroke: var(--brass);
  stroke-opacity: 0.8;
  stroke-linejoin: round;
}
.mmmap .mmmap-mk {
  background: none;
  border: 0;
}
.mmmap .mmmap-mk:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
  border-radius: 50%;
}
.mmmap-dot {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 2.5px white, 0 1px 4px 2px rgb(20 37 59 / 0.28);
  transition: transform 0.15s ease;
}
.mmmap .mmmap-mk:hover .mmmap-dot,
.mmmap .mmmap-mk:focus-visible .mmmap-dot {
  transform: scale(1.18);
}
.mmmap .mmmap-mk-on .mmmap-dot {
  box-shadow: 0 0 0 2.5px white, 0 0 0 6px var(--gold), 0 2px 8px 6px rgb(20 37 59 / 0.22);
}
.mmmap-mk-home svg {
  display: block;
  width: 36px;
  height: 46px;
  filter: drop-shadow(0 3px 3px rgb(20 37 59 / 0.3));
}
.mmmap .mmmap-mk-home.mmmap-mk-on svg {
  filter: drop-shadow(0 0 0 var(--gold)) drop-shadow(0 3px 3px rgb(20 37 59 / 0.3));
}
.mmmap .mmmap-mk-home.mmmap-mk-on::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 22px;
  height: 8px;
  margin-left: -11px;
  border-radius: 50%;
  border: 2.5px solid var(--gold);
  z-index: -1;
}
.mmmap .mmmap-label {
  padding: 2px 7px;
  font: 700 12.5px/1.35 var(--bodyface);
  color: var(--navy);
  background: rgb(251 248 243 / 0.92);
  border: 1px solid var(--line);
  border-radius: var(--mm-r);
  box-shadow: none;
}
.mmmap .mmmap-label::before {
  display: none;
}
.mmmap .mmmap-label.on {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.mmmap .mmmap-you {
  fill: var(--gold);
  fill-opacity: 1;
  stroke: var(--navy);
}
.mmmap .mmmap-you.out {
  fill: white;
}
.mmmap .leaflet-popup-content-wrapper {
  border-radius: var(--mm-r);
  box-shadow: 0 12px 30px -12px rgb(20 37 59 / 0.45);
  border-top: 2px solid var(--gold);
}
.mmmap .leaflet-popup-content {
  margin: 12px 30px 12px 14px;
  font: 470 15px/1.45 var(--bodyface);
}
.mmmap .leaflet-container a.leaflet-popup-close-button {
  width: 30px;
  height: 30px;
  font: 400 20px/30px var(--bodyface);
  color: var(--muted);
}
.mmmap-pop {
  display: grid;
  gap: 3px;
}
.mmmap-pop strong {
  font: 700 17px/1.2 var(--display);
  color: var(--navy);
}
.mmmap-pop span {
  font-size: 13px;
  color: var(--muted);
}
.mmmap .mmmap-pop a {
  margin-top: 4px;
  font-weight: 700;
  color: var(--brass);
}
.mmmap .mmmap-pop a:hover {
  text-decoration: underline;
}
.mmmap .leaflet-bar {
  border: 1px solid var(--line);
  border-radius: var(--mm-r);
  box-shadow: none;
}
.mmmap .leaflet-bar a {
  width: 34px;
  height: 34px;
  line-height: 32px;
  color: var(--navy);
  font-family: var(--bodyface);
}
.mmmap .leaflet-bar a:first-child {
  border-top-left-radius: var(--mm-r);
  border-top-right-radius: var(--mm-r);
}
.mmmap .leaflet-bar a:last-child {
  border-bottom-left-radius: var(--mm-r);
  border-bottom-right-radius: var(--mm-r);
}
.mmmap .leaflet-control-attribution {
  font: 11px/1.4 var(--bodyface);
  color: var(--muted);
  background: rgb(251 248 243 / 0.85);
}
.mmmap .leaflet-control-attribution a {
  color: var(--body);
}

/* ---------- side panel ---------- */
.mmmap-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  min-width: 0;
}
.mmmap-check {
  padding: 24px 24px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: var(--mm-r);
  box-shadow: var(--mm-shadow);
}
.mmmap-check h3 {
  font-size: 24px;
}
.mmmap-check label {
  display: block;
  margin-top: 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.mmmap-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.mmmap-row input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid var(--muted);
  border-radius: 2px;
  background: white;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mmmap-row input::placeholder {
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.mmmap-row input[aria-invalid="true"] {
  border-color: var(--brass);
  box-shadow: inset 0 0 0 1px var(--brass);
}
.mmmap-row .button {
  flex: none;
}
.mmmap-result {
  min-height: 3.1em;
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--body);
}
.mmmap-result:empty::before {
  content: "We’ll check it against the nine towns.";
  color: var(--muted);
}
.mmmap-result[data-tone="in"],
.mmmap-result[data-tone="out"] {
  padding-left: 12px;
  border-left: 2px solid var(--gold);
  color: var(--ink);
  font-weight: 700;
}
.mmmap-result[data-tone="out"] {
  border-left-color: var(--line);
}
.mmmap-result[data-tone="error"] {
  color: var(--brass);
}
.mmmap-result a {
  color: var(--brass);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.mmmap-result a:hover {
  color: var(--navy);
}
.mmmap-towns h3 {
  font: 700 15px/1.3 var(--bodyface);
  color: var(--muted);
  letter-spacing: 0;
}
.mmmap-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 0;
  list-style: none;
}
.mmmap-chips a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 13px;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--mm-r);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.mmmap-chips a::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--navy);
}
.mmmap-chips a.home::before {
  background: var(--gold);
  box-shadow: 0 0 0 1.5px var(--navy);
}
.mmmap-chips a:hover {
  border-color: var(--gold);
  color: var(--brass);
}
.mmmap-chips a[aria-current="page"] {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
  background: var(--wash);
}
.mmmap-gmaps {
  justify-self: start;
}
.mmmap-gmaps .icon {
  width: 20px;
  height: 20px;
}

/* ---------- footer preview (navy context) ---------- */
.mmfoot {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  color: #e3e8eb;
  font-size: 15px;
}
.mmfoot svg {
  width: 168px;
  height: auto;
  border: 1px solid rgb(226 199 122 / 0.35);
  border-radius: 3px;
  background: rgb(255 255 255 / 0.03);
  transition: border-color 0.15s ease;
}
.mmfoot .a {
  fill: var(--gold);
  fill-opacity: 0.2;
  stroke: var(--lightgold);
  stroke-width: 1.2;
  stroke-linejoin: round;
}
.mmfoot .d {
  fill: #e3e8eb;
}
.mmfoot .p {
  fill: var(--gold);
  stroke: var(--navy);
  stroke-width: 1;
}
.mmfoot span {
  font-weight: 700;
}
.mmfoot:hover svg {
  border-color: var(--lightgold);
}
.mmfoot:hover span {
  text-decoration: underline;
}
/* the same schematic inside the light map placeholder */
.mmmap-placeholder .a {
  fill: var(--gold);
  fill-opacity: 0.16;
  stroke: var(--brass);
  stroke-width: 1;
  stroke-linejoin: round;
}
.mmmap-placeholder .d {
  fill: var(--navy);
}
.mmmap-placeholder .p {
  fill: var(--gold);
  stroke: var(--navy);
  stroke-width: 1;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .mmmap-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 28px;
  }
}
@media (max-width: 860px) {
  .mmmap-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    margin-top: 26px;
  }
  .mmmap-canvas {
    height: 340px;
  }
}
@media (max-width: 740px) {
  .mmmap-head::before {
    margin-bottom: 16px;
  }
  .mmmap-head p {
    margin-top: 14px;
    font-size: 17px;
  }
  .mmmap-card {
    padding: 5px;
  }
  .mmmap-canvas {
    height: 320px;
  }
  .mmmap-legend {
    font-size: 13px;
    gap: 4px 14px;
  }
  .mmmap-check {
    padding: 20px 18px 18px;
  }
  .mmmap-check h3 {
    font-size: 22px;
  }
  .mmmap-side {
    gap: 24px;
  }
  .mmmap-gmaps {
    justify-self: stretch;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mmmap *,
  .mmfoot * {
    transition: none !important;
  }
}
