/* Section 3 — Foundations + ORT dual routes
   Isolated from Hero / scene-know. Equal visual weight. */

.scene-routes {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: min(100vh, 980px);
  padding: var(--section-pad-y, 4.5rem) 0;
  background:
    linear-gradient(180deg, #080B0F 0%, #0C1018 40%, #0C1018 100%);
  border-top: 1px solid rgba(123, 77, 255, 0.1);
}

.scene-routes-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 45% 40% at 22% 55%, rgba(123, 77, 255, 0.14), transparent 60%),
    radial-gradient(ellipse 40% 36% at 78% 48%, rgba(255, 138, 0, 0.06), transparent 58%),
    radial-gradient(ellipse 50% 30% at 50% 12%, rgba(123, 77, 255, 0.08), transparent 55%);
}

.scene-routes-shell {
  position: relative;
  z-index: 1;
  width: var(--container-wide, min(100% - 2.5rem, 1760px));
  max-width: var(--container-max-wide, 1760px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5, 2.5rem);
}

/* Intro — Level 2 reveal via .routes-reveal */
.routes-intro {
  max-width: 40rem;
}

.routes-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b8b4d4;
}

.routes-eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 138, 0, 0.7), transparent);
}

.routes-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.05rem, 3vw, 2.85rem);
  line-height: 1.14;
  letter-spacing: -0.03em;
  color: #f4f5f8;
  margin: 0 0 1.1rem;
}

.routes-support {
  margin: 0;
  max-width: 32rem;
  font-size: clamp(1.02rem, 1.15vw, 1.12rem);
  line-height: 1.55;
  color: var(--text-soft, #c9ccdb);
}

/* Dual-path map */
.routes-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2.75rem;
  align-items: start;
}

/* Trajectory canvas — full width above both paths */
.routes-canvas {
  grid-column: 1 / -1;
  position: relative;
  margin: 0.25rem 0 0.5rem;
  padding: 0.5rem 0 0.75rem;
}

.routes-trails {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
  pointer-events: none;
}

.routes-trail {
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  transition:
    opacity var(--motion-fast, 300ms) var(--ease-premium, ease),
    filter var(--motion-fast, 300ms) ease;
}

.routes-node {
  opacity: 0;
  transition:
    opacity var(--motion-fast, 300ms) var(--ease-premium, ease),
    filter var(--motion-fast, 300ms) ease;
}

.routes-node-f {
  fill: rgba(167, 139, 250, 0.85);
  stroke: rgba(196, 181, 253, 0.5);
  stroke-width: 1;
}

.routes-node-o {
  fill: rgba(255, 138, 0, 0.75);
  stroke: rgba(255, 169, 64, 0.45);
  stroke-width: 1;
}

.routes-converge {
  fill: rgba(196, 181, 253, 0.9);
  opacity: 0;
  filter: drop-shadow(0 0 12px rgba(123, 77, 255, 0.5));
}

.routes-converge-ring {
  fill: none;
  stroke: rgba(123, 77, 255, 0.35);
  stroke-width: 1;
  opacity: 0;
}

.routes-canvas-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 0.35rem;
  padding: 0 0.15rem;
}

.routes-canvas-tag {
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.routes-canvas-tag-f { color: #a78bfa; }
.routes-canvas-tag-o { color: #FFA940; }

.routes-converge-label {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.15rem;
}

.routes-converge-label span {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8b92ab;
}

.routes-converge-label span:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 1.15rem;
  border-radius: 50%;
  vertical-align: middle;
  background: rgba(123, 77, 255, 0.45);
}

/* Path content — editorial, not SaaS cards */
.route-path {
  position: relative;
  z-index: 1;
  padding: 1.25rem 0.15rem 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transition:
    border-color var(--motion-fast, 300ms) var(--ease-premium, ease);
}

.route-path-f {
  border-image: linear-gradient(90deg, rgba(123, 77, 255, 0.55), rgba(123, 77, 255, 0.25), transparent) 1;
}

.route-path-o {
  border-image: linear-gradient(90deg, rgba(123, 77, 255, 0.45), rgba(255, 138, 0, 0.35), transparent) 1;
}

.route-path::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--motion-fast, 300ms) var(--ease-premium, ease);
  background:
    linear-gradient(180deg, rgba(123, 77, 255, 0.06), transparent 42%);
}

.route-path-o::before {
  background:
    linear-gradient(180deg, rgba(255, 138, 0, 0.05), transparent 42%);
}

.route-path:hover::before,
.route-path:focus-within::before {
  opacity: 1;
}

/* Hover: illuminate matching trajectory only */
.routes-map:has(.route-path-f:hover) .routes-trail-f,
.routes-map:has(.route-path-f:focus-within) .routes-trail-f {
  filter: drop-shadow(0 0 10px rgba(123, 77, 255, 0.45));
  opacity: 1;
}

.routes-map:has(.route-path-f:hover) .routes-node-f,
.routes-map:has(.route-path-f:focus-within) .routes-node-f {
  filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.65));
}

.routes-map:has(.route-path-o:hover) .routes-trail-o,
.routes-map:has(.route-path-o:focus-within) .routes-trail-o {
  filter: drop-shadow(0 0 10px rgba(255, 138, 0, 0.4));
  opacity: 1;
}

.routes-map:has(.route-path-o:hover) .routes-node-o,
.routes-map:has(.route-path-o:focus-within) .routes-node-o {
  filter: drop-shadow(0 0 8px rgba(255, 138, 0, 0.55));
}

.routes-map:has(.route-path-f:hover) .routes-trail-o,
.routes-map:has(.route-path-f:focus-within) .routes-trail-o,
.routes-map:has(.route-path-f:hover) .routes-node-o,
.routes-map:has(.route-path-f:focus-within) .routes-node-o {
  opacity: 0.28;
}

.routes-map:has(.route-path-o:hover) .routes-trail-f,
.routes-map:has(.route-path-o:focus-within) .routes-trail-f,
.routes-map:has(.route-path-o:hover) .routes-node-f,
.routes-map:has(.route-path-o:focus-within) .routes-node-f {
  opacity: 0.28;
}

.route-label {
  margin: 0 0 0.85rem;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #a78bfa;
}

.route-label-o {
  color: #FFA940;
}

.route-headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.45rem, 2vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: #f4f5f8;
  margin: 0 0 1rem;
}

.route-body {
  margin: 0 0 1.15rem;
  max-width: 28rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--text-soft, #c9ccdb);
}

.route-ideal-k {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8d93aa;
}

.route-ideal {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.route-ideal li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #d4d8e8;
}

.route-ideal li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: rgba(123, 77, 255, 0.7);
}

.route-path-o .route-ideal li::before {
  border-radius: 50%;
  background: rgba(255, 138, 0, 0.7);
}

.route-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  margin-bottom: 1.35rem;
}

.route-checks span {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ca3c0;
  padding: 0.28rem 0;
  border-bottom: 1px solid rgba(123, 77, 255, 0.28);
  transition:
    color var(--motion-fast, 300ms) var(--ease-premium, ease),
    border-color var(--motion-fast, 300ms) var(--ease-premium, ease);
}

.route-checks-o span {
  border-bottom-color: rgba(255, 138, 0, 0.28);
}

.route-path:hover .route-checks span,
.route-path:focus-within .route-checks span {
  color: #c4b5fd;
  border-bottom-color: rgba(123, 77, 255, 0.55);
}

.route-path-o:hover .route-checks span,
.route-path-o:focus-within .route-checks span {
  color: #FFA940;
  border-bottom-color: rgba(255, 138, 0, 0.55);
}

.route-cta {
  min-height: 44px;
  transition:
    border-color var(--motion-micro, 280ms) var(--ease-premium, ease),
    background var(--motion-micro, 280ms) var(--ease-premium, ease),
    box-shadow var(--motion-micro, 280ms) var(--ease-premium, ease),
    transform var(--motion-micro, 280ms) var(--ease-premium, ease);
}

.route-path:hover .route-cta,
.route-path:focus-within .route-cta {
  border-color: rgba(123, 77, 255, 0.45);
  box-shadow: 0 0 24px rgba(123, 77, 255, 0.12);
}

.route-path-o:hover .route-cta-o,
.route-path-o:focus-within .route-cta-o {
  border-color: rgba(255, 138, 0, 0.4);
  box-shadow: 0 0 24px rgba(255, 138, 0, 0.1);
}

.routes-closing {
  margin: 0.35rem 0 0;
  max-width: 36rem;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.5vw, 1.35rem);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.015em;
  color: #e8eaf2;
  padding-left: 1.1rem;
  border-left: 2px solid transparent;
  border-image: linear-gradient(180deg, rgba(123, 77, 255, 0.8), rgba(255, 138, 0, 0.45)) 1;
}

/* Draw + node fade — once via .scene-routes.is-in (motion.css owns duration tokens) */
.scene-routes.is-in .routes-node[data-node="f1"],
.scene-routes.is-in .routes-node[data-node="o1"] {
  animation: routes-node-in var(--motion-medium, 750ms) var(--ease-premium, ease) 0.55s forwards;
}
.scene-routes.is-in .routes-node[data-node="f2"],
.scene-routes.is-in .routes-node[data-node="o2"] {
  animation: routes-node-in var(--motion-medium, 750ms) var(--ease-premium, ease) 0.85s forwards;
}
.scene-routes.is-in .routes-node[data-node="f3"],
.scene-routes.is-in .routes-node[data-node="o3"] {
  animation: routes-node-in var(--motion-medium, 750ms) var(--ease-premium, ease) 1.1s forwards;
}
.scene-routes.is-in .routes-node[data-node="f4"],
.scene-routes.is-in .routes-node[data-node="o4"] {
  animation: routes-node-in var(--motion-medium, 750ms) var(--ease-premium, ease) 1.3s forwards;
}

.scene-routes.is-in .routes-converge-ring {
  animation: routes-node-in var(--motion-medium, 750ms) var(--ease-premium, ease) 1.35s forwards;
}

/* Tablet — simplify visual */
@media (max-width: 1100px) {
  .scene-routes {
    min-height: 0;
    padding: 3.75rem 0 3.5rem;
  }

  .scene-routes-shell {
    width: var(--container-wide);
    max-width: var(--container-max-wide);
    gap: 2.1rem;
  }

  .routes-trails {
    max-height: 180px;
  }

  .routes-map {
    gap: 1.35rem 1.75rem;
  }

  .routes-node[data-node="f2"],
  .routes-node[data-node="o2"] {
    display: none;
  }
}

/* Mobile — vertical chapter order */
@media (max-width: 768px) {
  .scene-routes {
    padding: 2.75rem 0 3rem;
  }

  .scene-routes-shell {
    width: var(--container);
    max-width: var(--container-max);
    gap: 1.65rem;
  }

  .routes-map {
    display: flex;
    flex-direction: column;
    gap: 1.65rem;
  }

  .routes-canvas {
    order: -1;
    margin: 0;
    padding: 0.25rem 0;
  }

  .routes-trails {
    max-height: 120px;
    opacity: 0.85;
  }

  .routes-node[data-node="f3"],
  .routes-node[data-node="o3"],
  .routes-node[data-node="f4"],
  .routes-node[data-node="o4"],
  .routes-converge-ring {
    display: none;
  }

  .routes-canvas-labels {
    justify-content: flex-start;
  }

  .routes-converge-label {
    margin-left: 0;
    width: 100%;
  }

  .route-path {
    padding: 1.05rem 0 0.2rem;
    border-image: none;
    border-top: 0;
    padding-left: 1.15rem;
    border-left: 2px solid rgba(123, 77, 255, 0.45);
  }

  .route-path-o {
    border-left-color: rgba(255, 138, 0, 0.4);
  }

  .routes-title {
    font-size: clamp(1.9rem, 7.5vw, 2.4rem);
  }

  .route-cta {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .scene-routes-shell {
    width: var(--container);
    max-width: var(--container-max);
  }

  .routes-canvas-tag {
    display: none;
  }

  .route-checks {
    gap: 0.35rem 0.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .routes-node,
  .routes-converge,
  .routes-converge-ring {
    opacity: 1 !important;
    animation: none !important;
  }

  .routes-trail {
    stroke-dashoffset: 0 !important;
  }
}
