/* Chapter rail (task-timeline-progress) — vertical progress track with
 * jump links. Jumping uses plain anchors (#chN) + CSS smooth scrolling,
 * so it is keyboard accessible for free; reduced motion resets scroll
 * behavior in css/reset.css. */

.rail {
  position: fixed;
  right: clamp(0.5rem, 2vw, 1.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  padding-block: var(--space-3);
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0;
  margin: 0;
}

.rail-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--line);
  border-radius: 1px;
}

.rail-fill {
  width: 100%;
  height: var(--progress, 0%);
  background: var(--accent);
  border-radius: inherit;
}

.rail-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--space-3);
  height: var(--space-3);
}

.rail-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--bg);
  transition: background var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.rail-link:hover .rail-dot,
.rail-link:focus-visible .rail-dot,
.rail-link[aria-current="true"] .rail-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow);
}

.rail-label {
  position: absolute;
  right: calc(100% + 0.5rem);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
  pointer-events: none;
}

.rail-link:hover .rail-label,
.rail-link:focus-visible .rail-label,
.rail-link[aria-current="true"] .rail-label {
  opacity: 1;
  transform: none;
  color: var(--accent);
}

.rail-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (max-width: 52rem) {
  .rail-label {
    display: none;
  }
}

@media (max-width: 34rem) {
  .rail {
    display: none;
  }
}
