/* ==========================================================================
   Roadmap — "How We Bring Your Motion to Life?" Two-column section: intro
   copy + CTA + an animated character on the left, a 6-step zigzag
   production roadmap on the right (glowing center line, alternating
   icon/copy per step). Content and step order taken directly from the
   user's own reference mockup (01/Verstka reference: Laptop.jpg + 02.jpg).
   Background follows the site-wide per-section convention established in
   pitch.css: own near-black shade + small static low-alpha accent spots.
   ========================================================================== */

.roadmap {
  background-color: #0e0e12;
  background-image: radial-gradient(circle at 8% 6%, rgba(91, 42, 134, 0.14), transparent 30%);
  padding-block: 140px;
}

.roadmap__grid {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(480px, 1.2fr);
  gap: 96px;
  /* stretch (not start) so .roadmap__intro takes the full row height —
     needed to bottom-anchor the character against .roadmap__map's height,
     i.e. step 6, rather than sitting directly under the intro text. */
  align-items: stretch;
}

/* --- Intro column --- */

.roadmap__intro {
  position: relative;
}

.roadmap__intro-title {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.roadmap__intro-text {
  margin-top: var(--space-5);
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-text-muted);
}

.roadmap__intro-text + .roadmap__intro-text {
  margin-top: var(--space-4);
}

.roadmap__intro-cta-wrap {
  margin-top: var(--space-8);
}

/* --- Character illustration: real Lottie animation (assets/lottie/roadmap-laptop.json) --- */

.roadmap__character {
  /* Absolutely positioned against .roadmap__intro's bottom edge (which the
     grid's align-items:stretch above makes equal to .roadmap__map's own
     height, i.e. step 6's bottom) — pins the two exactly, sidestepping a
     flexbox auto-margin + aspect-ratio interaction that left a stray ~24px
     gap when this was done via `margin-top: auto` on a flex column instead. */
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  aspect-ratio: 1920 / 1750;
}

.roadmap__character svg {
  display: block;
}

/* --- Roadmap map: center glowing line + alternating steps --- */

.roadmap__map {
  position: relative;
  z-index: 0;
}

/* 9 parallel 1px hairlines (center + 4 either side, 3px apart), clipped to
   run exactly from marker 1's center to marker 6's center (never past the
   circles), drawn top->bottom in sync with the marker cascade below — see
   .roadmap__markers timing; total draw duration must match the last
   marker's delay+transition (3333ms + 520ms = 3853ms).

   The leading edge is revealed via an animated mask boundary (--line-progress,
   registered below with @property so it can transition smoothly) rather than
   `transform: scaleY()` — a moving mask keeps the soft-fade zone a constant
   40px wide at the current edge for the whole animation; scaleY would have
   compressed that fade proportionally with the box, so it wasn't reliably
   soft until the very end. */

@property --line-progress {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.roadmap__lines {
  position: absolute;
  left: 50%;
  top: 5.5556%;
  bottom: 5.5556%;
  width: 0;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
}

.roadmap__lines-track {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--color-purple) 0%, var(--color-magenta) 50%, var(--color-orange) 100%);
  /* The fade zone trails BEHIND the current progress (solid up to
     progress-40px, fading out over the last 40px, nothing beyond) rather
     than starting fresh AT progress and extending forward — that earlier
     version put a permanent 40px-tall glowing sliver right at the very top
     (marker 1's position) even at --line-progress:0%, since a gradient's
     first two stops share position 0 there and the fade still ran from
     that point to +40px regardless. This version collapses to genuinely
     nothing at 0% (both "solid" stops resolve to the same point). */
  --line-progress: 0%;
  mask-image: linear-gradient(to bottom, black 0, black calc(var(--line-progress) - 40px), transparent var(--line-progress));
  -webkit-mask-image: linear-gradient(to bottom, black 0, black calc(var(--line-progress) - 40px), transparent var(--line-progress));
  transition: --line-progress 3853ms linear;
}

.roadmap__lines-track--center {
  background: linear-gradient(180deg, #9475b0 0%, #d674b4 50%, #ffa96a 100%);
}

/* Glow as a blurred DUPLICATE of the real line set, not a generic bar: a
   second copy of the same 9 .roadmap__lines-track spans lives inside
   .roadmap__lines-glow, which only applies `filter: blur()` to the group —
   no mask of its own. Each duplicated track still carries its own
   mask-image/--line-progress (inherited from the shared .roadmap__lines-track
   rule below, triggered by the same .roadmap__lines.is-revealed as the
   crisp originals), so the glow reveals in perfect sync and actually traces
   the real line pattern (same spacing/opacity per pair) once blurred into a
   haze — rather than a plain rectangle. Blurring an unmasked wrapper also
   sidesteps the earlier "mask clips the blur bleed" bug entirely, since
   there's no mask box on the blurred element itself to clip against. */

.roadmap__lines-glow {
  position: absolute;
  inset: 0;
  filter: blur(4px);
  opacity: 0.7;
}

.roadmap__lines.is-revealed .roadmap__lines-track {
  --line-progress: 100%;
}

/* --- Numbered step markers: hand-built replacement for the old Lottie
   circles. Same size/timing intent (71.5px circle, 20-frame/667ms stagger,
   slight overshoot pop), scaled 1.5x smaller and self-colored per step. --- */

.roadmap__markers {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 0;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.roadmap__marker {
  position: absolute;
  left: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
  border-radius: 50%;
  border: 2px solid var(--marker-color);
  background: #0e0e12;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  color: var(--marker-color);
  transform: scale(0);
  transition: transform 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.roadmap__markers.is-revealed .roadmap__marker {
  transform: scale(1);
}

.roadmap__markers.is-revealed .roadmap__marker:nth-child(1) { transition-delay: 0ms; }
.roadmap__markers.is-revealed .roadmap__marker:nth-child(2) { transition-delay: 667ms; }
.roadmap__markers.is-revealed .roadmap__marker:nth-child(3) { transition-delay: 1333ms; }
.roadmap__markers.is-revealed .roadmap__marker:nth-child(4) { transition-delay: 2000ms; }
.roadmap__markers.is-revealed .roadmap__marker:nth-child(5) { transition-delay: 2667ms; }
.roadmap__markers.is-revealed .roadmap__marker:nth-child(6) { transition-delay: 3333ms; }

/* --- Information-flow streaks: thin bars drifting top->bottom behind the
   lines, varied speed/height/delay. Generated paused by js/roadmap-map.js,
   released to run (and loop forever) once the same trigger fires as the
   lines/markers above — stays paused/invisible until scrolled into view,
   then becomes a continuous ambient overlay. --- */

.roadmap__flow {
  position: absolute;
  left: 50%;
  top: 5.5556%;
  bottom: 5.5556%;
  width: 27px;
  transform: translateX(-50%);
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.roadmap__flow-streak {
  position: absolute;
  top: -180px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent 0%, var(--streak-color, var(--color-magenta)) 45%, var(--streak-color, var(--color-magenta)) 55%, transparent 100%);
  opacity: var(--streak-opacity, 0.5);
  animation-name: roadmapFlowDrift;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-play-state: paused;
}

.roadmap__flow.is-revealed .roadmap__flow-streak {
  animation-play-state: running;
}

@keyframes roadmapFlowDrift {
  0% { top: -180px; }
  100% { top: 100%; }
}

.roadmap__step {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  align-items: center;
  gap: var(--space-4);
}

.roadmap__step:nth-child(odd) .roadmap__step-icon { grid-column: 1; }
.roadmap__step:nth-child(odd) .roadmap__step-copy { grid-column: 3; }
.roadmap__step:nth-child(even) .roadmap__step-copy { grid-column: 1; }
.roadmap__step:nth-child(even) .roadmap__step-icon { grid-column: 3; }

.roadmap__step + .roadmap__step {
  margin-top: 20px;
}

.roadmap__step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.roadmap__step:nth-child(odd) .roadmap__step-icon {
  justify-content: flex-end;
}

.roadmap__step:nth-child(even) .roadmap__step-icon {
  justify-content: flex-start;
}

.roadmap__step-icon svg {
  width: 44px;
  height: 44px;
}

.roadmap__step-icon-frame {
  position: relative;
  display: inline-flex;
}

.roadmap__step-icon-frame img {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
}

.roadmap__step-icon-frame--1 img { height: 142px; }
.roadmap__step-icon-frame--2 img { height: 140px; }
.roadmap__step-icon-frame--3 img { height: 135px; }
.roadmap__step-icon-frame--4 img { height: 130px; }
.roadmap__step-icon-frame--5 img { height: 142px; }
.roadmap__step-icon-frame--6 img { height: 138px; }

/* Glow: a blurred radial-gradient blob sitting behind the icon (not shaped
   to its silhouette — a plain soft ellipse is far cheaper to render than
   blurring a duplicate of the icon's own complex line art, and reads fine
   at this size). Tunable knobs, all below:
   - inset on .roadmap__step-icon-glow: how far the blob extends past the
     icon's own box on each side (more negative = bigger glow footprint).
   - filter: blur(): softness of the blob's edge (higher = fluffier/less defined).
   - opacity on .roadmap__step-icon-glow: overall strength of the glow.
   - each rgba() stop below: color and per-stop alpha; the 3 stops are
     center color/alpha, mid color/alpha, and the transparent falloff point
     (adjust that last percentage to make the blob tighter/looser). */
.roadmap__step-icon-glow {
  position: absolute;
  inset: -8%;
  filter: blur(7px);
  opacity: 0.4;
  z-index: 0;
}

.roadmap__step-icon-frame--1 .roadmap__step-icon-glow {
  background: radial-gradient(ellipse at center, rgba(192, 41, 139, 0.4) 0%, rgba(91, 42, 134, 0.18) 50%, transparent 75%);
}

.roadmap__step-icon-frame--2 .roadmap__step-icon-glow {
  background: radial-gradient(ellipse at center, rgba(34, 211, 238, 0.4) 0%, rgba(99, 102, 241, 0.18) 50%, transparent 75%);
}

.roadmap__step-icon-frame--3 .roadmap__step-icon-glow {
  background: radial-gradient(ellipse at center, rgba(251, 191, 36, 0.4) 0%, rgba(239, 68, 68, 0.18) 50%, transparent 75%);
}

.roadmap__step-icon-frame--4 .roadmap__step-icon-glow {
  background: radial-gradient(ellipse at center, rgba(215, 19, 172, 0.4) 0%, rgba(116, 35, 182, 0.18) 50%, transparent 75%);
}

.roadmap__step-icon-frame--5 .roadmap__step-icon-glow {
  background: radial-gradient(ellipse at center, rgba(41, 195, 208, 0.38) 0%, rgba(153, 92, 213, 0.18) 50%, transparent 75%);
}

.roadmap__step-icon-frame--6 .roadmap__step-icon-glow {
  background: radial-gradient(ellipse at center, rgba(251, 191, 36, 0.4) 0%, rgba(239, 68, 68, 0.18) 50%, transparent 75%);
  opacity: 0.2;
}

.roadmap__step-copy {
  text-align: left;
}

.roadmap__step:nth-child(even) .roadmap__step-copy {
  text-align: right;
}

.roadmap__step-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.roadmap__step-title {
  margin-top: 4px;
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text);
}

.roadmap__step-desc {
  margin-top: var(--space-2);
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text-faint);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .roadmap {
    padding-block: var(--space-16);
  }
  .roadmap__grid {
    grid-template-columns: 1fr;
    gap: var(--space-12);
    align-items: start;
  }
  /* CTA button stays on desktop only. */
  .roadmap__intro-cta-wrap {
    display: none;
  }
  /* Laptop Lottie doubled for tablet (320 -> 640px) so it reads as a real
     illustration under the intro rather than a small badge. */
  .roadmap__character {
    position: static;
    width: min(640px, 92%);
    margin: var(--space-8) auto 0;
  }

  /* No cursor here, so no scroll-driven timeline animation: show the
     centre line fully drawn and the markers at full size immediately (no
     transitions), and drop the ambient flow streaks entirely. The map
     stays as static decoration on tablet; mobile replaces it outright
     below. */
  .roadmap__flow {
    display: none;
  }
  .roadmap__lines-track {
    --line-progress: 100%;
    transition: none;
  }
  .roadmap__marker {
    transform: scale(1);
    transition: none;
  }
}

@media (max-width: 767px) {
  .roadmap {
    padding-block: var(--space-12);
  }
  .roadmap__intro-title {
    font-size: 26px;
  }
  .roadmap__intro-text {
    font-size: var(--fs-body);
  }
  /* Mobile map: drop the centre-line timeline, markers, flow streaks and
     laptop, and lay the six steps out as a clean two-column table — a
     fixed icon cell on the left (all six aligned in one column, 1 -> 6
     down the page) and the text description on the right. Even row rhythm
     with a hairline between rows so it reads as an ordered table, not
     scattered floating icons. */
  .roadmap__character,
  .roadmap__lines,
  .roadmap__markers,
  .roadmap__flow {
    display: none;
  }
  .roadmap__steps {
    border-top: 1px solid var(--color-border);
  }
  .roadmap__step {
    grid-template-columns: 84px 1fr;
    gap: var(--space-5);
    align-items: center;
    text-align: left;
    padding-block: var(--space-5);
    border-bottom: 1px solid var(--color-border);
  }
  .roadmap__step + .roadmap__step {
    margin-top: 0;
  }
  /* grid-row:1 on both cells is required, not just grid-column: for the
     even steps the icon comes AFTER the copy in the DOM, and with only a
     column pinned the sparse auto-placement dropped that icon onto a
     second row instead of back into row 1 beside its text. Pinning both
     to row 1 forces every row — odd or even — into the same icon-left /
     text-right table shape. */
  .roadmap__step:nth-child(odd) .roadmap__step-icon,
  .roadmap__step:nth-child(even) .roadmap__step-icon {
    grid-column: 1;
    grid-row: 1;
    justify-content: center;
  }
  .roadmap__step:nth-child(odd) .roadmap__step-copy,
  .roadmap__step:nth-child(even) .roadmap__step-copy {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
  }
  .roadmap__step-icon-frame--1 img,
  .roadmap__step-icon-frame--2 img,
  .roadmap__step-icon-frame--3 img,
  .roadmap__step-icon-frame--4 img,
  .roadmap__step-icon-frame--5 img,
  .roadmap__step-icon-frame--6 img {
    height: 68px;
  }
}
