/*
  service_article.css
  Подключается ПОСЛЕ service_category.css
*/

/* ── ОБЁРТКА ── */
.sp-pg { padding: 24px 32px 56px; }
@media (max-width: 768px) { .sp-pg { padding: 16px 20px 40px; } }
@media (max-width: 480px) { .sp-pg { padding: 12px 16px 32px; } }

/* ── LAYOUT ── */
.sp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  align-items: start;
}
/* Главная колонка должна уметь сжиматься ниже ширины контента,
   иначе длинный текст/таблица распирает страницу */
.sp-layout__main { min-width: 0; }

/* ═══════════════════════════════════════
   HERO
═══════════════════════════════════════ */
.sp-hero {
  background:
    radial-gradient(ellipse at 0% 0%, rgba(168,210,160,0.7) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 0%, rgba(200,225,170,0.6) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(140,190,150,0.5) 0%, transparent 50%),
    radial-gradient(ellipse at 0% 100%, rgba(210,230,185,0.6) 0%, transparent 50%),
    #deecd8;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
}

.sp-hero__top {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 0;
}

.sp-hero__left {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.sp-hero__title {
  font-family: var(--serif);
  font-size: var(--text-3xl);
  font-weight: 400;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: break-word;
}

.sp-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-base);
  color: var(--muted);
  opacity: .85;
}

.sp-hero__img { overflow: hidden; border-radius: 0 var(--radius-lg) 0 10px; }
.sp-hero__img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── TOC ── */
.sp-toc { padding: 20px; }

.sp-toc__label {
  font-size: var(--text-sm);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--sage-dk);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 0.5px solid rgba(62, 94, 68, .15);
}

.sp-toc__links {
  background: rgba(255,255,255,.75);
  border-radius: 10px;
  padding: 12px 16px;
  backdrop-filter: blur(4px);
}

/* Две колонки — включается классом из JS при >3 пунктах */
.sp-toc__links--two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 16px;
}

.sp-toc__link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 0.5px solid rgba(62, 94, 68, .1);
  text-decoration: none;
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.45;
  transition: color .15s;
  min-width: 0;
}
.sp-toc__link:last-child { border-bottom: none; }
.sp-toc__link:hover { color: var(--sage-dk); }
.sp-toc__link:hover .sp-toc__num { color: var(--sage-dk); }
.sp-toc__link > span:last-child { overflow-wrap: anywhere; }

.sp-toc__num {
  font-size: var(--text-xs);
  color: var(--sage);
  font-weight: 500;
  min-width: 20px;
  flex-shrink: 0;
  transition: color .15s;
}

/* ═══════════════════════════════════════
   ТЕКСТ УСЛУГИ
═══════════════════════════════════════ */
.sp-body {
  background: var(--white);
  border: 0.5px solid rgba(107,143,113,.18);
  border-radius: var(--radius-md);
  padding: 32px 36px;
  margin-bottom: 12px;
  font-size: var(--text-lg);
  line-height: 1.85;
  color: var(--text);
  overflow-wrap: break-word;
}

.sp-body h2 { font-family: var(--serif); font-size: var(--text-2xl); font-weight: 400; color: var(--text); margin: 2rem 0 1rem; line-height: 1.3; padding-top: 8px; border-top: 0.5px solid rgba(107,143,113,.15); }
.sp-body h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.sp-body h3 { font-family: var(--serif); font-size: var(--text-xl); font-weight: 400; color: var(--text); margin: 24px 0 10px; line-height: 1.4; }
.sp-body h4 { font-size: var(--text-lg); font-weight: 500; color: var(--text); margin: 20px 0 8px; }
.sp-body p { margin: 0 0 16px; color: var(--text); }
.sp-body p:last-child { margin-bottom: 0; }
.sp-body ul, .sp-body ol { margin: 0 0 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.sp-body li { font-size: var(--text-lg); line-height: 1.7; color: var(--text); }
.sp-body ul li::marker { color: var(--sage); }
.sp-body ol li::marker { color: var(--sage-dk); font-weight: 500; }
.sp-body strong { font-weight: 500; }
.sp-body em { font-style: italic; color: var(--muted); }
.sp-body a { color: var(--sage-dk); text-decoration: underline; text-underline-offset: 3px; transition: color .15s; }
.sp-body a:hover { color: var(--sage); }
.sp-body img { max-width: 100%; height: auto; border-radius: var(--radius-md); margin: 16px 0; display: block; }
.sp-body video, .sp-body iframe { max-width: 100%; height: auto; }
.sp-body blockquote { margin: 20px 0; padding: 14px 20px; background: var(--ivory); border-left: 3px solid var(--sage); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-style: italic; color: var(--muted); font-size: var(--text-md); line-height: 1.7; }
/* display:block + overflow-x → широкая таблица скроллится внутри, а не распирает страницу */
.sp-body table { display: block; width: 100%; border-collapse: collapse; margin: 20px 0; font-size: var(--text-base); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sp-body th { background: var(--ivory); padding: 10px 14px; text-align: left; font-weight: 500; font-size: var(--text-sm); color: var(--sage-dk); border: 0.5px solid rgba(107,143,113,.2); }
.sp-body td { padding: 10px 14px; border: 0.5px solid rgba(107,143,113,.15); vertical-align: top; line-height: 1.6; }
.sp-body tr:nth-child(even) td { background: rgba(249,245,239,.5); }

/* ═══════════════════════════════════════
   ПОРТФОЛИО и FAQ (переопределяем margin из service_category.css)
═══════════════════════════════════════ */
.sp-section {
  margin-bottom: 12px !important;
}

.svc-portfolio.sp-section,
.svc-faq.sp-section {
  background: var(--white);
  border: 0.5px solid rgba(107,143,113,.18);
  border-radius: var(--radius-md);
  padding: 28px 32px;
}

.svc-portfolio__title,
.svc-faq__title {
  font-family: var(--serif);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--text);
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════
   НАВИГАЦИЯ ПРЕД / СЛЕД
═══════════════════════════════════════ */
.sp-nav { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.sp-nav__item { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--white); border: 0.5px solid rgba(107,143,113,.2); border-radius: var(--radius-md); text-decoration: none; color: inherit; flex: 1; max-width: 48%; transition: background .15s; }
.sp-nav__item:hover { background: var(--ivory); }
.sp-nav__item--next { justify-content: flex-end; text-align: right; }
.sp-nav__arrow { font-size: var(--text-xl); color: var(--sage-dk); flex-shrink: 0; opacity: .6; }
.sp-nav__label { font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.sp-nav__title { font-family: var(--serif); font-size: var(--text-base); color: var(--text); line-height: 1.4; }

/* ═══════════════════════════════════════
   ПОХОЖИЕ УСЛУГИ
═══════════════════════════════════════ */
.sp-related__title { font-size: var(--text-xs); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.sp-related__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sp-related__card { display: flex; flex-direction: column; background: var(--white); border: 0.5px solid rgba(107,143,113,.18); border-radius: var(--radius-md); overflow: hidden; text-decoration: none; color: inherit; transition: box-shadow .2s, transform .2s; }
.sp-related__card:hover { box-shadow: 0 4px 16px rgba(42,36,32,.07); transform: translateY(-2px); }
.sp-related__img { height: 110px; overflow: hidden; flex-shrink: 0; }
.sp-related__img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.sp-related__card:hover .sp-related__img img { transform: scale(1.04); }
.sp-related__img-ph { width: 100%; height: 100%; background: var(--ivory); }
.sp-related__body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; }
.sp-related__cat { font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--sage-dk); margin-bottom: 5px; }
.sp-related__card-title { font-family: var(--serif); font-size: var(--text-base); color: var(--text); line-height: 1.45; margin-bottom: 8px; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-related__meta { display: flex; align-items: center; gap: 8px; }

/* ═══════════════════════════════════════
   САЙДБАР — общее
═══════════════════════════════════════ */
.sp-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sp-sb-block {
  background: var(--white);
  border: 0.5px solid rgba(107,143,113,.2);
  border-radius: var(--radius-md);
  padding: 18px;
}

.sp-sb-title {
  font-size: var(--text-xs);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 0.5px solid rgba(107,143,113,.15);
}

/* Разделы */
.sp-sb-cats { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.sp-sb-cat { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: var(--text); transition: background .15s; }
.sp-sb-cat:hover { background: var(--ivory); }
.sp-sb-cat--active { background: rgba(62,94,68,.08); }
.sp-sb-cat__name { font-size: var(--text-base); }
.sp-sb-cat--active .sp-sb-cat__name { color: var(--sage-dk); font-weight: 500; }
.sp-sb-cat__count { font-size: var(--text-xs); color: var(--muted); background: var(--ivory); padding: 2px 8px; border-radius: var(--radius-pill); flex-shrink: 0; }
.sp-sb-cat--active .sp-sb-cat__count { background: rgba(62,94,68,.1); color: var(--sage-dk); }

/* ═══════════════════════════════════════
   САЙДБАР — блок статистики
   Отдельный элемент, 100% ширины сайдбара
═══════════════════════════════════════ */
.sp-sb-stats-block {
  /* Переопределяем svc-doc-card --stats: он уже имеет нужный фон и стили */
  border-radius: var(--radius-md) !important;
  width: 100%;
  box-sizing: border-box;
  cursor: default;
}
/* Убираем hover-трансформ — это не ссылка */
.sp-sb-stats-block:hover {
  transform: none !important;
  border-color: var(--sage-dk) !important;
}

/* ═══════════════════════════════════════
   САЙДБАР — карточки врачей
   Вертикально, одна колонка, без отступов внутри блока
═══════════════════════════════════════ */
.sp-sb-block--doctors {
  padding: 18px 0 0;  /* боковые и верхний падинг, низ — карточки сами */
  overflow: hidden;
}

.sp-sb-block--doctors .sp-sb-title {
  padding-left: 18px;
  padding-right: 18px;
}

.sp-sb-doc-list {
  display: flex;
  flex-direction: column;  /* строго одна колонка */
  gap: 0;
}

/* Карточка врача в сайдбаре */
.sp-sb-doc-list .svc-doc-card {
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-top: 0.5px solid rgba(107,143,113,.15);
  border-radius: 0;
  width: 100%;
}

.sp-sb-doc-list .svc-doc-card:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Высота фото: голова + плечи, а не только голова */
.sp-sb-doc-list .svc-doc-card__photo {
  height: 210px;
}

/* ═══════════════════════════════════════
   АДАПТИВ
═══════════════════════════════════════ */
@media (max-width: 1100px) {
  .sp-layout { grid-template-columns: minmax(0, 1fr) 220px; }
  .sp-hero__title { font-size: var(--text-2xl); }
  .sp-sb-doc-list .svc-doc-card__photo { height: 190px; }
}

/* Планшет: сайдбар уходит под контент */
@media (max-width: 860px) {
  .sp-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sp-sidebar {
    position: static;
    /*
      Два ряда:
      [разделы] [статистика]
      [врачи врачи врачи   ]
    */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }

  /* Блок врачей — занимает обе колонки (полная ширина) */
  .sp-sb-block--doctors {
    grid-column: 1 / -1;
  }

  /* Карточки врачей на планшете — горизонтальный ряд */
  .sp-sb-doc-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;   /* неполный ряд (одна карточка) — по центру, без пустоты справа */
  }

  .sp-sb-doc-list .svc-doc-card {
    flex: 1 1 200px;
    max-width: 320px;          /* не растягиваться во всю ширину — иначе фото «лоб и глаза» */
    border-top: none;
    border-left: 0.5px solid rgba(107,143,113,.15);
  }

  .sp-sb-doc-list .svc-doc-card:first-child {
    border-left: none;
  }

  .sp-sb-doc-list .svc-doc-card:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }

  .sp-sb-doc-list .svc-doc-card__photo { height: 190px; }

  .sp-hero__top { grid-template-columns: 1fr 180px; }
  .sp-related__grid { grid-template-columns: repeat(2, 1fr); }
}

/* Мобильник: всё в одну колонку */
@media (max-width: 600px) {
  .sp-hero__top { grid-template-columns: 1fr; }
  .sp-hero__img { height: 200px; border-radius: 0 0 0 10px; }
  .sp-hero { border-radius: var(--radius-md); }
  .sp-hero__left { padding: 20px 20px 16px; }
  .sp-hero__title { font-size: var(--text-xl); }
  .sp-body { padding: 20px; font-size: var(--text-md); }
  .sp-body h2 { font-size: var(--text-xl); }
  .sp-nav { flex-direction: column; }
  .sp-nav__item { max-width: 100%; }
  .sp-related__grid { grid-template-columns: 1fr; }

  /* Содержание — в одну колонку */
  .sp-toc__links--two-col { grid-template-columns: minmax(0, 1fr); }

  /* Сайдбар — одна колонка */
  .sp-sidebar {
    grid-template-columns: 1fr;
  }

  .svc-portfolio.sp-section,
  .svc-faq.sp-section { padding: 20px; }

  .sp-sb-doc-list .svc-doc-card__photo { height: 230px; }
}