/* The way between the front ends. A column of its own beside the stage, never part of the chrome
   bar: §04 says the chrome states and never navigates, and this is what lets that stay true. */

.rail {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: var(--rail-width);
  padding: 26px 5px 0;
  border-right: 1px solid var(--rule);
  background: var(--chrome);
  transition: width 200ms var(--ease-snap);
}

.rail--open {
  width: var(--rail-width-open);
  padding-right: 14px;
  padding-left: 14px;
}

.rail__toggle {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: var(--control-height-sm);
  height: var(--control-height-sm);
  border: 1px solid var(--field-border);
  background: var(--field-fill);
  cursor: pointer;
  transition: border-color 160ms ease;
}

.rail__toggle:hover {
  border-color: rgba(139, 92, 246, .55);
}

/* Three bars, drawn rather than set: there is no icon font here and an SVG for this would be
   three rectangles. The middle one is the element, the others are its edges. */
.rail__bars,
.rail__bars::before,
.rail__bars::after {
  display: block;
  width: 14px;
  height: 1px;
  background: var(--text-body);
}

.rail__bars {
  position: relative;
}

.rail__bars::before,
.rail__bars::after {
  content: '';
  position: absolute;
  left: 0;
}

.rail__bars::before {
  top: -5px;
}

.rail__bars::after {
  top: 5px;
}

.rail__toggle:hover .rail__bars,
.rail__toggle:hover .rail__bars::before,
.rail__toggle:hover .rail__bars::after {
  background: var(--text-heading);
}

.rail__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The chosen row takes the violet border and a tenth of a fill, which is what "chosen" looks like
   everywhere else in the control set. */
.rail__link {
  display: flex;
  align-items: center;
  height: var(--control-height-sm);
  padding: 0 12px;
  border: 1px solid transparent;
  color: var(--text-label);
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.rail__link:hover {
  border-color: rgba(139, 92, 246, .55);
  color: var(--text-heading);
}

.rail__link--on {
  border-color: rgba(139, 92, 246, .55);
  background: rgba(139, 92, 246, .1);
  color: var(--text-heading);
}

/* Narrow enough that a 248px column would be most of the stage, so the open rail floats over it
   instead — the idiom §05 already gives the builder's inspector. */
@media (max-width: 860px) {
  .rail--open {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--rail-width-open);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail {
    transition: none;
  }
}
