/* Переключатель чёрной / белой темы: «таблетка» с ползунком */
.abase-switch {
  flex-shrink: 0;
  margin: 0 .5rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 999px;
}
.abase-switch:focus-visible {
  outline: 2px solid var(--md-accent-fg-color, #526cfe);
  outline-offset: 3px;
}

.abase-switch__track {
  position: relative;
  display: block;
  width: 2.6rem;
  height: 1.4rem;
  border-radius: 999px;
  background: #0b0c0f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
  transition: background-color .35s ease, box-shadow .35s ease;
}
.abase-switch:hover .abase-switch__track {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45);
}

.abase-switch__knob {
  position: absolute;
  top: .2rem;
  left: .2rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  color: #0b0c0f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transition: transform .4s cubic-bezier(.34, 1.4, .64, 1), background-color .35s ease, color .35s ease;
}
.abase-switch:active .abase-switch__knob {
  width: 1.2rem;
  border-radius: 999px;
}

.abase-switch__knob svg {
  position: absolute;
  inset: .17rem;
  width: .66rem;
  height: .66rem;
  transition: opacity .25s ease, transform .4s cubic-bezier(.34, 1.4, .64, 1);
}
.abase-switch__sun {
  opacity: 0;
  transform: rotate(-90deg) scale(.5);
}

/* белая тема: светлая таблетка, чёрный ползунок справа */
[data-md-color-scheme=default] .abase-switch__track {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22);
}
[data-md-color-scheme=default] .abase-switch:hover .abase-switch__track {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .45);
}
[data-md-color-scheme=default] .abase-switch__knob {
  transform: translateX(1.2rem);
  background: #0b0c0f;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
[data-md-color-scheme=default] .abase-switch:active .abase-switch__knob {
  transform: translateX(1rem);
}
[data-md-color-scheme=default] .abase-switch__moon {
  opacity: 0;
  transform: rotate(90deg) scale(.5);
}
[data-md-color-scheme=default] .abase-switch__sun {
  opacity: 1;
  transform: none;
}

/* на время переключения плавно меняем цвета у всего сайта */
.abase-theme-anim,
.abase-theme-anim *,
.abase-theme-anim *::before,
.abase-theme-anim *::after {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, stroke .35s ease !important;
}

@media (prefers-reduced-motion: reduce) {
  .abase-switch__track,
  .abase-switch__knob,
  .abase-switch__knob svg,
  .abase-theme-anim,
  .abase-theme-anim * {
    transition: none !important;
  }
}
