/* Страница новости: теги-баблы, кнопки, таблицы/галереи */

.news-article {
  max-width: 52rem;
  margin: 0 auto;
  min-width: 0;
}

.news-article header h1 {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

.news-article .content {
  font-size: 1.05rem;
  line-height: 1.65;
}

/* Теги внизу — «баблы», как tags-links на Bitrix */
.news-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid #e8eaed;
}

.news-tag {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  background: #f0f1f1;
  color: #4c4c4c !important;
  text-decoration: none !important;
  border-radius: 999px;
  font-size: 0.875rem;
  line-height: 1.3;
  transition: background 0.15s ease, color 0.15s ease;
}

.news-tag:hover {
  background: #dedede;
  color: #1a1a2e !important;
}

/* Единый стиль CTA-кнопок (btn-blue из Bitrix + markdown «Подробнее») */
.news-article .content a.btn-blue {
  display: inline-block;
  margin: 0.5rem 0.35rem 0.5rem 0;
  padding: 0.7rem 1.35rem;
  min-width: 10rem;
  box-sizing: border-box;
  text-align: center;
  background: #0083b0;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  border: none;
  vertical-align: middle;
  transition: background 0.15s ease;
}

.news-article .content a.btn-blue:hover {
  background: #006a8e;
  color: #fff !important;
}

/* Таблицы из Bitrix-вёрстки новостей */
.news-article .content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  border: none;
  table-layout: fixed;
}

.news-article .content table td,
.news-article .content table th {
  border: none;
  vertical-align: middle;
  padding: 0.5rem 0.75rem;
  word-wrap: break-word;
}

.news-article .content table img,
.news-article .content table .article-content__img {
  display: inline-block;
  max-width: min(240px, 100%);
  width: auto;
  height: auto;
  margin: 0.35rem;
  vertical-align: middle;
}

/* Несколько скриншотов в одном абзаце — в ряд, не на всю ширину каждый */
.news-article .content p:has(> img:nth-of-type(2)) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-start;
  align-items: flex-start;
}

.news-article .content p:has(> img:nth-of-type(2)) > .article-content__img,
.news-article .content p:has(> img:nth-of-type(2)) > img {
  display: block;
  flex: 0 1 auto;
  max-width: min(260px, calc(50% - 0.5rem));
  width: auto;
  height: auto;
  margin: 0;
}

.news-article .content p:has(> img:nth-of-type(3)) > .article-content__img,
.news-article .content p:has(> img:nth-of-type(3)) > img {
  max-width: min(220px, calc(33.33% - 0.6rem));
}

/* Одиночная обложка/баннер — на ширину контента */
.news-article .content > p:has(> img:only-child) > .article-content__img,
.news-article .content > p:has(> img:only-child) > img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  margin: 1rem 0;
}

@media (max-width: 700px) {
  .news-article .content table,
  .news-article .content table tbody,
  .news-article .content table tr,
  .news-article .content table td {
    display: block;
    width: 100% !important;
  }

  .news-article .content table td {
    padding: 0.5rem 0;
  }

  .news-article .content p:has(> img:nth-of-type(2)) > .article-content__img,
  .news-article .content p:has(> img:nth-of-type(2)) > img,
  .news-article .content p:has(> img:nth-of-type(3)) > .article-content__img,
  .news-article .content p:has(> img:nth-of-type(3)) > img {
    max-width: min(100%, 320px);
  }
}
