.switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.switcher--saving {
  cursor: progress;
}

.switcher--saving .switcher__switch {
  pointer-events: none;
  cursor: progress;
}

.inline-feedback[hidden] {
  display: none;
}

.inline-feedback--error {
  align-items: flex-start;
  gap: 0.375rem;
  line-height: 1.25rem;
}

.inline-feedback--error .inline-feedback__result-icon {
  margin-top: 0.125rem;
}

@keyframes inline-feedback-acknowledged {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.12);
  }
}

.inline-feedback--acknowledged svg {
  transform-origin: center;
  animation: inline-feedback-acknowledged 0.22s
    cubic-bezier(0.2, 0.8, 0.2, 1);
}

.inline-feedback--saving {
  color: light-dark(var(--color-gray-500), var(--color-zinc-400));
}

.inline-feedback__spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  overflow: visible;
}

.inline-feedback__spinner rect {
  fill: currentColor;
  opacity: 0.18;
  animation: inline-feedback-spinner-spoke 0.9s linear infinite;
}

.inline-feedback__spinner rect:nth-child(1) {
  animation-delay: -0.825s;
}

.inline-feedback__spinner rect:nth-child(2) {
  animation-delay: -0.75s;
}

.inline-feedback__spinner rect:nth-child(3) {
  animation-delay: -0.675s;
}

.inline-feedback__spinner rect:nth-child(4) {
  animation-delay: -0.6s;
}

.inline-feedback__spinner rect:nth-child(5) {
  animation-delay: -0.525s;
}

.inline-feedback__spinner rect:nth-child(6) {
  animation-delay: -0.45s;
}

.inline-feedback__spinner rect:nth-child(7) {
  animation-delay: -0.375s;
}

.inline-feedback__spinner rect:nth-child(8) {
  animation-delay: -0.3s;
}

.inline-feedback__spinner rect:nth-child(9) {
  animation-delay: -0.225s;
}

.inline-feedback__spinner rect:nth-child(10) {
  animation-delay: -0.15s;
}

.inline-feedback__spinner rect:nth-child(11) {
  animation-delay: -0.075s;
}

.inline-feedback__spinner rect:nth-child(12) {
  animation-delay: 0s;
}

@keyframes inline-feedback-spinner-spoke {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.18;
  }
}

.inline-feedback--saving .inline-feedback__spinner {
  display: block;
}

.inline-feedback--saving .inline-feedback__result-icon,
.inline-feedback--saving .sr-only {
  display: none;
}

.switcher__label {
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

@media (max-width: 639px) {
  .switcher__label {
    font-size: 0.75rem;
    line-height: 1rem;
  }
}

.switcher__toggle {
  display: flex;
  align-items: center;
}

.switcher__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.switcher__switch {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.25rem;
  width: 2.5rem;
  position: relative;
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
}

.switcher__background {
  pointer-events: none;
  position: absolute;
  height: 1rem;
  width: 2.25rem;
  margin-left: auto;
  margin-right: auto;
  left: 0;
  right: 0;
  border-radius: 9999px;
  border: 1px solid
    light-dark(var(--color-gray-300), var(--color-zinc-600));
  background: linear-gradient(
    to bottom,
    light-dark(var(--color-gray-300), var(--color-zinc-800)),
    light-dark(var(--color-gray-200), var(--color-zinc-700))
  );
  box-shadow:
    inset 0 1px 2px
      light-dark(rgba(15, 23, 42, 0.2), rgba(0, 0, 0, 0.55)),
    inset 0 -1px 0
      light-dark(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.06));
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.switcher__input:checked ~ .switcher__switch .switcher__background {
  border-color: light-dark(
    var(--color-blue-600),
    var(--color-blue-300)
  );
  background: linear-gradient(
    to bottom,
    light-dark(var(--color-blue-500), var(--color-blue-400)),
    light-dark(var(--color-blue-600), var(--color-blue-500))
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.switcher__knob {
  pointer-events: none;
  position: absolute;
  left: 0;
  display: inline-block;
  height: 1.25rem;
  width: 1.25rem;
  border-radius: 9999px;
  border: 1px solid
    light-dark(var(--color-gray-300), var(--color-zinc-500));
  background: linear-gradient(
    to bottom,
    light-dark(var(--color-white), var(--color-zinc-100)),
    light-dark(var(--color-gray-100), var(--color-zinc-300))
  );
  box-shadow:
    0 1px 1px light-dark(rgba(15, 23, 42, 0.2), rgba(0, 0, 0, 0.45)),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition:
    width 0.12s ease,
    transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  transform: translateX(0);
}

.switcher__input:checked ~ .switcher__switch .switcher__knob {
  transform: translateX(1.25rem);
}

.switcher__input:not(:disabled)
  ~ .switcher__switch:active
  .switcher__knob {
  width: 1.5rem;
  box-shadow:
    0 1px 1px light-dark(rgba(15, 23, 42, 0.18), rgba(0, 0, 0, 0.4)),
    inset 0 1px 1px rgba(255, 255, 255, 0.7);
}

.switcher__input:checked:not(:disabled)
  ~ .switcher__switch:active
  .switcher__knob {
  transform: translateX(1rem);
}

.switcher__input:not(:disabled)
  ~ .switcher__switch:hover
  .switcher__background {
  border-color: light-dark(
    var(--color-gray-400),
    var(--color-zinc-500)
  );
  background: linear-gradient(
    to bottom,
    light-dark(var(--color-gray-300), var(--color-zinc-700)),
    light-dark(var(--color-gray-100), var(--color-zinc-600))
  );
  box-shadow:
    inset 0 1px 2px
      light-dark(rgba(15, 23, 42, 0.22), rgba(0, 0, 0, 0.6)),
    inset 0 -1px 0
      light-dark(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.08));
}

.switcher__input:checked:not(:disabled)
  ~ .switcher__switch:hover
  .switcher__background {
  border-color: light-dark(
    var(--color-blue-700),
    var(--color-blue-200)
  );
  background: linear-gradient(
    to bottom,
    light-dark(var(--color-blue-400), var(--color-blue-300)),
    light-dark(var(--color-blue-600), var(--color-blue-400))
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.switcher__input:not(:disabled) ~ .switcher__switch:hover .switcher__knob {
  border-color: light-dark(
    var(--color-gray-400),
    var(--color-zinc-400)
  );
  background: linear-gradient(
    to bottom,
    var(--color-white),
    light-dark(var(--color-gray-50), var(--color-zinc-200))
  );
  box-shadow:
    0 1px 1px light-dark(rgba(15, 23, 42, 0.2), rgba(0, 0, 0, 0.45)),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.switcher__input:focus-visible ~ .switcher__switch {
  outline: 2px solid
    light-dark(var(--color-blue-700), var(--color-blue-300));
  outline-offset: 3px;
}

.switcher__input:disabled ~ .switcher__switch {
  opacity: 0.3;
  cursor: not-allowed;
}

.switcher__input:disabled ~ .switcher__switch .switcher__background {
  border-color: light-dark(
    var(--color-gray-300),
    var(--color-zinc-600)
  );
  background: linear-gradient(
    to bottom,
    light-dark(var(--color-gray-300), var(--color-zinc-800)),
    light-dark(var(--color-gray-200), var(--color-zinc-700))
  );
  box-shadow:
    inset 0 1px 2px
      light-dark(rgba(15, 23, 42, 0.2), rgba(0, 0, 0, 0.55)),
    inset 0 -1px 0
      light-dark(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.06));
}

.switcher__input:disabled ~ .switcher__switch .switcher__knob {
  border-color: light-dark(var(--color-gray-300), var(--color-gray-600));
  background: linear-gradient(
    to bottom,
    light-dark(var(--color-white), var(--color-zinc-100)),
    light-dark(var(--color-gray-100), var(--color-zinc-300))
  );
}
