/* Badges, tabs, chips, toggles and the three animations. The motion is
   decoration: every screen still says what it says with it switched off, which
   is why reduced motion simply drops it. */

.badge {
  display: inline-flex;
  align-items: center;
  column-gap: 6px;
  border: 1px solid var(--c-neutral-3);
  border-radius: 100px;
  padding: 2px 12px;
  font: var(--t-body-small-300);
  color: var(--c-neutral-11);
  white-space: nowrap;
}

.badge-live {
  border-color: var(--c-green-darker);
  color: var(--c-green);
}

.badge-admin {
  border-color: var(--c-violet);
  color: var(--c-violet-light);
}

.tab {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 16px;
  border-radius: 100px;
  border: 1px solid var(--c-neutral-3);
  background: transparent;
  color: var(--c-neutral-10);
  font: var(--t-body-small-400);
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--transition-default),
    border-color var(--transition-default),
    color var(--transition-default);
}

.tab:hover {
  color: var(--c-white);
  border-color: var(--c-neutral-7);
}

.tab-active {
  background: var(--c-blue);
  border-color: var(--c-blue);
  color: var(--c-white);
}

.chip {
  display: inline-flex;
  align-items: center;
  column-gap: 8px;
  border: 1px solid var(--c-neutral-3);
  border-radius: 100px;
  padding: 4px 8px 4px 14px;
  font: var(--t-body-small-300);
  color: var(--c-neutral-12);
}

.chip button {
  border: 0;
  background: transparent;
  color: var(--c-neutral-9);
  border-radius: 100px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  transition: background-color var(--transition-default);
}

.chip button:hover {
  background: var(--c-neutral-2);
  color: var(--c-white);
}

.toggle {
  width: 36px;
  height: 20px;
  border-radius: 100px;
  border: 1px solid var(--c-neutral-6);
  background: var(--c-neutral-6);
  position: relative;
  cursor: pointer;
  transition:
    background-color var(--transition-default),
    border-color var(--transition-default);
}

.toggle span {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 100px;
  background: var(--c-white);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: margin-left var(--transition-default);
}

.toggle[aria-pressed="true"] {
  background: var(--c-green);
  border-color: var(--c-green);
}

.toggle[aria-pressed="true"] span {
  margin-left: 16px;
}

/* G2: a ring and an indeterminate bar. Together with the second line of copy
   they are the whole defence against the screen reading as a hang. */
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--c-neutral-5);
  border-top-color: var(--c-blue-lighter);
  border-radius: 100px;
  animation: dgspin 1s linear infinite;
}

@keyframes dgspin {
  to {
    transform: rotate(360deg);
  }
}

.progress {
  width: 180px;
  height: 2px;
  background: var(--c-neutral-2);
  border-radius: 100px;
  overflow: hidden;
}

@media (min-width: 900px) {
  .progress {
    width: 220px;
  }
}

.progress span {
  display: block;
  width: 25%;
  height: 100%;
  background: var(--c-blue);
  animation: dgbar 1.4s ease-in-out infinite;
}

@keyframes dgbar {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(400%);
  }
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 100px;
  background: var(--c-green);
  animation: dgpulse 1.8s ease-in-out infinite;
}

.dot-quiet {
  background: transparent;
  border: 1px solid var(--c-neutral-6);
  animation: none;
}

@keyframes dgpulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* Motion is decoration here; the meaning is in the words beside it. */
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .progress span,
  .dot {
    animation: none;
  }
}
