/* ============================================================
   BYPLAN — process-snake.css (v2)
   Goal (per your spec):
   - Under "Как это происходит" show steps in a horizontal journey:
     Row 1: 1 — 2 — 3 (full width)
     Row 2:     5 — 4   (left-to-right visual order as "5-4")
   - Put the subtitle ("Сделаем в течение 3 дней...") at the very bottom.

   Install:
     <link rel="stylesheet" href="assets/css/process-snake.css?v=2">
   ============================================================ */

:root{
  --step-gap: 18px;
  --step-pad: 18px;
  --step-dot: 28px;
  --step-line: rgba(0,0,0,.10);

  --step-card-bg: rgba(255,255,255,.58);
  --step-card-border: rgba(0,0,0,.06);
  --step-card-shadow: 0 18px 55px rgba(0,0,0,.10);

  --ease-out: cubic-bezier(.2,.8,.2,1);
}

/* --- Make #process a single-column "slide" and push subtitle to bottom --- */
#process .container{
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "title"
    "steps"
    "subtitle";
  gap: 14px;
}

#process h2{
  grid-area: title;
  margin-bottom: 0;
}

#process #stepsList{
  grid-area: steps;
}

#process [data-kv="process_subtitle"]{
  grid-area: subtitle;
  margin-top: 14px;
  max-width: 78ch;
  color: rgba(0,0,0,.62);
}

/* --- 3+2 snake grid --- */
#stepsList{
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--step-gap);
  position: relative;
  counter-reset: step;
}

/* Cards */
#stepsList li{
  counter-increment: step;
  position: relative;
  padding: calc(var(--step-pad) + 2px) var(--step-pad) var(--step-pad) calc(var(--step-pad) + var(--step-dot) + 10px);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.72), var(--step-card-bg));
  border: 1px solid var(--step-card-border);
  box-shadow: var(--step-card-shadow);
  overflow: visible;
}

/* Number dot */
#stepsList li::before{
  content: counter(step);
  position: absolute;
  left: var(--step-pad);
  top: var(--step-pad);
  width: var(--step-dot);
  height: var(--step-dot);
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.85rem;
  background: rgba(0,0,0,.06);
  border: 1px solid rgba(0,0,0,.10);
  color: rgba(0,0,0,.70);
}

/* Typography */
#stepsList li strong{
  display: block;
  margin: 0 0 6px 0;
  font-weight: 900;
  letter-spacing: -0.01em;
}
#stepsList li p{
  margin: 0;
  color: rgba(0,0,0,.62);
  line-height: 1.42;
}

/* --- Placement: Row1 = 1-2-3, Row2 = 5-4 (centered) --- */
#stepsList li:nth-child(1){ grid-column: 1; grid-row: 1; }
#stepsList li:nth-child(2){ grid-column: 2; grid-row: 1; }
#stepsList li:nth-child(3){ grid-column: 3; grid-row: 1; }

/* Row 2: leave col1 empty, put 5 in col2 and 4 in col3 */
#stepsList li:nth-child(5){ grid-column: 2; grid-row: 2; }
#stepsList li:nth-child(4){ grid-column: 3; grid-row: 2; }

/* ---- Connectors (1→2, 2→3, 3→4 down, 4→5 left) ---- */
#stepsList li{
  --cx: calc(var(--step-pad) + (var(--step-dot) / 2));
  --cy: calc(var(--step-pad) + (var(--step-dot) / 2));
}

/* 1→2, 2→3 */
#stepsList li:nth-child(1)::after,
#stepsList li:nth-child(2)::after{
  content:"";
  position: absolute;
  top: var(--cy);
  left: 100%;
  width: var(--step-gap);
  height: 2px;
  background: var(--step-line);
  border-radius: 99px;
}

/* 3→4 (down) — note: 4 is under 3 (same column 3) */
#stepsList li:nth-child(3)::after{
  content:"";
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: 2px;
  height: calc(100% + var(--step-gap));
  background: var(--step-line);
  border-radius: 99px;
}

/* 4→5 (left) — 4 at col3 row2, 5 at col2 row2 */
#stepsList li:nth-child(4)::after{
  content:"";
  position: absolute;
  top: var(--cy);
  left: calc(var(--step-gap) * -1);
  width: var(--step-gap);
  height: 2px;
  background: var(--step-line);
  border-radius: 99px;
}

/* Mobile: horizontal swipe (no snake, no connectors) */
@media (max-width: 980px){
  #process .container{
    display: block;
  }

  #stepsList{
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  #stepsList li{
    flex: 0 0 78vw;
    scroll-snap-align: start;
  }
  #stepsList li::after{ display: none; }

  #process [data-kv="process_subtitle"]{
    margin-top: 12px;
  }
}
