/* ============================================================
   article.css — стили статьи для rent2u.ru
   v1.1: исправлено прилипание, улучшен блок автора
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

/* ---------- Переменные ---------- */
:root {
  --art-accent:        #2b7de9;
  --art-accent-light:  #e8f1fd;
  --art-accent-dark:   #1a5bbf;
  --art-text:          #1a1d23;
  --art-muted:         #6b7280;
  --art-border:        #e5e8ec;
  --art-bg:            #ffffff;
  --art-bg-alt:        #f7f9fc;
  --art-radius:        10px;
  --art-font:          'Inter', 'Manrope', system-ui, -apple-system, sans-serif;
  --art-header-h:      68px; /* высота sticky-шапки сайта */
}

/* ============================================================
   ОБЁРТКА — сброс sticky-эффекта от шапки сайта
   ============================================================ */
.art-wrap {
  font-family: var(--art-font);
  color: var(--art-text);
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 60px;
  /* Отступ сверху чтобы sticky-шапка сайта (68px) не перекрывала контент */
  scroll-margin-top: calc(var(--art-header-h) + 16px);
}

/* Сброс: ни один элемент статьи не должен быть sticky/fixed */
.art-wrap,
.art-wrap *,
.art-header,
.art-meta,
.art-h1,
.art-breadcrumbs {
  position: static !important;
}
/* Исключения — только псевдоэлементы и элементы с явным relative */
.art-breadcrumbs__home,
.art-category-badge,
.art-related__card,
.art-rating__star,
.art-author-box__placeholder {
  position: relative !important;
}
/* Для корректного рендера абсолютных псевдоэлементов списков */
.art-body ul li,
.art-body ol li {
  position: relative !important;
}

/* ============================================================
   ХЛЕБНЫЕ КРОШКИ
   ============================================================ */
.art-breadcrumbs {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 13px;
  color: var(--art-muted);
  margin: 20px 0 24px;
  padding: 10px 14px;
  background: var(--art-bg-alt);
  border-radius: var(--art-radius);
  border: 1px solid var(--art-border);
}
.art-breadcrumbs a {
  color: var(--art-accent);
  text-decoration: none;
  transition: color .15s;
}
.art-breadcrumbs a:hover { color: var(--art-accent-dark); text-decoration: underline; }
.art-breadcrumbs__sep {
  color: var(--art-border);
  font-size: 11px;
  user-select: none;
}
.art-breadcrumbs__home {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
}
.art-breadcrumbs__current { color: var(--art-text); font-weight: 500; }

/* ============================================================
   ШАПКА СТАТЬИ
   ============================================================ */
.art-header {
  margin-bottom: 28px;
}

.art-category-badge {
  display: inline-block !important;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  background: var(--art-accent);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
  text-decoration: none;
  transition: background .15s;
}
.art-category-badge:hover { background: var(--art-accent-dark); color: #fff; }

.art-h1 {
  font-family: var(--art-font);
  font-size: clamp(22px, 3.2vw, 34px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -.02em;
  color: var(--art-text);
  margin: 0 0 20px;
}

/* --- Мета-строка --- */
.art-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid var(--art-border);
  border-bottom: 1px solid var(--art-border);
}
.art-meta__avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--art-accent-light);
}
.art-meta__avatar-placeholder {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--art-accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600;
  color: var(--art-accent);
  flex-shrink: 0;
}
.art-meta__info { flex: 1; min-width: 0; }
.art-meta__author-name {
  font-size: 14px; font-weight: 600;
  color: var(--art-text);
  display: block; margin-bottom: 2px;
}
.art-meta__dates {
  font-size: 12px;
  color: var(--art-muted);
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.art-meta__dates .upd-badge {
  background: var(--art-bg-alt);
  border: 1px solid var(--art-border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
}
.art-meta__read-time {
  margin-left: auto;
  font-size: 12px; color: var(--art-muted);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
}

/* ============================================================
   ГЕРОЙ-КАРТИНКА
   ============================================================ */
.art-hero {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 28px;
  aspect-ratio: 16 / 7;
  background: var(--art-bg-alt);
}
.art-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================
   ТЕЛО СТАТЬИ — ТИПОГРАФИКА
   ============================================================ */
.art-body {
  font-size: 16px;
  line-height: 1.85;
  color: var(--art-text);
}

.art-body p,
.art-body .art-p {
  margin: 0 0 1.15em;
}

.art-body a {
  color: var(--art-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .15s;
}
.art-body a:hover { color: var(--art-accent-dark); }

/* --- Заголовки --- */
.art-body h2,
.art-body .art-h2 {
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 700;
  line-height: 1.3;
  color: var(--art-text);
  margin: 2.2rem 0 .9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.art-body h2::before,
.art-body .art-h2::before {
  content: '';
  display: block;
  width: 4px;
  min-height: 1.3em;
  background: var(--art-accent);
  border-radius: 2px;
  flex-shrink: 0;
  margin-top: 3px;
}
.art-body h3,
.art-body .art-h3 {
  font-size: clamp(17px, 1.7vw, 20px);
  font-weight: 600;
  line-height: 1.35;
  color: var(--art-text);
  margin: 1.8rem 0 .7rem;
  padding-left: 14px;
  border-left: 2px solid var(--art-border);
}
.art-body h4,
.art-body .art-h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 1.4rem 0 .5rem;
  color: var(--art-text);
}

/* --- Картинки --- */
.art-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 1.5rem auto;
}
.art-body figure { margin: 1.5rem 0; }
.art-body figcaption {
  font-size: 13px; color: var(--art-muted);
  text-align: center; margin-top: 6px;
}

/* --- Списки --- */
.art-body ul,
.art-body .art-ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2em;
}
.art-body ul li,
.art-body .art-ul li {
  padding: 6px 0 6px 24px;
  font-size: 16px;
  line-height: 1.7;
  border-bottom: 1px solid var(--art-border);
}
.art-body ul li:last-child,
.art-body .art-ul li:last-child { border-bottom: none; }
.art-body ul li::before,
.art-body .art-ul li::before {
  content: '';
  position: absolute;
  left: 0; top: 16px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--art-accent);
}

.art-body ol,
.art-body .art-ol {
  list-style: none;
  counter-reset: art-counter;
  padding: 0;
  margin: 0 0 1.2em;
}
.art-body ol li,
.art-body .art-ol li {
  counter-increment: art-counter;
  padding: 8px 0 8px 40px;
  font-size: 16px;
  line-height: 1.7;
  border-bottom: 1px solid var(--art-border);
}
.art-body ol li:last-child,
.art-body .art-ol li:last-child { border-bottom: none; }
.art-body ol li::before,
.art-body .art-ol li::before {
  content: counter(art-counter);
  position: absolute;
  left: 0; top: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--art-accent);
  color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 26px;
}

/* --- Callout / Цитата --- */
.art-body blockquote,
.art-callout {
  background: var(--art-accent-light);
  border-left: 4px solid var(--art-accent);
  border-radius: 0 10px 10px 0;
  padding: 14px 18px;
  margin: 1.5rem 0;
  font-size: 15px;
  color: #1a3f6f;
  line-height: 1.7;
}
.art-body blockquote p { margin: 0; }

/* ============================================================
   ТАБЛИЦЫ
   ============================================================ */
.art-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--art-bg);
  margin: 1.5rem 0;
  border: 1px solid var(--art-border);
  border-radius: 12px;
  overflow: hidden;
}
.art-body table th {
  background: var(--art-accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 11px 16px;
  text-align: left;
}
.art-body table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--art-border);
  color: var(--art-text);
  vertical-align: top;
  line-height: 1.5;
}
.art-body table tr:nth-child(even) td { background: var(--art-bg-alt); }
.art-body table tr:last-child td { border-bottom: none; }
.art-body table tr:hover td { background: var(--art-accent-light); }

/* ============================================================
   БЛОК АВТОРА С БИОГРАФИЕЙ
   ============================================================ */
.art-author-box {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--art-bg);
  border: 1px solid var(--art-border);
  border-radius: 16px;
  padding: 24px 26px;
  margin: 40px 0 24px;
  box-shadow: 0 2px 12px rgba(43,125,233,.06);
}
.art-author-box__photo {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--art-accent-light);
}
.art-author-box__placeholder {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--art-accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
  color: var(--art-accent);
  flex-shrink: 0;
  border: 3px solid var(--art-accent-light);
}
.art-author-box__info { flex: 1; }
.art-author-box__label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--art-accent);
  margin-bottom: 5px;
  display: flex; align-items: center; gap: 6px;
}
.art-author-box__label::before {
  content: '';
  display: inline-block;
  width: 16px; height: 1.5px;
  background: var(--art-accent);
  border-radius: 1px;
}
.art-author-box__name {
  font-size: 18px; font-weight: 700;
  color: var(--art-text);
  margin-bottom: 10px;
  line-height: 1.2;
}
.art-author-box__bio {
  font-size: 14px;
  color: var(--art-muted);
  line-height: 1.7;
  border-top: 1px solid var(--art-border);
  padding-top: 10px;
  margin-top: 2px;
}

/* ============================================================
   ГОЛОСОВАНИЕ ЗВЁЗДАМИ
   ============================================================ */
.art-rating {
  background: var(--art-bg-alt);
  border: 1px solid var(--art-border);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  margin: 0 0 32px;
}
.art-rating__title {
  font-size: 15px; font-weight: 600;
  color: var(--art-text);
  margin-bottom: 14px;
}
.art-rating__stars {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 10px;
  cursor: pointer;
}
.art-rating__star {
  font-size: 36px;
  color: #d1d5db;
  transition: color .1s, transform .1s;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}
.art-rating__star.active,
.art-rating__star.hover {
  color: #f59e0b;
  transform: scale(1.14);
}
.art-rating__count {
  font-size: 13px; color: var(--art-muted);
  margin-top: 4px;
}
.art-rating__avg {
  font-size: 22px; font-weight: 700;
  color: var(--art-text);
  margin-right: 4px;
}
.art-rating__thanks {
  display: none;
  font-size: 14px; font-weight: 600;
  color: var(--art-accent);
  margin-top: 10px;
}

/* ============================================================
   ПОХОЖИЕ СТАТЬИ
   ============================================================ */
.art-related {
  margin: 0 0 40px;
}
.art-related__title {
  font-size: 20px; font-weight: 700;
  color: var(--art-text);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.art-related__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--art-border);
}
.art-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.art-related__card {
  background: var(--art-bg);
  border: 1px solid var(--art-border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  display: block;
  transition: box-shadow .2s, transform .2s;
  color: inherit;
}
.art-related__card:hover {
  box-shadow: 0 6px 20px rgba(43,125,233,.13);
  transform: translateY(-2px);
}
.art-related__card-img {
  width: 100%; height: 120px;
  object-fit: cover;
  display: block;
  background: var(--art-bg-alt);
}
.art-related__card-img-placeholder {
  width: 100%; height: 120px;
  background: linear-gradient(135deg, var(--art-accent-light) 0%, #dbeafe 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.art-related__card-body {
  padding: 12px 14px 14px;
}
.art-related__card-cat {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--art-accent);
  margin-bottom: 5px;
}
.art-related__card-title {
  font-size: 13px; font-weight: 600;
  color: var(--art-text);
  line-height: 1.45;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.art-related__card-date {
  font-size: 11px; color: var(--art-muted);
}

/* ============================================================
   АДАПТИВ
   ============================================================ */

/* ============================================================
   ОГЛАВЛЕНИЕ (TOC)
   ============================================================ */
.art-toc {
  background: var(--art-bg-alt);
  border: 1px solid var(--art-border);
  border-left: 4px solid var(--art-accent);
  border-radius: 0 12px 12px 0;
  padding: 18px 20px;
  margin: 0 0 28px;
}
.art-toc__header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--art-text);
  margin-bottom: 14px;
  user-select: none;
}
.art-toc__icon {
  color: var(--art-accent);
  flex-shrink: 0;
}
.art-toc__toggle {
  margin-left: auto;
  background: none;
  border: 1px solid var(--art-border);
  border-radius: 6px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--art-muted);
  padding: 0;
  transition: background .15s, color .15s, transform .2s;
  flex-shrink: 0;
}
.art-toc__toggle:hover { background: var(--art-accent-light); color: var(--art-accent); }
.art-toc__toggle.collapsed svg { transform: rotate(-90deg); }
.art-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: max-height .3s ease, opacity .3s ease;
  overflow: hidden;
}
.art-toc__list.hidden {
  max-height: 0 !important;
  opacity: 0;
}
.art-toc__item {}
.art-toc__link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--art-text);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.art-toc__link:hover {
  background: var(--art-accent-light);
  color: var(--art-accent);
}
.art-toc__link.active {
  background: var(--art-accent-light);
  color: var(--art-accent);
  font-weight: 600;
}
.art-toc__num {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--art-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
@media (max-width: 640px) {
  .art-wrap { padding: 0 0 40px; }
  .art-body { font-size: 15px; line-height: 1.78; }
  .art-meta { gap: 10px; }
  .art-meta__read-time { display: none; }
  .art-related__grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .art-author-box { flex-direction: column; align-items: center; text-align: center; padding: 18px; }
  .art-author-box__bio { text-align: left; }
  .art-rating__star { font-size: 30px; }
}
@media (max-width: 400px) {
  .art-related__grid { grid-template-columns: 1fr; }
}
