/*
 * HTML-карта сайта /karta-sajta/ (CHUNK-127): дерево из karta-sajta.php, панель линз и фильтра из site-map.js.
 * Подключается через wp_enqueue_style из шаблона, то есть РАНЬШЕ main.css: при равной специфичности побеждает main.css,
 * поэтому у потомков селекторы из двух классов (.nest-map .nest-map__x). Все имена с префиксом nest-map.
 * Размеры на десктопе — в единицах сайта: при ширине до 1600 px у html zoom .75, до 750 px — zoom 1 (отдельный блок внизу).
 * sticky на сайте не работает (body { overflow: hidden }), поэтому панель в обычном потоке.
 * Цвета: #599e31 — только рамки (на белом 3,3:1); текст — #303439 (12,4:1), #666e7b (5,1:1 на белом), ссылки и кнопки — #3f7a1f (5,2:1).
 * Фокус с клавиатуры даёт общее правило темы :focus-visible (main.css, CHUNK-089).
 */

.nest-map {
  --nm-ink: #303439;
  --nm-muted: #666e7b;
  --nm-line: #e3e7e0;
  --nm-leaf: #ecf2e9;
  --nm-green: #599e31;
  --nm-green-d: #3f7a1f;
  --nm-sun-l: #fbf295;
  font-family: "Manrope", sans-serif;
  color: var(--nm-ink);
  font-size: 18px;
  line-height: 1.5;
}
.nest-map [hidden] { display: none !important; }
.nest-map mark { background: var(--nm-sun-l); color: inherit; border-radius: 3px; padding: 0 1px; }
.nest-map button { font-family: inherit; }

/* ---------- вводный текст и быстрые ссылки (без JS) ---------- */
.nest-map .nest-map__lead { margin: 0 0 24px; max-width: 920px; color: #454a50; font-size: 20px; line-height: 1.5; }
.nest-map .nest-map__jump { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 36px; padding: 0; list-style: none; }
.nest-map .nest-map__jump a {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--nm-leaf);
  color: var(--nm-ink);
  font-weight: 700;
}
.nest-map .nest-map__jump a:hover { background: #dce8d6; }
.nest-map.nest-map--js .nest-map__jump { display: none; }

/* ---------- панель линз и фильтра (строит site-map.js) ---------- */
.nest-map .nest-map__tools { margin: 0 0 28px; }
.nest-map .nest-map__views { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.nest-map .nest-map__view {
  margin: 0;
  padding: 10px 24px;
  border: 2px solid var(--nm-leaf);
  border-radius: 999px;
  background: #fff;
  color: var(--nm-ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.nest-map .nest-map__view:hover { background: var(--nm-leaf); }
.nest-map .nest-map__view[aria-pressed="true"] { border-color: var(--nm-ink); background: var(--nm-ink); color: #fff; }
.nest-map .nest-map__find { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.nest-map .nest-map__q {
  flex: 1 1 420px;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 12px 20px;
  border: 2px solid var(--nm-green);
  border-radius: 16px;
  background: #fff;
  box-shadow: none;
  color: var(--nm-ink);
  font: 600 20px/1.3 "Manrope", sans-serif;
  -webkit-appearance: none;
  appearance: none;
}
.nest-map .nest-map__q::placeholder { color: #6f7680; font-weight: 500; opacity: 1; }
.nest-map .nest-map__q:focus { border-color: var(--nm-green-d); }
.nest-map .nest-map__act {
  flex: none;
  margin: 0;
  padding: 0 22px;
  border: 2px solid var(--nm-leaf);
  border-radius: 16px;
  background: #fff;
  color: var(--nm-green-d);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.nest-map .nest-map__act:hover { background: var(--nm-leaf); }
.nest-map .nest-map__status { min-height: 1.5em; margin: 14px 0 0; color: var(--nm-muted); font-size: 17px; }
.nest-map .nest-map__status a { color: var(--nm-green-d); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- линзы ---------- */
/* section в main.css имеет отступы 80/75 px — у вложенных линз их нет */
.nest-map .nest-map__lens { margin: 0 0 56px; padding: 0; }
.nest-map.nest-map--js .nest-map__lens { margin-bottom: 0; }
.nest-map .nest-map__h { margin: 0 0 6px; color: var(--nm-ink); font-size: 30px; font-weight: 700; line-height: 1.25; }
.nest-map .nest-map__note { margin: 0 0 22px; max-width: 920px; color: var(--nm-muted); font-size: 17px; }

/* ---------- дерево ---------- */
.nest-map .nest-map__lens ul { margin: 0; padding: 0; list-style: none; }
.nest-map .nest-map__lens li { margin: 0; padding: 4px 0; list-style: none; }
.nest-map .nest-map__lens ul ul { margin: 2px 0 8px 10px; padding: 0 0 0 20px; border-left: 2px solid var(--nm-leaf); }

.nest-map .nest-map__lens summary {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 2px;
  padding: 7px 0 7px 30px;
  cursor: pointer;
  list-style: none;
  font-size: 18px;
  font-weight: 700;
}
.nest-map .nest-map__lens summary::-webkit-details-marker { display: none; }
.nest-map .nest-map__lens summary::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px; /* у первой строки заголовка, даже если он переносится на несколько строк */
  width: 8px;
  height: 8px;
  border-right: 3px solid var(--nm-green-d);
  border-bottom: 3px solid var(--nm-green-d);
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
.nest-map .nest-map__lens details[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
.nest-map .nest-map__lens summary > b { font-weight: inherit; }
.nest-map .nest-map__lens summary > small {
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--nm-leaf);
  color: var(--nm-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}
.nest-map .nest-map__desc { color: var(--nm-muted); font-size: 16px; font-weight: 500; }
.nest-map .nest-map__go {
  margin-left: auto;
  color: var(--nm-green-d);
  font-size: 16px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.nest-map .nest-map__go:hover { text-decoration-thickness: 2px; }

/* стволы — карточки; остальные ветки — заголовки поменьше */
.nest-map .nest-map__lens > ul > li { padding: 0 0 16px; }
.nest-map .nest-map__lens > ul > li > details { padding: 4px 24px 14px; border: 2px solid var(--nm-leaf); border-radius: 24px; background: #fff; }
.nest-map .nest-map__lens > ul > li > details > summary { padding-top: 14px; padding-bottom: 14px; font-size: 26px; }
.nest-map .nest-map__lens > ul > li > details > summary::before { left: 9px; top: 29px; }
.nest-map .nest-map__lens > ul ul > li > details > summary { font-size: 20px; }
.nest-map .nest-map__lens > ul ul > li > details > summary::before { top: 18px; }

/* листья */
.nest-map .nest-map__lens li > a {
  color: var(--nm-ink);
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: rgba(63, 122, 31, .45);
  text-underline-offset: 3px;
}
.nest-map .nest-map__lens li > a:hover { color: var(--nm-green-d); text-decoration-color: currentColor; }
.nest-map .nest-map__sub { display: block; margin-top: 1px; color: var(--nm-muted); font-size: 16px; line-height: 1.4; }
.nest-map .nest-map__lens li > small { margin-left: 6px; color: var(--nm-muted); font-size: 14px; }
.nest-map .nest-map__lens .nest-map__sub + small { display: block; margin-left: 0; }

/* длинный список из одних ссылок — в две колонки */
@media (min-width: 1100px) {
  .nest-map .nest-map__lens ul.nest-map__cols { column-count: 2; column-gap: 48px; }
  .nest-map .nest-map__lens ul.nest-map__cols > li { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  .nest-map .nest-map__lens summary::before { transition: none; }
}

/* ---------- телефон: html zoom 1, размеры настоящие; .container 300 px, в карточке остаётся ~255 px ---------- */
@media (max-width: 750px) {
  .nest-map { font-size: 15px; }
  .nest-map .nest-map__lead { margin-bottom: 18px; font-size: 15px; }
  .nest-map .nest-map__jump { gap: 8px; margin-bottom: 24px; }
  .nest-map .nest-map__jump a { padding: 8px 14px; font-size: 14px; }
  .nest-map .nest-map__tools { margin-bottom: 20px; }
  /* линзы — горизонтальная лента, как фильтры на странице поиска */
  .nest-map .nest-map__views { flex-wrap: nowrap; gap: 8px; margin: 0 -4px 14px; padding: 0 4px 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nest-map .nest-map__view { flex: none; padding: 9px 16px; font-size: 15px; }
  .nest-map .nest-map__find { gap: 8px; }
  .nest-map .nest-map__q { flex: 1 1 100%; padding: 10px 14px; border-radius: 14px; font-size: 16px; }
  .nest-map .nest-map__act { flex: 1 1 0; padding: 10px 8px; border-radius: 14px; font-size: 14px; }
  .nest-map .nest-map__status { margin-top: 10px; font-size: 14px; }
  .nest-map .nest-map__h { font-size: 22px; }
  .nest-map .nest-map__note { margin-bottom: 14px; font-size: 14px; }
  .nest-map .nest-map__lens summary { padding: 8px 0 8px 22px; column-gap: 8px; font-size: 16px; }
  .nest-map .nest-map__lens summary::before { left: 4px; top: 16px; width: 7px; height: 7px; border-width: 2.5px; }
  .nest-map .nest-map__lens > ul > li { padding-bottom: 10px; }
  .nest-map .nest-map__lens > ul > li > details { padding: 2px 12px 10px; border-radius: 16px; }
  .nest-map .nest-map__lens > ul > li > details > summary { padding-top: 12px; padding-bottom: 12px; font-size: 19px; }
  .nest-map .nest-map__lens > ul > li > details > summary::before { left: 5px; top: 22px; }
  .nest-map .nest-map__lens > ul ul > li > details > summary { font-size: 16px; }
  .nest-map .nest-map__lens > ul ul > li > details > summary::before { top: 16px; }
  .nest-map .nest-map__lens ul ul { margin-left: 4px; padding-left: 10px; }
  .nest-map .nest-map__lens summary > small { font-size: 12px; }
  .nest-map .nest-map__desc { flex-basis: 100%; font-size: 13px; }
  .nest-map .nest-map__go { flex-basis: 100%; margin-left: 0; font-size: 14px; }
  .nest-map .nest-map__lens li > small { display: block; margin: 0; font-size: 12px; }
  .nest-map .nest-map__sub { font-size: 13px; }
}

/* ---------- страница 404: строка поиска и ссылка на карту над выбором раздела (404.php) ---------- */
.nest-map-find { max-width: 880px; margin: 60px auto 0; text-align: center; }
.nest-map-find .nest-map-find__lead { margin: 0 0 20px; color: #303439; font-size: 28px; font-weight: 600; line-height: 1.3; }
.nest-map-find .nest-search-form { margin-bottom: 20px; text-align: left; }
.nest-map-find .nest-map-find__map { color: #303439; font-size: 20px; line-height: 1.5; }
.nest-map-find .nest-map-find__map a { color: #3f7a1f; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 750px) {
  .nest-map-find { margin-top: 28px; }
  .nest-map-find .nest-map-find__lead { margin-bottom: 14px; font-size: 18px; }
  .nest-map-find .nest-map-find__map { font-size: 15px; }
}
