/* Окно карты курорта (frontend\widgets\ResortMapWidget) — общий блок новых тем. Цвета и шрифт — из токенов темы:
   nauga-nd / tiptoptrip-nd (--color-*) или regional (--accent, --ink…); тема может задать --rmap-* сама.
   Размер окна задаёт тема: .rmap заполняет свой контейнер (height: 100%), минимум — --rmap-min-h. */
.rmap {
  --rmap-accent: var(--color-accent, var(--accent, #0b6e75));
  --rmap-accent-hover: var(--color-accent-hover, var(--accent-hover, #095e64));
  --rmap-ink: var(--color-text, var(--ink, #0f2530));
  --rmap-muted: var(--color-text-muted, var(--muted, #5f6e77));
  --rmap-bg: var(--color-bg, var(--card, #fff));
  --rmap-border: var(--color-border, var(--line, #e4e8ea));
  --rmap-radius: var(--radius-m, var(--radius, 12px));
  --rmap-pill: 999px;
  --rmap-shadow: 0 2px 8px rgb(16 24 40 / 18%);
  --rmap-dim: rgb(9 24 32 / 45%);
  --rmap-min-h: 20rem;

  position: relative;
  height: 100%;
  min-height: var(--rmap-min-h);
  overflow: hidden;
  background: #e8eef0;
  color: var(--rmap-ink);
}

.rmap__live,
.rmap__preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.rmap__preview {
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.4s ease;
}

/* Затемнение превью: при наведении, фокусе кнопки и загрузке */
.rmap::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--rmap-dim);
  content: '';
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.rmap:not(.rmap--live):hover::after,
.rmap:not(.rmap--live):focus-within::after,
.rmap--loading::after {
  opacity: 1;
}

/* Кнопка «Загрузить карту» — по центру, видна при наведении (на сенсорных экранах — всегда) */
.rmap__load {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: var(--rmap-pill);
  background: var(--rmap-accent);
  box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
  color: #fff;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  translate: -50% -50%;
  transition: opacity 0.25s ease, background-color 0.2s ease;
}

.rmap:hover .rmap__load,
.rmap__load:focus-visible,
.rmap--loading .rmap__load,
.rmap--error .rmap__load {
  opacity: 1;
}

.rmap__load:hover {
  background: var(--rmap-accent-hover);
}

.rmap__load:focus-visible,
.rmap__full:focus-visible,
.rmap__chip:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--rmap-accent);
}

.rmap__load:disabled {
  cursor: progress;
}

@media (hover: none) {
  .rmap:not(.rmap--live)::after {
    opacity: 0.6;
  }

  .rmap__load {
    opacity: 1;
  }
}

/* После загрузки превью и кнопка уходят, под ними — живая карта */
.rmap--live .rmap__preview {
  opacity: 0;
  pointer-events: none;
}

.rmap--live .rmap__load,
.rmap--live .rmap__copy {
  display: none;
}

.rmap__icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* «На весь экран» — справа сверху, белая кнопка как у элементов карты */
.rmap__full {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  gap: 0.375rem;
  align-items: center;
  min-height: 44px;
  padding: 0 0.875rem;
  border: 1px solid var(--rmap-border);
  border-radius: var(--rmap-pill);
  background: var(--rmap-bg);
  box-shadow: var(--rmap-shadow);
  color: var(--rmap-ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.rmap__full:hover {
  color: var(--rmap-accent);
}

.rmap__icon--shrink,
.rmap--full .rmap__icon--expand {
  display: none;
}

.rmap--full .rmap__icon--shrink {
  display: block;
}

@media (max-width: 47.99em) {
  .rmap__full-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .rmap__full {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
}

/* Слои — чипы слева сверху (после загрузки) */
.rmap__layers {
  position: absolute;
  top: 12px;
  right: 180px;
  left: 12px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  pointer-events: none;
}

.rmap__layers[hidden] {
  display: none;
}

@media (max-width: 47.99em) {
  .rmap__layers {
    right: 68px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
}

.rmap__chip {
  display: inline-flex;
  flex: none;
  gap: 0.375rem;
  align-items: center;
  min-height: 36px;
  padding: 0 0.75rem;
  border: 1px solid var(--rmap-border);
  border-radius: var(--rmap-pill);
  background: var(--rmap-bg);
  box-shadow: var(--rmap-shadow);
  color: var(--rmap-ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}

.rmap__chip[aria-pressed='false'] {
  color: var(--rmap-muted);
  box-shadow: none;
  opacity: 0.85;
}

.rmap__chip-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rmap-kind);
}

.rmap__chip[aria-pressed='false'] .rmap__chip-mark {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--rmap-kind);
}

.rmap__chip-count {
  color: var(--rmap-muted);
  font-weight: 400;
}

/* Цвета видов точек */
.rmap__chip--hotel,
.rmap-dot--hotel {
  --rmap-kind: var(--rmap-accent);
}

.rmap__chip--fun,
.rmap-dot--fun {
  --rmap-kind: #8e44ad;
}

.rmap__chip--beach,
.rmap-dot--beach {
  --rmap-kind: #1d8fd1;
}

.rmap__chip--sight,
.rmap-dot--sight {
  --rmap-kind: #c0602a;
}

.rmap__copy {
  position: absolute;
  right: 8px;
  bottom: 6px;
  z-index: 2;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgb(255 255 255 / 75%);
  color: #333;
  font-size: 0.6875rem;
}

.rmap__msg {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 3;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 0.5rem 0.875rem;
  border-radius: var(--rmap-radius);
  background: var(--rmap-bg);
  box-shadow: var(--rmap-shadow);
  font-size: 0.875rem;
  translate: -50% 0;
}

.rmap__msg:empty,
.rmap--live .rmap__msg {
  /* сообщение об успехе — только для экранных чтецов */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

/* На весь экран: окно поверх страницы, страница не прокручивается */
.rmap.rmap--full {
  position: fixed;
  inset: 0;
  z-index: 1000;
  height: 100dvh;
  aspect-ratio: auto;
  border-radius: 0;
}

.rmap-lock,
.rmap-lock body {
  overflow: hidden;
}

/* Тема может держать полосу прокрутки на html (scrollbar-gutter: stable): под полноэкранной картой это пустая
   полоса справа (tiptoptrip-nd, 2026-12-03) */
html.rmap-lock {
  scrollbar-gutter: auto;
}

/* На весь экран — колонка жилья в видимой части карты: слева (с 768; владелец 2026-12-03), на телефоне — лента внизу.
   Карта, чипы и «Свернуть» сдвигаются, чтобы колонка их не закрывала. */
.rmap {
  --rmap-side-w: 380px;
  --rmap-strip-h: 128px;
}

.rmap__side {
  display: none;
}

.rmap--full.rmap--live .rmap__side:not([hidden]) {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  background: var(--rmap-surface, var(--color-surface, var(--bg, #f6f7f7)));
}

.rmap__side-head {
  margin: 0;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--rmap-border);
  background: var(--rmap-bg);
  font-size: 0.9375rem;
  font-weight: 700;
}

.rmap__side-list {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem;
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.rmap__more {
  flex: none;
  min-height: 44px;
  margin: 0 0.75rem 0.75rem;
  border: 1px solid var(--rmap-accent);
  border-radius: var(--rmap-pill);
  background: var(--rmap-bg);
  color: var(--rmap-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.rmap__more[hidden] {
  display: none;
}

.rmap-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.5rem;
  border: 1px solid var(--rmap-border);
  border-radius: var(--rmap-radius);
  background: var(--rmap-bg);
  color: var(--rmap-ink);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rmap-item:hover,
.rmap-item:focus-visible,
.rmap-item--active {
  border-color: var(--rmap-accent);
  box-shadow: 0 0 0 1px var(--rmap-accent);
}

.rmap-item:focus-visible {
  outline: 3px solid var(--rmap-accent);
  outline-offset: 2px;
}

.rmap-item__img {
  width: 112px;
  height: 84px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8eef0;
}

.rmap-item__body {
  display: grid;
  align-content: start;
  gap: 0.25rem;
  min-width: 0;
}

.rmap-item__title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rmap-item__meta {
  color: var(--rmap-muted);
  font-size: 0.8125rem;
}

.rmap-item__price {
  color: var(--rmap-accent);
  font-size: 0.9375rem;
  font-weight: 700;
}

@media (min-width: 48em) {
  .rmap--full.rmap--live .rmap__side:not([hidden]) {
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--rmap-side-w);
    border-right: 1px solid var(--rmap-border);
  }

  .rmap--full.rmap--live:has(.rmap__side:not([hidden])) .rmap__live {
    left: var(--rmap-side-w);
    width: auto;
  }

  .rmap--full.rmap--live:has(.rmap__side:not([hidden])) .rmap__layers {
    left: calc(var(--rmap-side-w) + 12px);
  }
}

/* Колонка слева без «на весь экран» (опция виджета aside — страница карты курорта, regional): только с 1024, ниже —
   окно как раньше. Высота колонки = высоте карты (колонка в окне, свой скролл списка). */
@media (min-width: 64em) {
  .rmap--aside.rmap--live .rmap__side:not([hidden]) {
    position: absolute;
    z-index: 3;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: var(--rmap-side-w);
    border-right: 1px solid var(--rmap-border);
    background: var(--rmap-surface, var(--color-surface, var(--bg, #f6f7f7)));
  }

  .rmap--aside.rmap--live:has(.rmap__side:not([hidden])) .rmap__live {
    left: var(--rmap-side-w);
    width: auto;
  }

  .rmap--aside.rmap--live:has(.rmap__side:not([hidden])) .rmap__layers {
    left: calc(var(--rmap-side-w) + 12px);
  }
}

[data-rmap-ext-more][hidden] {
  display: none;
}

/* Телефон: лента внизу, карточки листаются вбок */
@media (max-width: 47.99em) {
  .rmap--full.rmap--live .rmap__side:not([hidden]) {
    right: 0;
    bottom: 0;
    left: 0;
    height: var(--rmap-strip-h);
    border-top: 1px solid var(--rmap-border);
  }

  .rmap--full.rmap--live:has(.rmap__side:not([hidden])) .rmap__live {
    bottom: var(--rmap-strip-h);
    height: auto;
  }

  .rmap__side-head {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }

  .rmap__side-list {
    grid-auto-columns: 82%;
    grid-auto-flow: column;
    padding: 0.5rem 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
  }

  .rmap__side-list > li {
    scroll-snap-align: start;
  }

  .rmap-item {
    grid-template-columns: 80px minmax(0, 1fr);
    padding: 0.375rem;
  }

  .rmap-item__img {
    width: 80px;
    height: 60px;
  }

  .rmap__more {
    display: none;
  }
}

/* ---------- Точки на живой карте (макеты ymaps.templateLayoutFactory) ---------- */
.rmap-pin {
  position: absolute;
  bottom: 6px;
  left: 0;
  padding: 0.25rem 0.5rem;
  border-radius: var(--rmap-pill);
  background: var(--rmap-bg);
  box-shadow: var(--rmap-shadow);
  color: var(--rmap-ink);
  font-family: var(--font-base, var(--font, system-ui, sans-serif));
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  translate: -50% 0;
}

.rmap-pin::after {
  position: absolute;
  top: 100%;
  left: 50%;
  border: 6px solid transparent;
  border-top-color: var(--rmap-bg);
  content: '';
  translate: -50% 0;
}

.rmap-pin:hover,
.rmap-pin--active {
  z-index: 1;
  background: var(--rmap-accent);
  color: #fff;
}

.rmap-pin:hover::after,
.rmap-pin--active::after {
  border-top-color: var(--rmap-accent);
}

.rmap-cluster {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid var(--rmap-bg);
  border-radius: 50%;
  background: var(--rmap-accent);
  box-shadow: var(--rmap-shadow);
  color: #fff;
  font-family: var(--font-base, var(--font, system-ui, sans-serif));
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  translate: -50% -50%;
}

.rmap-cluster--active {
  z-index: 1;
  background: var(--rmap-ink);
  scale: 1.15;
}

.rmap-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--rmap-kind);
  box-shadow: var(--rmap-shadow);
  cursor: pointer;
  translate: -50% -50%;
}

/* ---------- Попап точки (свой balloonLayout): карточка в стиле сайта, круглый крестик, хвостик к точке ---------- */
.rmap-pop {
  position: absolute;
  width: 280px;
  border-radius: var(--rmap-radius);
  background: var(--rmap-bg);
  box-shadow: 0 12px 32px rgb(9 24 32 / 22%), 0 2px 6px rgb(9 24 32 / 12%);
  font-family: var(--font-base, var(--font, system-ui, sans-serif));
}

.rmap-pop__tail {
  position: absolute;
  top: 100%;
  left: 50%;
  border: 9px solid transparent;
  border-top-color: var(--rmap-bg);
  translate: -50% 0;
}

.rmap-pop__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--rmap-shadow);
  color: var(--rmap-ink);
  cursor: pointer;
}

.rmap-pop__close:hover {
  color: var(--rmap-accent);
}

.rmap-pop__close:focus-visible {
  outline: 3px solid var(--rmap-accent);
  outline-offset: 2px;
}

.rmap-pop__close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-width: 2.5;
}

.rmap-card {
  display: block;
  overflow: hidden;
  border-radius: var(--rmap-radius);
  color: var(--rmap-ink);
  text-decoration: none;
}

.rmap-card:focus {
  outline: none;
}

.rmap-card:focus-visible {
  outline: 3px solid var(--rmap-accent);
  outline-offset: -3px;
}

/* без фото — место под крестик */
.rmap-card--text .rmap-card__body {
  padding-right: 3rem;
}

.rmap-card__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--rmap-accent-soft, var(--color-accent-soft, var(--accent-soft, #e7f1f2)));
}

/* заглушка битого фото: светлый фон темы со значком карты */
.rmap-noimg {
  color: transparent;
  background: var(--rmap-accent-soft, var(--color-accent-soft, var(--accent-soft, #e7f1f2)))
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a99a6' stroke-width='1.5' stroke-linejoin='round'%3E%3Cpath d='M3 21h18M5 21V8l7-5 7 5v13M10 21v-6h4v6'/%3E%3C/svg%3E")
    center / 40px no-repeat;
}

.rmap-card__body {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem 1rem 0.875rem;
}

.rmap-card__meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--rmap-muted);
  font-size: 0.8125rem;
}

.rmap-card__rating {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: var(--rmap-pill);
  background: var(--rmap-accent);
  color: #fff;
  font-weight: 700;
}

.rmap-card__rating .rmap-card__star {
  color: #ffd166;
}

.rmap-card__star {
  color: #f5a623;
}

.rmap-card__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.rmap-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.375rem;
}

.rmap-card__price {
  font-size: 1.0625rem;
  font-weight: 800;
}

.rmap-card__price small {
  color: var(--rmap-muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.rmap-card__cta {
  padding: 0.375rem 0.875rem;
  border-radius: var(--rmap-pill);
  background: var(--rmap-accent);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

a.rmap-card:hover .rmap-card__cta {
  background: var(--rmap-accent-hover);
}

/* ---------- Попап кластера: список жилья в стиле карточки точки ---------- */
.rmap-list {
  display: grid;
  overflow: hidden;
  border-radius: var(--rmap-radius);
  color: var(--rmap-ink);
}

.rmap-list__head {
  padding: 0.75rem 3rem 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 800;
}

.rmap-list__rows {
  display: grid;
  max-height: min(15.5rem, 45vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid rgb(9 24 32 / 8%);
}

.rmap-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  align-items: start;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid rgb(9 24 32 / 8%);
  color: inherit;
  text-decoration: none;
}

.rmap-row:last-child {
  border-bottom: 0;
}

.rmap-row:focus-visible {
  outline: 3px solid var(--rmap-accent);
  outline-offset: -3px;
}

.rmap-row__img {
  grid-row: span 2;
  width: 72px;
  height: 56px;
  border-radius: 8px;
  background: var(--rmap-accent-soft, var(--color-accent-soft, var(--accent-soft, #e7f1f2)));
  object-fit: cover;
}

.rmap-row__body {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.rmap-row__title {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.25;
}

.rmap-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  color: var(--rmap-muted);
  font-size: 0.8125rem;
}

.rmap-row__cta {
  grid-column: 2;
  color: var(--rmap-accent);
  font-size: 0.8125rem;
  font-weight: 700;
}

a.rmap-row:hover .rmap-row__cta {
  color: var(--rmap-accent-hover);
}

@media (prefers-reduced-motion: reduce) {
  .rmap__preview,
  .rmap::after,
  .rmap__load {
    transition: none;
  }
}

/* Окно карты поверх каталога (кнопка «Карта», data-rmap-open) */
.rmap--modal[hidden] {
  display: none;
}
