/*
  «Ранее по теме» — таймлайн на странице материала.
  Подключается после style_19.css и adaptive_1280.css.
  Разметка: public/templates/materials/partials/earlier_news.html.mustache
  Поведение: public/js_19/related_news.js
*/
.related-news {
  --related-news-duration: 200ms;
  --related-news-easing: ease-in-out;
  clear: both; margin: 40px 0 80px;
}
.content .related-news .related-news__heading {
  margin: 0 0 44px; padding: 0; border: 0; color: #000;
  font-size: 24px; font-weight: 700; line-height: 1.2; text-transform: uppercase;
}

/* Геометрия блока; линия, даты, время и иконки наследуются от .list. */
.content .related-news .list {
  width: calc(100% - 20px); margin: 0 0 0 20px; padding: 0 0 32px;
}
.related-news .NewsList { margin: 0; padding: 0; }
.content .related-news .list li.related-news__item {
  margin: 0; padding: 0 0 24px 118px;
}
.content .related-news .list li.date {
  display: grid; grid-template-rows: 1fr;
  box-sizing: border-box; width: 100%; max-width: none;
  margin: 0 0 8px; padding: 16px 0 16px 52px; line-height: 24px;
}
.content .related-news .list li.date > span {
  left: 0; padding: 0 10px; min-height: 0; overflow: hidden; justify-self: start;
}
.content .related-news .list li > a.related-news__link {
  display: block; width: auto; max-width: none; color: #000;
  font-size: 20px; line-height: 24px; text-decoration: none;
  overflow-wrap: anywhere;
}
.content .related-news .list li .time { left: -20px; line-height: 24px; white-space: nowrap; }
.content .related-news .list li .type {
  left: 62px; top: 0; padding: 0; margin: 0; line-height: 24px;
}
/* .material-detail .text не должна менять унаследованную иконку .type.text. */
.related-news .type.text::after { content: none; }
.related-news__short-date { display: none; color: #000; }
.related-news__summary { display: grid; grid-template-rows: 1fr; margin-top: 20px; font-weight: 400; }
.related-news__summary-inner { min-height: 0; overflow: hidden; }
.related-news__exclusive {
  padding: 1px 5px; background: #01c4ff; color: #fff;
  font-size: 14px; font-weight: 700; line-height: 1; text-transform: uppercase;
  vertical-align: 2px;
}
.related-news__headline { transition: color .15s ease; }
.content .related-news .related-news__link:hover .related-news__headline,
.content .related-news .related-news__link:focus-visible .related-news__headline { color: #00c0fd; }
.related-news__link:focus-visible,
.related-news__toggle:focus-visible { outline: 2px solid #00a3d9; outline-offset: 4px; }

.related-news__control { position: relative; height: 44px; margin: 4px 0 12px; }
.related-news__control::before {
  content: ""; position: absolute; top: 50%; left: 12px; right: 0; height: 1px;
  background: #ccc;
}
.related-news__toggle {
  position: relative; left: -22px; display: block; box-sizing: border-box;
  width: 44px; height: 44px; margin: 0; padding: 0; border: 0;
  border-radius: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none; touch-action: manipulation;
}
.related-news__toggle::before {
  content: ""; position: absolute; inset: 12px 10px; background: #fff;
}
.related-news__toggle::after {
  content: ""; position: absolute; top: 15px; left: 14px;
  width: 0; height: 0; border-left: 8px solid transparent;
  border-right: 8px solid transparent; border-top: 14px solid #00c0fd;
  transition: transform var(--related-news-duration) var(--related-news-easing);
}
.related-news__toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.related-news__control[hidden] { display: none; }

/* Сокращенное представление тех же новостей, заданных backend. */
.content .related-news .list [data-collapsed="true"] li.date {
  grid-template-rows: 0fr; padding-top: 0; padding-bottom: 0; margin-bottom: 0; opacity: 0;
}
.related-news [data-collapsed="true"] .related-news__summary {
  grid-template-rows: 0fr; margin-top: 0; opacity: 0;
}
.related-news [data-collapsed="true"] .related-news__clock { display: none; }
.related-news [data-collapsed="true"] .related-news__short-date { display: inline; }
.content .related-news [data-collapsed="true"] li.related-news__item {
  padding-left: 202px; padding-bottom: 24px;
}
.content .related-news [data-collapsed="true"] li > a.related-news__link { font-weight: 400; }
.content .related-news [data-collapsed="true"] li .time { left: 62px; }
.content .related-news [data-collapsed="true"] li .type { left: 146px; }
.related-news [data-related-news-fold] .related-news__item::before {
  content: ""; position: absolute; left: -7px; top: 5px;
  width: 14px; height: 14px; border-radius: 50%; background: #d0d0d0;
  box-shadow: 0 0 0 7px #fff; opacity: 0; pointer-events: none;
}
.related-news [data-collapsed="true"] .related-news__item::before { opacity: 1; }

/* Включается при первом клике: начальный компактный вид появляется сразу.
   Grid анимирует естественную высоту, без лимита max-height и замеров JS. */
.related-news [data-related-news-motion] li.date,
.related-news [data-related-news-motion] .related-news__summary {
  transition-property: grid-template-rows, padding-top, padding-bottom, margin-top, margin-bottom, opacity;
  transition-duration: var(--related-news-duration);
  transition-timing-function: var(--related-news-easing);
}
.related-news [data-related-news-motion] .related-news__item {
  transition: padding-left var(--related-news-duration) var(--related-news-easing);
}
.related-news [data-related-news-motion] .time,
.related-news [data-related-news-motion] .type {
  transition: left var(--related-news-duration) var(--related-news-easing);
}
.related-news [data-related-news-motion] .related-news__item::before {
  transition: opacity var(--related-news-duration) var(--related-news-easing);
}

@media only screen and (max-width: 760px) {
  .related-news { margin: 32px 0 48px; }
  .content .related-news .related-news__heading { margin-bottom: 28px; font-size: 22px; }
  .content .related-news .list { width: calc(100% - 12px); margin-left: 12px; padding-bottom: 12px; }
  .content .related-news .list li.date { padding: 12px 0 12px 16px; font-size: 18px; }
  .content .related-news .list li.date > span { padding: 0 8px; }
  .content .related-news .list li.related-news__item,
  .content .related-news [data-collapsed="true"] li.related-news__item { padding: 30px 0 24px 24px; }
  .content .related-news .list li > a.related-news__link { font-size: 18px; line-height: 22px; }
  .content .related-news .list li .time,
  .content .related-news [data-collapsed="true"] li .time { left: 24px; font-size: 16px; }
  .content .related-news .list li .type,
  .content .related-news [data-collapsed="true"] li .type { left: 88px; }
  .related-news__summary { margin-top: 12px; }
  .related-news__exclusive { font-size: 12px; vertical-align: 1px; }
  .related-news__control { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .related-news { --related-news-duration: 0ms; }
  .related-news__toggle::after, .related-news__headline { transition: none; }
}



/* Полоска */
.content .related-news .related-news__header {
  display: flex;
  align-items: center;
  gap: 20px;
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 44px;
  padding: 15px 20px;
  background: #00c4ff;
  color: #fff;
  font-family: 'ProximaNova', sans-serif;
  font-size: 24px;
  line-height: 30px;
  text-transform: uppercase;
}

.related-news__header .related-news__history-icon {
  display: block;
  flex: 0 0 30px;
}

.content .related-news .related-news__header .related-news__heading {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  color: #fff;
  font-family: inherit;
  font-size: inherit;
  font-weight: 800;
  line-height: inherit;
  text-transform: inherit;
}

.related-news__header .related-news__separator {
  flex: 0 0 auto;
  font-weight: 700;
}

.content .related-news .related-news__header .related-news__all {
  color: #fff;
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  line-height: inherit;
  text-decoration: underline;
  text-underline-position: under;
}

.content .related-news .related-news__header .related-news__all:hover {
  text-decoration: none;
}

.content .related-news .related-news__header .related-news__all:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

@media only screen and (max-width: 760px) {
  .content .related-news .related-news__header {
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 28px;
    font-size: 22px;
  }

  .related-news__header .related-news__separator {
    display: none;
  }

  .content .related-news .related-news__header .related-news__heading {
    flex: 1 1 0;
    min-width: 0;
  }

  .content .related-news .related-news__header .related-news__all {
    flex: 0 0 100%;
    box-sizing: border-box;
    padding-left: 50px;
    font-size: 18px;
    line-height: 24px;
  }
}
