:root {
  color-scheme: light dark;
  --bg: light-dark(#f8fafc, #0b1120);
  --surface: light-dark(#ffffff, #111a2e);
  --fg: light-dark(#0f172a, #e2e8f0);
  --muted: light-dark(#5a6474, #94a3b8);
  --accent: light-dark(#1f4e79, #7fb2e5);
  --accent-soft: light-dark(#1f4e7914, #7fb2e51a);
  --border: light-dark(#e2e8f0, #1e293b);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

.theme-toggle {
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.5rem;
  padding: .35rem .8rem;
  border: 1px solid var(--border);
  border-radius: 2rem;
  background: var(--surface);
  color: var(--fg);
  font: 600 .95rem/1.2 'Source Sans 3', system-ui, sans-serif;
  cursor: pointer;
}
.theme-toggle:not([hidden]) { display: inline-flex; }
.theme-toggle::before {
  content: '';
  width: 1rem;
  height: 1rem;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-corner {
  position: absolute;
  top: 1rem;
  right: max(1rem, (100% - 72rem) / 2);
}
@media print {
  :root[data-theme], :root { color-scheme: light; }
  .theme-toggle:not([hidden]) { display: none; }
}
