/* Theme switch shared by all pages. Each page sets the --tt-* colours. */
.theme-toggle {
  --tt-track: rgba(127, 127, 127, .18);
  --tt-knob: currentColor;
  --tt-icon-on: #000;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  width: 60px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--tt-border, transparent);
  border-radius: 999px;
  background: var(--tt-track);
  color: inherit;
  cursor: pointer;
}
.theme-toggle svg {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: color .25s ease;
}
.theme-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--tt-knob);
  transition: transform .25s ease;
}
[data-theme="dark"] .theme-toggle::after { transform: translateX(30px); }
[data-theme="light"] .theme-toggle .tt-sun,
[data-theme="dark"] .theme-toggle .tt-moon { color: var(--tt-icon-on); }
@media (prefers-reduced-motion: reduce) {
  .theme-toggle::after, .theme-toggle svg { transition: none; }
}

/* Language switch: EN | RU, same colours as the theme switch */
.lang-toggle {
  --tt-track: rgba(127, 127, 127, .18);
  --tt-knob: currentColor;
  --tt-icon-on: #000;
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: 64px;
  height: 30px;
  padding: 0 3px;
  border: 1px solid var(--tt-border, transparent);
  border-radius: 999px;
  background: var(--tt-track);
  color: inherit;
  font: 700 11px/1 ui-monospace, "JetBrains Mono", Consolas, monospace;
  letter-spacing: .04em;
  cursor: pointer;
}
.lang-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 22px;
  border-radius: 999px;
  background: var(--tt-knob);
  transition: transform .25s ease;
}
[data-lang="ru"] .lang-toggle::after { transform: translateX(28px); }
.lang-toggle span { position: relative; z-index: 1; width: 28px; text-align: center; transition: color .25s ease; }
[data-lang="en"] .lang-toggle [data-l="en"],
[data-lang="ru"] .lang-toggle [data-l="ru"] { color: var(--tt-icon-on); }
.toggles { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
/* While a Russian page is being translated (a split second) */
html.i18n-wait body { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .lang-toggle::after, .lang-toggle span { transition: none; }
}
