/* Блок «158 городов России свободно»: объёмная карта свободных городов (27.10.2026).
   Разметку и SVG собирает scripts/map_build.py, поведение — js/goroda-map.js.
   Цвета сайта: тёмно-синий #093573, синий #2f73c0, рамки #4C7ABE, карта #c0d4ec, красный #cd3135. */

.gm {
  margin-top: 40px;
  color: #093573;
  font-family: "LetoSans", sans-serif;
}

.gm-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Цифры */
.gm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.gm-stat {
  border: 2px solid #4C7ABE;
  border-radius: 20px;
  padding: 18px 22px 16px;
  background: #fff;
}

.gm-stat b {
  display: block;
  font-family: "LetoSans-Bold", sans-serif;
  font-weight: normal;
  font-size: 44px;
  line-height: 46px;
  color: #093573;
}

.gm-stat span {
  display: block;
  padding-top: 6px;
  font-size: 15px;
  line-height: 20px;
  color: #2f73c0;
}

/* Поиск и фильтр */
.gm-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  margin-top: 34px;
}

.gm-search input {
  width: 300px;
  height: 46px;
  padding: 0 20px 0 46px;
  border: 2px solid #4C7ABE;
  border-radius: 50px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23093573' stroke-width='2'%3E%3Ccircle cx='7.5' cy='7.5' r='6'/%3E%3Cpath d='M12 12l5 5'/%3E%3C/svg%3E") no-repeat 18px center;
  font-family: "LetoSans", sans-serif;
  font-size: 16px;
  color: #093573;
  outline: none;
  -webkit-appearance: none;
}

.gm-search input:focus {
  border-color: #093573;
  box-shadow: 0 0 0 4px rgba(47, 115, 192, 0.15);
}

.gm-search input::placeholder {
  color: #6f8db5;
}

.gm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gm-chip {
  height: 40px;
  padding: 0 16px;
  border: 1px solid #c0d4ec;
  border-radius: 50px;
  background: #fff;
  font-family: "LetoSans", sans-serif;
  font-size: 14px;
  color: #093573;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.gm-chip b {
  font-family: "LetoSans-Bold", sans-serif;
  font-weight: normal;
  color: #2f73c0;
  padding-left: 4px;
}

.gm-chip:hover {
  border-color: #4C7ABE;
}

.gm-chip.is-active {
  background: #093573;
  border-color: #093573;
  color: #fff;
}

.gm-chip.is-active b {
  color: #fff;
}

.gm-chip:focus-visible,
.gm-cta__btn:focus-visible,
.gm-card__btn:focus-visible,
.gm-card__close:focus-visible {
  outline: 3px solid #2f73c0;
  outline-offset: 2px;
}

/* Сцена и карта */
.gm-stage {
  position: relative;
  margin-top: 18px;
  perspective: 1600px;
}

.gm-map {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gm-ripples {
  fill: #c0d4ec;
  opacity: 0.7;
}

.gm-shadow {
  fill: #093573;
  opacity: 0.16;
}

.gm-side {
  fill: url(#gmSide);
}

.gm-top {
  fill: url(#gmTop);
}

.gm-grid {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.2;
  opacity: 0.9;
}

.gm-edge {
  fill: none;
  stroke: #8fb1dd;
  stroke-width: 1.2;
}

.gm-halo {
  pointer-events: none;
}

/* Города */
.gm-city {
  cursor: pointer;
  transition: opacity 0.35s;
}

.gm-base {
  fill: #2f73c0;
  opacity: 0.35;
}

.gm-st-busy .gm-base {
  fill: none;
  stroke: #6e7f99;
  stroke-width: 1.6;
  opacity: 1;
}

.gm-st-center .gm-base {
  fill: #cd3135;
  opacity: 0.45;
}

.gm-cap {
  fill: #ffffff;
  stroke: #2f73c0;
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s;
}

.gm-st-center .gm-cap {
  stroke: #cd3135;
  stroke-width: 2.6;
}

.gm-hit {
  stroke: transparent;
  stroke-width: 22;
  stroke-linecap: round;
  fill: none;
  pointer-events: stroke;
}

.gm-col {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: filter 0.25s;
}

.gm-city.is-hot .gm-col {
  filter: brightness(1.25) saturate(1.2);
}

.gm-city.is-hot .gm-cap {
  transform: scale(1.7);
}

.gm-city.is-hot .gm-base {
  opacity: 0.8;
}

.gm-pulse {
  fill: none;
  stroke: #cd3135;
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: gm-pulse 2.6s ease-out infinite;
}

@keyframes gm-pulse {
  from {
    transform: scale(0.4);
    opacity: 0.9;
  }
  to {
    transform: scale(3.2);
    opacity: 0;
  }
}

/* Подписи миллионников */
.gm-label {
  font-family: "LetoSans-Bold", sans-serif;
  fill: #093573;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
  transition: opacity 0.35s;
}

.gm-label-busy {
  fill: #6e7f99;
}

.gm-label-center {
  fill: #cd3135;
}

/* Фильтр по размеру */
.gm[data-filter="mil"] .gm-city:not(.gm-s-mil),
.gm[data-filter="k500"] .gm-city:not(.gm-s-k500),
.gm[data-filter="k300"] .gm-city:not(.gm-s-k300),
.gm[data-filter="k100"] .gm-city:not(.gm-s-k100) {
  opacity: 0.1;
}

.gm[data-filter]:not([data-filter="all"]):not([data-filter="mil"]) .gm-label:not(.gm-label-center) {
  opacity: 0;
}

.gm-city.is-hot {
  opacity: 1 !important;
}

/* Появление: столбики растут волной от Казани. Класс gm-anim ставит скрипт, без него всё видно сразу. */
.gm.gm-anim .gm-col {
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d), filter 0.25s;
}

.gm.gm-anim .gm-cap {
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d), opacity 0.4s var(--d);
}

.gm.gm-anim:not(.is-visible) .gm-col {
  transform: scaleY(0);
}

.gm.gm-anim:not(.is-visible) .gm-cap {
  transform: translateY(var(--h));
  opacity: 0;
}

.gm.gm-anim:not(.is-visible) .gm-label {
  opacity: 0;
}

.gm.gm-anim .gm-label {
  transition: opacity 0.6s 1.2s;
}

/* Карточка города */
.gm-card {
  position: absolute;
  z-index: 5;
  width: 300px;
  padding: 20px 22px 18px;
  border: 2px solid #4C7ABE;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(9, 53, 115, 0.18);
  text-align: left;
}

.gm-card[hidden] {
  display: none;
}

.gm-card__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  background: none;
  font-size: 24px;
  line-height: 30px;
  color: #6f8db5;
  cursor: pointer;
}

.gm-card__name {
  padding-right: 24px;
  font-family: "LetoSans-Bold", sans-serif;
  font-size: 22px;
  line-height: 26px;
  color: #093573;
}

.gm-card__region {
  padding-top: 2px;
  font-size: 14px;
  line-height: 19px;
  color: #6f8db5;
}

.gm-card__facts {
  margin: 12px 0 14px;
  padding: 0;
}

.gm-card__facts li {
  position: relative;
  padding: 4px 0 4px 18px;
  font-size: 15px;
  line-height: 20px;
  color: #093573;
}

.gm-card__facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f73c0;
}

.gm-card__facts li.is-busy::before {
  background: none;
  border: 2px solid #6e7f99;
  width: 4px;
  height: 4px;
}

.gm-card__facts li.is-center::before {
  background: #cd3135;
}

.gm-card__facts b {
  font-family: "LetoSans-Bold", sans-serif;
  font-weight: normal;
}

.gm-card__btn {
  display: block;
  width: 100%;
  padding: 12px 10px 10px;
  border: 0;
  border-radius: 50px;
  background: #BC3F3C;
  font-family: "LetoSans-Bold", sans-serif;
  font-size: 13px;
  letter-spacing: 0.16px;
  text-transform: uppercase;
  color: #ffffff;
  cursor: pointer;
}

.gm-card__btn:hover {
  background: #d30037;
}

.gm-card__link {
  display: block;
  padding-top: 10px;
  text-align: center;
  font-size: 14px;
  color: #2f73c0;
  text-decoration: underline;
}

/* Легенда и кнопки */
.gm-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  margin: 6px 0 0;
  padding: 0;
  font-size: 14px;
  line-height: 20px;
  color: #093573;
}

.gm-key {
  display: inline-block;
  vertical-align: -2px;
  margin-right: 8px;
}

.gm-key-free {
  width: 6px;
  height: 18px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, rgba(47, 115, 192, 0.15), #3d8bdf);
  box-shadow: 0 -3px 0 -1px #fff, 0 -4px 0 0 #2f73c0;
}

.gm-key-busy {
  width: 12px;
  height: 7px;
  border: 2px solid #6e7f99;
  border-radius: 50%;
}

.gm-key-center {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cd3135;
  box-shadow: 0 0 0 4px rgba(205, 49, 53, 0.2);
}

.gm-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px 30px;
  margin-top: 34px;
}

.gm-cta__btn {
  border: 0;
  font-size: 14px;
  line-height: 24px;
  color: #ffffff;
  cursor: pointer;
}

.gm-cta__link {
  font-family: "LetoSans-Bold", sans-serif;
  font-size: 15px;
  color: #093573;
  text-decoration: underline;
}

@media screen and (max-width: 1199px) {
  .gm-stat b {
    font-size: 38px;
    line-height: 40px;
  }
}

@media screen and (max-width: 991px) {
  .gm-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .gm-label {
    display: none;
  }
}

/* На телефоне карта шире экрана и листается пальцем; подписи только у ключевых городов, крупнее */

@media screen and (max-width: 767px) {
  .gm {
    margin-top: 24px;
  }
  .gm-stats {
    gap: 10px;
  }
  .gm-stat {
    padding: 12px 14px;
    border-radius: 14px;
  }
  .gm-stat b {
    font-size: 30px;
    line-height: 32px;
  }
  .gm-stat span {
    font-size: 13px;
    line-height: 17px;
  }
  .gm-controls {
    margin-top: 20px;
  }
  .gm-search,
  .gm-search input {
    width: 100%;
  }
  .gm-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .gm-chip {
    flex: 0 0 auto;
  }
  .gm-map {
    transform: none;
    width: 760px;
    max-width: none;
  }
  .gm-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 -15px;
    padding: 0 15px 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .gm-scroll::-webkit-scrollbar,
  .gm-chips::-webkit-scrollbar {
    display: none;
  }
  .gm-chips {
    scrollbar-width: none;
  }
  .gm-label-key {
    display: block;
    font-size: 21px;
    stroke-width: 6px;
  }
  .gm-stage::after {
    content: "← листайте карту →";
    display: block;
    padding-top: 6px;
    text-align: center;
    font-size: 13px;
    color: #6f8db5;
  }
  .gm-card {
    position: static;
    width: auto;
    margin-top: 10px;
  }
  .gm-legend {
    justify-content: flex-start;
    flex-direction: column;
  }
  .gm-cta {
    flex-direction: column;
  }
  .gm-cta__btn {
    padding-left: 30px;
    padding-right: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gm-pulse {
    animation: none;
    opacity: 0;
  }
  .gm-map {
    transition: none;
    transform: none;
  }
}
