/*
 * Контентные страницы с сайдбаром (page.php и родственные шаблоны).
 * Спокойный редакционный слой поверх legacy style.css и modern-*.css:
 * хлебные крошки, лид, якорная навигация чипами, ленты дат, ссылки-кнопки,
 * картинки без «прыжков». Всё скоупится на .left_part / .main-post-content.
 */

.left_part {
  --cp-ink: #16181d;
  --cp-text: #2b2f36;
  --cp-muted: #6b7280;
  --cp-accent: #146eb3;
  --cp-accent-soft: #eaf3fb;
  --cp-gold: #f7a600;
  --cp-line: #e6e8ec;
  --cp-line-soft: #eef0f3;
  --cp-surface: #f6f7f9;
}

/* ---------- Хлебные крошки: тише, без спрайта ---------- */
.left_part .breadcrumbs {
  margin-top: 1.25rem;
  margin-bottom: 0.25rem;
}

.left_part .breadcrumbs ul li {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--cp-muted);
  padding-left: 1.25rem;
}

.left_part .breadcrumbs ul li:first-child {
  padding-left: 0;
}

.left_part .breadcrumbs ul li:before {
  content: "";
  top: 0.4rem;
  left: 0.375rem;
  width: 0.375rem;
  height: 0.375rem;
  background: none;
  border-right: 1.5px solid #b8bcc4;
  border-bottom: 1.5px solid #b8bcc4;
  transform: rotate(-45deg);
}

.left_part .breadcrumbs ul li a {
  color: var(--cp-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.left_part .breadcrumbs ul li a:hover {
  color: var(--cp-ink);
}

/* ---------- Текст ---------- */
.main-post-content {
  color: var(--cp-text);
}

.main-post-content p {
  font-size: 1.0625rem;
  line-height: 1.65;
  margin: 0 0 1.25rem;
}

/* Лид: первый абзац чуть крупнее и мягче по тону */
.main-post-content > p:first-child {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: #3f4450;
  margin-bottom: 1.25rem;
}

.main-post-content strong {
  color: var(--cp-ink);
}

/* Ссылки в тексте: тонкое подчёркивание с отступом, без анимации «всего» */
.main-post-content a:not(:has(img)) {
  color: var(--cp-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(20, 110, 179, 0.35);
  text-underline-offset: 0.18em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.main-post-content a:not(:has(img)):hover {
  text-decoration-color: currentColor;
}

/* ---------- Разделы: h2 с якорем — редакционная линейка ---------- */
.main-post-content > h2 {
  scroll-margin-top: 5.5rem;
}

.main-post-content > h2:not(:first-child) {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--cp-line);
}

/* ---------- Якорная навигация (h3 + список ссылок на #id) как чипы ---------- */
.main-post-content > h3 + ul:has(> li > a[href^="#"]) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0.25rem 0 0.75rem;
  padding: 0;
}

.main-post-content > h3 + ul:has(> li > a[href^="#"]) > li {
  margin: 0;
  padding: 0;
}

.main-post-content > h3 + ul:has(> li > a[href^="#"]) > li:before {
  content: none;
}

.main-post-content > h3 + ul:has(> li > a[href^="#"]) > li > a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--cp-line);
  border-radius: 999px;
  background: #fff;
  color: var(--cp-ink);
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.main-post-content > h3 + ul:has(> li > a[href^="#"]) > li > a:hover {
  border-color: var(--cp-accent);
  background: var(--cp-accent-soft);
  color: var(--cp-accent);
}

/* ---------- Ленты дат: список, где каждый пункт начинается с <strong> ---------- */
.main-post-content > ul:has(> li > strong:first-child) {
  list-style: none;
  margin: 0.5rem 0 1.5rem;
  padding: 0;
}

.main-post-content > ul:has(> li > strong:first-child) > li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.375rem;
  line-height: 1.55;
}

.main-post-content > ul:has(> li > strong:first-child) > li + li {
  border-top: 1px solid var(--cp-line-soft);
}

.main-post-content > ul:has(> li > strong:first-child) > li:before {
  content: "";
  position: absolute;
  left: 0.125rem;
  top: 1.05rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--cp-gold);
  padding: 0;
}

.main-post-content > ul:has(> li > strong:first-child) > li > strong {
  font-variant-numeric: tabular-nums;
}

/* Обычные списки: маркер спокойнее */
.main-post-content ul li:before {
  color: var(--cp-accent);
}

/* ---------- Ссылка-действие: абзац, в котором только <strong><a> ---------- */
.main-post-content > p > strong:only-child > a:only-child {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--cp-line);
  border-radius: 0.75rem;
  background: var(--cp-surface);
  color: var(--cp-ink);
  text-decoration: none;
  line-height: 1.3;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.main-post-content > p > strong:only-child > a:only-child:hover {
  border-color: var(--cp-accent);
  background: var(--cp-accent-soft);
  color: var(--cp-accent);
}

/* ---------- Картинки: мягкая тень, без подпрыгивания при наведении ---------- */
.main-post-content img,
.clearfix.main-post-content img,
.left_part .clearfix.main-post-content img {
  border-radius: 0.875rem;
  border: 1px solid rgba(22, 24, 29, 0.06);
  box-shadow: 0 1px 2px rgba(22, 24, 29, 0.05), 0 12px 32px -12px rgba(22, 24, 29, 0.18);
  margin: 1.5rem auto;
  transition: box-shadow 0.25s ease;
}

.main-post-content img:hover,
.clearfix.main-post-content img:hover,
.left_part .clearfix.main-post-content img:hover {
  transform: none;
  box-shadow: 0 1px 2px rgba(22, 24, 29, 0.05), 0 16px 40px -12px rgba(22, 24, 29, 0.24);
  cursor: default;
}

.left_part .clearfix.main-post-content a > img:hover {
  cursor: zoom-in;
}

.main-post-content p:has(> a > img:only-child),
.main-post-content p:has(> img:only-child) {
  line-height: 0;
  margin: 0 0 1.25rem;
}

/* ---------- Браузерные поверхности ---------- */
.left_part ::selection {
  background: #fde9bf;
  color: var(--cp-ink);
}

.left_part a:focus-visible {
  outline: 2px solid var(--cp-accent);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

@media (max-width: 768px) {
  .main-post-content p {
    font-size: 1rem;
    line-height: 1.6;
  }

  .main-post-content > p:first-child {
    font-size: 1.0625rem;
  }

  .main-post-content > h2:not(:first-child) {
    margin-top: 2.25rem;
    padding-top: 1.25rem;
  }

  .main-post-content > h3 + ul:has(> li > a[href^="#"]) > li > a {
    min-height: 2rem;
    padding: 0.3125rem 0.75rem;
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .left_part *,
  .left_part *::before,
  .left_part *::after {
    transition: none !important;
  }
}
