.theme-toggle {
  --theme-toggle-border: rgba(226, 196, 132, 0.42);
  --theme-toggle-fg: #e2c484;
  --theme-toggle-bg: rgba(226, 196, 132, 0.08);
  --theme-toggle-hover: rgba(226, 196, 132, 0.16);
  appearance: none;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 999px;
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-fg);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.theme-toggle:hover {
  background: var(--theme-toggle-hover);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  grid-area: 1 / 1;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle[data-theme-state="light"] .icon-sun,
html[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

.theme-toggle[data-theme-state="light"] .icon-moon,
html[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle {
  --theme-toggle-border: rgba(35, 75, 82, 0.28);
  --theme-toggle-fg: #234b52;
  --theme-toggle-bg: rgba(35, 75, 82, 0.06);
  --theme-toggle-hover: rgba(35, 75, 82, 0.12);
}

.home-links .theme-toggle,
.site-nav .theme-toggle {
  margin-left: 2px;
}

@media (max-width: 620px) {
  .theme-toggle {
    width: 34px;
    height: 34px;
  }

  .theme-toggle svg {
    width: 15px;
    height: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle {
    transition: none;
  }
}
