/* Why stream: SVG spine + branches, scroll-drawn */

.why-stream-wrap {
  position: relative;
  max-width: 920px;
  margin-inline: auto;
}

.why-stream__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.why-stream {
  position: relative;
  z-index: 1;
}

.why-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.why-path--spine {
  stroke: url(#whySpineGradV);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.45));
  transition: stroke-dashoffset 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.why-path--spine.is-drawn {
  animation: why-path-flow 4s ease-in-out infinite;
}

.why-path--branch {
  stroke: url(#whyBranchGrad);
  stroke-width: 2;
  opacity: 0.35;
  transition:
    stroke-dashoffset 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.5s ease;
}

.why-path--branch.is-drawn {
  opacity: 1;
}

.why-path--horiz {
  stroke: url(#whyBranchGrad);
  stroke-width: 1.25;
  opacity: 0.28;
  transition:
    stroke-dashoffset 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.45s ease;
}

.why-path--horiz-connector {
  stroke-width: 2;
  opacity: 0.4;
}

.why-path--horiz-connector.is-drawn {
  opacity: 0.95;
  animation: why-horiz-flow 2.6s linear infinite;
}

.why-path--horiz-tail.is-drawn {
  opacity: 0.9;
}

.why-path--horiz-tick {
  stroke-width: 1.5;
  opacity: 0.45;
}

.why-path--horiz-tick.is-drawn {
  opacity: 0.95;
}

.why-path--vert {
  stroke: url(#whySpineGradV);
  stroke-width: 1.25;
  stroke-linecap: round;
}

.why-path--vert-rail {
  opacity: 0.22;
  stroke-width: 1;
}

.why-path--vert-body,
.why-path--vert-join {
  stroke: url(#whyBranchGrad);
  opacity: 0.3;
  transition:
    stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.45s ease;
}

.why-path--vert-body.is-drawn,
.why-path--vert-join.is-drawn {
  opacity: 0.85;
}

.why-path--branch.is-drawn,
.why-path--horiz-tail.is-drawn,
.why-path--horiz-tick.is-drawn,
.why-path--vert-body.is-drawn,
.why-path--vert-join.is-drawn {
  animation: why-path-flow 3.2s ease-in-out infinite;
}

.why-path--horiz-connector.is-drawn {
  animation: why-horiz-flow 2.6s linear infinite;
}

@keyframes why-path-flow {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

@keyframes why-horiz-flow {
  to {
    stroke-dashoffset: -26;
  }
}

.why-path--node-dot {
  fill: url(#whyNodeDotGrad);
  opacity: 0;
  transition: opacity 0.4s ease 0.35s;
}

.why-path--node-dot.is-drawn {
  opacity: 1;
}

/* ── Per-step icon colors (distinct from default blue/violet) ── */
.why--stream .why-node[data-step="1"] .why-node__marker {
  background: linear-gradient(135deg, #0891b2, #22d3ee);
  box-shadow:
    0 0 0 4px rgba(34, 211, 238, 0.18),
    0 0 36px rgba(34, 211, 238, 0.5);
}

.why--stream .why-node[data-step="2"] .why-node__marker {
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  box-shadow:
    0 0 0 4px rgba(139, 92, 246, 0.18),
    0 0 36px rgba(139, 92, 246, 0.5);
}

.why--stream .why-node[data-step="3"] .why-node__marker {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  box-shadow:
    0 0 0 4px rgba(245, 158, 11, 0.18),
    0 0 36px rgba(245, 158, 11, 0.5);
}

.why--stream .why-node[data-step="4"] .why-node__marker {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow:
    0 0 0 4px rgba(16, 185, 129, 0.18),
    0 0 36px rgba(16, 185, 129, 0.5);
}

.why--stream .why-node[data-step="5"] .why-node__marker {
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  box-shadow:
    0 0 0 4px rgba(244, 63, 94, 0.18),
    0 0 36px rgba(244, 63, 94, 0.5);
}

.why--stream .why-node[data-step="6"] .why-node__marker {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow:
    0 0 0 4px rgba(99, 102, 241, 0.18),
    0 0 36px rgba(99, 102, 241, 0.5);
}

.why--stream .why-node__marker {
  animation: why-marker-pulse-accent 3s ease-in-out infinite;
}

.why--stream .why-node:nth-child(2) .why-node__marker { animation-delay: -0.5s; }
.why--stream .why-node:nth-child(3) .why-node__marker { animation-delay: -1s; }
.why--stream .why-node:nth-child(4) .why-node__marker { animation-delay: -1.5s; }
.why--stream .why-node:nth-child(5) .why-node__marker { animation-delay: -2s; }
.why--stream .why-node:nth-child(6) .why-node__marker { animation-delay: -2.5s; }

@keyframes why-marker-pulse-accent {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

/* ── Per-step SVG connector strokes ── */
.why-path--step-1.is-drawn { stroke: #22d3ee; filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.55)); }
.why-path--step-2.is-drawn { stroke: #8b5cf6; filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.55)); }
.why-path--step-3.is-drawn { stroke: #f59e0b; filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.55)); }
.why-path--step-4.is-drawn { stroke: #10b981; filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.55)); }
.why-path--step-5.is-drawn { stroke: #f43f5e; filter: drop-shadow(0 0 6px rgba(244, 63, 94, 0.55)); }
.why-path--step-6.is-drawn { stroke: #6366f1; filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.55)); }

.why-path--horiz-connector.why-path--step-1.is-drawn,
.why-path--horiz-connector.why-path--step-2.is-drawn,
.why-path--horiz-connector.why-path--step-3.is-drawn,
.why-path--horiz-connector.why-path--step-4.is-drawn,
.why-path--horiz-connector.why-path--step-5.is-drawn,
.why-path--horiz-connector.why-path--step-6.is-drawn {
  stroke-width: 2.25;
  animation: why-horiz-flow 2s linear infinite;
}

.why-path--vert-body.is-drawn,
.why-path--vert-join.is-drawn {
  animation: why-vert-flow 2.4s linear infinite;
}

@keyframes why-vert-flow {
  to {
    stroke-dashoffset: -22;
  }
}

.why-path--node-dot-step-1 { fill: #22d3ee; }
.why-path--node-dot-step-2 { fill: #8b5cf6; }
.why-path--node-dot-step-3 { fill: #f59e0b; }
.why-path--node-dot-step-4 { fill: #10b981; }
.why-path--node-dot-step-5 { fill: #f43f5e; }
.why-path--node-dot-step-6 { fill: #6366f1; }

.why-path--node-dot.is-drawn {
  filter: drop-shadow(0 0 8px currentColor);
}

/* Traveling energy along central spine */
.why-path--spine-energy {
  stroke: #fff;
  stroke-width: 2;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.8));
}

.why-path--spine.is-drawn ~ .why-path--spine-energy,
.why-path--spine-energy.is-drawn {
  opacity: 0.85;
  animation: why-spine-energy 3.5s linear infinite;
}

@keyframes why-spine-energy {
  to {
    stroke-dashoffset: -248;
  }
}

.why-path--spine.is-drawn {
  stroke-width: 3.5;
  animation: why-path-flow 3s ease-in-out infinite, why-spine-glow 4s ease-in-out infinite;
}

@keyframes why-spine-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.65));
  }
}

/* Desktop: more space between copy and marker for connectors */
@media (min-width: 721px) {
  .why-node {
    gap: 1.25rem 2.75rem;
  }

  .why-node__body {
    max-width: 360px;
  }
}

/* Mobile: vertical timeline rail (no SVG overlay) */
@media (max-width: 720px) {
  .why-stream__svg {
    display: none;
  }

  .why-stream-wrap {
    padding-left: 0.25rem;
  }

  .why-stream {
    border-left: 2px solid rgba(124, 58, 237, 0.25);
    padding-left: 1.35rem;
    margin-left: 0.5rem;
  }

  .why-stream {
    border-left-color: rgba(124, 58, 237, 0.35);
  }

  .why-node[data-step="1"] .why-node__marker {
    box-shadow: 0 0 0 3px rgba(12, 10, 24, 0.9), 0 0 24px rgba(34, 211, 238, 0.45);
  }

  .why-node[data-step="2"] .why-node__marker {
    box-shadow: 0 0 0 3px rgba(12, 10, 24, 0.9), 0 0 24px rgba(139, 92, 246, 0.45);
  }

  .why-node[data-step="3"] .why-node__marker {
    box-shadow: 0 0 0 3px rgba(12, 10, 24, 0.9), 0 0 24px rgba(245, 158, 11, 0.45);
  }

  .why-node[data-step="4"] .why-node__marker {
    box-shadow: 0 0 0 3px rgba(12, 10, 24, 0.9), 0 0 24px rgba(16, 185, 129, 0.45);
  }

  .why-node[data-step="5"] .why-node__marker {
    box-shadow: 0 0 0 3px rgba(12, 10, 24, 0.9), 0 0 24px rgba(244, 63, 94, 0.45);
  }

  .why-node[data-step="6"] .why-node__marker {
    box-shadow: 0 0 0 3px rgba(12, 10, 24, 0.9), 0 0 24px rgba(99, 102, 241, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .why-path--branch,
  .why-path--horiz,
  .why-path--vert-body,
  .why-path--vert-join,
  .why-path--node-dot,
  .why-path--spine-energy {
    transition: none;
    animation: none;
  }

  .why--stream .why-node__marker {
    animation: none;
    transform: none;
  }

  .why-path--branch,
  .why-path--horiz,
  .why-path--vert,
  .why-path--node-dot,
  .why-path--spine {
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
  }
}
