/**
 * AtomCAE — блок «Карточки» (atomcae-cards).
 * Шапка повторяет «Преимущества», карточки — в ОДНУ КОЛОНКУ: слева изображение,
 * справа заголовок + текст (WYSIWYG) в рамке. Грузится после layout.css. Десктоп-first.
 */

.cards {
  background: var(--color-surface);
  color: var(--color-dark);
}

.cards__inner {
  width: min(1402px, 100% - 2 * 40px);
  margin-inline: auto;
}

/* --- Шапка секции (как в «Преимущества») --- */
.cards__head {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding-bottom: 32px;
}

.cards__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  font-size: var(--font-size-eyebrow);
  line-height: var(--font-size-eyebrow);
  letter-spacing: var(--letter-spacing-tight);
  white-space: nowrap;
}

.cards__eyebrow-arrow {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  background-color: var(--color-primary);
  -webkit-mask: url("../icons/arrow-down-right.svg") center / contain no-repeat;
  mask: url("../icons/arrow-down-right.svg") center / contain no-repeat;
}

.cards__eyebrow-text {
  opacity: 0.4;
}

.cards__intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.cards__title {
  margin: 0;
  max-width: 928px;
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-h2);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-heading);
}

.cards__aside {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  width: 452px;
}

.cards__desc {
  margin: 0;
  max-width: 433px;
  font-size: var(--font-size-nav);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-tight);
  opacity: 0.8;
}

.cards__plus {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  opacity: 0.25;
  background-color: var(--color-dark);
  -webkit-mask: url("../icons/plus.svg") center / contain no-repeat;
  mask: url("../icons/plus.svg") center / contain no-repeat;
}

/* Вариант «лид под заголовком»: заголовок + лид в столбик во всю ширину. */
.cards__head--lead {
  padding-bottom: 0;
}

.cards__head--lead .cards__intro {
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
}

.cards__head--lead .cards__title {
  max-width: none;
}

.cards__lead-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.cards__lead {
  margin: 0;
  flex: 1 1 auto;
  font-size: var(--font-size-nav);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-tight);
  opacity: 0.7;
}

/* --- Список карточек: одна колонка сверху вниз --- */
.cards__list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}

/* Карточка = рамка (как карточка «Преимущества»): изображение слева, текст справа. */
.cards__card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 40px;
  padding: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  transition: background-color 0.18s ease;
}

.cards__card:hover {
  background: var(--color-surface-hover);
}

@media (prefers-reduced-motion: reduce) {
  .cards__card {
    transition: none;
  }
}

/* Изображение слева: фиксированная колонка 300px, заполняет высоту карточки (cover). */
.cards__media {
  position: relative;
  flex: 0 0 300px;
  min-height: 260px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--color-surface-hover);
}

.cards__media-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Правая часть: заголовок + текст, по центру по вертикали. */
.cards__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  min-width: 0;
}

.cards__card-title {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-h3);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
}

/* уголок-стрелка ↘ внизу-справа (как в «Преимущества») */
.cards__corner {
  position: absolute;
  inset-block-end: 31px;
  inset-inline-end: 31px;
  width: 10px;
  height: 10px;
  opacity: 0.3;
  background-color: var(--color-dark);
  -webkit-mask: url("../icons/cta-arrow.svg") center / contain no-repeat;
  mask: url("../icons/cta-arrow.svg") center / contain no-repeat;
}

/* --- WYSIWYG-текст карточки --- */
.cards__text p {
  margin: 0;
  font-size: var(--font-size-nav);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-tight);
  opacity: 0.7;
}

.cards__text p + p {
  margin-top: 16px;
}

/* абзац (или иной блок) ПОСЛЕ списка — тот же отступ, иначе прилипает к списку */
.cards__text :is(ul, ol) + * {
  margin-top: 16px;
}

/* Списки — светлая плашка + синяя галочка, как в блоке [[content]] (.content__body).
   Приглушённость li через color rgba (НЕ opacity — иначе гаснет галочка-псевдоэлемент). */
.cards__text ul,
.cards__text ol {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.cards__text li {
  position: relative;
  padding-left: 30px;
  font-size: var(--font-size-nav);
  line-height: var(--line-height-relaxed);
  letter-spacing: var(--letter-spacing-tight);
  color: rgba(22, 34, 56, 0.7);
}

.cards__text li + li {
  margin-top: 8px;
}

.cards__text ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(22, 34, 56, 0.06);
}

.cards__text ul li::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 5px;
  width: 14px;
  height: 14px;
  background-color: var(--color-primary);
  -webkit-mask: url("../icons/check.svg") center / contain no-repeat;
  mask: url("../icons/check.svg") center / contain no-repeat;
}

.cards__text ol {
  counter-reset: cards-ol;
}

.cards__text ol li::before {
  counter-increment: cards-ol;
  content: counter(cards-ol) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
}

.cards__text a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cards__text strong,
.cards__text b {
  font-weight: var(--font-weight-medium);
}

/* --- Планшет: шапка в одну колонку --- */
@media (max-width: 1100px) {
  .cards__intro {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
  }

  .cards__title {
    max-width: none;
    font-size: 40px;
  }

  .cards__aside {
    width: 100%;
  }

  .cards__desc {
    max-width: none;
  }
}

/* --- ≤768: шрифты карточек как на смартфонах --- */
@media (max-width: 768px) {
  .cards__card-title {
    font-size: 22px;
  }

  .cards__text p,
  .cards__text li {
    font-size: 16px;
    line-height: 22px;
  }
}

/* --- Смартфон: изображение сверху, текст снизу (карточка в столбик) --- */
@media (max-width: 640px) {
  .cards {
    padding-block: 30px;
  }

  .cards__inner {
    width: min(1402px, 100% - 2 * 15px);
  }

  .cards__head {
    gap: 24px;
    padding-bottom: 0;
  }

  .cards__eyebrow {
    font-size: 16px;
    line-height: 16px;
  }

  .cards__intro {
    gap: 16px;
  }

  .cards__title {
    font-size: 28px;
    letter-spacing: -1px;
  }

  .cards__desc {
    font-size: 16px;
    line-height: 22px;
  }

  .cards__plus {
    display: none;
  }

  .cards__list {
    gap: 8px;
    margin-top: 32px;
  }

  /* карточка в столбик: изображение сверху, тело снизу */
  .cards__card {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    padding: 24px;
  }

  .cards__media {
    flex-basis: auto;
    width: 100%;
    min-height: 200px;
  }

  .cards__corner {
    position: static;
    align-self: flex-end;
  }
}
