/* =========================================================
   <theme-switch> 样式：胶囊形分段控件
   ========================================================= */

theme-switch {
  display: inline-block;
}

.theme-switch {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--page-control-border);
  border-radius: 999px;
  min-inline-size: 0;
}

.theme-switch__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.theme-switch__option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  color: var(--page-muted);
  font-size: 13px;
  font-weight: 450;
  line-height: 16px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-switch__option:hover {
  color: var(--page-strong);
}

.theme-switch__option:has(.theme-switch__input:checked) {
  background: var(--page-control-active);
  box-shadow: var(--page-control-shadow);
  color: var(--page-strong);
}

.theme-switch__option:has(.theme-switch__input:focus-visible) {
  outline: 2px solid var(--page-focus);
  outline-offset: 1px;
}

/* 原生单选框保留可访问性，只在视觉上隐藏 */
.theme-switch__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
