html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

.theme-switch {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid #3d4046;
  border-radius: 50%;
  background: #17191d;
  color: #e4e6e9;
  cursor: pointer;
}
.theme-switch:hover {
  border-color: #8b8e95;
  background: #2a2d32;
}
.theme-switch:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
html[data-theme="light"] .theme-switch {
  border-color: #c8cacf;
  background: #fafafa;
  color: #282b30;
}
html[data-theme="light"] .theme-switch:hover {
  border-color: #777a83;
  background: #e7e8ea;
}
.theme-switch-icon {
  position: relative;
  display: block;
  width: 19px;
  height: 19px;
}
.theme-switch-icon::before,
.theme-switch-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}
.theme-switch-icon::before {
  inset: 4px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.theme-switch-icon::after {
  top: calc(50% - .8px);
  left: calc(50% - .8px);
  width: 1.6px;
  height: 1.6px;
  border-radius: 50%;
  box-shadow: 0 -8.2px, 5.8px -5.8px, 8.2px 0, 5.8px 5.8px,
    0 8.2px, -5.8px 5.8px, -8.2px 0, -5.8px -5.8px;
}
html[data-theme="light"] .theme-switch-icon::before {
  inset: 2px 3px 4px 3px;
  transform: rotate(-23deg);
  border: 0;
  box-shadow: -2.5px 2.5px 0 1px currentColor;
}
html[data-theme="light"] .theme-switch-icon::after { content: none; }
