.theme-switch {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(190, 194, 205, .16);
  border-radius: 8px;
  background: rgba(190, 194, 205, .06);
  color: #e4e4e8;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.theme-switch:hover {
  border-color: rgba(190, 194, 205, .42);
  background: rgba(190, 194, 205, .12);
}

.theme-switch:focus-visible {
  outline: 2px solid #aeb1ba;
  outline-offset: 3px;
}

.theme-switch__icon {
  display: block;
  width: 17px;
  height: 17px;
  flex: none;
  overflow: visible;
}

.theme-switch__sun-rays {
  transform-origin: 12px 12px;
  transition: opacity .2s ease, transform .32s cubic-bezier(.23, 1, .32, 1);
}

.theme-switch__moon {
  transform-origin: center;
  transition: opacity .2s ease, transform .32s cubic-bezier(.23, 1, .32, 1);
}

.theme-switch__moon-cutout {
  fill: var(--theme-button-bg, #101014);
  transition: fill .2s ease;
}

html[data-theme="dark"] .theme-switch__sun-rays,
html[data-theme="light"] .theme-switch__moon {
  opacity: 0;
  transform: scale(.55) rotate(-40deg);
}

html[data-theme="dark"] .theme-switch__moon,
html[data-theme="light"] .theme-switch__sun-rays {
  opacity: 1;
  transform: scale(1) rotate(0);
}

.theme-switch--compact {
  width: 36px;
  min-height: 36px;
  padding: 0;
}

.theme-switch--compact .theme-switch__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

html[data-theme="light"] .theme-switch {
  border-color: rgba(32, 33, 38, .18);
  background: rgba(255, 255, 255, .78);
  color: #202126;
  --theme-button-bg: #f0f0f2;
}

html[data-theme="light"] .theme-switch:hover {
  border-color: rgba(32, 33, 38, .42);
  background: #e5e5e8;
}

html[data-theme="dark"] .theme-switch {
  --theme-button-bg: #101014;
}

html[data-theme-reveal]::view-transition-old(root),
html[data-theme-reveal]::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

@media (max-width: 560px) {
  .theme-switch:not(.theme-switch--compact) {
    width: 36px;
    min-height: 34px;
    padding: 0;
  }

  .theme-switch:not(.theme-switch--compact) .theme-switch__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-switch,
  .theme-switch__sun-rays,
  .theme-switch__moon {
    transition: none;
  }
}
