/* Переменные и шрифты */
@font-face {
  font-family: Inter;
  src: url("fonts/inter-cyrillic-ext.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: Inter;
  src: url("fonts/inter-cyrillic.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: Inter;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: Inter;
  src: url("fonts/inter-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --page: #0a0a0a;
  --panel: #141414;
  --raised: #1a1a1a;
  --border: #262626;
  --border-hover: #525252;
  --text: #fff;
  --muted: #a1a1aa;
  --badge: rgb(255 255 255 / 8%);
  --badge-text: #e4e4e7;
  --radius: 8px;
  --control-radius: 6px;
  --motion: 200ms cubic-bezier(.4, 0, .2, 1);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

/* База и клавиатурный фокус */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
}

h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; line-height: 1.25; }
h3 { font-size: 1rem; line-height: 1.35; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible,
.leaflet-container :where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

[data-icon] {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button svg, .button svg, [data-icon] svg {
  display: block;
  flex: none;
  width: 18px;
  height: 18px;
}

/* Лейаут и шапка */
.shell {
  width: min(1360px, calc(100% - 80px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgb(10 10 10 / 70%);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: 1;
}

.wordmark-dot { color: var(--muted); }

.brand-mark {
  width: 32px;
  height: 32px;
  border: 1px solid #404040;
  border-radius: var(--control-radius);
  color: var(--text);
  background: var(--panel);
}

.brand-mark svg { width: 23px; height: 23px; }

.navigation {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  gap: 24px;
}

.navigation a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.navigation a[aria-current="page"] { color: var(--text); }

.navigation a[aria-current="page"]::after {
  position: absolute;
  content: "";
  height: 1px;
  inset: auto 0 -1px;
  background: var(--text);
}

.navigation svg, .header-geo svg { width: 16px; height: 16px; }
.nav-count { padding: 0 4px; border-radius: 4px; color: var(--badge-text); background: var(--badge); font-size: .75rem; }

.header-context {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-geo {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: .875rem;
  white-space: nowrap;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
  padding-block: 48px 32px;
}

.intro h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.intro h1 span { color: var(--muted); }
.intro p { max-width: 52ch; margin-top: 12px; color: var(--muted); }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.metrics > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;
  gap: 4px;
  min-width: 126px;
  padding: 12px 16px;
}

.metrics > div + div { border-left: 1px solid var(--border); }
.metrics dt { color: var(--muted); font-size: .8125rem; white-space: nowrap; }

.metrics dd {
  color: var(--text);
  font-size: clamp(1.75rem, 3vw, 2.125rem);
  font-weight: 650;
  line-height: 1.16;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.work-layout {
  display: grid;
  grid-template-columns: minmax(420px, .88fr) minmax(0, 1.12fr);
  align-items: start;
  gap: 16px;
}

.work-layout.map-hidden { grid-template-columns: 1fr; }
.catalog-panel, .map-panel { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }

.section-heading, .map-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
}

.section-heading p, .map-top h2 { margin-bottom: 2px; }
.section-heading p { margin-top: 4px; }
.quiet, .section-heading p { color: var(--muted); font-size: .8125rem; }

/* Компоненты · кнопки, формы и фильтры */
.button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary { color: #000; background: var(--text); }
.button.secondary, .icon-button { border-color: var(--border); color: var(--text); background: transparent; }
.button.small { min-height: 36px; padding: 8px; font-size: .8125rem; }
.button.small svg { width: 16px; height: 16px; }
.icon-button { flex: none; width: 36px; height: 36px; min-height: 0; padding: 0; }

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: .8125rem;
  font-weight: 550;
  text-underline-offset: 3px;
}

#filters { display: grid; gap: 12px; padding: 0 20px 12px; }

.query-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  color: var(--muted);
  background: var(--page);
}

.query-field:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 1px; }

.query-field input {
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: .9375rem;
}

.query-field input:focus-visible { outline: none; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

kbd {
  padding: 0 4px;
  min-width: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  font-size: .75rem;
  text-align: center;
}

.filter-selects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.filter-selects label, .form-grid label, .status-control, .account-dialog label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 550;
}

select,
.form-grid input,
.account-dialog input,
.pitch-output {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  color: var(--text);
  background: var(--page);
  font-size: .875rem;
}

select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23A1A1AA' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  text-overflow: ellipsis;
}

select option { color: var(--text); background: var(--page); }

@supports (appearance: base-select) and selector(::picker(select)) {
  select, select::picker(select) { appearance: base-select; }
  select { padding-right: 12px; background-image: none; }
  select::picker-icon { color: var(--muted); }
  select::picker(select) {
    max-block-size: min(320px, 55dvh);
    margin-block: 4px;
    padding: 4px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--page);
  }
  select option {
    min-block-size: 36px;
    padding: 8px;
    border-radius: 4px;
    overflow-wrap: anywhere;
  }
  select option:checked, select option:focus-visible { background: var(--raised); }
}

.filter-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-height: 36px; }

.switch-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: .875rem;
  font-weight: 550;
  cursor: pointer;
}

.switch-label input { position: absolute; opacity: 0; }

.switch {
  display: flex;
  align-items: center;
  width: 36px;
  height: 20px;
  padding: 2px;
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  background: var(--page);
}

.switch::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
}

.switch-label input:checked + .switch { border-color: var(--text); background: var(--text); }
.switch-label input:checked + .switch::before { background: #000; transform: translateX(16px); }
.switch-label input:focus-visible + .switch { outline: 2px solid var(--text); outline-offset: 1px; }
#reset-filters { margin-left: auto; }
#status-filter { width: auto; min-height: 36px; margin-left: auto; }

/* Компоненты · результаты и пустые состояния */
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding-inline: 20px;
  border-block: 1px solid var(--border);
  background: var(--page);
}

.sort-control { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.sort-control svg { width: 15px; height: 15px; }
.sort-control select { min-height: 36px; padding-left: 4px; border: 0; background-color: transparent; font-size: .8125rem; }
.results-stage { position: relative; isolation: isolate; }

.results {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  list-style: none;
}

.results:empty { padding: 0; }
.results-ghost { position: absolute; inset: 0 0 auto; z-index: 1; pointer-events: none; }

.result-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-inline: 12px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  scroll-margin-top: 80px;
}

.result-row:focus-within { border-color: var(--border-hover); }
.result-row.is-highlighted { border-color: var(--muted); background: var(--raised); }

.lead-open {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 8px 0;
  border: 0;
  border-radius: var(--control-radius);
  color: inherit;
  background: transparent;
  text-align: left;
}

.category-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  color: var(--muted);
  background: var(--raised);
}

.lead-text { min-width: 0; overflow: hidden; }
.lead-name, .lead-meta, .lead-address { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-name { color: var(--text); font-size: .9375rem; font-weight: 650; line-height: 1.3; }
.lead-meta, .lead-address { margin-top: 2px; color: var(--muted); font-size: .8125rem; line-height: 1.3; }
.lead-info { display: grid; justify-items: end; gap: 4px; }

.score, .site-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--badge-text);
  background: var(--badge);
  white-space: nowrap;
}

.score { min-width: 32px; padding: 2px 4px; font-weight: 650; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.site-tag { padding: 2px 4px; font-size: .6875rem; }
.bookmark { border-color: transparent; color: var(--muted); }
.bookmark[aria-pressed="true"] { color: var(--text); }
.bookmark[aria-pressed="true"] svg { fill: rgb(255 255 255 / 20%); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .875rem;
}

.empty { display: grid; justify-items: center; gap: 12px; padding: 40px 20px; text-align: center; }
.empty p { max-width: 36ch; color: var(--muted); font-size: .9375rem; }

.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-hover);
  border-radius: 50%;
  color: var(--text);
  background: var(--raised);
}

/* Компоненты · Leaflet и тёмная подложка */
.map-panel { position: sticky; top: 80px; overflow: hidden; scroll-margin-top: 72px; }

.map {
  position: relative;
  isolation: isolate;
  height: clamp(440px, 54vh, 600px);
  overflow: hidden;
  border-block: 1px solid var(--border);
  color: var(--text);
  background: var(--page);
}

.offline-map { position: absolute; pointer-events: none; }
.leaflet-container { background: #0a0a0a; font-family: inherit; }
.leaflet-container .leaflet-tile-pane { filter: grayscale(1); }
.leaflet-container a { color: var(--text); }
.leaflet-container .leaflet-control-attribution { color: var(--muted); background: rgb(10 10 10 / 92%); }
.leaflet-control-attribution a { text-decoration: underline; }

.leaflet-container .leaflet-bar,
.leaflet-container .leaflet-control-layers {
  border: 1px solid var(--border-hover);
  border-radius: var(--control-radius);
  color: var(--text);
  background: var(--panel);
  box-shadow: none;
}

.leaflet-container .leaflet-bar a,
.leaflet-container .leaflet-bar a.leaflet-disabled {
  border-color: var(--border);
  color: var(--text);
  background: var(--panel);
}

.leaflet-container .leaflet-bar a.leaflet-disabled { color: var(--muted); }
.leaflet-container .leaflet-control-layers-toggle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 9 5-9 5-9-5zm-9 9 9 5 9-5M3 16l9 5 9-5'/%3E%3C/svg%3E");
  background-size: 20px;
}
.leaflet-control-layers label { color: var(--text); }
.leaflet-control-layers input { accent-color: var(--text); }

.lokal-pin, .lokal-cluster {
  display: grid;
  place-items: center;
  border: 1px solid #000;
  border-radius: 50%;
  color: #000;
  background: var(--text);
}

.lokal-pin.has-site::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0a0a0a;
}

.lokal-cluster { font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lokal-pin.is-active, .lokal-pin.pin-selected { outline: 2px solid #fff; outline-offset: 2px; pointer-events: none; }
.lokal-pin.pin-selected { outline-offset: 3px; }
.lokal-pin.is-active::after { width: 8px; height: 8px; border-radius: 50%; background: #0a0a0a; content: ""; }

.map-tile-notice {
  padding: 4px 8px;
  border: 1px solid var(--border-hover);
  border-radius: var(--control-radius);
  color: var(--muted);
  background: var(--panel);
}

.map-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 44px;
  padding: 8px 16px;
  color: var(--muted);
  font-size: .8125rem;
}

.map-site-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.map-site-label { margin-right: 3px; }
.map-site-filter button { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 3px 7px; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--muted); }
.map-site-filter button:hover, .map-site-filter button[aria-pressed="true"] { border-color: var(--border-hover); color: var(--text); }
.map-site-filter button[aria-pressed="true"] { background: #2a2a2a; }
.map-site-filter i { display: grid; place-items: center; width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.map-site-filter [data-map-site="with"] i::after { content: ""; width: 3px; height: 3px; border-radius: 50%; background: #0a0a0a; }
.map-count { margin-left: auto; }

/* Компоненты · нижняя панель и диалоги */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 16px 24px;
  color: var(--muted);
  font-size: .8125rem;
}

.footer-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px 16px; }

dialog {
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel);
}

dialog::backdrop { background: rgb(0 0 0 / 72%); }
.lead-dialog { width: min(600px, calc(100vw - 24px)); max-width: none; margin: 12px 12px 12px auto; padding: 0; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.lead-dialog .dialog-top { position: sticky; z-index: 2; top: 0; background: var(--panel); }
.lead-header { padding: 20px; }
.lead-header-label { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--muted); font-size: .875rem; }
.lead-header h2 { font-size: 1.75rem; overflow-wrap: anywhere; }
.lead-header p { margin-top: 4px; color: var(--muted); }
.lead-actions, .form-actions, .contacts, .account-profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lead-actions { margin-top: 16px; }
.lead-map-actions { display: flex; gap: 8px; max-width: 100%; }
.lead-map-actions button { flex-shrink: 0; }
.lead-map-actions a { min-width: 0; white-space: normal; text-align: center; }
.lead-section { padding: 16px 20px; border-top: 1px solid var(--border); }
.lead-section h3 { margin-bottom: 8px; }
.score-heading { display: flex; align-items: center; gap: 8px; }
.score-heading .score { margin-bottom: 8px; }
.reason-list { margin: 0; padding-left: 20px; color: var(--muted); font-size: .875rem; }
.contacts .button { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.contacts .button[href^="tel:"] { font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.pitch-output { min-height: 136px; margin-top: 8px; resize: vertical; }
.form-actions { margin-top: 8px; }
.about-dialog { width: min(544px, calc(100vw - 24px)); padding: 0 20px 20px; }
.about-dialog .dialog-top { padding-inline: 0; }
.about-dialog p { margin-block: 12px 0; color: var(--muted); }
.account-dialog { width: min(420px, calc(100vw - 24px)); }
.account-dialog form { display: grid; gap: 12px; padding-top: 16px; }
.account-dialog .account-error { margin: 0; padding: 8px; border: 1px solid var(--border-hover); border-radius: var(--control-radius); color: var(--text); font-size: .875rem; }
.account-dialog .text-button { justify-self: start; }
.account-profile-actions { margin-top: 12px; }
#account-current-email { overflow-wrap: anywhere; }

.toast {
  position: fixed;
  z-index: 20;
  bottom: 20px;
  left: 50%;
  max-width: calc(100% - 24px);
  padding: 12px 16px;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--raised);
  font-size: .875rem;
  transform: translateX(-50%);
}

@media (hover: hover) {
  .navigation a:hover, .text-button:hover, .bookmark:hover { color: var(--text); }
  .text-button:hover { text-decoration: underline; }
  .button.primary:hover { background: var(--badge-text); }
  .button.secondary:hover, .icon-button:hover, select:hover { border-color: var(--border-hover); }
  .result-row:hover { border-color: var(--border-hover); }
  .result-row:hover .score { color: #fff; background: rgb(255 255 255 / 14%); }
  .leaflet-container .leaflet-bar a:hover { background: #262626; }
  .lokal-pin.leaflet-interactive:hover, .lokal-cluster:hover { outline: 2px solid #fff; outline-offset: 1px; }
  @supports (appearance: base-select) and selector(::picker(select)) {
    select option:hover { background: var(--raised); }
  }
}

/* Анимации · только transform и opacity */
@media (prefers-reduced-motion: no-preference) {
  .button, .icon-button, .switch::before, .result-row { transition: transform var(--motion), opacity var(--motion); }
  .button:active, .icon-button:active { transform: scale(.95); }

  .motion-ready .metrics,
  .motion-ready .filter-panel {
    animation: intro-rise var(--motion) both;
  }

  .motion-ready .filter-panel { animation-delay: 40ms; }
  .results-ghost.is-leaving { animation: list-leave 96ms ease-out both; will-change: opacity; }
  .results.is-entering { animation: list-enter var(--motion) 96ms both; will-change: transform, opacity; }
  .result-row.is-awaiting:not(:focus-within) { opacity: 0; transform: translateY(15px); }
  .result-row.is-revealing { animation: intro-rise var(--motion) var(--reveal-delay, 0ms) both; will-change: transform, opacity; }
  .result-row:focus-within { animation: none; }

  .result-row.is-highlighted::after {
    content: "";
    position: absolute;
    inset: -1px;
    pointer-events: none;
    border: 1px solid #fff;
    border-radius: inherit;
    animation: highlight-release 900ms ease-out both;
  }

  dialog[open] { animation: list-enter var(--motion) both; }
  dialog[open]::backdrop { animation: backdrop-appear var(--motion) both; }

  @media (hover: hover) {
    .result-row:hover { transform: translateY(-2px); }
  }

  @supports (appearance: base-select) and selector(::picker(select)) {
    select:open::picker(select) { animation: list-enter var(--motion) both; }
  }

  @keyframes intro-rise {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  @keyframes list-leave { to { opacity: 0; } }
  @keyframes list-enter { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  @keyframes highlight-release { from { opacity: 1; } to { opacity: 0; } }
  @keyframes backdrop-appear { from { opacity: 0; } to { opacity: 1; } }
}

/* Reduced motion · состояния меняются сразу */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  .results-ghost { display: none; }
}

/* Mobile и узкие окна */
@media (max-width: 1060px) {
  .shell { width: calc(100% - 48px); }
  .work-layout { grid-template-columns: minmax(360px, 1fr) minmax(0, 1fr); }
  .intro { gap: 20px; }
  .lead-open { gap: 8px; }
}

@media (max-width: 760px) {
  .work-layout { grid-template-columns: 1fr; }
  .map-panel { position: static; }
  .map { height: min(420px, 65dvh); }
  .intro { grid-template-columns: 1fr; gap: 20px; padding-block: 32px 24px; }
  .metrics > div { min-width: 0; }
}

@media (max-width: 620px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; min-height: 56px; }
  .wordmark { gap: 4px; font-size: 1.25rem; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .navigation { justify-content: center; gap: 12px; }
  .navigation a { font-size: .8125rem; }
  .navigation a [data-icon], .header-account [data-icon], .header-geo { display: none; }
  .header-account { padding-inline: 8px; }
  .metrics > div { padding-inline: 12px; }
  .section-heading, .map-top, .results-toolbar { padding-inline: 12px; }
  #filters { padding-inline: 12px; }
  .result-row { gap: 4px; padding-inline: 8px 4px; }
  .result-row .category-icon { width: 32px; height: 32px; }
  .lead-open { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .lead-address { display: none; }
  .map-footer { gap: 8px; padding-inline: 12px; }
  .site-footer { flex-wrap: wrap; }
}

@media (max-width: 400px) {
  .shell { width: calc(100% - 24px); }
  .header-inner, .navigation { gap: 8px; }
  .navigation a, .header-account.button { font-size: .75rem; }
  .nav-count { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .wordmark { font-size: 1.0625rem; }
  .brand-mark { width: 24px; height: 24px; }
  .brand-mark svg { width: 16px; height: 16px; }
  .intro h1 { font-size: 2.25rem; }
  .metrics > div { padding: 8px; }
  .metrics dt { font-size: .75rem; white-space: normal; }
  .metrics dd { font-size: 1.5rem; }
  .section-heading h2 { font-size: 1.0625rem; }
  .section-heading .button svg { display: none; }
  .lead-name { font-size: .875rem; }
  .lead-meta { font-size: .75rem; }
  .map-count { margin-left: 0; }
}

/* Микродвижения каталога */
:root {
  --motion-fast: 150ms;
  --motion-base: 250ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.result-row.is-highlighted { background-color: var(--panel); }
.bookmark-glyph { position: relative; display: grid; place-items: center; }
.bookmark-glyph-accent {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: 0;
}
.bookmark[aria-pressed="true"] .bookmark-glyph-accent { opacity: 1; }

.results-skeleton:not([hidden]) ~ .empty { display: none; }
.skeleton-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 8px 14px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
}
.skeleton-copy { display: grid; gap: 8px; }
.skeleton-card span:not(.skeleton-copy), .skeleton-copy i {
  display: block;
  border-radius: 4px;
  background-color: #303030;
}
.skeleton-icon { width: 36px; height: 36px; }
.skeleton-score { width: 28px; height: 20px; justify-self: end; }
.skeleton-copy i { width: min(72%, 210px); height: 10px; }
.skeleton-copy i + i { width: min(48%, 124px); height: 8px; }

.lokal-pin.pin-hover {
  border-color: transparent;
  outline: none;
  background-color: transparent;
  pointer-events: none;
}
.lokal-pin.pin-hover::after { content: none; }
.pin-hover-dot {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #000;
  border-radius: 50%;
  outline: 1px solid #fff;
  outline-offset: 2px;
  background-color: #fff;
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .bookmark:hover { color: var(--muted); }
  .bookmark:hover .bookmark-glyph-accent { opacity: 1; }
  .result-row:hover .score { color: var(--badge-text); background-color: var(--badge); }
  .lead-open .score:hover { background-color: #3a3a3a; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .button, .leaflet-bar a, .leaflet-control-layers-toggle {
    transition: transform var(--motion-fast) var(--ease-out),
                opacity var(--motion-fast) var(--ease-out),
                background-color var(--motion-fast) var(--ease-out),
                border-color var(--motion-fast) var(--ease-out);
  }
  button:enabled:active, .button:active, .leaflet-bar a:not(.leaflet-disabled):active,
  .leaflet-control-layers-toggle:active { transform: scale(.97); }

  .result-row {
    transition: transform var(--motion-fast) var(--ease-out),
                border-color var(--motion-fast) var(--ease-out);
  }
  .bookmark-glyph-accent { transition: opacity var(--motion-fast) var(--ease-out); }
  .score { transition: background-color var(--motion-fast) var(--ease-out); }
  .switch::before { transition: transform var(--motion-fast) var(--ease-out); }

  .motion-ready .metrics, .motion-ready .filter-panel, .result-row.is-revealing {
    animation-name: lokal-rise;
    animation-duration: var(--motion-base);
    animation-timing-function: var(--ease-out);
  }
  .result-row.is-revealing:focus-within { animation: none; }
  .result-row.is-awaiting:not(:focus-within) { transform: translateY(10px); }
  .results-ghost.is-leaving { animation: lokal-list-out var(--motion-fast) var(--ease-out) both; }
  .results.is-entering { animation: lokal-list-in var(--motion-base) var(--ease-out) both; }
  .results.is-entering.after-exit { animation-delay: var(--motion-fast); }
  .results-skeleton:not([hidden]) { animation: lokal-skeleton 1.4s ease-in-out infinite; }
  .results-stage:has(.results-ghost) .results-skeleton { animation-delay: var(--motion-fast); animation-fill-mode: backwards; }
  .pin-hover.is-active .pin-hover-dot { animation: lokal-pin-in var(--motion-fast) var(--ease-out) both; }
  .pin-hover.is-releasing .pin-hover-dot { animation: lokal-pin-out var(--motion-fast) var(--ease-out) both; }
  .result-row.is-highlighted::after { animation: lokal-border-cue 1s ease-in-out both; }

  @media (hover: hover) {
    .result-row:hover { transform: translateY(-2px); border-color: #525252; }
  }

  @keyframes lokal-rise {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  @keyframes lokal-list-out { to { transform: translateY(5px); opacity: 0; } }
  @keyframes lokal-list-in { from { transform: translateY(5px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  @keyframes lokal-skeleton { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
  @keyframes lokal-pin-in { from { transform: scale(1); opacity: .7; } to { transform: scale(1.3); opacity: 1; } }
  @keyframes lokal-pin-out { from { transform: scale(1.3); opacity: 1; } to { transform: scale(1); opacity: 0; } }
  @keyframes lokal-border-cue { 0%, 50%, 100% { opacity: 0; } 22%, 72% { opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
  .result-row:not(:focus-within):not(.is-highlighted):hover { border-color: var(--border); }
  .bookmark:not([aria-pressed="true"]):hover { color: var(--muted); }
  .result-row:hover .score { color: var(--badge-text); background-color: var(--badge); }
  .lokal-pin.pin-hover.is-releasing { display: none; }
}
