/* Контентные разделы и статические страницы: кейсы, блог, FAQ, отзывы, о компании,
   контакты, документы, поиск, 404, лендинги /cms/, /developer/, /ai/.
   Опирается на токены и базовые классы main.css. Префикс ct- у собственных классов. */

/* Текст из визуального редактора (инфоблоки, статьи, кейсы). */
.prose { max-width: 760px; overflow-wrap: anywhere; }
.prose > * + * { margin-top: 16px; }
.prose h2 { font-size: clamp(24px, 2.4vw, 30px); margin-top: 40px; }
.prose h3 { font-size: 21px; margin-top: 32px; }
.prose h4 { font-size: 18px; margin-top: 24px; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 12px; }
.prose p:empty, .prose br + br { display: none; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--accent-strong); }
.prose a { color: var(--accent-strong); text-underline-offset: 3px; }
.prose img { border-radius: var(--radius-card); margin: 24px auto; height: auto !important; max-width: 100% !important; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose blockquote { margin: 24px 0; padding: 16px 20px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius-input) var(--radius-input) 0; }
.prose [style*="width"] { max-width: 100% !important; }
.prose iframe, .prose video { max-width: 100%; border-radius: var(--radius-card); }
.prose--wide { max-width: none; }

/* Общие блоки. */
.ct-mt-0 { margin-top: 0 !important; }
.ct-mt-16 { margin-top: 16px; }
.ct-mt-24 { margin-top: 24px; }
.ct-mt-40 { margin-top: 40px; }
.ct-lead { font-size: 19px; color: var(--text-muted); max-width: 62ch; }
.ct-back { margin-top: 40px; }
.ct-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; list-style: none; margin: 0; padding: 0; }
.ct-grid--2 { grid-template-columns: repeat(2, 1fr); }
.ct-grid--4 { grid-template-columns: repeat(4, 1fr); }
.ct-grid > * { min-width: 0; }
.ct-card {
  display: flex; flex-direction: column; gap: 10px; padding: 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
}
.ct-card--tint { background: var(--accent-soft); border-color: transparent; }
.ct-card__title { font-size: 20px; }
.ct-card__text { color: var(--text-muted); font-size: 16px; }
.ct-card .link-arrow { margin-top: auto; padding-top: 8px; font-size: 16px; }
a.ct-card { text-decoration: none; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
a.ct-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ct-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.ct-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.ct-split { display: grid; grid-template-columns: 1fr 1.5fr; gap: 56px; align-items: start; }
.ct-split > * { min-width: 0; }
.ct-note { margin-top: 20px; font-size: 15px; color: var(--text-muted); }

/* CTA-плашка. */
.ct-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  padding: 40px; background: var(--accent-soft); border-radius: var(--radius-card);
}
.ct-cta__title { font-size: clamp(22px, 2.4vw, 30px); }
.ct-cta__text { margin-top: 8px; color: var(--text-muted); max-width: 52ch; }

/* Фильтр-чипы (кейсы, FAQ). */
.ct-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.ct-filter__btn {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface);
  font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1; color: var(--text); text-decoration: none; cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.ct-filter__btn:hover { border-color: var(--text); }
.ct-filter__btn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.ct-filter__count { margin-left: 6px; opacity: .6; font-size: 13px; }

/* Список кейсов. */
.ct-cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 24px; }
.ct-cases > .case, .ct-cases > .case:nth-child(1), .ct-cases > .case:nth-child(2) { grid-column: auto; }
.ct-cases > [hidden] { display: none; }
.case__media--empty { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 18px; padding: 24px; text-align: center; }
.case__text { margin-top: 8px; font-size: 15px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Детальная кейса. */
.ct-case-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: start; }
.ct-case-hero > * { min-width: 0; }
.ct-case-hero__media { border-radius: var(--radius-card); overflow: hidden; background: var(--surface-2); }
.ct-case-hero__media img { width: 100%; height: auto; }
.ct-tasks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; list-style: none; margin: 24px 0 0; padding: 0; counter-reset: task; }
.ct-tasks > li {
  position: relative; padding: 24px 24px 24px 72px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); counter-increment: task; min-width: 0;
}
.ct-tasks > li::before {
  content: counter(task); position: absolute; left: 24px; top: 22px;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 15px;
}
.ct-tasks p { margin: 0; }
.ct-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ct-summary > * { min-width: 0; }
.ct-summary__title { font-size: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.ct-summary ul { padding-left: 1.2em; margin: 0; }
.ct-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.ct-gallery > a { display: block; border-radius: var(--radius-card); overflow: hidden; background: var(--surface-2); }
.ct-gallery img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16 / 10; transition: transform .5s var(--ease); }
.ct-gallery > a:hover img { transform: scale(1.02); }
.ct-fifty { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.ct-fifty > * { min-width: 0; }
.ct-fifty img { border-radius: var(--radius-card); }

/* Блог. */
.ct-posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 24px; list-style: none; margin: 0; padding: 0; }
.ct-posts > * { min-width: 0; }
.ct-post { display: flex; flex-direction: column; height: 100%; text-decoration: none; }
.ct-post__media { border-radius: var(--radius-card); overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); margin-bottom: 16px; }
.ct-post__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.ct-post:hover .ct-post__media img { transform: scale(1.03); }
.ct-post__date { font-size: 14px; color: var(--text-muted); }
.ct-post__title { margin-top: 6px; font-size: 20px; }
.ct-post:hover .ct-post__title { color: var(--accent-strong); }
.ct-post__text { margin-top: 8px; font-size: 15px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ct-post--text { padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.ct-article__meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 15px; color: var(--text-muted); }
.ct-article__cover { margin: 0 0 40px; border-radius: var(--radius-card); overflow: hidden; max-width: 960px; }
.ct-article__cover img { width: 100%; height: auto; }
.ct-article__nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.ct-article__nav a { max-width: 46%; text-decoration: none; }
.ct-article__nav span { display: block; font-size: 14px; color: var(--text-muted); }
.ct-article__nav strong { display: block; margin-top: 4px; }
.ct-article__nav a:hover strong { color: var(--accent-strong); }

/* Постраничная навигация. */
.ct-pager { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 48px; list-style: none; padding: 0; }
.ct-pager a, .ct-pager span {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-control); text-decoration: none; font-weight: 600;
}
.ct-pager a:hover { border-color: var(--text); }
.ct-pager [aria-current="page"] { background: var(--text); border-color: var(--text); color: #fff; }

/* FAQ по категориям. */
.ct-faq-group + .ct-faq-group { margin-top: 56px; }
.ct-faq-group__title { font-size: clamp(22px, 2.2vw, 28px); margin-bottom: 8px; }
.faq__answer ul, .faq__answer ol { margin: 8px 0 0; padding-left: 1.3em; }
.faq__answer li + li { margin-top: 4px; }
.faq__answer a { color: var(--accent-strong); }

/* Отзывы. */
.ct-reviews { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; list-style: none; margin: 0; padding: 0; }
.ct-reviews > * { min-width: 0; }
.ct-review { display: flex; flex-direction: column; gap: 14px; height: 100%; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.ct-review__letter { display: block; border-radius: var(--radius-input); overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-2); border: 1px solid var(--line); }
.ct-review__letter img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ct-review__quote { margin: 0; color: var(--text); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ct-review__quote.is-open { -webkit-line-clamp: unset; display: block; }
.ct-review__more { align-self: flex-start; padding: 0; border: 0; background: none; font: inherit; cursor: pointer; }
.ct-review__name { font-weight: 700; font-size: 18px; }
.ct-review__services { margin-top: auto; font-size: 14px; color: var(--text-muted); }
.ct-review__services a { color: inherit; }

/* Контакты. */
.ct-contacts { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; align-items: stretch; }
.ct-contacts > * { min-width: 0; }
.ct-contacts__list { display: grid; gap: 24px; list-style: none; margin: 0; padding: 0; }
.ct-contacts__label { display: block; font-size: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.ct-contacts__value { display: block; margin-top: 4px; font-size: 20px; font-weight: 600; text-decoration: none; }
a.ct-contacts__value:hover { color: var(--accent-strong); }
.ct-map { position: relative; min-height: 420px; border-radius: var(--radius-card); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.ct-map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Вакансии. */
.ct-vacancy-cta { margin-top: 16px; }

/* Поиск. */
.ct-search { display: flex; gap: 12px; max-width: 720px; }
.ct-search__input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 16px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-control);
}
.ct-search__input:focus { border-color: var(--text); outline: none; }
.ct-search-results { list-style: none; margin: 40px 0 0; padding: 0; max-width: 860px; }
.ct-search-results > li { padding: 24px 0; border-top: 1px solid var(--line); }
.ct-search-results > li:last-child { border-bottom: 1px solid var(--line); }
.ct-search-results a { font-size: 20px; font-weight: 600; text-decoration: none; }
.ct-search-results a:hover { color: var(--accent-strong); }
.ct-search-results p { margin-top: 8px; color: var(--text-muted); font-size: 16px; }
.ct-search-results b { color: var(--text); }
.ct-search-results__url { display: block; margin-top: 4px; font-size: 14px; color: var(--text-muted); }

/* 404. */
.ct-404 { padding: 72px 0 32px; }
.ct-404__code { font-size: clamp(72px, 12vw, 140px); font-weight: 700; line-height: 1; color: var(--accent-strong); }

/* Документ (политика). */
.ct-doc { max-width: 860px; }
.ct-doc h2 { font-size: 22px; margin-top: 40px; }
.ct-doc .ct-placeholder { padding: 2px 6px; background: var(--accent-soft); border-radius: 6px; }

@media (max-width: 900px) {
  .ct-grid, .ct-grid--2, .ct-grid--4, .ct-cases, .ct-posts, .ct-reviews,
  .ct-split, .ct-case-hero, .ct-tasks, .ct-summary, .ct-gallery, .ct-fifty, .ct-contacts { grid-template-columns: 1fr; }
  .ct-split, .ct-case-hero, .ct-fifty, .ct-contacts { gap: 28px; }
  .ct-cta { padding: 28px 20px; }
  .ct-map { min-height: 320px; }
  .ct-article__nav a { max-width: 100%; }
}
@media (min-width: 901px) and (max-width: 1100px) {
  .ct-cases, .ct-posts, .ct-reviews, .ct-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .ct-search { flex-direction: column; }
}

/* Кейсы /portfolio/: фильтры двумя группами и галерея квадратных плиток.
   Плитка — верх скриншота сайта; у длинных скриншотов при наведении кадр плавно едет вниз (видно весь сайт). */
.pf-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px 48px; margin-bottom: 40px; }
.pf-filters__title { margin-bottom: 12px; font-size: 17px; font-weight: 700; }
.pf-filters__list { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface);
  font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1; color: var(--text); cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.pf-pill span { font-size: 13px; color: var(--text-muted); }
.pf-pill:hover { border-color: var(--text); }
.pf-pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pf-pill[aria-pressed="true"] span { color: rgb(255 255 255 / .65); }
.pf-pill[hidden] { display: none; }
.pf-pill--more { border-style: dashed; color: var(--text-muted); }

.pf-empty { margin-top: 24px; color: var(--text-muted); }
.pf-reset { padding: 0; border: 0; background: none; font: inherit; color: var(--accent-strong); font-weight: 600; cursor: pointer; }

@media (max-width: 899px) {
  .pf-filters { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 28px; }
  /* На телефоне фильтры — строка с прокруткой, чтобы не занимать первый экран. */
  .pf-filters__list { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .pf-pill { flex: none; }
 }

/* Статья блога: текст удобной ширины слева, справа липкая панель с оглавлением и связью — страница на всю ширину контейнера. */
.ct-article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 64px; align-items: start; }
.ct-article-main { min-width: 0; }
.ct-article-main .prose { max-width: 820px; }
.ct-article-main .ct-article__cover { max-width: none; }
.ct-article-aside { position: sticky; top: calc(var(--header-h) + 40px); display: grid; gap: 16px; }
.ct-toc { padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.ct-toc__title { font-size: 17px; font-weight: 700; cursor: pointer; list-style: none; }
.ct-toc__title::-webkit-details-marker { display: none; }
.ct-toc__title { display: flex; justify-content: space-between; align-items: center; }
.ct-toc__title::after { content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .2s var(--ease); }
.ct-toc[open] .ct-toc__title::after { transform: translateY(2px) rotate(-135deg); }
.ct-toc__list { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: toc; display: grid; gap: 2px; max-height: calc(100vh - 420px); overflow-y: auto; }
.ct-toc__list li { counter-increment: toc; }
.ct-toc__list a { display: grid; grid-template-columns: 28px 1fr; padding: 7px 8px; border-radius: 10px; font-size: 15px; line-height: 1.35; color: var(--text-muted); text-decoration: none; }
.ct-toc__list a::before { content: counter(toc, decimal-leading-zero); font-size: 13px; font-weight: 700; color: var(--text-muted); opacity: .7; padding-top: 1px; }
.ct-toc__list a:hover { color: var(--text); background: var(--surface-2); }
.ct-toc__list a.is-active { color: var(--accent-strong); background: var(--accent-soft); }
.ct-toc__list a.is-active::before { color: var(--accent-strong); opacity: 1; }
.ct-aside-cta { padding: 24px; background: var(--grad-soft); border-radius: var(--radius-card); display: grid; gap: 10px; justify-items: start; }
.ct-aside-cta__title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.ct-aside-cta__text { font-size: 15px; color: var(--text-muted); }
.ct-aside-cta .btn { margin-top: 6px; }
.ct-aside-cta__phone { font-weight: 700; text-decoration: none; }
.ct-aside-cta__phone:hover { color: var(--accent-strong); }
.prose h2[id] { scroll-margin-top: calc(var(--header-h) + 40px); }
@media (max-width: 1000px) {
  .ct-article-layout { grid-template-columns: 1fr; gap: 24px; }
  .ct-article-aside { position: static; order: -1; }
  .ct-toc__list { max-height: none; }
  .ct-aside-cta { display: none; }
}
/* Реквизиты на «Контактах»: две колонки на широком экране */
.ct-requisites { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 20px 32px; margin-top: 24px; }
.ct-requisites > li:last-child { grid-column: 1 / -1; }
