/* Раздел «Проекты»: статьи-кейсы и хаб. Подключается после ../styles.css.
   Без .hero: шапка сразу в светлом состоянии (см. initHeaderScroll в script.js). */

.case {
  padding: calc(var(--header-height) + 32px) 16px 0;
}

/* Хлебные крошки над заголовком */
.case-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 20px;
  color: #8a8a8e;
}

.case-crumbs a {
  color: #8a8a8e;
  text-decoration: none;
}

.case-crumbs a:hover {
  color: var(--text-dark);
}

.case-crumbs [aria-current="page"] {
  color: var(--text-dark);
}

/* Заголовок статьи */
.case-head {
  max-width: 680px;
  margin: 0 auto;
}

.case-meta {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 20px;
  color: #888888;
}

.case-head h1 {
  margin: 0;
  font-size: 32px;
  line-height: 36px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.case-lead {
  margin: 28px 0 0;
  max-width: 760px;
  font-size: 18px;
  line-height: 26px;
  color: #3a3a3c;
}

/* Ссылки как на остальном сайте: синие, без подчёркивания, подчёркивание при наведении */
.case-lead a,
.case__inner a:not(.btn) {
  color: var(--primary);
  text-decoration: none;
}

.case-lead a:hover,
.case__inner h3 {
  margin: 40px 0 8px;
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
  color: var(--text-dark);
}

.case__inner h2 + h3,
.case__inner h2 + p + h3 {
  margin-top: 24px;
}

.case__inner a:not(.btn):hover {
  text-decoration: underline;
}

.case-cover {
  max-width: 920px;
  margin: 56px auto 0;
}

.case-cover img {
  width: 100%;
  border-radius: 28px;
}

@media (min-width: 1024px) {
  .case {
    padding-top: calc(var(--header-height) + 56px);
  }

  .case-head h1 {
    font-size: 48px;
    line-height: 56px;
  }

  .case-cover {
    margin-top: 72px;
  }
}

/* Тело статьи: одна колонка для чтения, как в редакционных медиа */
.case__inner {
  max-width: 680px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 26px;
  color: #222222;
}

.case__inner p {
  margin: 0 0 24px;
}

.case__inner h2 {
  margin: 64px 0 16px;
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  color: var(--text-dark);
}

/* Цифры: просто числа, без карточек */
.case-facts {
  display: grid;
  text-align: center;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 24px;
  margin: 64px 0 56px;
  padding: 32px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.case-facts dt {
  font-size: 32px;
  line-height: 36px;
  font-weight: 700;
}

.case-facts dd {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 20px;
  color: #888888;
}

/* С 768px цифры в одну строку: четыре равные колонки, каждая цифра с подписью по центру своей колонки */
@media (min-width: 768px) {
  .case-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Цитаты */
.case-epigraph {
  margin: 56px 0;
  padding: 0 0 0 24px;
  border-left: 3px solid var(--text-dark);
}

.case__inner .case-epigraph p {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}

.case-epigraph cite {
  display: block;
  margin-top: 12px;
  font-size: 14px;
  line-height: 20px;
  font-style: normal;
  color: #888888;
}

.case-quote {
  margin: 0 0 24px;
  padding: 0 0 0 24px;
  border-left: 3px solid var(--primary);
  font-size: 18px;
  line-height: 26px;
}

.case-quote.is-placeholder {
  border-left-color: #ff9500;
  color: #8a5a00;
  font-size: 16px;
  line-height: 24px;
}

/* Фото: на всю ширину колонки, широкие выходят за неё */
.case-figure {
  margin: 48px 0;
}

.case-figure img {
  width: 100%;
  border-radius: 16px;
}

/* Вертикальные фото целиком, без обрезки: по центру колонки, не выше экрана */
.case-figure--portrait img {
  width: auto;
  max-width: 100%;
  max-height: min(65vh, 540px);
  margin: 0 auto;
}

.case-figure--portrait figcaption {
  text-align: center;
}

.case-figure figcaption {
  margin-top: 12px;
  font-size: 14px;
  line-height: 20px;
  color: #8a8a8e;
}

@media (min-width: 1024px) {
  .case-figure {
    margin: 56px 0;
  }

  .case-figure--wide {
    margin-left: -120px;
    margin-right: -120px;
  }

  .case-figure--wide figcaption {
    padding: 0 120px;
  }
}

/* Маршрут */
.case-route {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 24px;
}

.case-route th,
.case-route td {
  padding: 14px 8px 14px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.case-route th {
  font-size: 14px;
  font-weight: 500;
  color: #888888;
}

.case-route td:first-child {
  white-space: nowrap;
  color: #888888;
}

.case-route td:last-child,
.case-route th:last-child {
  padding-right: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.case-route tr.is-peak td {
  font-weight: 600;
  color: var(--text-dark);
}

/* Пожелания: только текст */
.case-wishes {
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-wish {
  margin: 0;
  padding: 18px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

.case-wish:first-child {
  padding-top: 0;
}

.case-wish cite {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 20px;
  font-style: normal;
  font-weight: 400;
  color: #888888;
}

.case-list {
  margin: 0 0 24px;
  padding-left: 22px;
}

.case-list li {
  margin-bottom: 8px;
}

/* Призыв */
.case-cta {
  margin: 112px 0 0;
  padding: 48px 0 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.case__inner .case-cta h2 {
  margin: 0 0 16px;
}

.case-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.case-cta__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Три кнопки связи в одну строку колонки 680px */
@media (min-width: 768px) {
  .case-cta__actions .case-cta__btn {
    padding: 0 20px;
  }
}

.case-cta__icon {
  flex: none;
  filter: brightness(0);
}

.case-cta__icon--light {
  filter: brightness(0) invert(1);
}

/* Хаб */
.projects-hub-head {
  padding-bottom: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page-case .solutions {
  padding-top: 56px;
}

/* Вопросы в той же колонке, что и статья */
.page-case .faq {
  padding-top: 96px;
}

body.page-case .faq__inner {
  max-width: 712px;
  padding-left: 16px;
  padding-right: 16px;
}

.page-case .faq__title {
  text-align: left;
  font-size: 24px;
  line-height: 30px;
}

/* Хаб: лента карточек в одну колонку, как в редакционных медиа.
   Вся карточка кликабельна: ссылка заголовка растянута на карточку, кнопка внизу только для вида. */
.feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 48px;
}

.feed-item {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 32px 32px 32px;
  border-radius: 28px;
  background: #f2f2f4;
  transition: background-color 0.2s ease;
}

.case__inner .feed-item__title a {
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .feed-item:hover {
    background: #eaeaed;
  }
}

.case__inner .feed-item__title {
  margin: 0;
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
}

.case__inner .feed-item__title a {
  color: var(--text-dark);
  text-decoration: none;
}

/* Заголовок без подчёркивания; при наведении на карточку синеет */
.case__inner .feed-item__title a:hover,
.case__inner .feed-item__title a:focus-visible {
  text-decoration: none;
}

.case__inner .feed-item:hover .feed-item__title a {
  color: var(--primary);
}

.feed-item__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 28px;
}

.feed-item__link:focus-visible {
  outline: none;
}

.feed-item__link:focus-visible::after {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.case__inner .feed-item__meta {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 20px;
  color: #8a8a8e;
}

.case__inner .feed-item__lead {
  margin: 16px 0 24px;
  font-size: 16px;
  line-height: 24px;
  color: #3a3a3c;
}

.feed-item__img {
  width: 100%;
  border-radius: 16px;
}

.feed-item__btn {
  margin-top: 24px;
  background: #ffffff;
}

@media (max-width: 767px) {
  .feed-item {
    padding: 24px 20px;
    border-radius: 24px;
  }

  .case__inner .feed-item__title {
    font-size: 18px;
    line-height: 24px;
  }
}

/* Выводы: подзаголовки с номером в строку, текст по левому краю колонки */
.case-lessons {
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: lesson;
}

.case-lessons li {
  margin: 0 0 40px;
  counter-increment: lesson;
}

.case__inner .case-lessons h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
}

.case__inner .case-lessons h3::before {
  content: counter(lesson) ". ";
}

.case__inner .case-lessons p {
  margin: 0;
}

/* Больше воздуха в конце статьи */
.page-case .case-cta {
  margin-top: 128px;
  padding-top: 64px;
}

.page-case .faq {
  padding-top: 144px;
}

.page-case .footer {
  margin-top: 160px;
}

/* График: горизонтальные полосы, значение задаётся --v в процентах (максимум 165) */
.case-chart {
  margin: 48px 0;
}

.case__inner .case-chart__title {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.case-chart__bars {
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-chart__bars li {
  display: grid;
  grid-template-columns: 128px 1fr 48px;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 20px;
}

.case-chart__label {
  color: #555555;
}

.case-chart__bar {
  height: 12px;
  width: calc(var(--v) / 165 * 100%);
  border-radius: 6px;
  background: #c9ccd3;
}

.case-chart__bars li.is-accent .case-chart__bar {
  background: var(--primary);
}

.case-chart__bars li.is-accent .case-chart__label,
.case-chart__bars li.is-accent .case-chart__value {
  color: var(--text-dark);
  font-weight: 600;
}

.case-chart__value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.case-chart figcaption {
  margin-top: 16px;
  font-size: 14px;
  line-height: 20px;
  color: #8a8a8e;
}

@media (max-width: 480px) {
  .case-chart__bars li {
    grid-template-columns: 96px 1fr 44px;
    gap: 8px;
  }
}

/* Галерея макетов: плитки 2×2 на светлом фоне */
.case-gallery {
  margin: 48px 0;
}

.case-gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-gallery__grid li {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  padding: 20px;
  border-radius: 16px;
  background: #f4f4f6;
}

.case-gallery__grid img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.case-gallery figcaption {
  margin-top: 12px;
  font-size: 14px;
  line-height: 20px;
  color: #8a8a8e;
}

/* В хабе вступление как подзаголовки секций сайта: 16px, серое */
.page-case .case-head .case-lead--muted {
  font-size: 16px;
  line-height: 24px;
  color: #888888;
}
