/* ============================================================
   LAYOUT C — JOURNEY (fixed side rail + scrolling content)
   ============================================================ */

.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-5);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
}
.rail .brand__logo {
  height: 46px;
}

/* Stops with route line */
.rail__stops {
  position: relative;
  flex: 0 0 auto;
  margin-bottom: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 30px;
}
.rail__stops::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 14px;
  bottom: 14px;
  border-left: 2px dashed var(--color-border);
}
.rail-stop {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}
.rail-stop::before {
  content: '';
  position: absolute;
  left: -22px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.rail-stop:hover {
  color: var(--color-navy);
  background: var(--color-bg);
}
.rail-stop.is-active {
  color: var(--color-navy);
  background: var(--color-bg);
}
.rail-stop.is-active::before {
  border-color: var(--color-navy);
  background: var(--color-navy);
  animation: stop-arrive 0.8s var(--ease-out, ease-out) 1;
}
.rail-stop.is-visited::before {
  border-color: var(--color-navy);
  background: var(--color-navy);
  opacity: 0.4;
}
@keyframes stop-arrive {
  0% {
    box-shadow: 0 0 0 0 rgba(20, 65, 138, 0.4);
  }
  100% {
    box-shadow: 0 0 0 11px rgba(20, 65, 138, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .rail-stop.is-active::before {
    animation: none;
  }
}

/* Navy trail — the part of the route already flown */
.rail__trail {
  position: absolute;
  left: 12px;
  top: 14px;
  width: 2px;
  height: 0;
  background: var(--color-navy);
  border-radius: 2px;
  transition: height 0.45s var(--ease-out, ease);
  z-index: 0;
}
.rail__plane {
  position: absolute;
  left: 4px;
  top: 12px;
  width: 19px;
  height: 19px;
  color: var(--color-primary);
  transform: rotate(180deg);
  transition: top 0.45s var(--ease-out, ease);
  z-index: 1;
}
.rail__plane svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 3px rgba(200, 16, 46, 0.4));
}

/* Route progress meter */
.rail__progress {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.rail__progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.rail__progress-top [data-progress-num] {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0;
  color: var(--color-navy);
}
.rail__progress-bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  overflow: hidden;
}
.rail__progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-navy), var(--color-primary));
  transition: width 0.2s linear;
}

.rail__cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.rail__cta .btn {
  width: 100%;
  justify-content: center;
}
.rail__theme {
  align-self: flex-start;
  border: 1px solid var(--color-border);
}

.journey-main {
  margin-left: 300px;
}
.journey-main .hero {
  padding-block: clamp(var(--space-10), 7vh, var(--space-16)) clamp(var(--space-10), 7vh, var(--space-16));
}
.journey-footer .footer__inner {
  margin-left: 0;
}
.journey-footer {
  margin-left: 300px;
}

/* Mobile: rail collapses to sticky top bar with chips */
/* Mobile route strip — hidden on desktop */
.railbar-route {
  display: none;
}

@media (max-width: 900px) {
  .rail {
    position: sticky;
    top: 0;
    bottom: auto;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    padding: 8px var(--space-4);
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    overflow: visible;
  }
  .rail .brand__logo {
    height: 30px;
  }
  .rail__stops {
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .rail__stops {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding-left: 0;
    min-height: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rail__stops::-webkit-scrollbar {
    display: none;
  }
  .rail__stops::before,
  .rail-stop::before,
  .rail__plane {
    display: none;
  }
  .rail-stop {
    white-space: nowrap;
    padding: 8px 9px;
    font-size: var(--text-xs);
    min-height: 40px;
  }
  .rail__cta .btn--ghost {
    display: none;
  }
  .rail__progress,
  .rail__trail {
    display: none;
  }
  .rail__cta .btn {
    padding: 8px 12px;
    font-size: var(--text-xs);
    min-height: 40px;
    white-space: nowrap;
  }
  .rail__theme {
    display: none;
  }
  .rail-stop.is-visited {
    color: var(--color-navy);
  }
  .railbar-route {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 3px;
    background: repeating-linear-gradient(90deg, var(--color-border) 0 6px, transparent 6px 12px);
    pointer-events: none;
  }
  .railbar-route__trail {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, var(--color-navy), var(--color-primary));
    transition: width 0.3s ease;
  }
  .railbar-route__plane {
    position: absolute;
    top: 50%;
    left: 10px;
    width: 15px;
    height: 15px;
    color: var(--color-primary);
    transform: translate(-50%, -50%) rotate(90deg);
    transition: left 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(200, 16, 46, 0.35));
  }
  .railbar-route__plane svg {
    display: block;
    width: 100%;
    height: 100%;
  }
  .journey-main,
  .journey-footer {
    margin-left: 0;
  }
}
