/* ==========================================================================
   СТРАНИЦА СТАТЬИ — Современная журнальная типографика (Mobile First)
   ========================================================================== */

.article_page {
  background-color: #ffffff;
  color: #1e293b;
  padding: 18px 0 60px;
}

.article_container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.article_breadcrumb {
  margin-bottom: 20px;
}

/* --- 1. Шапка статьи --- */
.article_header {
  margin-bottom: 28px;
}

@media (min-width: 992px) {
  .article_header {
    margin-bottom: 38px;
  }
}

.article_meta_top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 14px;
}

.article_cat_badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.article_cat_badge:hover {
  opacity: 0.85;
}

.article_cat_badge.badge-green {
  background-color: #ecfccb;
  color: #3f6212;
}

.article_cat_badge.badge-blue {
  background-color: #e0f2fe;
  color: #0369a1;
}

.article_meta_item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
}

.article_main_title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.22;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.02em;
  max-width: 920px;
}

@media (min-width: 768px) {
  .article_main_title {
    font-size: 34px;
  }
}

@media (min-width: 1024px) {
  .article_main_title {
    font-size: 40px;
    line-height: 1.18;
  }
}

/* Обложка статьи (выводится только при наличии фото) */
.article_cover {
  margin: 22px 0 0 0;
  border-radius: 14px;
  overflow: hidden;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
}

@media (min-width: 768px) {
  .article_cover {
    margin-top: 28px;
    border-radius: 18px;
  }
}

.article_cover img {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: cover;
}

/* --- 2. Сетка страницы (Контент + Сайдбар с содержанием) --- */
.article_layout {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

@media (min-width: 1024px) {
  .article_layout.has-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 760px) 300px;
    justify-content: space-between;
    align-items: start;
    gap: 44px;
  }

  .article_layout.no-sidebar .article_content_col {
    max-width: 780px;
  }

  /* На десктопе контент слева, содержание липкое справа */
  .article_content_col {
    order: 1;
  }

  .article_sidebar {
    order: 2;
    position: sticky;
    top: 95px;
  }
}

/* --- 3. Оглавление (Содержание статьи) --- */
.article_toc_card {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
}

.article_toc_toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
}

.toc_chevron {
  color: #64748b;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.article_toc_card.is-open .toc_chevron {
  transform: rotate(180deg);
}

.article_toc_nav {
  display: none;
  padding: 0 18px 16px;
}

.article_toc_card.is-open .article_toc_nav {
  display: block;
}

@media (min-width: 1024px) {
  .article_toc_toggle {
    cursor: default;
    padding-bottom: 10px;
  }

  .toc_chevron {
    display: none;
  }

  .article_toc_nav {
    display: block !important;
    max-height: calc(100vh - 340px);
    overflow-y: auto;
  }
}

.article_toc_list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 2px solid #e2e8f0;
}

.toc_item {
  margin: 0;
  padding-left: 14px;
  position: relative;
}

.toc_item.toc_h3 {
  padding-left: 26px;
}

.toc_link {
  display: block;
  font-size: 13.5px;
  line-height: 1.4;
  color: #475569;
  text-decoration: none;
  transition: color 0.2s ease;
}

.toc_link:hover {
  color: #1d70b8;
}

.toc_link.is-active {
  color: #1d70b8;
  font-weight: 700;
}

.toc_link.is-active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 2px;
  bottom: 2px;
  width: 2px;
  background-color: #1d70b8;
}

/* Мини-CTA в сайдбаре (виден только на десктопе) */
.article_side_cta {
  display: none;
}

@media (min-width: 1024px) {
  .article_side_cta {
    display: block;
    margin-top: 20px;
    padding: 20px;
    border-radius: 14px;
    background: linear-gradient(155deg, #f4faeb 0%, #eaf6d8 100%);
    border: 1px solid #d9f99d;
  }

  .side_cta_title {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px 0;
    line-height: 1.3;
  }

  .side_cta_text {
    font-size: 13.5px;
    line-height: 1.45;
    color: #334155;
    margin: 0 0 14px 0;
  }

  .side_cta_btn {
    width: 100%;
    padding: 11px 16px;
    background-color: #8cc63f;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
      background-color 0.2s ease,
      transform 0.2s ease;
  }

  .side_cta_btn:hover {
    background-color: #7ab332;
    transform: translateY(-1px);
  }
}

/* ==========================================================================
   4. ТЕЛО СТАТЬИ ИЗ WYSIWYG (Типографика, картинки, таблицы, цитаты)
   ========================================================================== */

.article_body {
  font-size: 16px;
  line-height: 1.72;
  color: #1e293b;
  word-wrap: break-word;
}

@media (min-width: 768px) {
  .article_body {
    font-size: 17px;
    line-height: 1.75;
  }
}

/* Абзацы */
.article_body p {
  margin: 0 0 18px 0;
}

.article_body p:empty,
.article_body p.is-empty-spacer {
  display: none;
}

/* Заголовки (с защитой от перекрытия шапкой при переходе по якорю) */
.article_body h2 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.28;
  color: #0f172a;
  margin: 38px 0 16px 0;
  letter-spacing: -0.01em;
  scroll-margin-top: 95px;
}

@media (min-width: 768px) {
  .article_body h2 {
    font-size: 26px;
    margin-top: 44px;
  }
}

.article_body h2:first-child {
  margin-top: 0;
}

.article_body h3 {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.32;
  color: #0f172a;
  margin: 28px 0 12px 0;
  scroll-margin-top: 95px;
}

@media (min-width: 768px) {
  .article_body h3 {
    font-size: 21px;
  }
}

.article_body h4 {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin: 22px 0 10px 0;
}

/* Ссылки в тексте */
.article_body a {
  color: #1d70b8;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(29, 112, 184, 0.4);
  transition:
    color 0.2s ease,
    text-decoration-color 0.2s ease;
}

.article_body a:hover {
  color: #14538a;
  text-decoration-color: #14538a;
}

/* Списки */
.article_body ul,
.article_body ol {
  margin: 0 0 22px 0;
  padding-left: 24px;
}

.article_body li {
  margin-bottom: 10px;
  padding-left: 4px;
}

.article_body ul li::marker {
  color: #8cc63f;
  font-size: 1.1em;
}

.article_body ol li::marker {
  color: #1d70b8;
  font-weight: 700;
}

/* --- КАРТИНКИ И СХЕМЫ ИЗ WYSIWYG --- */
.article_body img {
  display: block;
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  margin: 26px auto !important;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
  background-color: #ffffff;
  cursor: zoom-in;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
  float: none !important; /* На смартфонах убираем обтекание, чтобы текст не сжимался */
}

.article_body img:hover {
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.11);
}

/* На планшетах и десктопе возвращаем аккуратное обтекание, если автор задал его в редакторе */
@media (min-width: 680px) {
  .article_body img[style*="float: left"],
  .article_body img[style*="float:left"] {
    float: left !important;
    max-width: 48% !important;
    margin: 6px 24px 16px 0 !important;
  }

  .article_body img[style*="float: right"],
  .article_body img[style*="float:right"] {
    float: right !important;
    max-width: 48% !important;
    margin: 6px 0 16px 24px !important;
  }
}

/* Подпись под картинкой (генерируется JS из атрибута alt/title) */
.article_figure {
  margin: 26px 0;
  text-align: center;
}

.article_figure img {
  margin: 0 auto !important;
}

.article_figcaption {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #64748b;
}

/* --- ВРЕЗКИ И ЦИТАТЫ (Blockquote) --- */
.article_body blockquote {
  margin: 28px 0;
  padding: 18px 20px !important;
  background-color: #f0f7ff;
  border-left: 4px solid #1d70b8;
  border-radius: 0 12px 12px 0;
  color: #0f172a;
  font-size: 15.5px;
  line-height: 1.65;
  border: none;
}

@media (min-width: 768px) {
  .article_body blockquote {
    padding: 22px 26px !important;
    font-size: 16.5px;
  }
}

.article_body blockquote p:last-child {
  margin-bottom: 0;
}

/* --- АДАПТИВНЫЕ ТАБЛИЦЫ ИЗ WYSIWYG --- */
.table_responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 28px 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background-color: #ffffff;
}

.article_body table {
  width: 100% !important;
  border-collapse: collapse;
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  min-width: 520px;
}

.article_body th,
.article_body td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  vertical-align: top;
}

.article_body th:last-child,
.article_body td:last-child {
  border-right: none;
}

.article_body tr:last-child td {
  border-bottom: none;
}

.article_body th {
  background-color: #f8fafc;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 2px solid #cbd5e1;
}

.article_body tbody tr:hover td {
  background-color: #f8fafc;
}

/* Разделитель */
.article_body hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 34px 0;
}

/* --- 5. Нижний CTA блок после статьи --- */
.article_bottom_cta {
  margin-top: 44px;
  padding: 24px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 768px) {
  .article_bottom_cta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 30px 32px;
    gap: 28px;
  }
}

.bottom_cta_badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background-color: rgba(140, 198, 63, 0.2);
  color: #a3e635;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.bottom_cta_title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 8px 0;
  color: #ffffff;
}

@media (min-width: 768px) {
  .bottom_cta_title {
    font-size: 22px;
  }
}

.bottom_cta_desc {
  font-size: 14.5px;
  line-height: 1.5;
  color: #cbd5e1;
  margin: 0;
  max-width: 480px;
}

.bottom_cta_actions {
  flex-shrink: 0;
}

.bottom_cta_btn {
  width: 100%;
  padding: 13px 24px;
  background-color: #8cc63f;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.bottom_cta_btn:hover {
  background-color: #7ab332;
  transform: translateY(-1px);
}

/* --- 6. Навигация под статьёй --- */
.article_footer_nav {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.article_back_link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #1d70b8;
  text-decoration: none;
  transition: color 0.2s ease;
}

.article_back_link:hover {
  color: #14538a;
}

.article_share_btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.article_share_btn:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

/* --- 7. Лайтбокс для схем и картинок --- */
.article_lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(15, 23, 42, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.article_lightbox[hidden] {
  display: none;
}

.article_lightbox img {
  max-width: 94vw;
  max-height: 82vh;
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.lightbox_close {
  position: absolute;
  top: 16px;
  right: 22px;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1.5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox_caption {
  margin-top: 12px;
  color: #e2e8f0;
  font-size: 14px;
  text-align: center;
  max-width: 680px;
}
