:root {
  --blue: #0c5cc0;
  --blue-dark: #094a9a;
  --ink: #1a1f2e;
  --muted: #5a6478;
  --line: #d8dee9;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ok: #1a7f4b;
  --warn: #9a6b00;
  --radius: 10px;
  --font: "Roboto", system-ui, sans-serif;
  --max: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--blue-dark);
}

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  color: var(--blue);
}

.nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--blue);
}

.hero {
  padding: 2rem 0 1.25rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.25;
  font-weight: 500;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}

.page-404 {
  padding-block: 3.5rem 4rem;
}

.page-404__code {
  margin: 0 0 0.35rem;
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 500;
  line-height: 1;
  color: color-mix(in srgb, var(--blue) 45%, var(--line));
  letter-spacing: 0.04em;
}

.page-404 .actions {
  margin-top: 1.35rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel + .panel {
  margin-top: 1rem;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 500;
}

.panel h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 500;
}

.map-shell {
  height: min(70vh, 560px);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e8eef8;
}

.map-fd-zoom {
  margin-top: 0.55rem;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.map-fd-zoom:hover {
  background: var(--blue-dark);
}

.map-shell--region {
  position: relative;
  height: min(78vh, 720px);
  margin-bottom: 1rem;
}

.map-shell--region iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #e8eef8;
}

.search-box {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.search-box input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.search-box input:focus {
  outline: 2px solid color-mix(in srgb, var(--blue) 35%, white);
  border-color: var(--blue);
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.region-grid a {
  display: block;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
}

.region-grid a:hover {
  border-color: var(--blue);
}

.region-grid .meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  background: #e8f0fc;
  color: var(--blue-dark);
}

.badge--map {
  background: #e5f6ec;
  color: var(--ok);
}

.badge--dir {
  background: #fff4d6;
  color: var(--warn);
}

.badge--trans {
  background: #eee8ff;
  color: #4b3f8a;
}

.crumbs {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 1rem 0;
}

.crumbs a {
  color: var(--muted);
}

.prose p {
  margin: 0 0 0.85rem;
}

.kv {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.kv div {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) 1fr;
  gap: 0.5rem;
}

.kv dt {
  color: var(--muted);
  margin: 0;
}

.kv dd {
  margin: 0;
}

.cta-form {
  display: grid;
  gap: 0.75rem;
  max-width: 32rem;
}

.cta-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.92rem;
}

.cta-form input,
.cta-form textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.cta-form .hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 1.1rem;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--blue-dark);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--line);
}

.btn--ghost:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.examples a {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
}

.disclaimer {
  font-size: 0.88rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
  padding-top: 0.85rem;
}

.site-footer {
  margin-top: 2.5rem;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--muted);
}

.alpha-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0 1rem;
}

.alpha-jump a {
  min-width: 1.6rem;
  text-align: center;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-size: 0.85rem;
}

.fd-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fd-list > li {
  margin-bottom: 1.25rem;
}

.fd-list h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.form-status {
  min-height: 1.25rem;
  font-size: 0.9rem;
}

.form-status.is-ok {
  color: var(--ok);
}

.form-status.is-err {
  color: #b42318;
}

@media (max-width: 640px) {
  .kv div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* —— Map app shell (Yandex / 2GIS-like) —— */
body.map-app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #dce6f4;
}

body.map-app .map-app__main {
  height: 100%;
  margin: 0;
  padding: 0;
}

.map-app__shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.map-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #e8eef8;
}

.map-stage--region #adesMap,
.map-stage #adesMap {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

.map-bar {
  position: absolute;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  box-shadow: 0 1px 8px rgba(26, 31, 46, 0.08);
  font-size: 0.88rem;
  color: var(--muted);
}

.map-bar--top {
  top: 0.75rem;
  left: 0.75rem;
  right: auto;
  width: min(360px, calc(100% - 5.5rem));
  border-radius: 10px;
  min-height: 2.6rem;
}

.map-bar--top .brand {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.map-bar__context {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-bar__link {
  margin-left: auto;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
}

.map-bar__link:hover {
  color: var(--blue-dark);
}

.map-bar__toggle {
  margin-left: auto;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.map-bar__toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.map-bar--top .map-bar__link + .map-bar__toggle {
  margin-left: 0;
}

.map-bar--bottom {
  left: 0.75rem;
  right: auto;
  bottom: 0.75rem;
  width: min(360px, calc(100% - 1.5rem));
  border-radius: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.map-bar__status {
  color: var(--ink);
  font-weight: 500;
}

.map-bar__meta {
  color: var(--muted);
}

.map-bar__disclaimer {
  color: var(--muted);
}

.map-bar__disclaimer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.map-bar__disclaimer a:hover {
  color: var(--ink);
}

.map-panel {
  position: absolute;
  z-index: 25;
  top: 4rem;
  left: 0.75rem;
  bottom: 3.5rem;
  width: min(360px, calc(100% - 1.5rem));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(26, 31, 46, 0.12);
  overflow: hidden;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body.map-app--panel-collapsed .map-panel {
  transform: translateX(calc(-100% - 1rem));
  opacity: 0;
  pointer-events: none;
}

.map-panel__head {
  flex-shrink: 0;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.map-panel__title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.3;
}

.map-panel__lead {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.map-panel__head .badge {
  margin-bottom: 0.35rem;
}

.search-box--panel {
  margin: 0 0 0.65rem;
}

.search-box--panel input {
  width: 100%;
}

.map-tabs {
  display: flex;
  gap: 0.35rem;
}

.map-tabs__btn {
  flex: 1;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.map-tabs__btn.is-active {
  background: color-mix(in srgb, var(--blue) 12%, white);
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  color: var(--blue-dark);
  font-weight: 500;
}

.map-panel__body {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1rem 1rem;
  -webkit-overflow-scrolling: touch;
}

.map-panel__h {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.map-panel__section + .map-panel__section {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.map-panel__letter h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.map-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.map-list li + li {
  margin-top: 0.35rem;
}

.map-list a {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid transparent;
}

.map-list a:hover {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 6%, white);
}

.map-list .meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.alpha-jump--panel {
  margin: 0 0 0.65rem;
}

.map-panel .panel {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.map-panel .panel + .panel {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

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

.map-panel .disclaimer {
  margin-top: 1rem;
  padding-top: 0.75rem;
}

body.map-app--filter-map #regions {
  display: none;
}

@media (max-width: 768px) {
  .map-bar--top,
  .map-bar--bottom {
    top: auto;
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
  }

  .map-bar--top {
    top: 0.5rem;
  }

  .map-bar--bottom {
    bottom: 0.5rem;
  }

  .map-bar__context {
    display: none;
  }

  .map-panel {
    top: auto;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 3.25rem;
    width: auto;
    max-height: min(48vh, 420px);
    border-radius: 12px 12px 10px 10px;
  }

  body.map-app--panel-collapsed .map-panel {
    transform: translateY(calc(100% + 1.5rem));
  }

  .map-bar--bottom .map-bar__meta {
    display: none;
  }
}
