.settlement-map {
  --map-ink: #1c2a24;
  --map-muted: #68736d;
  --map-line: rgba(28, 42, 36, .16);
  --map-surface: #fff;
  --map-open: #258657;
  --map-closed: #9a5a52;
  position: relative;
  padding: 72px 0 88px;
  color: var(--map-ink);
  background: var(--color-white, #fff);
}

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

.settlement-map__inner {
  width: min(100% - 40px, 1506px);
  margin-inline: auto;
}

.settlement-map__heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  align-items: end;
  gap: 48px;
  margin-bottom: 32px;
}

.settlement-map__heading h1,
.settlement-map__heading h2 {
  max-width: 760px;
  margin: 3px 0 0;
  font-family: "Forum", Georgia, serif;
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.map-page {
  min-height: 100vh;
  background: var(--color-cream, #fff3ce);
}

body[data-map-hero-state="hidden"] .map-page {
  padding-top: 140px;
}

.map-page__content {
  padding-top: 72px;
}

.map-page__intro {
  display: grid;
  width: min(100% - 40px, 1506px);
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  align-items: end;
  gap: 48px;
  margin: 0 auto 32px;
}

.map-page__intro h1,
.map-page__intro h2 {
  max-width: 760px;
  margin: 3px 0 0;
  font-family: "Forum", Georgia, serif;
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.map-page__intro > p {
  margin: 0;
  color: var(--map-muted, #68736d);
  font-size: 17px;
  line-height: 1.55;
}

.map-page .settlement-map {
  min-height: 0;
  padding-top: 0;
  background: transparent;
}

.settlement-map__heading > p {
  margin: 0;
  color: var(--map-muted);
  font-size: 17px;
  line-height: 1.55;
}

.settlement-map__eyebrow {
  margin: 0;
  color: var(--color-orange, #e47e27);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.settlement-map__filter-tools {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.settlement-map__filter-toggle {
  display: inline-flex;
  min-width: 126px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  color: #fff;
  font-weight: 800;
  background: var(--color-olive, #50571a);
  border: 1px solid var(--color-olive, #50571a);
  border-radius: 4px;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.settlement-map__filter-toggle:hover,
.settlement-map__filter-toggle[aria-expanded="true"],
.settlement-map__filter-toggle.is-active {
  color: #fff;
  background: var(--color-orange, #e47e27);
  border-color: var(--color-orange, #e47e27);
}

.settlement-map__filter-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settlement-map__filter-count {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: var(--map-ink);
  font-size: 11px;
  line-height: 1;
  background: #fff;
  border-radius: 50%;
}

.settlement-map__filter-count[hidden],
.settlement-map__filters[hidden] {
  display: none;
}

.settlement-map__filters {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, 1.25fr) repeat(4, minmax(126px, 1fr)) minmax(100px, .7fr) minmax(190px, 1.25fr) 44px minmax(122px, .8fr);
  align-items: end;
  gap: 12px;
  padding: 16px;
  margin-bottom: 22px;
  background: var(--map-surface);
  border: 1px solid var(--map-line);
  border-radius: 6px;
}

.settlement-map__filter-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  font-weight: 800;
}

.settlement-map__filter-heading svg,
.settlement-map__filter-reset svg,
.settlement-map__zoom svg,
.map-popover__head button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settlement-map__filters label,
.settlement-map__price-filter {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.settlement-map__filters label > span,
.settlement-map__price-filter > span {
  overflow: hidden;
  color: var(--map-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.settlement-map__filters select,
.settlement-map__filters input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  color: var(--map-ink);
  background: #f8f8f4;
  border: 1px solid rgba(28, 42, 36, .18);
  border-radius: 4px;
  outline: none;
}

.settlement-map__filters select:focus,
.settlement-map__filters input:focus {
  border-color: var(--color-orange, #e47e27);
  box-shadow: 0 0 0 3px rgba(228, 126, 39, .13);
}

.settlement-map__price-filter > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.settlement-map__filter-reset,
.settlement-map__filter-apply,
.settlement-map__zoom button,
.map-popover__head button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--map-ink);
  background: #f8f8f4;
  border: 1px solid rgba(28, 42, 36, .18);
  border-radius: 4px;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.settlement-map__filter-apply {
  width: auto;
  min-width: 122px;
  padding: 0 16px;
  color: #fff;
  font-weight: 800;
  background: var(--color-olive, #50571a);
  border-color: var(--color-olive, #50571a);
}

.settlement-map__filter-reset:hover,
.settlement-map__filter-apply:hover,
.settlement-map__zoom button:hover,
.map-popover__head button:hover {
  color: #fff;
  background: var(--color-olive, #50571a);
  border-color: var(--color-olive, #50571a);
}

.settlement-map__canvas {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #7baf75;
  border: 1px solid rgba(28, 42, 36, .14);
  border-radius: 6px;
  box-shadow: 0 22px 60px rgba(31, 54, 42, .14);
}

.settlement-map__stage {
  width: min(100%, 900px);
  margin-inline: auto;
  aspect-ratio: 834.46 / 870.71;
  overflow: hidden;
}

.settlement-map__svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.settlement-map--zoomed .settlement-map__svg {
  cursor: grab;
}

.settlement-map__svg:active {
  cursor: grabbing;
}

.settlement-map__base,
.map-decoration,
.map-plot__house,
.map-object__icon {
  pointer-events: none;
}

.map-object__custom-icon {
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(18, 45, 31, .28));
}

.map-decoration {
  opacity: .94;
}

.map-plot,
.map-object {
  --map-accent: #2f7d5a;
  outline: none;
  transition: opacity .25s ease, filter .25s ease;
}

.map-plot__hit,
.map-object__hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 8;
  pointer-events: all;
  cursor: pointer;
}

.map-plot__halo,
.map-object__halo {
  fill: color-mix(in srgb, var(--map-accent) 10%, transparent);
  stroke: var(--map-accent);
  stroke-width: 4;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 3px var(--map-accent)) drop-shadow(0 0 8px var(--map-accent));
  transition: opacity .2s ease;
}

.map-plot__runner,
.map-object__runner {
  fill: none;
  stroke: #fff;
  stroke-width: 4.5;
  stroke-dasharray: 9 91;
  stroke-linecap: round;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 7px var(--map-accent));
}

.map-plot:hover .map-plot__halo,
.map-plot:focus .map-plot__halo,
.map-plot.is-selected .map-plot__halo,
.map-object:hover .map-object__halo,
.map-object:focus .map-object__halo,
.map-object.is-selected .map-object__halo,
.map-plot:hover .map-plot__runner,
.map-plot:focus .map-plot__runner,
.map-plot.is-selected .map-plot__runner,
.map-object:hover .map-object__runner,
.map-object:focus .map-object__runner,
.map-object.is-selected .map-object__runner {
  opacity: 1;
}

.map-plot:hover .map-plot__runner,
.map-plot:focus .map-plot__runner,
.map-plot.is-selected .map-plot__runner,
.map-object:hover .map-object__runner,
.map-object:focus .map-object__runner,
.map-object.is-selected .map-object__runner {
  animation: map-border-runner 2.2s linear infinite;
}

.map-plot__house-position {
  pointer-events: none;
}

.map-plot__house-float {
  transform-box: fill-box;
  transform-origin: center bottom;
}

.map-plot:hover .map-plot__house-float,
.map-plot:focus .map-plot__house-float,
.map-plot.is-selected .map-plot__house-float {
  animation: map-house-float 1.8s ease-in-out infinite;
}

.map-plot--closed .map-plot__house {
  opacity: .78;
  filter: saturate(.72);
}

.map-plot__number circle:first-child {
  fill: var(--map-accent);
  stroke: rgba(255, 255, 255, .82);
  stroke-width: 1.4;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .2));
}

.map-plot__number text {
  dominant-baseline: central;
  fill: #fff;
  font-family: "Mulish", Verdana, sans-serif;
  font-size: 9px;
  font-weight: 800;
  text-anchor: middle;
}

.map-plot__status-dot {
  fill: var(--map-open);
  stroke: #fff;
  stroke-width: 1.1;
}

.map-plot--closed .map-plot__status-dot {
  fill: var(--map-closed);
}

.map-plot__number {
  opacity: 1;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.settlement-map--numbers-hover .map-plot__number {
  opacity: 0;
}

.settlement-map--numbers-hover .map-plot:hover .map-plot__number,
.settlement-map--numbers-hover .map-plot:focus .map-plot__number,
.settlement-map--numbers-hover .map-plot.is-selected .map-plot__number {
  opacity: 1;
}

.map-plot.is-filtered-out {
  opacity: .14;
  filter: grayscale(.75);
}

.map-object {
  --map-accent: #f08b2e;
}

.map-object__visibility {
  fill: transparent;
  pointer-events: none;
  transition: fill .2s ease;
}

.map-object__name {
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.map-object:hover .map-object__name,
.map-object:focus .map-object__name,
.map-object.is-selected .map-object__name {
  opacity: 1;
}

.map-object__name rect {
  fill: rgba(31, 42, 36, .88);
}

.map-object__name text {
  dominant-baseline: central;
  fill: #fff;
  font-family: "Mulish", Verdana, sans-serif;
  font-size: 7.5px;
  font-weight: 700;
  text-anchor: middle;
}

.map-object--closed .map-object__icon {
  opacity: .78;
  filter: saturate(.72);
}

.map-object--visible .map-object__icon {
  opacity: 1;
  filter: none;
}

.map-object--visible .map-object__custom-icon {
  opacity: 1;
  filter: drop-shadow(0 2px 4px rgba(18, 45, 31, .28));
}

.map-object--muted .map-object__icon,
.map-object--muted .map-object__custom-icon {
  opacity: .42;
  filter: grayscale(.82) saturate(.18);
}

.map-object--muted .map-object__visibility {
  fill: rgba(82, 91, 85, .25);
}

.settlement-map__zoom {
  position: absolute;
  z-index: 8;
  top: 14px;
  right: 14px;
  display: grid;
  gap: 6px;
}

.settlement-map__zoom button {
  color: var(--map-ink);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 22px rgba(17, 39, 28, .14);
}

.settlement-map__result {
  position: absolute;
  z-index: 7;
  right: 14px;
  bottom: 14px;
  min-height: 34px;
  padding: 7px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: rgba(28, 42, 36, .82);
  border-radius: 4px;
  pointer-events: none;
}

.map-popover {
  position: absolute;
  z-index: 22;
  width: min(360px, calc(100% - 24px));
  max-height: min(620px, calc(100% - 24px));
  padding: 20px;
  overflow: hidden;
  color: var(--map-ink);
  background: #fff;
  border: 1px solid rgba(28, 42, 36, .14);
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(20, 38, 29, .3);
  opacity: 0;
  transform: translateY(7px);
  transition: opacity .2s ease, transform .2s ease;
}

.map-popover.is-open {
  opacity: 1;
  transform: translateY(0);
}

.map-popover-backdrop {
  position: absolute;
  z-index: 21;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(15, 27, 21, .08);
  border: 0;
}

.map-popover__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 34px;
  align-items: start;
  gap: 10px;
}

.map-popover__head h3 {
  margin: 1px 0 0;
  font-family: "Forum", Georgia, serif;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.map-popover__kicker {
  display: block;
  color: var(--map-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.map-popover__head button {
  width: 34px;
  height: 34px;
  color: var(--map-muted);
  background: transparent;
  border-color: rgba(28, 42, 36, .12);
}

.map-popover__status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  background: var(--map-closed);
  border-radius: 999px;
  text-transform: uppercase;
}

.map-popover__status--open {
  background: var(--map-open);
}

.map-popover__type {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 800;
}

.map-popover__type::before {
  width: 10px;
  height: 10px;
  background: var(--map-accent);
  border-radius: 2px;
  content: "";
}

.map-popover__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 16px;
  overflow: hidden;
  background: rgba(28, 42, 36, .09);
  border: 1px solid rgba(28, 42, 36, .09);
  border-radius: 4px;
}

.map-popover__fact {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 10px;
  background: #fff;
}

.map-popover__fact span {
  color: var(--map-muted);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
}

.map-popover__fact strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.3;
}

.map-popover__description {
  margin: 16px 0 0;
  color: #46524c;
  font-size: 14px;
  line-height: 1.55;
}

.map-popover__tariffs {
  margin-top: 17px;
}

.map-popover__tariffs h4 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.map-popover__tariff-list {
  display: grid;
  gap: 7px;
  max-height: 180px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.map-popover__tariff {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 11px;
  background: #f4f5ec;
  border-radius: 4px;
}

.map-popover__tariff > div,
.map-popover__tariff b {
  display: grid;
  min-width: 0;
}

.map-popover__tariff strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-popover__tariff span,
.map-popover__tariff small {
  color: var(--map-muted);
  font-size: 10px;
  font-weight: 600;
}

.map-popover__tariff b {
  color: var(--color-olive, #50571a);
  font-size: 14px;
  line-height: 1.2;
  text-align: right;
}

.settlement-map--preview {
  padding: 0;
  background: transparent;
}

.settlement-map--preview .settlement-map__canvas {
  box-shadow: none;
}

.settlement-map--preview .settlement-map__stage {
  width: 100%;
}

.settlement-map__error {
  width: min(100% - 40px, 900px);
  padding: 24px;
  margin: 0 auto;
  color: #fff;
  background: #81544d;
  border-radius: 6px;
}

@keyframes map-border-runner {
  to { stroke-dashoffset: -100; }
}

@keyframes map-house-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (max-width: 1280px) {
  .settlement-map__filters {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .settlement-map__filter-heading {
    grid-column: 1 / span 3;
  }

  .settlement-map__filter-reset {
    grid-column: 4;
    grid-row: 1;
    justify-self: end;
  }
}

@media (max-width: 1180px) {
  body[data-map-hero-state="hidden"] .map-page {
    padding-top: 88px;
  }
}

@media (max-width: 820px) {
  .settlement-map {
    padding: 52px 0 64px;
  }

  .settlement-map__inner {
    width: min(100% - 24px, 1506px);
  }

  .map-page__content {
    padding-top: 52px;
  }

  .map-page__intro {
    width: min(100% - 24px, 1506px);
    grid-template-columns: 1fr;
    gap: 13px;
    margin-bottom: 24px;
  }

  .map-page__intro h1,
  .map-page__intro h2 {
    font-size: 42px;
  }

  .map-page__intro > p {
    font-size: 15px;
  }

  .settlement-map__heading {
    grid-template-columns: 1fr;
    gap: 13px;
    margin-bottom: 24px;
  }

  .settlement-map__heading h1,
  .settlement-map__heading h2 {
    font-size: 42px;
  }

  .settlement-map__heading > p {
    font-size: 15px;
  }

  .settlement-map__filters {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
  }

  .settlement-map__filter-heading {
    grid-column: 1 / -1;
  }

  .settlement-map__price-filter {
    grid-column: 1 / -1;
  }

  .settlement-map__filter-apply {
    grid-column: 1 / -1;
  }

  .settlement-map__filter-reset {
    position: absolute;
    right: 25px;
    margin-top: 0;
  }

  .settlement-map__zoom {
    top: 8px;
    right: 8px;
  }

  .settlement-map__zoom button {
    width: 38px;
    height: 38px;
  }

  .settlement-map__result {
    right: 8px;
    bottom: 8px;
  }

  .map-popover-backdrop {
    position: fixed;
    display: block;
    background: rgba(14, 27, 20, .42);
    opacity: 0;
    transition: opacity .2s ease;
  }

  .map-popover-backdrop.is-open {
    opacity: 1;
  }

  .map-popover {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0 !important;
    top: auto !important;
    width: 100%;
    max-height: min(74vh, 650px);
    padding: 18px 18px max(18px, env(safe-area-inset-bottom));
    overflow-y: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 6px 6px 0 0;
    transform: translateY(18px);
  }

  .map-popover.is-open {
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  body[data-map-hero-state="hidden"] .map-page {
    padding-top: 74px;
  }
}

@media (max-width: 520px) {
  .map-page__intro h1,
  .map-page__intro h2,
  .settlement-map__heading h1,
  .settlement-map__heading h2 {
    font-size: 36px;
  }

  .settlement-map__filters {
    grid-template-columns: 1fr;
  }

  .settlement-map__filter-heading,
  .settlement-map__price-filter,
  .settlement-map__filter-apply {
    grid-column: 1;
  }

  .settlement-map__filter-reset {
    right: 23px;
  }

  .settlement-map__filters label:nth-of-type(1) {
    margin-top: 3px;
  }

  .map-popover__facts {
    grid-template-columns: 1fr 1fr;
  }

  .map-popover__head h3 {
    font-size: 27px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-plot__runner,
  .map-object__runner,
  .map-plot__house-float,
  .map-popover,
  .map-popover-backdrop {
    animation: none !important;
    transition: none !important;
  }
}
