/*
 * Desktop chapter rail
 * Mirrors the homepage's editorial section numbering without competing with
 * the fixed contact controls on the right edge.
 */
.chapter-rail {
  position: fixed;
  top: calc(50% + 32px);
  left: max(12px, calc((100vw - 1520px) / 2));
  right: auto;
  bottom: auto;
  z-index: 420;
  display: block;
  width: 34px;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-12px, -50%, 0);
  transition: opacity 220ms ease, transform 420ms cubic-bezier(.16, 1, .3, 1) !important;
}

.chapter-rail[data-visible="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, -50%, 0);
}

.chapter-rail__count {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin: 0 0 9px 1px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

.chapter-rail__current { color: var(--accent); }
.chapter-rail__divider { font-style: normal; opacity: .55; }

.chapter-rail__meter {
  position: relative;
}

.chapter-rail__meter::before,
.chapter-rail__progress {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 3px;
  width: 1px;
  pointer-events: none;
}

.chapter-rail__meter::before { background: var(--border-h); }

.chapter-rail__progress {
  background: var(--accent);
  transform: scaleY(var(--chapter-progress, 0));
  transform-origin: 50% 0;
  will-change: transform;
}

.chapter-rail__list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter-rail__link {
  position: relative;
  display: flex;
  align-items: center;
  width: 32px;
  height: 15px;
  color: var(--text-2);
  text-decoration: none;
}

.chapter-rail__mark {
  display: block;
  width: 8px;
  height: 1px;
  margin-left: 3px;
  background: var(--border-h);
  transform-origin: left center;
  transition: width 180ms ease, height 180ms ease, background-color 180ms ease;
}

.chapter-rail__link.is-past .chapter-rail__mark {
  background: var(--text-3);
}

.chapter-rail__link[aria-current="location"] .chapter-rail__mark {
  width: 22px;
  height: 2px;
  background: var(--accent);
}

.chapter-rail__label {
  position: absolute;
  left: 29px;
  top: 50%;
  min-width: max-content;
  padding: 6px 9px 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-4px, -50%, 0);
  transition: opacity 140ms ease, transform 180ms ease, visibility 140ms;
  pointer-events: none;
  white-space: nowrap;
}

.chapter-rail__link:hover .chapter-rail__label,
.chapter-rail__link:focus-visible .chapter-rail__label {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, -50%, 0);
}

.chapter-rail__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#leistungen,
#beispiele,
#unterschied,
#preise,
#prozess,
#ueber-mich,
#warum,
#einzugsgebiet,
#ratgeber,
#faq,
#kontakt,
#anfahrt {
  scroll-margin-top: 88px;
}

@media (max-width: 1199px), (max-height: 649px) {
  .chapter-rail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .chapter-rail,
  .chapter-rail__link,
  .chapter-rail__mark,
  .chapter-rail__label {
    transition: none !important;
  }
}
