/* ==========================================================================
   Roadmap 2040 — visionary timeline replacement
   Floating nodes connected by an animated, glowing SVG pathway.
   The rail is layout-driven (grid + nth-child zigzag); the JS layer
   reads real node positions and draws the connecting path on top,
   so it stays correct at every breakpoint without hardcoded coordinates.
   ========================================================================== */

.roadmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 28px 0 var(--space-5);
}

.roadmap-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--silver);
}

.roadmap-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.roadmap-legend-item[data-status="foundation"] .roadmap-legend-swatch,
.roadmap-legend-item[data-status="live"] .roadmap-legend-swatch { background: var(--cyan); box-shadow: 0 0 8px 1px rgba(95,212,216,0.6); }
.roadmap-legend-item[data-status="progress"] .roadmap-legend-swatch { background: var(--amber); box-shadow: 0 0 8px 1px rgba(240,180,41,0.55); }
.roadmap-legend-item[data-status="planned"] .roadmap-legend-swatch { background: var(--violet); box-shadow: 0 0 8px 1px rgba(139,124,246,0.55); }
.roadmap-legend-item[data-status="vision"] .roadmap-legend-swatch { background: var(--blue); box-shadow: 0 0 10px 2px rgba(79,140,255,0.6); }

/* ---- Rail + SVG pathway layer ---- */

.roadmap-rail {
  position: relative;
  padding: 20px 40px;
}

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

#roadmapGradient stop:nth-child(1) { stop-color: var(--blue); }
#roadmapGradient stop:nth-child(2) { stop-color: var(--cyan); }
#roadmapGradient stop:nth-child(3) { stop-color: var(--violet); }

.roadmap-path {
  fill: none;
  stroke: url(#roadmapGradient);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.85;
}

.roadmap-path-glow {
  fill: none;
  stroke: url(#roadmapGradient);
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.14;
  filter: blur(5px);
}

.roadmap-path-flow {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1 26;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(95,212,216,0.9));
  transition: opacity 0.8s ease;
  animation: roadmap-flow 3.4s linear infinite;
}

.roadmap-rail.in-view .roadmap-path-flow { opacity: 0.9; }

@keyframes roadmap-flow {
  to { stroke-dashoffset: -270; }
}

/* ---- Node grid: zigzag on desktop, single column on mobile ---- */

.roadmap-node {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 64px 1fr;
  align-items: center;
  column-gap: var(--space-3);
  min-height: 128px;
}

.roadmap-node:nth-child(odd) .roadmap-card { grid-column: 1; text-align: right; margin-left: auto; }
.roadmap-node:nth-child(odd) .roadmap-dot { grid-column: 2; }

.roadmap-node:nth-child(even) .roadmap-card { grid-column: 3; text-align: left; margin-right: auto; }
.roadmap-node:nth-child(even) .roadmap-dot { grid-column: 2; }

/* ---- Dot / node marker ---- */

.roadmap-dot {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.roadmap-dot-ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  opacity: 0;
  transition: opacity 0.6s ease, border-color 0.6s ease;
}

.roadmap-node.in-view .roadmap-dot-ring {
  opacity: 0.55;
  animation: roadmap-pulse 2.6s var(--ease-in-out) infinite;
}

.roadmap-dot-core {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-raised);
  border: 1px solid var(--hairline);
  z-index: 1;
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

@keyframes roadmap-pulse {
  0%   { transform: scale(0.85); opacity: 0.55; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* status → glow color, once revealed */
.roadmap-node[data-status="foundation"].in-view .roadmap-dot-core,
.roadmap-node[data-status="live"].in-view .roadmap-dot-core {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px 3px rgba(95,212,216,0.55);
}
.roadmap-node[data-status="foundation"].in-view .roadmap-dot-ring,
.roadmap-node[data-status="live"].in-view .roadmap-dot-ring { border-color: var(--cyan); }

.roadmap-node[data-status="progress"].in-view .roadmap-dot-core {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 14px 3px rgba(240,180,41,0.5);
}
.roadmap-node[data-status="progress"].in-view .roadmap-dot-ring { border-color: var(--amber); }

.roadmap-node[data-status="planned"].in-view .roadmap-dot-core {
  background: var(--violet);
  border-color: var(--violet);
  box-shadow: 0 0 14px 3px rgba(139,124,246,0.5);
}
.roadmap-node[data-status="planned"].in-view .roadmap-dot-ring { border-color: var(--violet); }

.roadmap-node[data-status="vision"].in-view .roadmap-dot-core {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 18px 4px rgba(79,140,255,0.6);
}
.roadmap-node[data-status="vision"].in-view .roadmap-dot-ring { border-color: var(--blue); }

/* ---- Card ---- */

.roadmap-card {
  --float-duration: 6s;
  --float-delay: 0s;
  position: relative;
  max-width: 400px;
  padding: 22px 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  background: linear-gradient(160deg, var(--graphite), var(--ink-raised));
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out),
              border-color 0.5s ease, box-shadow 0.5s ease;
}

.roadmap-node.in-view .roadmap-card {
  opacity: 1;
  transform: translateY(0);
  animation: roadmap-float var(--float-duration) ease-in-out var(--float-delay) infinite;
}

@keyframes roadmap-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.roadmap-node[data-status="vision"] .roadmap-card { border-color: var(--violet-dim); }
.roadmap-node[data-status="vision"].in-view .roadmap-card { box-shadow: 0 0 26px -8px rgba(79,140,255,0.35); }
.roadmap-node[data-status="planned"].in-view .roadmap-card { box-shadow: 0 0 22px -10px rgba(139,124,246,0.3); }

.roadmap-year {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--paper);
  margin-bottom: 6px;
}

.roadmap-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--silver);
  margin-bottom: 10px;
}

.roadmap-node[data-status="foundation"] .roadmap-status,
.roadmap-node[data-status="live"] .roadmap-status { color: var(--cyan); }
.roadmap-node[data-status="progress"] .roadmap-status { color: var(--amber); }
.roadmap-node[data-status="planned"] .roadmap-status { color: var(--violet); }
.roadmap-node[data-status="vision"] .roadmap-status { color: var(--blue); }

.roadmap-card h3 { font-size: 19px; margin-bottom: 8px; }
.roadmap-card p { font-size: 14.5px; line-height: 1.6; color: var(--paper-dim); }

/* ---- Mobile: single column, dot on the left ---- */

@media (max-width: 899px) {
  .roadmap-rail { padding: 20px 16px 20px 4px; }

  .roadmap-node {
    grid-template-columns: 48px 1fr;
    column-gap: 18px;
    min-height: auto;
    margin-bottom: 6px;
  }

  .roadmap-node:nth-child(odd) .roadmap-dot,
  .roadmap-node:nth-child(even) .roadmap-dot { grid-column: 1; width: 48px; height: 48px; }

  .roadmap-node:nth-child(odd) .roadmap-card,
  .roadmap-node:nth-child(even) .roadmap-card {
    grid-column: 2;
    text-align: left;
    margin: 0;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .roadmap-card, .roadmap-dot-ring, .roadmap-path-flow { animation: none !important; }
}
