/*
 * The rail.
 *
 * Every screen the site has, in one list down the left, the way a casino lists
 * its games. It is fixed, so it stays put while a page scrolls, and it folds
 * into a strip of icons when the words will not fit or when somebody folds it.
 *
 * The board is not covered by it: the shell is padded by exactly the width of
 * the rail, the same arrangement the chat room uses on the other side.
 */

.side {
  position: fixed;
  left: 12px;
  top: 104px;
  bottom: 16px;
  z-index: 39;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 214px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-y: auto;
  transition: width 200ms ease;
}

.side-label {
  padding: 8px 8px 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-list button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    color 140ms ease;
}

/*
 * The mark on the chosen one.
 *
 * A short bar against the inside edge rather than a whole tinted row: it says
 * where you are without shouting, and it grows into place.
 */
.side-list button::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 999px;
  background: var(--lime);
  transform: translateY(-50%);
  transition: height 160ms ease;
}

.side-list button.is-on::before {
  height: 18px;
}

/* A dot for a screen with something waiting on it. */
.side-dot {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(204, 255, 0, 0.18);
}

.side-dot[hidden] {
  display: none;
}

.side-list button svg {
  flex: none;
  width: 19px;
  height: 19px;
  opacity: 0.85;
  transition: opacity 140ms ease;
}

.side-list button:hover svg,
.side-list button.is-on svg {
  opacity: 1;
}

.side-list button:hover {
  background: #111c31;
  color: var(--text);
}

.side-list button.is-on {
  background: color-mix(in srgb, var(--lime) 16%, #111c31);
  color: var(--lime);
}

/*
 * The sound, at the foot of the rail.
 *
 * A symbol and nothing else, because a word that says "Sound on" is a word
 * that has to be translated and re-measured; a speaker with a cross through
 * it says the same thing in every language. The state lives on the button.
 */
/* The two of them sit on the floor of the rail, one at each end. */
.side-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.side-sound {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition:
    color 140ms ease,
    border-color 140ms ease;
}

.side-sound:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.side-sound svg {
  width: 17px;
  height: 17px;
}

/* On shows the waves, off shows the cross, and only ever one of them. */
.side-sound .side-sound-off,
.side-sound.is-off .side-sound-on {
  display: none;
}

.side-sound.is-off .side-sound-off {
  display: block;
}

.side-sound.is-off {
  color: var(--down);
  border-color: color-mix(in srgb, var(--down) 45%, var(--line));
}

/* Out of sight, still read aloud. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.side-fold {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.side-fold svg {
  width: 16px;
  height: 16px;
  transition: transform 200ms ease;
}

.side-fold:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* Folded: icons only, and the arrow turns to say which way out is. */
.shell.side-folded .side {
  width: 56px;
  padding: 12px 8px;
}

.shell.side-folded .side-label,
.shell.side-folded .side-list button span {
  display: none;
}

.shell.side-folded .side-list button {
  justify-content: center;
  padding: 0;
}

.shell.side-folded .side-fold {
  margin-left: 0;
}

.shell.side-folded .side-fold svg {
  transform: rotate(180deg);
}

/*
 * The board makes room for it, the same way it makes room for the chat.
 * Padding rather than a column, because the rail is fixed and a column would
 * scroll away with the page.
 */
.shell {
  padding-left: 240px;
}

.shell.side-folded {
  padding-left: 82px;
}

.site-footer {
  padding-left: 240px;
}

.shell.side-folded ~ .site-footer,
.side-folded-page .site-footer {
  padding-left: 82px;
}

@media (max-width: 1180px) {
  .side {
    width: 56px;
    padding: 12px 8px;
  }

  .side-label,
  .side-list button span {
    display: none;
  }

  .side-list button {
    justify-content: center;
    padding: 0;
  }

  .side-fold {
    display: none;
  }

  .shell,
  .shell.side-folded {
    padding-left: 78px;
  }

  .site-footer {
    padding-left: 78px;
  }
}

@media (max-width: 820px) {
  .side {
    display: none;
  }

  .shell,
  .shell.side-folded,
  .site-footer {
    padding-left: 14px;
  }
}

/* Folded to icons, the two stack instead of sharing a line. */
.shell.side-folded .side-foot {
  flex-direction: column;
  gap: 10px;
}
