/* NISearch: страница выдачи (results.html, result_templates/*, elements/*, answer/*, filters/*).
   Цвета, радиусы, отступы, шрифты, движение: только --nis-* из tokens.css. */

/* ---------- Общее ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#results .invisible {
  display: none;
}

#results summary {
  cursor: pointer;
  list-style: none;
}

#results summary::-webkit-details-marker {
  display: none;
}

#results :focus-visible {
  outline: 2px solid var(--nis-focus);
  outline-offset: 2px;
  border-radius: var(--nis-radius-xs);
}

#results .sxng-icon-set,
#results .sxng-icon-set-small,
#results .sxng-icon-set-big {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: none;
  vertical-align: -3px;
}

#results .sxng-icon-set,
#results .sxng-icon-set-big {
  width: 20px;
  height: 20px;
  vertical-align: -4px;
}

/* ---------- Фильтры (строка под вкладками категорий) ---------- */

#main_results .search_filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--nis-space-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: var(--nis-space-2) 0 var(--nis-space-3);
}

#main_results .search_filters::-webkit-scrollbar {
  display: none;
}

#main_results .filter-pill {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 32px;
  padding: 0 var(--nis-space-6) 0 var(--nis-space-3);
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-sunken);
  color: var(--nis-text);
  font-size: var(--nis-font-sm);
  line-height: 1;
  white-space: nowrap;
}

#main_results .filter-pill select {
  appearance: none;
  -webkit-appearance: none;
  height: 100%;
  max-width: 260px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-overflow: ellipsis;
  cursor: pointer;
}

#main_results .filter-pill .sxng-icon-set-small {
  position: absolute;
  right: var(--nis-space-2);
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  vertical-align: baseline;
  color: var(--nis-text-subtle);
  pointer-events: none;
}

#main_results .filter-pill:has(select:focus-visible) {
  outline: 2px solid var(--nis-focus);
  outline-offset: 2px;
}

@media (hover: hover) {
  #main_results .filter-pill:hover {
    background: var(--nis-surface-hover);
  }
}

/* ---------- Раскладка: #results > (ответы) + .serp (main + aside) + пагинация ---------- */

#results {
  box-sizing: border-box;
  max-width: calc(var(--nis-content-width) + var(--nis-aside-width) + 48px + 48px);
  margin: 0 auto;
  padding: var(--nis-space-4) var(--nis-space-4) var(--nis-space-12);
  color: var(--nis-text);
  font-size: var(--nis-font-md);
  line-height: 1.5;
}

@media (min-width: 768px) {
  #results {
    padding-left: var(--nis-space-6);
    padding-right: var(--nis-space-6);
  }
}

/* Ширина колонок и отступы для карточек: единые на всех страницах выдачи. */
.serp {
  min-width: 0;
}

.serp-main {
  min-width: 0;
}

/* Desktop: основная колонка слева, правая колонка sticky справа. */
@media (min-width: 1100px) {
  .serp {
    display: grid;
    grid-template-columns: minmax(0, var(--nis-content-width)) minmax(0, var(--nis-aside-width));
    column-gap: 48px;
    align-items: start;
  }

  .serp-main {
    grid-column: 1;
    grid-row: 1;
  }

  #sidebar {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: var(--nis-results-sticky-top, 112px);
    min-width: 0;
    max-height: calc(100vh - var(--nis-results-sticky-top, 112px) - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .serp-suggestions-bottom {
    display: none;
  }

  /* Картинки: плитка на всю ширину, правая колонка уходит под плитку. */
  #results.only_template_images {
    max-width: 1280px;
  }

  #results.only_template_images .serp {
    grid-template-columns: minmax(0, 1fr);
  }

  #results.only_template_images #sidebar {
    grid-column: 1;
    grid-row: 2;
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: var(--nis-space-8);
  }
}

/* Узкий экран: всё в один столбец. Правая колонка (карточка объекта) поднимается над выдачей,
   блок «Вместе с этим ищут» и «Ещё» уходят вниз. Для этого .serp и #sidebar становятся display: contents. */
@media (max-width: 1099px) {
  #results {
    display: flex;
    flex-direction: column;
  }

  .serp,
  #sidebar {
    display: contents;
  }

  #answers {
    order: 0;
  }

  #infoboxes {
    order: 1;
  }

  .serp-main {
    order: 2;
  }

  #pagination {
    order: 3;
  }

  .serp-rest {
    order: 4;
  }

  .serp-suggestions-aside {
    display: none;
  }
}

/* ---------- Ответы (калькулятор, конвертер, перевод, погода) ---------- */

#answers {
  box-sizing: border-box;
  max-width: var(--nis-content-width);
  margin: 0 0 var(--nis-space-6);
  padding: var(--nis-space-4) var(--nis-space-5);
  border-radius: var(--nis-radius-xl);
  background: var(--nis-surface-raised);
  box-shadow: var(--nis-shadow-card);
}

/* Заголовок «Ответы» не нужен визуально (калькулятор, созданный JS, приходит со своим h4). */
#answers > .title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#answers > span {
  font-size: var(--nis-font-xl);
  font-weight: 500;
}

#answers .answer {
  color: var(--nis-text);
  font-size: var(--nis-font-lg);
  line-height: 1.4;
}

#answers .answer + .answer {
  margin-top: var(--nis-space-3);
  padding-top: var(--nis-space-3);
  border-top: 1px solid var(--nis-border);
}

#answers .answer-text {
  display: flex;
  flex-direction: column;
  gap: var(--nis-space-1);
}

#answers .answer-expr {
  color: var(--nis-text-muted);
  font-size: var(--nis-font-md);
}

#answers .answer-value {
  color: var(--nis-text);
  font-size: var(--nis-font-3xl);
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#answers .answer-plain {
  display: block;
  color: var(--nis-text);
  font-size: var(--nis-font-md);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#answers .answer-url {
  display: inline-block;
  margin-top: var(--nis-space-2);
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-sm);
  text-decoration: none;
}

@media (hover: hover) {
  #answers .answer-url:hover {
    color: var(--nis-text-muted);
    text-decoration: underline;
  }
}

#answers .answer-translations summary {
  display: flex;
  align-items: center;
  gap: var(--nis-space-2);
}

#answers .answer-translations dl {
  margin: var(--nis-space-3) 0 0;
}

#answers .answer-translations dt {
  font-weight: 600;
  color: var(--nis-text);
}

#answers .answer-translations dd {
  margin: 0 0 var(--nis-space-3);
  color: var(--nis-text-muted);
  font-size: var(--nis-font-sm);
}

#answers .answer-subhead {
  margin-top: var(--nis-space-2);
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-xs);
}

#answers .item-transliteration {
  color: var(--nis-text-subtle);
  font-style: italic;
}

#answers .answer-translations ul {
  margin: 0;
  padding-left: var(--nis-space-5);
}

#answers .weather .summary {
  font-size: var(--nis-font-md);
  color: var(--nis-text);
}

#answers .weather-table {
  width: 100%;
  margin: var(--nis-space-2) 0;
  border-collapse: collapse;
  font-size: var(--nis-font-sm);
}

#answers .weather-table td {
  padding: var(--nis-space-1) var(--nis-space-3) var(--nis-space-1) 0;
  color: var(--nis-text-muted);
}

#answers .weather-table img.symbol {
  width: 48px;
  height: 48px;
}

#answers .weather-forecast .summary {
  margin-top: var(--nis-space-3);
  font-size: var(--nis-font-sm);
  color: var(--nis-text);
}

/* ---------- Исправления запроса (над выдачей) ---------- */

#corrections {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--nis-space-1) var(--nis-space-2);
  margin: 0 0 var(--nis-space-4);
  color: var(--nis-text-muted);
  font-size: var(--nis-font-md);
}

#corrections form {
  display: inline;
  margin: 0;
}

#corrections .correction-link {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--nis-link);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

@media (hover: hover) {
  #corrections .correction-link:hover {
    text-decoration: underline;
  }
}

/* ---------- Сообщения движков: тихая заметка ---------- */

.engines-note {
  margin: 0 0 var(--nis-space-4);
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-sm);
}

.engines-note-title {
  display: inline-flex;
  align-items: center;
  gap: var(--nis-space-2);
  padding: var(--nis-space-1) 0;
  color: var(--nis-text-muted);
}

.engines-note-title::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.engines-note[open] > .engines-note-title::after {
  transform: translateY(2px) rotate(-135deg);
}

.engines-note .engine-stats {
  margin-top: var(--nis-space-2);
  border-collapse: collapse;
}

.engines-note .engine-stats td {
  padding: var(--nis-space-1) var(--nis-space-4) var(--nis-space-1) 0;
}

.engines-note .engine-stats a {
  color: var(--nis-text-muted);
}

.engines-note .response-error {
  color: var(--nis-warning);
}

/* ---------- Список результатов ---------- */

#urls {
  display: block;
}

#urls > hr {
  margin: var(--nis-space-6) 0;
  border: 0;
  border-top: 1px solid var(--nis-border);
}

.result {
  position: relative;
  margin: 0 0 var(--nis-space-6);
  color: var(--nis-text);
  font-size: var(--nis-font-md);
  line-height: 1.5;
}

.result .result-main {
  display: flex;
  align-items: flex-start;
  gap: var(--nis-space-4);
}

.result .result-body {
  flex: 1 1 auto;
  min-width: 0;
}

/* Выбор с клавиатуры (JS ставит data-vim-selected): полоска акцентом слева. */
.result[data-vim-selected]::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--nis-space-3));
  top: var(--nis-space-1);
  bottom: var(--nis-space-1);
  width: 3px;
  border-radius: var(--nis-radius-full);
  background: var(--nis-accent);
}

.result-head {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-bottom: var(--nis-space-1);
}

.result .url_header {
  display: inline-flex;
  align-items: center;
  gap: var(--nis-space-2);
  max-width: 100%;
  min-width: 0;
  color: var(--nis-url);
  font-size: var(--nis-font-md);
  line-height: 1.3;
  text-decoration: none;
}

.result .favicon {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: var(--nis-radius-xs);
}

.result .url_wrapper {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.result .url_wrapper > span {
  display: inline;
}

.result .url_wrapper > span + span::before {
  content: " \203A ";
  color: var(--nis-text-subtle);
}

.result .result-title {
  margin: 0 0 var(--nis-space-1);
  font-size: calc(var(--nis-font-lg) + 2px);
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.result .result-title a {
  color: var(--nis-link);
  text-decoration: none;
  transition: color var(--nis-motion-fast) var(--nis-motion-easing);
}

.result .result-title a:visited {
  color: var(--nis-link-visited);
}

.result .result-title a:focus-visible {
  text-decoration: underline;
}

@media (hover: hover) {
  .result .result-title a:hover,
  .result .url_header:hover .url_wrapper {
    text-decoration: underline;
  }
}

.result .result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 var(--nis-space-1);
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-sm);
  line-height: 1.4;
}

.result .result-meta > * + *::before {
  content: "\00B7";
  margin: 0 var(--nis-space-2);
}

.result .content {
  margin: 0;
  color: var(--nis-text);
  font-size: var(--nis-font-md);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.result .content b,
.result .content strong {
  font-weight: 600;
}

.result .empty_element {
  color: var(--nis-text-subtle);
}

.result .highlight {
  color: var(--nis-text-muted);
}

/* Совпадения с запросом: жирным, цветом текста (не ссылки и не мета). */
.result .result-title .highlight,
.result .content .highlight {
  color: inherit;
  font-weight: 600;
}

.result .engines {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nis-space-1) var(--nis-space-3);
  margin-top: var(--nis-space-2);
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-sm);
  line-height: 1.4;
}

.result .engines .cache_link {
  color: var(--nis-text-subtle);
  text-decoration: underline;
  text-decoration-color: var(--nis-border-strong);
  transition: color var(--nis-motion-fast) var(--nis-motion-easing);
}

@media (hover: hover) {
  .result .engines .cache_link:hover {
    color: var(--nis-text-muted);
  }
}

.result .altlink {
  margin: var(--nis-space-2) 0 0;
  font-size: var(--nis-font-sm);
}

.result .altlink a {
  color: var(--nis-link);
  text-decoration: none;
  cursor: pointer;
}

.result .altlink a:visited {
  color: var(--nis-link-visited);
}

@media (hover: hover) {
  .result .altlink a:hover {
    text-decoration: underline;
  }
}

.result .embedded-content iframe,
.result .embedded-video iframe,
.result .embedded-video video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin-top: var(--nis-space-3);
  border: 0;
  border-radius: var(--nis-radius-lg);
  background: var(--nis-surface-sunken);
}

.result .audio-control audio {
  width: 100%;
  margin-top: var(--nis-space-3);
}

/* Миниатюра (правый край у обычных результатов, слева у видео) */
.result .thumbnail_link {
  position: relative;
  display: block;
  flex: none;
  width: 96px;
  height: 72px;
  overflow: hidden;
  border-radius: var(--nis-radius-md);
  background: var(--nis-surface-sunken);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nis-text) 10%, transparent);
}

.result .thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail_length {
  position: absolute;
  right: var(--nis-space-2);
  bottom: var(--nis-space-2);
  padding: 1px var(--nis-space-2);
  border-radius: var(--nis-radius-xs);
  background: var(--nis-surface-raised);
  color: var(--nis-text);
  font-size: var(--nis-font-xs);
  line-height: 1.5;
}

/* Мета-строка результата: дата и автор в новостях выделены. */
.result.category-news .published_date {
  color: var(--nis-text-muted);
  font-weight: 500;
}

.result.category-news .result-title {
  font-size: calc(var(--nis-font-lg) + 2px);
}

/* Видео: миниатюра 16:9 слева, 200 px. */
.result-videos .thumbnail_link {
  width: 200px;
  height: 112px;
  border-radius: var(--nis-radius-lg);
}

.result-videos .result-meta .result_author {
  color: var(--nis-text-muted);
}

/* Таблица «ключ — значение» (keyvalue) и атрибуты (file, paper, packages) */
.result-keyvalue table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--nis-font-sm);
}

.result-keyvalue th,
.result-keyvalue td {
  padding: var(--nis-space-2) var(--nis-space-3);
  border-bottom: 1px solid var(--nis-border);
  text-align: left;
  vertical-align: top;
}

.result-keyvalue caption {
  padding-bottom: var(--nis-space-2);
  color: var(--nis-text);
  font-weight: 500;
  text-align: left;
}

.result-keyvalue .col-key {
  width: 32%;
  color: var(--nis-text-muted);
  font-weight: 400;
}

.result-keyvalue .col-value {
  color: var(--nis-text);
  overflow-wrap: anywhere;
}

.result .attributes {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--nis-space-1) var(--nis-space-4);
  margin: var(--nis-space-3) 0 0;
  font-size: var(--nis-font-sm);
}

.result .attributes > div {
  display: contents;
}

.result .attributes dt {
  color: var(--nis-text-subtle);
}

.result .attributes dd {
  margin: 0;
  color: var(--nis-text);
  overflow-wrap: anywhere;
}

.result .attributes code {
  font-family: var(--nis-font-mono);
  font-size: var(--nis-font-xs);
}

.result .abstract {
  margin: var(--nis-space-2) 0 0;
  color: var(--nis-text-muted);
}

.result .comments {
  margin: var(--nis-space-2) 0 0;
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-sm);
}

.result .stat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nis-space-2);
  margin: var(--nis-space-2) 0 0;
  color: var(--nis-text-subtle);
}

.result .stat .badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--nis-space-2);
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-sunken);
  color: var(--nis-text-muted);
  font-size: var(--nis-font-xs);
}

.result .magnetlink,
.result .torrentfile {
  display: inline-flex;
  align-items: center;
  gap: var(--nis-space-1);
  margin-right: var(--nis-space-3);
  color: var(--nis-link);
  text-decoration: none;
}

.result .result-product-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--nis-space-1) var(--nis-space-3);
  margin: var(--nis-space-2) 0 0;
}

.result .result_price {
  color: var(--nis-text);
  font-size: var(--nis-font-lg);
  font-weight: 600;
}

.result .result_shipping,
.result .result_source_country {
  color: var(--nis-text-muted);
  font-size: var(--nis-font-sm);
}

.result .code-meta {
  font-size: var(--nis-font-sm);
  color: var(--nis-text-muted);
}

/* Код: моноширинный блок с горизонтальной прокруткой */
.result .codelines {
  margin-top: var(--nis-space-2);
  padding: var(--nis-space-2) var(--nis-space-3);
  overflow-x: auto;
  border-radius: var(--nis-radius-md);
  background: var(--nis-surface-sunken);
  font-family: var(--nis-font-mono);
  font-size: var(--nis-font-sm);
  line-height: 1.5;
}

.result .codelines pre,
.result .codelines code {
  margin: 0;
  font: inherit;
  white-space: pre;
}

/* Карта (map) */
.result .result-map-table {
  width: 100%;
  margin-top: var(--nis-space-2);
  border-collapse: collapse;
  font-size: var(--nis-font-sm);
}

.result .result-map-table th {
  width: 30%;
  padding: var(--nis-space-1) var(--nis-space-3) var(--nis-space-1) 0;
  color: var(--nis-text-subtle);
  font-weight: 400;
  text-align: left;
  vertical-align: top;
}

.result .result-map-table td {
  padding: var(--nis-space-1) 0;
  color: var(--nis-text);
  vertical-align: top;
}

.result .map-toggle {
  margin: var(--nis-space-2) 0 0;
}

.result .map-toggle a {
  display: inline-flex;
  align-items: center;
  gap: var(--nis-space-1);
  height: 28px;
  padding: 0 var(--nis-space-3);
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-sunken);
  color: var(--nis-link);
  font-size: var(--nis-font-sm);
  text-decoration: none;
  cursor: pointer;
}

.osm-map-box {
  width: 100%;
  height: 300px;
  margin: var(--nis-space-3) 0 0;
  overflow: hidden;
  border-radius: var(--nis-radius-lg);
  background: var(--nis-surface-sunken);
}

/* ---------- Картинки: плитка по высоте строки и просмотр справа ---------- */

#results.only_template_images #urls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nis-space-2);
}

#results.only_template_images #urls::after {
  content: "";
  flex-grow: 10;
}

#results.only_template_images #urls > hr {
  display: none;
}

#results.only_template_images #pagination {
  max-width: none;
}

#results.only_template_images .result-images {
  flex: 1 1 200px;
  height: 180px;
  margin: 0;
  overflow: hidden;
  border-radius: var(--nis-radius-md);
  background: var(--nis-surface-sunken);
}

#results.only_template_images .result-images[data-vim-selected]::before {
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: auto;
  border-radius: var(--nis-radius-md);
  background: none;
  box-shadow: inset 0 0 0 3px var(--nis-accent);
}

.result-images .image_link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.result-images img.image_thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-images .image_resolution,
.result-images .title,
.result-images .source {
  display: none;
  position: absolute;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.result-images .image_resolution {
  top: var(--nis-space-2);
  right: var(--nis-space-2);
  padding: 1px var(--nis-space-2);
  border-radius: var(--nis-radius-xs);
  background: var(--nis-surface-raised);
  color: var(--nis-text);
  font-size: var(--nis-font-xs);
}

.result-images .title {
  left: 0;
  right: 0;
  bottom: 20px;
  padding: var(--nis-space-1) var(--nis-space-2);
  background: var(--nis-surface-raised);
  color: var(--nis-text);
  font-size: var(--nis-font-sm);
}

.result-images .source {
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 var(--nis-space-2);
  background: var(--nis-surface-raised);
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-xs);
  line-height: 20px;
}

@media (hover: hover) {
  .result-images .image_link:hover .image_resolution,
  .result-images .image_link:hover .title,
  .result-images .image_link:hover .source,
  .result-images .image_link:focus-visible .title,
  .result-images .image_link:focus-visible .source {
    display: block;
  }
}

/* Панель просмотра: скрыта, пока картинка не выбрана кликом (JS: #results.image-detail-open). */
.result-images .detail {
  display: none;
}

#results.image-detail-open .result-images[data-vim-selected] .detail {
  display: flex;
  flex-direction: column;
  gap: var(--nis-space-3);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  box-sizing: border-box;
  width: 40%;
  min-width: 360px;
  padding: var(--nis-space-4) var(--nis-space-6) var(--nis-space-6);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--nis-surface-raised);
  border-left: 1px solid var(--nis-border);
  box-shadow: var(--nis-shadow-popover);
  color: var(--nis-text);
  font-size: var(--nis-font-md);
}

#results.image-detail-open .result-images[data-vim-selected] .detail .detail-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: var(--nis-space-1);
}

#results.image-detail-open .result-images[data-vim-selected] .detail .detail-toolbar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-sunken);
  color: var(--nis-text);
}

@media (hover: hover) {
  #results.image-detail-open .result-images[data-vim-selected] .detail .detail-toolbar a:hover {
    background: var(--nis-surface-hover);
  }
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-images-source {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  overflow: hidden;
  border-radius: var(--nis-radius-lg);
  background: var(--nis-surface-sunken);
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-images-source img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 360px);
  width: auto;
  height: auto;
  object-fit: contain;
}

#results.image-detail-open .result-images[data-vim-selected] .detail h4 {
  margin: 0 0 var(--nis-space-2);
  font-size: calc(var(--nis-font-lg) + 2px);
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-content {
  margin: 0 0 var(--nis-space-3);
  color: var(--nis-text-muted);
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nis-space-2);
  margin-bottom: var(--nis-space-3);
}

#results.image-detail-open .result-images[data-vim-selected] .detail .button-link {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 var(--nis-space-5);
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-sunken);
  color: var(--nis-text);
  font-weight: 500;
  text-decoration: none;
}

#results.image-detail-open .result-images[data-vim-selected] .detail .button-link.button-primary {
  background: var(--nis-accent);
  color: var(--nis-accent-fg);
}

#results.image-detail-open .result-images[data-vim-selected] .detail dl.result-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--nis-space-1) var(--nis-space-4);
  margin: 0 0 var(--nis-space-3);
  font-size: var(--nis-font-sm);
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-facts > div {
  display: contents;
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-facts dt {
  color: var(--nis-text-subtle);
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-facts dd {
  margin: 0;
  color: var(--nis-text);
  overflow-wrap: anywhere;
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-url {
  margin: 0;
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-sm);
  overflow-wrap: anywhere;
}

#results.image-detail-open .result-images[data-vim-selected] .detail .result-url a {
  color: var(--nis-link);
}

@media (max-width: 767px) {
  #results.image-detail-open .result-images[data-vim-selected] .detail {
    width: 100%;
    min-width: 0;
    padding: var(--nis-space-3) var(--nis-space-4) var(--nis-space-5);
    border-left: 0;
    box-shadow: none;
  }

  #results.image-detail-open .result-images[data-vim-selected] .detail .result-images-source img {
    max-height: calc(100vh - 300px);
  }
}

#results.image-detail-open #backToTop {
  display: none;
}

/* ---------- Правая колонка: карточка объекта, блоки ---------- */

#infoboxes {
  margin: 0 0 var(--nis-space-4);
}

.infobox {
  box-sizing: border-box;
  margin: 0 0 var(--nis-space-4);
  padding: var(--nis-space-5);
  border-radius: var(--nis-radius-xl);
  background: var(--nis-surface-raised);
  box-shadow: var(--nis-shadow-card);
  color: var(--nis-text);
  font-size: var(--nis-font-md);
  line-height: 1.5;
}

.infobox .infobox-image {
  display: block;
  width: 100%;
  max-height: 240px;
  margin: 0 0 var(--nis-space-4);
  object-fit: cover;
  border-radius: var(--nis-radius-lg);
  background: var(--nis-surface-sunken);
}

.infobox .title {
  margin: 0 0 var(--nis-space-2);
  color: var(--nis-text);
  font-size: var(--nis-font-2xl);
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.infobox .infobox-content {
  margin: 0 0 var(--nis-space-4);
  color: var(--nis-text-muted);
}

.infobox .attributes {
  display: grid;
  gap: var(--nis-space-2);
  margin: 0 0 var(--nis-space-4);
}

.infobox .attributes dl {
  display: grid;
  grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
  gap: 0 var(--nis-space-3);
  margin: 0;
  font-size: var(--nis-font-sm);
}

.infobox .attributes dt {
  color: var(--nis-text-subtle);
}

.infobox .attributes dd {
  margin: 0;
  color: var(--nis-text);
  overflow-wrap: anywhere;
}

.infobox .attributes dd img {
  max-width: 100%;
  height: auto;
}

.infobox .urls ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nis-space-2);
  margin: 0 0 var(--nis-space-3);
  padding: 0;
  list-style: none;
}

.infobox .urls a,
.infobox .relatedTopics input[type="submit"],
.suggestion-list input[type="submit"] {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--nis-space-3);
  border: 0;
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-sunken);
  color: var(--nis-link);
  font: inherit;
  font-size: var(--nis-font-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.infobox .relatedTopics h3 {
  margin: var(--nis-space-3) 0 var(--nis-space-2);
  color: var(--nis-text-muted);
  font-size: var(--nis-font-sm);
  font-weight: 600;
}

.infobox .relatedTopics form {
  display: inline-block;
  margin: 0 var(--nis-space-1) var(--nis-space-2) 0;
}

.infobox .relatedTopics input[type="submit"] {
  color: var(--nis-text);
}

.infobox-source {
  margin: var(--nis-space-3) 0 0;
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-sm);
}

@media (hover: hover) {
  .infobox .urls a:hover,
  .infobox .relatedTopics input[type="submit"]:hover,
  .suggestion-list input[type="submit"]:hover {
    background: var(--nis-surface-hover);
  }
}

/* Вместе с этим ищут */
.suggestions-block .title {
  margin: 0 0 var(--nis-space-3);
  color: var(--nis-text);
  font-size: var(--nis-font-lg);
  font-weight: 600;
  line-height: 1.3;
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nis-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.suggestion-list form {
  margin: 0;
}

.suggestion-list input[type="submit"] {
  color: var(--nis-text);
}

.serp-suggestions {
  margin: var(--nis-space-6) 0 0;
}

.serp-suggestions-aside {
  margin: 0 0 var(--nis-space-4);
}

/* Ещё: ссылка на поиск, скачивание (низкий приоритет) */
.serp-more {
  margin: 0;
  color: var(--nis-text-subtle);
  font-size: var(--nis-font-sm);
}

.serp-more > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--nis-space-2);
  padding: var(--nis-space-2) 0;
  color: var(--nis-text-muted);
}

.serp-more > summary::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.serp-more[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.serp-tool {
  margin: var(--nis-space-3) 0 0;
}

.serp-tool-title {
  margin: 0 0 var(--nis-space-2);
  color: var(--nis-text-muted);
  font-size: var(--nis-font-sm);
  font-weight: 600;
}

.serp-tool-formats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nis-space-2);
}

.serp-tool-formats form {
  margin: 0;
}

input.serp-tool-format,
#copy_url {
  appearance: none;
  -webkit-appearance: none;
  min-height: 28px;
  padding: 0 var(--nis-space-3);
  border: 0;
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-sunken);
  color: var(--nis-text);
  font: inherit;
  font-size: var(--nis-font-sm);
  cursor: pointer;
}

@media (hover: hover) {
  input.serp-tool-format:hover,
  #copy_url:hover {
    background: var(--nis-surface-hover);
  }
}

.selectable_url pre {
  margin: var(--nis-space-2) 0 0;
  padding: var(--nis-space-2) var(--nis-space-3);
  overflow-x: auto;
  border-radius: var(--nis-radius-md);
  background: var(--nis-surface-sunken);
  color: var(--nis-text-muted);
  font-family: var(--nis-font-mono);
  font-size: var(--nis-font-xs);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- Пагинация ---------- */

#pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nis-space-3) var(--nis-space-4);
  max-width: var(--nis-content-width);
  margin: var(--nis-space-8) 0 0;
}

#pagination form {
  margin: 0;
}

#pagination .previous_page {
  order: 1;
}

#pagination .numbered_pagination {
  order: 2;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nis-space-1);
}

#pagination .next_page {
  order: 3;
}

#pagination .previous_page button,
#pagination .next_page button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--nis-space-2);
  height: 40px;
  padding: 0 var(--nis-space-5);
  border: 0;
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-sunken);
  color: var(--nis-text);
  font: inherit;
  font-size: var(--nis-font-md);
  font-weight: 500;
  cursor: pointer;
}

@media (hover: hover) {
  #pagination .previous_page button:hover,
  #pagination .next_page button:hover {
    background: var(--nis-surface-hover);
  }
}

#pagination .previous_page div,
#pagination .next_page div {
  display: block;
}

#pagination .previous_page .sxng-icon-set-small,
#pagination .next_page .sxng-icon-set-small {
  width: 14px;
  height: 14px;
}

#pagination .numbered_pagination input.page_number,
#pagination .numbered_pagination input.page_number_current {
  appearance: none;
  -webkit-appearance: none;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--nis-space-2);
  border: 0;
  border-radius: var(--nis-radius-full);
  background: transparent;
  color: var(--nis-text-muted);
  font: inherit;
  font-size: var(--nis-font-md);
  cursor: pointer;
}

@media (hover: hover) {
  #pagination .numbered_pagination input.page_number:hover {
    background: var(--nis-surface-hover);
    color: var(--nis-text);
  }
}

#pagination .numbered_pagination input.page_number_current {
  background: var(--nis-accent-subtle);
  color: var(--nis-accent-text);
  font-weight: 600;
  cursor: default;
}

/* Бесконечная прокрутка (спиннер) */
.loader {
  width: 24px;
  height: 24px;
  margin: var(--nis-space-4) auto;
  border: 3px solid var(--nis-border);
  border-top-color: var(--nis-accent);
  border-radius: 50%;
  text-indent: -9999em;
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .loader {
    animation: nis-spin 900ms linear infinite;
  }

  @keyframes nis-spin {
    to {
      transform: rotate(360deg);
    }
  }
}

/* Наверх */
#backToTop {
  position: fixed;
  right: var(--nis-space-6);
  bottom: var(--nis-space-6);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
}

#results.scrolling #backToTop {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: no-preference) {
  #backToTop {
    transition: opacity var(--nis-motion-normal) var(--nis-motion-easing);
  }
}

#backToTop a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--nis-radius-full);
  background: var(--nis-surface-raised);
  box-shadow: var(--nis-shadow-popover);
  color: var(--nis-text);
}

@media (hover: hover) {
  #backToTop a:hover {
    background: var(--nis-surface-hover);
  }
}

/* ---------- Узкий экран ---------- */

@media (max-width: 639px) {
  #results {
    padding-top: var(--nis-space-3);
  }

  .result .result-main {
    gap: var(--nis-space-3);
  }

  .result .thumbnail_link {
    width: 72px;
    height: 72px;
  }

  .result .result-title {
    font-size: calc(var(--nis-font-lg) + 1px);
  }

  .result-videos .thumbnail_link {
    width: 144px;
    height: 81px;
  }

  .result[data-vim-selected]::before {
    left: calc(-1 * var(--nis-space-2));
  }

  #answers .answer-value {
    font-size: var(--nis-font-2xl);
  }

  #results.only_template_images #urls {
    gap: var(--nis-space-1);
  }

  #results.only_template_images .result-images {
    flex-basis: 140px;
    height: 120px;
  }

  #pagination {
    gap: var(--nis-space-2);
  }

  #pagination .previous_page,
  #pagination .next_page {
    width: 100%;
  }

  #pagination .previous_page button,
  #pagination .next_page button {
    width: 100%;
  }

  #pagination .numbered_pagination {
    justify-content: center;
    width: 100%;
  }

  #results .filter-pill {
    height: 36px;
  }
}
