:root {
  color-scheme: light;
  --page-background: #fff;
  --page-text: #000;
  --page-muted: #555;
  --page-link: #000;
  --page-visited: green;
  --button-background: #fff;
  --button-text: #111;
  --button-border: #111;
  --button-hover-background: #111;
  --button-hover-text: #fff;
  --toggle-border: #d0d0d0;
  --toggle-hover: #f0f0f0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-background: #000;
  --page-text: #ededed;
  --page-muted: #b8b8b8;
  --page-link: #ededed;
  --page-visited: #86d7a0;
  --button-background: #000;
  --button-text: #ededed;
  --button-border: #aaa;
  --button-hover-background: #ededed;
  --button-hover-text: #000;
  --toggle-border: #555;
  --toggle-hover: #202020;
}

html,
body,
.nav,
.slider {
  background-color: var(--page-background);
  color: var(--page-text);
}

.nav h1,
.slider h1,
.main h1 {
  color: var(--page-text);
}

.main h2,
.section h2,
.slider h2 {
  color: var(--page-muted);
}

a:link {
  color: var(--page-link);
}

a:visited {
  color: var(--page-visited);
}

a:hover,
.nav h1:hover,
.main h1:hover {
  color: #ff0266;
}

.button,
.btn,
a.button:link,
a.button:visited,
a.btn:link,
a.btn:visited {
  background: var(--button-background);
  color: var(--button-text);
  border-color: var(--button-border);
}

.button:hover,
.btn:hover,
a.button:hover,
a.btn:hover {
  background: var(--button-hover-background);
  color: var(--button-hover-text);
}

:root[data-theme="dark"] .background {
  filter: invert(1) hue-rotate(180deg);
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--toggle-border);
  border-radius: 50%;
  background: var(--page-background);
  color: var(--page-text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  background: var(--toggle-hover);
}

.theme-toggle:focus-visible {
  outline: 2px solid #ff0266;
  outline-offset: 4px;
}

.theme-toggle i {
  width: 20px;
  height: 20px;
  line-height: 20px;
  pointer-events: none;
}

.theme-toggle .theme-icon-sun,
:root[data-theme="dark"] .theme-toggle .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-sun {
  display: block;
}
