/* ============================================================
   HOME — "How we work" roadmap
   Desktop: gradient rail with step cards alternating above and
   below it. ≤1100px: vertical timeline. The rail fills and the
   steps pop in once .rm-flow gets .is-in (web-development.js).
   ============================================================ */
.rm {
  --rm-ink: #0e1630;
  --rm-text: #5b6480;
  --rm-line: #e3e8fb;
  --rm-grad: linear-gradient(120deg, #2563eb 0%, #4f46e5 52%, #7c3aed 100%);
  --rm-ease: cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  padding: clamp(80px, 9vw, 120px) 0;
  background:
    radial-gradient(circle, rgba(79, 70, 229, 0.09) 1px, transparent 1.5px) 0 0 / 26px 26px,
    radial-gradient(ellipse at 50% 55%, rgba(124, 58, 237, 0.07), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f6f7ff 100%);
}

/* ── Head ────────────────────────────────────────────── */
.rm-head {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}
.rm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid #dbe2ff;
  background: #f3f5ff;
  color: #4f46e5;
  font: 700 12px/1 var(--font-secondary, "Inter", sans-serif);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rm-head .rm-title {
  margin: 22px 0 0;
  color: var(--rm-ink);
  font: 800 clamp(2.2rem, 4.3vw, 3.6rem) / 1.08 var(--font-primary, sans-serif);
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.rm-title span {
  background: var(--rm-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Flow (desktop roadmap) ──────────────────────────── */
.rm-flow {
  position: relative;
  max-width: 1240px;
  margin: clamp(44px, 5vw, 64px) auto 0;
}
.rm-rail {
  position: absolute;
  left: calc(100% / 14);
  right: calc(100% / 14);
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 4px;
  background: var(--rm-line);
}
.rm-rail-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--rm-grad);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.45);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.8s var(--rm-ease) 0.2s;
}
.rm-rail-pulse {
  position: absolute;
  top: 50%;
  left: 0;
  width: 90px;
  height: 8px;
  margin: -4px 0 0 -45px;
  border-radius: 8px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  filter: blur(1px);
  opacity: 0;
}
.rm-flow.is-in .rm-rail-fill {
  transform: scaleX(1);
}
.rm-flow.is-in .rm-rail-pulse {
  animation: rmPulse 4.5s 2.2s linear infinite;
}

.rm-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rm-step {
  display: grid;
  grid-template-rows: minmax(180px, 1fr) 96px minmax(180px, 1fr);
  justify-items: center;
  min-width: 0;
}

/* Node on the rail */
.rm-node {
  position: relative;
  z-index: 2;
  grid-row: 2;
  align-self: center;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--rm-grad);
  color: #fff;
  font-size: 24px;
  box-shadow:
    0 0 0 7px #fff,
    0 0 0 8px var(--rm-line),
    0 14px 28px rgba(79, 70, 229, 0.32);
  opacity: 0;
  scale: 0.4;
  transition:
    opacity 0.5s ease calc(0.3s + var(--i) * 0.22s),
    scale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) calc(0.3s + var(--i) * 0.22s),
    box-shadow 0.3s ease;
}
.rm-node b {
  position: absolute;
  top: -10px;
  right: -14px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--rm-line);
  color: #4f46e5;
  font: 800 11px/1 var(--font-secondary, sans-serif);
  box-shadow: 0 6px 14px rgba(37, 52, 140, 0.12);
}

/* Card — odd steps above the rail, even steps below */
.rm-card {
  position: relative;
  grid-row: 1;
  align-self: end;
  width: 172%;
  margin-bottom: 18px;
  padding: 22px 20px 20px;
  border-radius: 20px;
  border: 1px solid var(--rm-line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 38px rgba(37, 52, 140, 0.08);
  opacity: 0;
  translate: 0 -14px;
  transition:
    opacity 0.6s ease calc(0.45s + var(--i) * 0.22s),
    translate 0.7s var(--rm-ease) calc(0.45s + var(--i) * 0.22s),
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}
.rm-step:nth-child(even) .rm-card {
  grid-row: 3;
  align-self: start;
  margin: 18px 0 0;
  translate: 0 14px;
}
.rm-step:first-child .rm-card {
  justify-self: start;
  width: 150%;
}
.rm-step:last-child .rm-card {
  justify-self: end;
  width: 150%;
}
/* Stem joining card and node */
.rm-card::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -34px;
  width: 2px;
  height: 34px;
  margin-left: -1px;
  background: linear-gradient(180deg, #c7cffb, #818cf8);
}
.rm-step:nth-child(even) .rm-card::before {
  top: -34px;
  bottom: auto;
  background: linear-gradient(0deg, #c7cffb, #818cf8);
}
.rm-step:first-child .rm-card::before {
  left: calc(100% / 3);
}
.rm-step:last-child .rm-card::before {
  left: calc(100% * 2 / 3);
}
/* Accent bar */
.rm-card::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: -1px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--rm-grad);
  opacity: 0.85;
}
.rm-no {
  position: absolute;
  top: 6px;
  right: 14px;
  color: #eef1ff;
  font: 800 46px/1 var(--font-primary, sans-serif);
  letter-spacing: -0.04em;
  pointer-events: none;
}
.rm-card h3 {
  position: relative;
  margin: 0 0 6px;
  color: var(--rm-ink);
  font: 800 18px/1.2 var(--font-primary, sans-serif);
}
.rm-card p {
  position: relative;
  margin: 0;
  color: var(--rm-text);
  font-size: 14px;
  line-height: 1.6;
}

.rm-flow.is-in .rm-node {
  opacity: 1;
  scale: 1;
}
.rm-flow.is-in .rm-step .rm-card {
  opacity: 1;
  translate: 0 0;
}

/* Hover */
.rm-step:hover .rm-card {
  border-color: #b9c3ff;
  box-shadow: 0 22px 46px rgba(79, 70, 229, 0.16);
}
.rm-step:hover .rm-node {
  box-shadow:
    0 0 0 7px #fff,
    0 0 0 9px #a5b4fc,
    0 18px 34px rgba(79, 70, 229, 0.45);
}

@keyframes rmPulse {
  0% {
    left: 0;
    opacity: 0;
  }
  8%,
  88% {
    opacity: 1;
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

/* ── ≤1100px: vertical timeline ──────────────────────── */
@media (max-width: 1100px) {
  .rm-flow {
    max-width: 720px;
  }
  .rm-rail {
    left: 31px;
    right: auto;
    top: 32px;
    bottom: 32px;
    width: 3px;
    height: auto;
    margin: 0;
  }
  .rm-rail-fill {
    transform: scaleY(0);
    transform-origin: top;
  }
  .rm-flow.is-in .rm-rail-fill {
    transform: scaleY(1);
  }
  .rm-rail-pulse {
    left: 50%;
    top: 0;
    width: 7px;
    height: 80px;
    margin: -40px 0 0 -3.5px;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  }
  .rm-flow.is-in .rm-rail-pulse {
    animation-name: rmPulseY;
  }
  .rm-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  .rm-step,
  .rm-step:nth-child(even) {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto;
    column-gap: 22px;
    justify-items: stretch;
  }
  .rm-node {
    grid-row: 1;
    grid-column: 1;
    align-self: start;
    margin-top: 8px;
  }
  .rm-card,
  .rm-step:nth-child(even) .rm-card,
  .rm-step:first-child .rm-card,
  .rm-step:last-child .rm-card {
    grid-row: 1;
    grid-column: 2;
    align-self: start;
    justify-self: stretch;
    width: auto;
    margin: 0;
    translate: 16px 0;
  }
  .rm-card::before,
  .rm-step:nth-child(even) .rm-card::before {
    top: 38px;
    bottom: auto;
    left: -22px;
    width: 22px;
    height: 2px;
    margin: 0;
    background: linear-gradient(90deg, #818cf8, #c7cffb);
  }
}
@keyframes rmPulseY {
  0% {
    top: 0;
    opacity: 0;
  }
  8%,
  88% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

@media (max-width: 560px) {
  .rm-rail {
    left: 25px;
    top: 26px;
    bottom: 26px;
  }
  .rm-step,
  .rm-step:nth-child(even) {
    grid-template-columns: 52px minmax(0, 1fr);
    column-gap: 16px;
  }
  .rm-node {
    width: 52px;
    height: 52px;
    font-size: 20px;
    margin-top: 6px;
  }
  .rm-node b {
    top: -8px;
    right: -10px;
    font-size: 10px;
  }
  .rm-card,
  .rm-step:nth-child(even) .rm-card,
  .rm-step:first-child .rm-card,
  .rm-step:last-child .rm-card {
    padding: 18px 16px 16px;
  }
  .rm-card::before,
  .rm-step:nth-child(even) .rm-card::before {
    top: 31px;
    left: -16px;
    width: 16px;
  }
  .rm-no {
    font-size: 38px;
  }
  .rm-card h3 {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rm-rail-fill,
  .rm-node,
  .rm-card {
    transition: none !important;
  }
  .rm-rail-pulse {
    animation: none !important;
  }
}
