/* Стили базы знаний: список статей и страница статьи.
   Подключается только страницами раздела «База знаний», основной style.css не меняется. */

/* ── Список статей ──────────────────────────────────────── */

.blog-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 32px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--card-bg);
  color: inherit;
  text-decoration: none;
}
.blog-card:hover { box-shadow: 0 0 0 2px var(--forest-ink); }
.blog-card:focus-visible {
  outline: 2px solid var(--forest-ink);
  outline-offset: 2px;
}

.blog-card__tag {
  align-self: flex-start;
  margin-bottom: 16px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--forest-ink);
  color: var(--paper);
  font-weight: 500;
  font-size: 13px;
}

.blog-card__title {
  margin-bottom: 10px;
  font-size: 21px;
  line-height: 1.2;
}

.blog-card__text {
  flex-grow: 1;
  font-size: 16px;
  color: var(--slate);
}

.blog-card__meta {
  margin-top: 20px;
  font-size: 14px;
  color: var(--slate);
}

/* Первая карточка в списке статей растягивается, чтобы в последнем ряду не было пустых ячеек */
.blog-card--wide { grid-column: span 2; }
.blog-card--full { grid-column: 1 / -1; }

/* Блок «Статьи по теме» на страницах услуг */
.section--articles { padding-bottom: 0; }

.articles-more {
  margin-top: 32px;
  text-align: center;
}
.articles-more a {
  color: var(--forest-ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Заголовок статьи ───────────────────────────────────── */

.article-head {
  padding: 32px 0 40px;
  background: var(--paper);
}

.article-head__inner { max-width: 880px; }

.article-head__title {
  font-weight: 900;
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: .98;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.article-head__lead {
  max-width: 62ch;
  margin-top: 20px;
  font-size: 20px;
  line-height: 1.45;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 24px;
  font-size: 15px;
  color: var(--slate);
}

/* ── Колонки: оглавление и текст ────────────────────────── */

.article-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 760px);
  gap: 56px;
  padding-bottom: var(--section-gap);
}

.article-toc {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  align-self: start;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--fog);
  font-size: 15px;
}

.article-toc__title {
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--obsidian);
}

.article-toc ol {
  display: grid;
  gap: 8px;
}

.article-toc a {
  color: var(--charcoal);
  text-decoration: none;
}
.article-toc a:hover {
  color: var(--forest-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Текст статьи ───────────────────────────────────────── */

.article-body {
  font-size: 18px;
  line-height: 1.6;
}

.article-body > * + * { margin-top: 18px; }

.article-body h2 {
  margin-top: 48px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.article-body h3 {
  margin-top: 32px;
  font-size: 22px;
}

.article-body ul,
.article-body ol { padding-left: 24px; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li + li { margin-top: 8px; }

.article-body a {
  color: var(--forest-ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body strong { font-weight: 600; }

/* Короткий ответ в начале статьи */
.article-summary {
  padding: 24px 28px;
  border-radius: var(--radius);
  background: var(--linen-mist);
  color: var(--forest-ink);
}
.article-summary__title {
  margin-bottom: 10px;
  font-weight: 600;
}
.article-summary ul { padding-left: 20px; }

/* Выноска с важным уточнением */
.article-note {
  padding: 20px 24px;
  border-left: 4px solid var(--lime-voltage);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--fog);
  font-size: 17px;
}

/* Таблицы прокручиваются внутри своей рамки, а не всей страницы */
.article-table {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--ring);
}
.article-table table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.45;
}
.article-table th,
.article-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.article-table th {
  background: var(--fog);
  color: var(--obsidian);
  font-weight: 600;
}
.article-table tr:last-child td { border-bottom: 0; }

/* Таблица из двух колонок помещается на телефоне без прокрутки */
.article-table--compact table { min-width: 0; }

/* Предложение помощи внутри статьи */
.article-cta {
  margin-top: 40px;
  padding: 32px;
  border-radius: var(--radius-lg);
  background: var(--forest-ink);
  color: rgba(255, 255, 255, .86);
}
.article-cta__title {
  margin-bottom: 10px;
  color: var(--paper);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.article-cta .button { margin-top: 20px; }
.article-body .article-cta a.button {
  color: var(--forest-ink);
  text-decoration: none;
}

/* Вопросы и ответы внутри статьи используют общие стили .faq-item */
.article-body .faq-list { margin-top: 20px; }

.article-sources {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--slate);
}
.article-sources ul { margin-top: 8px; }

.article-updated {
  margin-top: 16px;
  font-size: 15px;
  color: var(--slate);
}

/* Другие статьи */
.article-related { padding: var(--section-gap) 0; }
.article-related .blog-list { margin-top: 24px; }

/* ── Адаптивность ───────────────────────────────────────── */

@media (max-width: 1080px) {
  .blog-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-card--full { grid-column: auto; }
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
  .article-toc { position: static; }
}

@media (max-width: 640px) {
  .blog-list { grid-template-columns: minmax(0, 1fr); }
  .blog-card--wide { grid-column: auto; }
  .blog-card { padding: 22px; }
  .article-table--compact table { font-size: 14px; }
  .article-table--compact th,
  .article-table--compact td { padding: 10px 8px; }
  .article-head__lead { font-size: 18px; }
  .article-body { font-size: 17px; }
  .article-body h2 { font-size: 25px; }
  .article-cta {
    padding: 24px;
    border-radius: 20px;
  }
}
