:root {
  --transDur: 0.3s;
}

/* Default */
.theme {
  font-family: "Roboto", sans-serif;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.theme__fill,
.theme__icon {
  transition: transform var(--transDur) ease-in-out;
}
.theme__fill {
  background-color: var(--bg);
  display: block;
  mix-blend-mode: difference;
  position: fixed;
  inset: 0;
  height: 100%;
  transform: translateX(-100%);
}
.theme__icon,
.theme__toggle {
  z-index: 1;
}
.theme__icon,
.theme__icon-part {
  position: absolute;
}
.theme__icon {
  display: block;
  top: 11px;
  left: 12px;
  width: 23px;
  height: 23px;
}

.theme__icon img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.theme__label,
.theme__toggle,
.theme__toggle-wrap {
  position: relative;
}
.theme__toggle,
.theme__toggle:before {
  display: block;
}
.theme__toggle {
  margin: revert;
  background-color: #c1c6cf;
  box-shadow: inset 6px 6px 12px rgba(0, 0, 0, 0.15),
    inset -6px -6px 12px rgba(255, 255, 255, 0.8);
  border-radius: 25% / 50%;
  box-shadow: 0 0 0 0.125em var(--primaryT);
  padding: 0.25em;
  width: 88px;
  height: 3em;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color var(--transDur) ease-in-out,
    box-shadow 0.15s ease-in-out, transform var(--transDur) ease-in-out;
}
.theme__toggle:before {
  background: linear-gradient(145deg, #e5e5e5, #ffffff);
  box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  content: "";
  width: 2.5em;
  height: 2.5em;
  transition: background-color var(--transDur) ease-in-out,
    transform var(--transDur) ease-in-out;
}
.theme__toggle::after {
  content: "claro";
  position: absolute;
  top: 50%;
  left: 5px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: bold;
  color: #767b87;
  transform: translate(0, -50%);
  transition: all var(--transDur) ease-in-out;
  text-anchor: middle;
}

.theme__toggle:checked:after {
  content: "escuro";
  transform: translate(36px, -50%);
  color: #c1c6cf;
}
.theme__toggle:focus {
  box-shadow: 0 0 0 0.125em var(--primary);
  outline: transparent;
}

/* Checked */
.theme__toggle:checked {
  background-color: hsl(198, 90%, 15%);
}
.theme__toggle:before {
  transform: translateX(49.3px);
}

.theme__toggle ~ .theme__icon {
  transform: translateX(50.4px);
}

.theme__toggle:checked:before,
.theme__toggle:checked ~ .theme__icon {
  transform: translateX(0);
}
.theme__toggle:checked:before {
  background-color: hsl(198, 90%, 55%);
}
/* .theme__toggle:checked ~ .theme__fill {
  transform: translateX(0);
} */

.theme__toggle ~ .theme__icon .icon-dark {
  visibility: hidden;
}
.theme__toggle:checked ~ .theme__icon .icon-light {
  visibility: hidden;
}

.theme__toggle:checked ~ .theme__icon {
  left: 10px;
}

.theme__toggle:checked ~ .theme__icon .icon-dark {
  visibility: visible;
}

.theme__toggle-wrap {
  margin: 0 0.75em;
}

@supports selector(:focus-visible) {
  .theme__toggle:focus {
    box-shadow: 0 0 0 0.125em var(--primaryT);
  }
  .theme__toggle:focus-visible {
    box-shadow: 0 0 0 0.125em var(--primary);
  }
}
