/*
Theme Name: SES Theme
Theme URI:
Author: Tema
Description: Кастомная тема для сайта СЭС Москва и Московская область.
Управление контентом через wp-admin без сторонних плагинов.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.0
License: GPL v2 or later
Text Domain: ses-theme
*/

/* Основные стили проекта подключаются отдельно из css/main.css.
   Этот файл грузится после main.css (зависимость в functions.php) —
   здесь только точечные оверрайды темы. main.css не трогаем. */

/* --- Шапка: переключатель языка скрыт (EN-версия не используется) --- */
.header .language {
  display: none;
}

/* --- Шапка: десктоп-меню 992–1439px (в main.css бургер включается при 1440px) --- */
@media (min-width: 992px) and (max-width: 1439px) {
  .burger {
    display: none !important;
  }

  .menu {
    display: block !important;
  }

  .header__inner {
    display: flex !important;
  }

  .header__btn {
    display: none !important;
  }

  .header__bottom {
    position: relative;
    overflow: visible;
  }

  .header {
    overflow: visible;
  }

  .header .mobile-menu {
    position: absolute !important;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: auto !important;
    height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    background: transparent !important;
    z-index: auto !important;
  }

  .header .mobile-menu._active {
    top: auto !important;
  }

  .header .mobile-menu__block {
    display: none !important;
  }

  .header .mobile-menu__body {
    position: static;
    padding: 0;
    margin: 0;
    background: transparent;
    border-radius: 0;
  }

  .header .mobile-menu__body > .mobile-menu__body_link,
  .header .mobile-menu__body > .mobile-menu__button {
    display: none !important;
  }

  .header .pulldown {
    position: absolute !important;
    left: 0;
    right: 0;
    top: 0;
    z-index: 5;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-50%) !important;
    transition: all 0.5s !important;
    width: 100% !important;
    background-color: var(--color-white) !important;
    border-top: 1px solid #f1f1f1 !important;
    padding-bottom: 30px !important;
    display: block !important;
  }

  .header .pulldown._act {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
  }

  .header .pulldown.active:not(._act) {
    display: none !important;
  }

  .header .pulldown__wrap {
    flex-direction: row !important;
    max-width: 1870px !important;
    padding: 0 24px !important;
  }

  .header .pulldown__col:not(:first-child) {
    border-left: 1px solid #dfe3e8 !important;
    padding-left: 24px !important;
    width: 400px !important;
  }

  .header .pulldown__col {
    background-color: transparent !important;
    padding-top: 30px !important;
    padding-right: 10px !important;
    border-radius: 0 !important;
  }

  .header .pulldown__col:first-child {
    display: block !important;
  }

  .header .pulldown__button svg {
    display: none !important;
  }
}

/* --- Пагинация блога (страница «Блог») --- */
.blog-pagination {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.blog-pagination__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.blog-pagination__link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--color-gray, #f3f3f3);
  color: var(--color-black, #010205);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}

.blog-pagination__link:hover {
  background: var(--color-blue, #0036a7);
  color: #fff;
}

.blog-pagination__link.is-active {
  background: var(--color-red, #d62718);
  color: #fff;
  cursor: default;
}

.blog-pagination__link--arrow {
  font-size: 20px;
  line-height: 1;
}

/* --- Хлебные крошки: управляем фон по типу страницы --- */
/* Блог и услуги: прозрачный фон (как в дизайне). */
body.page-template-page-blog .breadcrumbs,
body.page-template-page-services-php .breadcrumbs,
body.page-slug-services .breadcrumbs,
.hero--services .breadcrumbs,
body.page-template-page-page-districts-php .breadcrumbs,
body.page-slug-page-districts .breadcrumbs,
body.single-ses_service .breadcrumbs,
body.single-ses_norm_doc .breadcrumbs,
body.page-slug-page-document .breadcrumbs,
body.page-template-page-page-document-php .breadcrumbs,
body.post-type-archive-ses_service .breadcrumbs,
body.single-post .breadcrumbs,
body.single-ses_okrug .breadcrumbs {
  background: transparent;
  padding-left: 0px;
}
body.single-ses_okrug .breadcrumbs {
  margin-bottom: 45px;
}

/* Каталог округов: ACF-роутер, шаблон default — крошки в синем hero без белой подложки. */
.hero--districts .breadcrumbs {
  background: transparent;
  padding: 0;
}

/* Страница документа / норматив: ACF + page-template-default, крошки внутри hero--mod1. */
.hero--mod1 .breadcrumbs {
  background: transparent;
  padding: 0;
}

/* Юр. лица и ИП (/page-yr-ip/): hero--mod3, крошки на фоне изображения. */
.hero--mod3 .breadcrumbs,
body.page-slug-page-yr-ip .breadcrumbs,
body.page-template-page-page-yr-ip-php .breadcrumbs {
  background: transparent;
  padding: 0;
}

/* Нормативные документы и смежные hero--okrug: крошки на фоне изображения без белой подложки. */
.hero--okrug .breadcrumbs,
body.page-slug-documents .breadcrumbs,
body.page-template-page-documents-php .breadcrumbs {
  background: transparent;
  padding: 0;
}

/* Прейскурант: белый фон и паддинги как в макете. */
body.page-template-page-page-pricelist-php .breadcrumbs {
  padding-top: 20px;
  padding-left: 24px;
  background: #fff;
}

/* --- Hero: затемняющий градиент поверх фоновой картинки --- */
/* Для страниц услуг и подуслуг: делаем читабельную подложку под текстом/плитками. */
body.ses-service-page .hero[style*="background-image"] {
  position: relative;
}

body.ses-service-page .hero[style*="background-image"]::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0) -50.68%, #010B23 100%);
}

body.ses-service-page .hero[style*="background-image"] .hero__content {
  position: relative;
  z-index: 1;
}

/* --- Каталог услуг (блок «Услуги СЭС Москвы и МО»): горизонтальный скролл табов
   при большом количестве категорий. Скоуп `.services` — затрагивает только
   этот блок, «Быстрый выбор услуги» (.choice) остаётся гридом. */
.services .tabs__nav {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-blue, #0036a7) transparent;
  padding-bottom: 12px;
  justify-content: flex-start;
}

.services .tabs__nav::-webkit-scrollbar {
  height: 6px;
}

.services .tabs__nav::-webkit-scrollbar-thumb {
  background: var(--color-blue, #0036a7);
  border-radius: 3px;
}

.services .tabs__nav::-webkit-scrollbar-track {
  background: transparent;
}

.services .tabs__nav .tabs__button {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Блог: табы — <button>, сбрасываем только дефолты браузера (серый/синий фон — в main.css). */
.blog .tabs__nav button.tabs__button {
  border: none;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}

.blog .tabs__nav button.tabs__button.active-tab {
  color: var(--color-white);
}

@media (max-width: 767px) {
  .blog .tabs__nav button.tabs__button.active-tab {
    color: var(--color-black);
  }
}

.blog-pagination__link {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

/* --- Каталог услуг (страница «Услуги»): компактные карточки --- */
/* Скоуп `.tabs` важен: блок services на главной — без вкладок,
   поэтому эти правила его НЕ затрагивают, только карточки каталога. */
/* auto-fill (не auto-fit): пустые колонки не схлопываются, поэтому
   одиночная карточка (напр. «Гербицидная обработка» — 1 услуга)
   не растягивается на всю ширину ряда. justify-content:start —
   неполный последний ряд прижат влево, а не размазан. */
.tabs .services__body {
  grid-template-columns: repeat(auto-fill, minmax(300px, 360px));
  justify-content: start;
  gap: 20px;
}

.tabs .services__item {
  padding: 24px;
  border-radius: 24px;
  max-width: 100%;
}

.tabs .services__item_icon {
  width: 56px;
  height: 56px;
  padding: 10px;
  margin-bottom: 16px;
}

.tabs .services__item_title {
  font-size: 20px;
  margin-bottom: 10px;
}

.tabs .services__item_cost {
  font-size: 24px;
  margin-bottom: 16px;
}

/* Контейнер кнопок: своего правила в main.css нет — кнопки стыковались
   без отступа. Раскладываем в ряд с переносом и зазором. */
.tabs .services__item_button {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tabs .services__item_button .button {
  padding: 14px 20px;
  gap: 10px;
  flex: 1 1 auto;
}

.about__text--rich p {
  margin: 0 0 1em;
}

.about__text--rich p:last-child {
  margin-bottom: 0;
}

.about__text--rich ul,
.about__text--rich ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

.hero__text--rich p {
  margin: 0 0 1em;
}

.hero__text--rich p:last-child {
  margin-bottom: 0;
}

/* --- HTML-карта сайта (/sitemap/) — только этот шаблон --- */
body.page-template-page-sitemap-php .page-sitemap,
body.page-slug-sitemap .page-sitemap {
  padding: 48px 0 80px;
  background: var(--color-gray, #f3f3f3);
}

body.page-template-page-sitemap-php .page-sitemap__breadcrumbs,
body.page-slug-sitemap .page-sitemap__breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

body.page-template-page-sitemap-php .page-sitemap__crumb,
body.page-slug-sitemap .page-sitemap__crumb {
  color: var(--color-blue, #0036a7);
  text-decoration: none;
}

body.page-template-page-sitemap-php .page-sitemap__crumb:hover,
body.page-slug-sitemap .page-sitemap__crumb:hover {
  text-decoration: underline;
}

body.page-template-page-sitemap-php .page-sitemap__crumb--current,
body.page-slug-sitemap .page-sitemap__crumb--current {
  color: var(--color-black, #010205);
}

body.page-template-page-sitemap-php .page-sitemap__crumb-sep,
body.page-slug-sitemap .page-sitemap__crumb-sep {
  color: #999;
}

body.page-template-page-sitemap-php .page-sitemap__header,
body.page-slug-sitemap .page-sitemap__header {
  margin-bottom: 24px;
}

body.page-template-page-sitemap-php .page-sitemap__title,
body.page-slug-sitemap .page-sitemap__title {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-black, #010205);
}

body.page-template-page-sitemap-php .page-sitemap__lead,
body.page-slug-sitemap .page-sitemap__lead {
  margin: 0;
  max-width: 640px;
  font-size: 16px;
  line-height: 1.55;
  color: #555;
}

body.page-template-page-sitemap-php .page-sitemap__jump,
body.page-slug-sitemap .page-sitemap__jump {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

body.page-template-page-sitemap-php .page-sitemap__jump-link,
body.page-slug-sitemap .page-sitemap__jump-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e2e6ef;
  color: var(--color-blue, #0036a7);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

body.page-template-page-sitemap-php .page-sitemap__jump-link:hover,
body.page-slug-sitemap .page-sitemap__jump-link:hover {
  background: var(--color-blue, #0036a7);
  border-color: var(--color-blue, #0036a7);
  color: #fff;
}

/* Masonry: колонки, карточки не рвутся между колонками */
body.page-template-page-sitemap-php .page-sitemap__grid,
body.page-slug-sitemap .page-sitemap__grid {
  column-count: 1;
  column-gap: 20px;
}

@media (min-width: 640px) {
  body.page-template-page-sitemap-php .page-sitemap__grid,
  body.page-slug-sitemap .page-sitemap__grid {
    column-count: 2;
    column-gap: 24px;
  }
}

body.page-template-page-sitemap-php .page-sitemap__card,
body.page-slug-sitemap .page-sitemap__card {
  display: inline-block;
  width: 100%;
  margin: 0 0 20px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8ebf2;
  padding: 24px 28px;
  box-shadow: 0 4px 24px rgba(1, 11, 35, 0.06);
  vertical-align: top;
}

body.page-template-page-sitemap-php .page-sitemap__h2,
body.page-slug-sitemap .page-sitemap__h2 {
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-blue, #0036a7);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-black, #010205);
}

body.page-template-page-sitemap-php .page-sitemap__h3,
body.page-slug-sitemap .page-sitemap__h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-black, #010205);
}

body.page-template-page-sitemap-php .page-sitemap__list,
body.page-slug-sitemap .page-sitemap__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

body.page-template-page-sitemap-php .page-sitemap__item,
body.page-slug-sitemap .page-sitemap__item {
  margin: 0;
  padding: 0;
}

body.page-template-page-sitemap-php .page-sitemap__link,
body.page-slug-sitemap .page-sitemap__link {
  display: block;
  padding: 6px 0;
  color: var(--color-blue, #0036a7);
  font-size: 15px;
  line-height: 1.45;
  text-decoration: none;
  transition: color .15s ease;
}

body.page-template-page-sitemap-php .page-sitemap__link:hover,
body.page-slug-sitemap .page-sitemap__link:hover {
  color: var(--color-red, #d62718);
  text-decoration: underline;
}

body.page-template-page-sitemap-php .page-sitemap__link--cat,
body.page-slug-sitemap .page-sitemap__link--cat {
  padding: 0;
  font-size: inherit;
}

body.page-template-page-sitemap-php .page-sitemap__list--cols,
body.page-slug-sitemap .page-sitemap__list--cols {
  column-count: 1;
  column-gap: 24px;
}

@media (min-width: 576px) {
  body.page-template-page-sitemap-php .page-sitemap__list--cols,
  body.page-slug-sitemap .page-sitemap__list--cols {
    column-count: 2;
  }
}

@media (min-width: 992px) {
  body.page-template-page-sitemap-php .page-sitemap__list--cols.page-sitemap__list--dense,
  body.page-slug-sitemap .page-sitemap__list--cols.page-sitemap__list--dense {
    column-count: 3;
  }
}

body.page-template-page-sitemap-php .page-sitemap__list--cols .page-sitemap__item,
body.page-slug-sitemap .page-sitemap__list--cols .page-sitemap__item {
  break-inside: avoid;
  margin-bottom: 2px;
}

/* Категории услуг — masonry (как основная сетка) */
body.page-template-page-sitemap-php .page-sitemap__groups,
body.page-slug-sitemap .page-sitemap__groups {
  column-count: 1;
  column-gap: 14px;
}

@media (min-width: 520px) {
  body.page-template-page-sitemap-php .page-sitemap__groups,
  body.page-slug-sitemap .page-sitemap__groups {
    column-count: 2;
  }
}

body.page-template-page-sitemap-php .page-sitemap__group,
body.page-slug-sitemap .page-sitemap__group {
  display: inline-block;
  width: 100%;
  margin: 0 0 14px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--color-gray, #f3f3f3);
  vertical-align: top;
  box-sizing: border-box;
}

body.page-template-page-sitemap-php .page-sitemap__list--nested .page-sitemap__link,
body.page-slug-sitemap .page-sitemap__list--nested .page-sitemap__link {
  padding: 4px 0;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

body.page-template-page-sitemap-php .page-sitemap__list--nested .page-sitemap__link:hover,
body.page-slug-sitemap .page-sitemap__list--nested .page-sitemap__link:hover {
  color: var(--color-blue, #0036a7);
}

body.page-template-page-sitemap-php .page-sitemap__list--docs .page-sitemap__link,
body.page-slug-sitemap .page-sitemap__list--docs .page-sitemap__link {
  font-size: 14px;
  line-height: 1.5;
}

/* --- Блок «5 шагов» (.steps): сетка вместо Swiper --- */
.steps:not(.steps--mod1):not(.steps--mod2) .steps__slider {
  overflow: visible;
  padding-bottom: 0;
}

.steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-wrapper {
  display: grid !important;
  gap: 40px;
  width: 100% !important;
  transform: none !important;
  flex-direction: unset !important;
  flex-wrap: unset !important;
  box-sizing: border-box;
}

.steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  height: auto !important;
  flex: none !important;
}

.steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide .step {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: auto !important;
  min-height: 400px;
  max-height: 610px;
  box-sizing: border-box;
}

.steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-pagination {
  display: none !important;
}

/* Фон карточки — на весь .step */
.steps:not(.steps--mod1):not(.steps--mod2) .step__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  margin: 0;
  pointer-events: none;
}

.steps:not(.steps--mod1):not(.steps--mod2) .step__image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.steps:not(.steps--mod1):not(.steps--mod2) .step__wrap {
  position: relative;
  z-index: 3;
}

.steps:not(.steps--mod1):not(.steps--mod2) .step--text-white {
  color: var(--color-white, #fff);
}

.steps:not(.steps--mod1):not(.steps--mod2) .step--text-black {
  color: var(--color-black, #010205);
}

.steps:not(.steps--mod1):not(.steps--mod2) .step--text-black .step__phone,
.steps:not(.steps--mod1):not(.steps--mod2) .step--text-black .step__phone_link {
  color: inherit;
}

/* Десктоп: 3 карточки + 2 карточки */
@media (min-width: 1025px) {
  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-wrapper {
    grid-template-columns: repeat(6, 1fr);
    grid-template-areas:
      "s1 s1 s2 s2 s3 s3"
      "s4 s4 s4 s5 s5 s5";
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(1) {
    grid-area: s1;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(2) {
    grid-area: s2;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(3) {
    grid-area: s3;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(4) {
    grid-area: s4;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(5) {
    grid-area: s5;
  }
}

/* Планшет */
@media (min-width: 768px) and (max-width: 1024px) {
  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-wrapper {
    grid-template-columns: repeat(6, 1fr);
    grid-template-areas:
      "s1 s1 s1 s2 s2 s2"
      "s3 s3 s3 s3 s3 s3"
      "s4 s4 s4 s5 s5 s5";
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(1) {
    grid-area: s1;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(2) {
    grid-area: s2;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(3) {
    grid-area: s3;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(4) {
    grid-area: s4;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide:nth-child(5) {
    grid-area: s5;
  }
}

/* Мобильный: колонка, без слайдера */
@media (max-width: 767px) {
  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas: none;
    gap: 20px;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide {
    grid-area: auto !important;
  }

  .steps:not(.steps--mod1):not(.steps--mod2) .steps__slider .swiper-slide .step {
    min-height: 320px;
    max-height: none;
  }
}
