/* css/process.css */

.process {
  padding: clamp(20px, 2.5vh, 36px) 0;
  background: var(--c-bg-milk);
  /* Общая ширина текстовой колонки для .pstep и .process__timeline — оба
     считают от одного и того же .container, поэтому совпадают день-в-день */
  --pcol-gap: var(--space-7);
}

.process__pin {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* width:100% явно — иначе внутри flex-колонки .process__pin ширина
   .container становится auto/shrink-to-fit, и calc(45%...) у
   .process__timeline (потомок с процентным max-width) упирается
   в круговую зависимость и схлопывает контейнер до контента */
.process .container { width: 100%; max-width: 1060px; }

.process__heading { margin-bottom: clamp(14px, 1.8vh, 24px); text-align: left; }
.process__heading .title-split__strong,
.process__heading .title-split__light { color: var(--c-ink); }

/* Сцена этапов */
.process__stage {
  position: relative;
  min-height: clamp(170px, 20vh, 230px);
  margin-bottom: clamp(40px, 6vh, 72px);
}

.pstep {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
  opacity: 0;
  transform: translateX(120px) scale(0.97);
  filter: blur(4px);
  pointer-events: none;
  transition: opacity 1.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.6s cubic-bezier(0.16, 1, 0.3, 1),
    filter 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.pstep.is-active { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); pointer-events: auto; }

/* Пройденные шаги уходят влево, будущие ждут справа — направление
   перехода совпадает с движением по таймлайну. */
.pstep.is-before { transform: translateX(-120px) scale(0.97); filter: blur(4px); }
.pstep.is-after  { transform: translateX(120px) scale(0.97); filter: blur(4px); }

/* Мобильный порядок: изображение сверху, текст под ним */
.pstep__media { order: -1; }
.pstep__text { order: 0; display: flex; flex-direction: column; }

.pstep__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }

.pstep__list li {
  position: relative;
  padding-left: 16px;
  font-family: var(--f-body);
  font-size: var(--fs-body);
  color: var(--c-body-light);
  line-height: var(--lh-body);
}

.pstep__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-accent);
}

.pstep__media {
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: var(--c-surface);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pstep__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pstep__ph { font-family: var(--f-body); font-size: var(--fs-caption); color: var(--c-body-light); }

.process__cta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: clamp(28px, 4vh, 44px);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur-ui) var(--ease-soft), transform var(--dur-ui) var(--ease-soft);
}

.process__cta.is-shown { opacity: 1; transform: translateY(0); }

.process__cta-text {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: var(--c-ink);
  margin: 0;
}

@media (min-width: 768px) {
  .pstep {
    grid-template-columns: calc(45% - var(--pcol-gap) / 2) calc(55% - var(--pcol-gap) / 2);
    gap: var(--pcol-gap);
  }

  .pstep__media { order: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pstep,
  .process__cta {
    transition: none;
  }
  .pstep { filter: none; }
}

@media (max-width: 767.98px) {
  /* Соседние карточки выглядывают за краями контейнера */
  .process .container { overflow: hidden; }

  /* Сцена превращается в ленту */
  .process__stage {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 12px;
    min-height: 0 !important;
    margin-bottom: clamp(18px, 2.5vh, 28px);
    transition: transform 0.6s var(--ease-soft);
    touch-action: pan-y;
  }

  .pstep {
    position: static;
    inset: auto;
    flex: 0 0 88%;
    max-width: 88%;
    opacity: 0.35;
    transform: none;
    pointer-events: auto;
    gap: 0;
    /* display: contents у .pstep__text поднимает head и list
       на уровень грида — тогда head можно положить поверх фото */
    grid-template-areas: "media" "list";
    grid-template-columns: 1fr;
    transition: opacity 0.5s var(--ease-soft);
  }

  .pstep.is-active,
  .pstep.is-before,
  .pstep.is-after { transform: none; }

  .pstep.is-active { opacity: 1; }

  .pstep__text { display: contents; }
  .pstep__media { grid-area: media; order: 0; position: relative; }
  .pstep__list  { grid-area: list; }

  /* Номер и название — поверх фото, внизу слева */
  .pstep__head {
    grid-area: media;
    align-self: end;
    z-index: 2;
    display: block;
    margin: 0;
    padding: 44px 14px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.35) 55%, transparent 100%);
    border-radius: 0 0 12px 12px;
  }

  .pstep__head .pstep__num {
    display: block;
    margin: 0 0 3px;
    font-family: var(--f-display);
    font-weight: 500;
    font-size: var(--fs-caption);
    letter-spacing: 0.14em;
    color: var(--c-white);
    opacity: 0.85;
  }

  .pstep__head .pstep__title {
    display: block;
    font-family: var(--f-display);
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1.15;
    letter-spacing: 0.02em;
    color: var(--c-white);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  }

  /* Список вплотную под фото */
  .pstep__list {
    gap: 4px;
    padding-top: 12px;
  }

  .pstep__list li {
    padding-left: 14px;
    font-size: var(--fs-small);
    line-height: 1.45;
  }

  .pstep__list li::before { width: 4px; height: 4px; top: 0.5em; }

  .process__cta { margin-top: clamp(20px, 3vh, 32px); }
}
