/* Поток 3: секции 07 (#cases) и 09 (#process). Классы с префиксами .cases__ и .process__ */

/* ===== 07. Наши объекты ===== */
/* Телефон: лента внутри блока, листается пальцем. Страница вбок не едет. */
.cases__list,
.process__list {
  display: flex;
  gap: 16px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 4px var(--gutter) 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--gutter);
  -webkit-overflow-scrolling: touch;
}
.cases__item,
.process__item {
  flex: 0 0 min(80%, 300px);
  min-width: 0;
  scroll-snap-align: start;
}

/* Карточка объекта: фото квадратом (карточка целиком в экране 1440×900), тег, заголовок,
   параметры чипами (значение не рвётся: «1 пост» целиком), описание 14/22. Карточки в ряду равной высоты. */
.cases__card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
}
.cases__photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--c-light);
}
.cases__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  padding: 16px var(--card-pad) var(--card-pad);
}
.cases__body .tag { background: var(--c-light); }
.cases__body h3 { margin: 10px 0 10px; }
.cases__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cases__param {
  white-space: nowrap;
  padding: 3px 8px;
  border: 1px solid rgba(3, 82, 95, .25);
  border-radius: 6px;
  font-weight: 600; font-size: var(--fs-meta); line-height: var(--lh-meta);
  color: var(--c-primary);
}
/* Разделитель « · » остаётся в тексте (для копирования и экранного диктора), визуально его заменяет промежуток между чипами */
.cases__sep {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.cases__body > p:last-child { font-size: var(--fs-body); line-height: var(--lh-body); }

@media (min-width: 768px) {
  .cases__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .cases__item { flex: none; }
  .cases__photo { aspect-ratio: 4 / 3; }
}
@media (min-width: 1024px) {
  .cases__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cases__photo { aspect-ratio: 1 / 1; }
}

/* ===== 09. Как проходит монтаж ===== */
.process__figure { margin: 0; }
.process__link {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--c-light);
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transition: box-shadow .2s, transform .2s;
}
.process__link:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.process__photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.process__figure figcaption {
  margin-top: 12px;
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  font-weight: 500;
}

@media (min-width: 768px) {
  .process__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .process__item { flex: none; }
  /* 11 фото: последний кадр (четыре поста в ряд) на две колонки - ряды заполнены до правого края
     и на 3, и на 4 колонки. Фото растягивается по высоте соседей, лишнее обрезается. */
  .process__item:last-child { grid-column: span 2; }
  .process__item:last-child .process__figure { display: flex; flex-direction: column; height: 100%; }
  .process__item:last-child .process__link { flex: 1; position: relative; min-height: 200px; }
  .process__item:last-child .process__photo { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; object-position: 50% 60%; }
}
@media (min-width: 1024px) {
  .process__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Лайтбокс: нативный <dialog>, закрытие крестиком, кликом по фону и Esc */
.process__lightbox {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  overflow: visible;
  color: var(--c-white);
}
.process__lightbox::backdrop { background: rgba(3, 55, 61, .88); }
.process__lightbox-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 16px 16px;
}
.process__lightbox-img {
  width: auto;
  height: auto;
  max-width: min(92vw, 700px);
  max-height: calc(100vh - 160px);
  border-radius: var(--radius-card);
  background: var(--c-light);
}
.process__lightbox-caption {
  max-width: min(92vw, 700px);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 500;
  text-align: center;
  color: var(--c-white);
}
.process__lightbox-close {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--c-white);
  font-size: 36px;
  line-height: 44px;
  text-align: center;
}
.process__lightbox-close:hover { color: var(--c-accent); }
