/* Abireg NER — стили разметки сущностей */

/* Сущность выглядит ровно как окружающий текст: тот же шрифт, цвет, вес,
   без подчёркивания. Единственный сигнал — cursor:pointer и tooltip на hover.
   Подчёркивание появляется только при наведении.
   Только первое упоминание оборачивается; повторы — plain text. */
/* !important перебивает фирменные красные стили ссылок сайта (.newstext a и т.п.),
   иначе сущность красится в #c5001e. Сущность = обычный текст, без подсветки. */
.ner-entity,
.ner-entity:link,
.ner-entity:visited {
  position: relative;
  display: inline;
  color: inherit !important;
  font: inherit;
  font-weight: inherit !important;
  font-style: inherit;
  text-decoration: none !important;
  border-bottom: none !important;
  background: none !important;
  cursor: pointer;
}
.ner-entity:hover {
  color: inherit !important;
  border-bottom: 1px dotted currentColor !important;
  text-decoration: none !important;
}

/* Tooltip */
.ner-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 10px 14px;
  min-width: 180px;
  max-width: 260px;
  white-space: normal;
  text-align: left;
  pointer-events: none;
  font-size: 13px;
  line-height: 1.4;
}

/* Стрелка tooltip */
.ner-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}
.ner-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #e0e0e0;
}

/* Показываем tooltip на hover (desktop) */
@media (hover: hover) {
  .ner-entity[data-ner-slug]:hover .ner-tooltip {
    display: block;
    pointer-events: auto;
  }
}

/* Показываем tooltip при .ner-active (мобильные) */
.ner-entity.ner-active .ner-tooltip {
  display: block;
  pointer-events: auto;
}

.ner-tooltip-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  margin-bottom: 3px;
}

.ner-tooltip-name {
  display: block;
  font-weight: 600;
  color: #222;
  margin-bottom: 6px;
}

.ner-tooltip-link {
  display: inline-block;
  font-size: 12px;
  color: #1a6ed8;
  text-decoration: none;
  border-bottom: none !important;
}
.ner-tooltip-link:hover {
  text-decoration: underline;
}

/* Мобильные: tooltip снизу если нет места сверху */
@media (max-width: 767px) {
  .ner-tooltip {
    bottom: auto;
    top: calc(100% + 6px);
    max-width: 220px;
  }
  .ner-tooltip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #fff;
  }
  .ner-tooltip::before {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #e0e0e0;
  }
}

/* variantA-dotted */
/* Вариант А (27.07.2026, выбор Шефа): сущность видно как ссылку —
   пунктир фирменного цвета под текстом. Сам текст остаётся чёрным,
   чтобы не перетягивать внимание при 20-40 сущностях на статью.
   Доступность: сигнал не только цветом (WCAG 1.4.1) — есть пунктир. */
.ner-entity,
.ner-entity:link,
.ner-entity:visited {
  border-bottom: 1px dotted #B6001B !important;
  text-decoration: none !important;
}
.ner-entity:hover,
.ner-entity:focus-visible {
  border-bottom: 1px solid #B6001B !important;
}
.ner-entity:focus-visible {
  outline: 2px solid #B6001B;
  outline-offset: 2px;
}
@media (hover: none) {
  .ner-entity, .ner-entity:link, .ner-entity:visited {
    border-bottom: 1px dotted #B6001B !important;
  }
}
