/* ============================================
   SERVICES PAGE - Section-based layout
   ============================================ */

/* Скрываем автоматический заголовок страницы "Услуги" */
article > h1:first-child,
.td-content > h1:first-child,
main article h1:not(.services-hero__title) {
  display: none !important;
}

/* Убираем все отступы перед hero-секцией */
body:has(.services-hero) main,
body:has(.services-hero) article,
body:has(.services-hero) .td-content,
article:has(.services-hero),
article .services-hero:first-child,
article:has(.services-hero) > *:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.td-content:has(.services-hero),
main article:has(.services-hero),
main:has(.services-hero) article {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* Убираем отступы у всех элементов перед hero */
.services-hero:first-child,
.services-hero:first-of-type,
article > .services-hero:first-child,
main > .services-hero:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Обёртка для контента, как на landing page */
.services-content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Улучшенная типографика для читаемости */
.services-content-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

/* Исключение для блока "Как я работаю" */
.service-section--intro .services-content-wrapper {
  max-width: 100%;
}

.services-content-wrapper p {
  line-height: 1.7;
}

.services-content-wrapper li {
  line-height: 1.6;
}

.services-content-wrapper h3 {
  line-height: 1.3;
}

/* Hero должен быть вне ограничений article */
article .services-hero {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  max-width: none;
}

.service-section {
  position: relative;
  padding: 3.5rem 0;
  z-index: 0;
}

/* Фон секций на всю ширину экрана */
.service-section::before {
  content: "";
  position: absolute;
  inset: 0;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  z-index: -1;
  pointer-events: none;
}

.service-section--intro::before {
  background: #f9fafb;
}

.service-section--panel::before {
  background: #ffffff;
}

.service-section--muted::before {
  background: #f3f4f6;
}

/* HERO на странице услуг - как на главной */
.services-hero {
  padding: 0 !important;
  margin: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
  overflow: visible;
  width: 100vw;
  position: relative;
  margin-left: -50vw;
  margin-right: -50vw;
}

.services-hero__split {
  display: flex;
  flex-wrap: wrap;
  min-height: 500px;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.services-hero__content {
  flex: 1 1 500px;
  display: flex;
  align-items: center;
  padding: 4rem 6rem 4rem 3rem;
  background: #fff;
}

.services-hero__text {
  max-width: 560px;
}

.services-hero__title {
  font-size: clamp(2.2rem, 3vw, 2.8rem);
  font-weight: 800;
  margin: 0 0 0.9rem;
  line-height: 1.1;
  color: #111827;
}

.services-hero__lead.services-intro {
  margin: 0 0 1.5rem;
  font-size: 1.02rem;
  line-height: 1.65;
  color: #374151;
}

.services-hero__sub {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #6b7280;
}

.services-hero__nav {
  flex: 1 1 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 500px;
  padding: 4rem 3rem 4rem 6rem;
  border-radius: 0 !important;
  box-shadow: none !important;
  border: none !important;
}

@media (max-width: 768px) {
  .services-hero__split {
    flex-direction: column;
  }

  .services-hero__content {
    padding: 2rem 1.5rem;
  }

  .services-hero__nav {
    min-height: auto;
    padding: 2rem 1.5rem;
  }

  /* Отключаем sticky на мобильных */
  .service-aside-card {
    position: static;
    top: auto;
  }

  /* Уменьшаем отступы */
  .services-content-wrapper {
    padding: 0 1rem;
  }

  .service-section {
    padding: 2rem 0;
  }

  .service-section__content {
    gap: 2rem;
  }

  .service-aside-card {
    padding: 1.5rem;
  }

  /* Увеличиваем touch targets для навигации */
  .services-nav__item {
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* Intro paragraph above first section on services page (используется внутри hero) */
.services-intro {
  font-size: 1.05rem;
}

/* Top navigation with anchors to services (в hero слева) */
.services-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
}

.services-nav__item {
  display: inline-block;
  color: #374151;
  font-size: 1.15rem;
  font-weight: 400;
  text-decoration: none;
  line-height: 1.5;
  transition: all 0.2s ease;
  position: relative;
  padding: 0.25rem 0;
}

.services-nav__item::after {
  content: '››';
  display: inline-block;
  margin-left: 0.15rem;
  font-size: 1rem;
  color: #374151;
  vertical-align: middle;
  transition: transform 0.2s ease, color 0.2s ease;
  opacity: 0.7;
}

.services-nav__item:hover::after {
  transform: translateX(4px);
  opacity: 1;
  color: #D66F5F;
}

/* Service headings */
.service-section h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #111827;
  margin-top: 0;
  margin-bottom: 1rem;
}

.service-section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111827;
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
  scroll-margin-top: 100px; /* Отступ для якорных ссылок с учётом sticky хедера */
}

.service-section h3 + p {
  font-size: 1.05rem;
  color: #6b7280;
  font-style: italic;
  margin-bottom: 1.5rem;
}

/* Bold labels (Для кого, Результат, etc) */
.service-section p strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 1.2rem 0 0.35rem;
}

/* Двухколоночный layout для блоков услуг:
   заголовок и лид сверху, под ними два столбца */
.service-section--split {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.service-section__header {
  width: 100%;
}

.service-section__header h3 {
  margin-top: 0;
  scroll-margin-top: 100px; /* Отступ для якорных ссылок с учётом sticky хедера */
}

.service-section__header p {
  margin-bottom: 0;
}

.service-section__content {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: flex-start;
}

.service-section__main {
  min-width: 0;
}

.service-section__aside {
  min-width: 0;
}

.service-aside-card {
  background: #ffffff;
  border-radius: 0.9rem;
  padding: 1.8rem 1.9rem;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
  position: sticky;
  top: 2rem;
}

.service-aside-card h4 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}

.service-aside-card p {
  margin: 0 0 1.2rem;
  font-size: 0.96rem;
  line-height: 1.6;
}

.service-aside-card .cta-primary {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: center;
  /* Мягкий цвет на десктопе */
  background: #E88B7A !important;
}

.service-aside-card .cta-primary:hover {
  background: #D66F5F !important;
}

@media (max-width: 768px) {
  .service-section__content {
    grid-template-columns: 1fr;
  }

  .service-aside-card {
    margin-top: 1rem;
    position: static;
    top: auto;
  }
}

/* Lists with arrows */
.service-section ul:not(.service-includes) {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.service-section ul:not(.service-includes) li {
  padding-left: 1.5rem;
  position: relative;
  margin: 0.4rem 0;
  line-height: 1.65;
}

.service-section ul:not(.service-includes) li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #111827;
  font-weight: 700;
}

/* Numbered lists */
.service-section ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0 1rem;
}

.service-section ol li {
  padding-left: 0.5rem;
  margin: 0.5rem 0;
  line-height: 1.65;
}

/* CTA buttons - используем классы из components.css */
.service-section .cta-primary {
  margin: 1.5rem 0 0.5rem;
}

/* Intro section (Как я работаю) */
.service-section--intro h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #000;
  margin: 0 0 1.5rem;
  text-align: center;
}

/* Principles as three cards - на всю ширину */
.services-principles-wrapper {
  width: 100%;
  max-width: 100%;
  padding: 0 2rem;
  box-sizing: border-box;
  overflow-x: hidden;
}

.services-principles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.3rem;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.services-principles__card {
  background: #fff;
  border-radius: 0.9rem;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
  font-size: 0.98rem;
  line-height: 1.6;
  min-height: 140px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.services-principles__card p {
  margin-bottom: 0;
}

/* Список "Что входит" с точками */
.service-includes {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin: 0 0 1.5rem 0;
}

.service-includes li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
  font-size: 0.95rem;
  color: #374151;
}

.service-includes li::before {
  content: none !important;
}

.service-includes li::after {
  content: none !important;
}

.service-includes li:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .services-principles-wrapper {
    padding: 0 1rem;
  }

  .services-principles {
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
  }

  .services-principles__card {
    padding: 1.2rem 1rem;
    min-height: auto;
    font-size: 0.9rem;
  }
}

/* FAQ section styling */
.service-section:last-of-type p strong {
  font-size: 1.05rem;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 1.2rem;
  margin-bottom: 0.4rem;
}

/* Horizontal rules between sections - full width */
article hr {
  border: none;
  height: 0;
  margin: 0;
  padding: 0;
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .service-section h3 {
    font-size: 1.4rem;
  }

  .service-section a[href*="t.me"] {
    display: block;
    text-align: center;
  }

  /* Дополнительные мобильные оптимизации */
  .services-content-wrapper {
    padding: 0 1rem;
  }

  .service-section {
    padding: 2rem 0;
  }

  .service-section__content {
    gap: 2rem;
  }

  .service-aside-card {
    padding: 1rem 0.875rem;
    position: static;
    top: auto;
    margin-top: 0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    border: 1px solid #f3f4f6;
    border-radius: 0.75rem;
  }

  .service-aside-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
  }

  /* Улучшаем отступы списка на мобильных */
  .service-includes {
    padding-left: 1.2rem;
    margin: 0 0 1rem 0;
  }

  .service-includes li {
    margin-bottom: 0.45rem;
    line-height: 1.7;
    font-size: 0.875rem;
    padding-left: 0.3rem;
    color: #4b5563;
  }

  .service-includes li:last-child {
    margin-bottom: 0;
  }

  /* Outline-стиль кнопки на мобильных */
  .service-aside-card .cta-primary {
    padding: 0.7rem 1.15rem;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    min-height: 44px;
    font-weight: 600;
    /* Outline-стиль: прозрачный фон, цветная рамка */
    background: transparent !important;
    color: #D66F5F !important;
    border: 1.5px solid #D66F5F !important;
    box-sizing: border-box;
    max-width: 100%;
  }

  .service-aside-card .cta-primary:hover,
  .service-aside-card .cta-primary:active {
    background: #D66F5F !important;
    color: #ffffff !important;
  }

  .services-nav {
    gap: 0.2rem;
  }

  .services-nav__item {
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

