/* Adapted from andrew-demchenk0/honest-stingray-90 (MIT).
   Attribution and license: theme-switch.LICENSE.txt. */
.appearance-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.appearance-switch {
  position: relative;
  display: block;
  width: 64px;
  height: 44px;
  margin: 0;
  cursor: pointer;
}
.appearance-switch .appearance-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
}
.appearance-slider {
  position: absolute;
  inset: 5px 0;
  background: #73c0fc;
  border-radius: 30px;
  box-shadow: 0 0 0 1px var(--field-border);
  transition: background-color 0.4s;
  pointer-events: none;
}
.appearance-slider::before {
  position: absolute;
  content: '';
  width: 30px;
  height: 30px;
  border-radius: 50%;
  left: 2px;
  bottom: 2px;
  z-index: 2;
  background: #e8e8e8;
  transition: transform 0.4s;
}
.appearance-sun svg,
.appearance-moon svg {
  position: absolute;
  top: 5px;
  width: 24px;
  height: 24px;
  z-index: 1;
}
.appearance-sun svg {
  left: 36px;
  animation: appearance-sun-rotate 15s linear infinite;
}
.appearance-moon svg {
  left: 5px;
  fill: #73c0fc;
  animation: appearance-moon-tilt 5s linear infinite;
}
.appearance-input:checked + .appearance-slider {
  background: #000000;
}
.appearance-input:checked + .appearance-slider::before {
  transform: translateX(30px);
}
.appearance-input:focus-visible + .appearance-slider,
.appearance-auto:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.appearance-auto {
  position: relative;
  isolation: isolate;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
}
.appearance-auto::before {
  content: '';
  position: absolute;
  inset: 10px 4px;
  z-index: -1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.appearance-auto:hover,
.appearance-auto[aria-pressed='true'] {
  color: var(--accent);
}
.appearance-auto:hover::before {
  background: var(--hover);
  border-color: var(--field-border);
}
.appearance-auto[aria-pressed='true']::before {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
@keyframes appearance-sun-rotate {
  to { transform: rotate(360deg); }
}
@keyframes appearance-moon-tilt {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}
@media (prefers-reduced-motion: reduce) {
  .appearance-control *,
  .appearance-control *::before {
    animation: none;
    transition: none;
  }
}

.appearance-control[hidden] { display: none !important; }
.appearance-control .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
