/* =========================
   TARGET HIGHLIGHT
   Мягкая подсветка фрагмента при переходе из текста в текст

   Важно:
   не используем :target,
   чтобы обычные якоря, карта сфер, попап и меню не подсвечивались.
========================= */

.sphere-paper .ud-highlight-target {
  position: relative;
  border-radius: clamp(0.35rem, 1vw, 0.65rem);
  scroll-margin-top: clamp(5rem, 14svh, 9rem);
}

/* Убираем браузерную рамку при фокусе */
.sphere-paper .ud-highlight-target:focus {
  outline: none;
}

/* Подсветка включается только JS-классом */
.sphere-paper .ud-highlight-target.is-ud-highlighted {
  animation: ud-target-highlight-soft 3.4s ease-out 1;
}

/* Еле заметная подсветка */
@keyframes ud-target-highlight-soft {
  0% {
    background-color: rgba(255, 232, 170, 0.16);
  }

  45% {
    background-color: rgba(255, 238, 190, 0.08);
  }

  100% {
    background-color: transparent;
  }
}

/* =========================
   POEM
   Компактный стихотворный блок
   Без рамки, без коробки, без растягивания на весь лист
========================= */

.sphere-paper .ud-poem {
  display: table;
  width: fit-content;
  max-width: 100%;

  margin-top: clamp(0.9rem, 2vw, 1.35rem);
  margin-bottom: clamp(0.9rem, 2vw, 1.35rem);
  margin-left: auto;
  margin-right: auto;

  padding: clamp(0.2rem, 0.8vw, 0.45rem) clamp(0.35rem, 1vw, 0.65rem);

  border: 0;
  background: transparent;
  box-shadow: none;

  line-height: 1.28;
}

/* На случай если браузер или тема дают blockquote свои отступы */
.sphere-paper blockquote.ud-poem {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Заголовок внутри стиха, если он есть */
.sphere-paper .ud-poem h4 {
  margin-top: 0;
  margin-bottom: clamp(0.45rem, 1.2vw, 0.7rem);
  padding: 0;
  line-height: 1.25;
}

/* Абзацы внутри стиха: убираем большой воздух темы */
.sphere-paper .ud-poem p {
  margin-top: 0;
  margin-bottom: clamp(0.45rem, 1vw, 0.7rem);
  padding: 0;
  line-height: 1.28;
}

/* Последний абзац без нижнего отступа */
.sphere-paper .ud-poem p:last-child {
  margin-bottom: 0;
}

/* Строки стихотворения всегда столбцом, но плотно */
.sphere-paper .ud-poem-line {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1.28;
}

/* Если WordPress вдруг добавит br внутри стихотворных строк */
.sphere-paper .ud-poem br {
  display: none;
}

/* Если у человека отключены анимации */
@media (prefers-reduced-motion: reduce) {
  .sphere-paper .ud-highlight-target.is-ud-highlighted {
    animation: none;
    background-color: rgba(255, 238, 190, 0.08);
  }
}