/* ============================================================
   09 — Cases carousel. Значения сняты из Figma-фреймов Cases
   (1600: 116:82717, 1200: 116:82718, 1024: 116:82716,
   768: 116:82722, 430: 116:82721, 375: 116:82720, 320: 116:82719),
   fileKey oFtdKnfuDczuCj4v7e0emt.
   База = фрейм 1600 (боковые поля страницы 24 — решение Alexa,
   поверх макетных 30). Остальные поля — из макета.
   Маска коллажа в Figma = прямоугольник rx16 → здесь radius 16
   + overflow hidden на окне изображения.
   ============================================================ */

.cs { padding: 0 24px; font-family: 'Inter', sans-serif; color: #EAEAEA; }
.cs, .cs * { box-sizing: border-box; }

.cs-inner { display: flex; flex-direction: column; gap: 20px; }

/* --- Шапка блока: заголовок + табы --- */
.cs-head { display: flex; flex-direction: column; gap: 32px; }

.cs-title {
  margin: 0;
  max-width: 383px;
  font-weight: 400;
  font-size: 36px;
  line-height: 40px;
  letter-spacing: 0.72px;
  text-transform: uppercase;
  color: #EAEAEA;
}

.cs-tabs {
  background: #232325;
  border-radius: 111px;
  padding: 4px;
  overflow: hidden;
}
.cs-tabs-row { display: flex; align-items: center; height: 56px; }
.cs-tabs-row--mobile { display: none; }

.cs-tab {
  flex: 1 0 0;
  min-width: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 20px 22px;
  border: 0;
  border-radius: 51px;
  background: #232325;
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  line-height: 16px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #EAEAEA;
  cursor: pointer;
}
.cs-tab--active { background: #EAEAEA; color: #232325; }

.cs-tab-div { flex: none; width: 1px; height: 20px; background: #EAEAEA; opacity: 0.24; }

/* --- Список карточек --- */
.cs-list { display: flex; flex-direction: column; gap: 20px; }

/* Карточка. На 1600 — горизонтальная 1540×588: текстовая колонка + окно 882×572,
   зеркальные карточки — row-reverse. */
.cs-card {
  display: flex;
  height: 588px;
  background: #232325;
  border-radius: 24px;
}
.cs-card--flip { flex-direction: row-reverse; }

.cs-card-col { position: relative; flex: 1 0 0; min-width: 1px; }

.cs-card-head {
  position: absolute;
  left: 28px;
  top: 28px;
  width: 581px;
  max-width: calc(100% - 56px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.cs-card--flip .cs-card-head { width: 572px; }

.cs-card-title {
  margin: 0;
  font-weight: 600;
  font-size: 32px;
  line-height: 38px;
  text-transform: uppercase;
  color: #EAEAEA;
}

/* Чипсы — в макете вплотную, без gap */
.cs-chips { display: flex; flex-wrap: wrap; align-items: flex-start; }
.cs-chip {
  border: 1px solid #D9D9D9;
  border-radius: 23px;
  padding: 8px 14px;
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  color: #EAEAEA;
}
.cs-chip--dim { color: #D9D9D9; }

/* Плашка «WILL BE AVAILABLE SOON» — на 1600 прижата к низу текстовой колонки */
.cs-cta {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 40px;
  background: rgba(164, 164, 164, 0.28);
  border-radius: 14px;
  opacity: 0.44;
  font-weight: 600;
  font-size: 16px;
  line-height: 20px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #F7F7F7;
}

/* --- Окно изображения --- */
.cs-media {
  position: relative;
  flex: none;
  width: 882px;
  height: 580px;   /* 588 − 2×4: вертикальный отступ равен боковому */
  align-self: center;
  margin: 4px 4px 4px 0;   /* правка Alexa: 8 было слишком крупно */
  border-radius: 16px;      /* маска коллажа в Figma — прямоугольник rx16 */
  overflow: hidden;
}
.cs-card--flip .cs-media { margin: 4px 0 4px 4px; }

/* Коллаж: геометрия из макета — бокс 2162/1634, верх −37.06%, низ −23.6%, центр по X */
.cs-collage {
  position: absolute;
  left: 50%;
  top: -37.06%;
  bottom: -23.6%;
  transform: translateX(-50%);
  aspect-ratio: 2162 / 1634;
}
.cs-collage img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

/* Таймлайн (прогресс слайдов) поверх изображения */
.cs-timeline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(23, 23, 25, 0.72);
  border-radius: 61px;
}
.cs-seg {
  position: relative;
  flex: 1 0 0;
  min-width: 1px;
  height: 6px;
  border-radius: 12px;
  background: #818181;
  overflow: hidden;
}
.cs-seg--full { background: #FFFFFF; }
.cs-seg--active::after {
  content: "";
  position: absolute;
  inset: 0 25px 0 0;
  border-radius: 12px;
  background: #EAEAEA;
}

/* Курсор-«c» — декор из макета, координаты фиксированные, на узких окнах клипается */
.cs-cursor { position: absolute; left: 463px; top: 384px; width: 18px; height: 27px; }

/* Счётчик со стрелками. На 1600 — по центру снизу */
.cs-switch {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  background: rgba(23, 23, 25, 0.72);
  border-radius: 87px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.cs-switch-btn {
  position: relative;
  flex: none;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.cs-switch-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
}
.cs-switch-ring--sm { width: 56px; height: 56px; }
.cs-switch-ring--lg { width: 64px; height: 64px; }
.cs-switch-arrow {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 16px;
}
.cs-switch-arrow--prev { left: calc(50% - 2.5px); transform: translate(-50%, -50%) rotate(180deg); }
.cs-switch-arrow--next { left: calc(50% + 2.5px); transform: translate(-50%, -50%); }
.cs-switch-count {
  align-self: center;
  padding: 28px 8px;
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  color: #D9D9D9;
}
.cs-count-b { display: none; }

/* На 1600 оверлеи (таймлайн, курсор, счётчик) — только на первой карточке */
.cs-card:not(.cs-card--1) .cs-timeline,
.cs-card:not(.cs-card--1) .cs-cursor,
.cs-card:not(.cs-card--1) .cs-switch { display: none; }

/* ============================================================
   ≤1200 — карточки складываются вертикально (макет 1200/1024):
   голова → изображение 644 → плашка; оверлеи на всех карточках,
   счётчик 1/10, таймлайн из 6 сегментов, счётчик справа снизу.
   ============================================================ */
@media (max-width: 1200px) {
  .cs { padding: 0 20px; }

  .cs-card,
  .cs-card--flip { flex-direction: column; height: auto; padding: 8px; }

  .cs-card-col { display: contents; }

  .cs-card-head,
  .cs-card--flip .cs-card-head {
    position: static;
    order: 1;
    width: auto;
    max-width: none;
    padding: 8px 88px 0 8px;
  }

  .cs-media,
  .cs-card--flip .cs-media {
    order: 2;
    width: auto;
    height: 644px;
    align-self: stretch;
    margin: 20px 0 0;
  }

  .cs-cta {
    position: static;
    order: 3;
    margin: 8px 0 0;
    border-radius: 16px;
  }

  /* Оверлеи видны на всех карточках */
  .cs-card:not(.cs-card--1) .cs-timeline,
  .cs-card:not(.cs-card--1) .cs-cursor,
  .cs-card:not(.cs-card--1) .cs-switch { display: flex; }
  .cs-card:not(.cs-card--1) .cs-cursor { display: block; }

  /* Счётчик — в правый нижний угол; на всех карточках 1/10 */
  .cs-switch { left: auto; right: 12px; transform: none; }
  .cs-count-a { display: none; }
  .cs-count-b { display: inline; }

  /* Таймлайн из 6 сегментов */
  .cs-seg--xl { display: none; }
}

/* ============================================================ 1024 */
@media (max-width: 1024px) {
  .cs { padding: 0 16px; }
}

/* ============================================================ 768 */
@media (max-width: 1023px) {
  .cs { padding: 0 12px; }
  .cs-list { gap: 12px; }
  .cs-card-head,
  .cs-card--flip .cs-card-head { padding: 8px 0 0 8px; }
}

/* ============================================================
   ≤430 — малый вариант карточки (макет 430/375): узкая шапка блока
   с другим набором табов, тайтл 20/24, чипсы 12/14, окно 460,
   плашки скрыты (на 430 их нет в макете).
   ============================================================ */
@media (max-width: 719px) {
  .cs { padding: 0 8px; }

  .cs-head { gap: 24px; }
  .cs-title {
    /* бокс в макете 275, но веб-метрики Inter чуть шире фигмовских:
       290 сохраняет макетный перенос «INTRODUCING OUR / LATEST PROJECTS» */
    max-width: 290px;
    font-size: 28px;
    line-height: 32px;
    letter-spacing: 0.56px;
  }
  .cs-tabs-row--desktop { display: none; }
  .cs-tabs-row--mobile { display: flex; }

  .cs-card,
  .cs-card--flip { border-radius: 20px; padding: 4px; }

  .cs-card-head,
  .cs-card--flip .cs-card-head { gap: 16px; padding: 16px 0 0 12px; }

  .cs-card-title { font-size: 20px; line-height: 24px; }

  .cs-chip { padding: 8px 12px; font-size: 12px; line-height: 14px; }

  .cs-media,
  .cs-card--flip .cs-media { height: 460px; margin-top: 24px; }

  .cs-cta { display: none; }

  .cs-switch { right: 4px; bottom: 4px; }
}

/* ============================================================ 375 */
@media (max-width: 375px) {
  .cs { padding: 0 6px; }

  .cs-card,
  .cs-card--flip { padding: 8px 4px 4px; }

  .cs-card-head,
  .cs-card--flip .cs-card-head { padding: 8px 0 0 12px; }

  /* В макете 375 плашка есть только у первой карточки */
  .cs-card--1 .cs-cta { display: flex; }
}


/* ============================================================
   Табы категорий забирают слот хедера
   Пока блок Cases на экране, категории ведут себя как шапка:
   встают на её место, ужимаются до высоты её плашки и уходят по
   нижней кромке блока. Геометрию слота скрипт снимает с самой
   плашки хедера, поэтому чисел про брейкпоинты здесь нет.
   ============================================================ */

/* Обёртка всегда в потоке: она держит место таба и отвечает на вопрос
   «где бы он сейчас был». Прячущаяся подложка для этого не годится —
   у скрытого элемента нулевой прямоугольник, и механизм зацикливается. */
.cs-tabs-hold { display: block; }

.cs-tabs.is-pinned {
  position: fixed;
  z-index: 101;              /* над хедером: он на 100. Работает только
                                потому, что скрипт поднимает таб в body —
                                внутри секции этот номер ничего не значит. */
  margin: 0;
  height: var(--cs-tabs-h);
  translate: 0 var(--cs-tabs-exit, 0%);
}

/* Ряд и сами табы садятся на высоту плашки хедера, а не на свои 56 */
.cs-tabs.is-pinned .cs-tabs-row,
.cs-tabs.is-pinned .cs-tab {
  height: calc(var(--cs-tabs-h) - 8px);
}

/* Разделители тянутся за новой высотой, иначе торчат старыми 56 */
.cs-tabs.is-pinned .cs-tab-div {
  height: calc(var(--cs-tabs-h) - 24px);
}

@media (prefers-reduced-motion: reduce) {
  .cs-tabs.is-pinned { transition: none; }
}
