.theme-control {
  visibility: hidden;
  flex: 0 0 auto;
  line-height: 1;
}

.theme-control[data-theme-ready] {
  visibility: visible;
}

.theme-control__group {
  display: flex;
  min-inline-size: 0;
  margin: 0;
  border: 1px solid var(--line-strong);
  padding: 2px;
  gap: 2px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.theme-control__legend,
.theme-control__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.theme-control__option {
  position: relative;
  display: flex;
  margin: 0;
}

.theme-control__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-control__choice {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.48rem;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1;
  user-select: none;
}

.theme-control__option:hover .theme-control__choice {
  background: var(--surface-alt);
  color: var(--ink);
}

.theme-control__input:checked + .theme-control__choice {
  background: var(--inverse-bg);
  color: var(--inverse-text);
}

.theme-control__input:focus-visible + .theme-control__choice {
  outline: 2px solid var(--focus-outline);
  outline-offset: 2px;
}

.theme-control__label-short {
  display: none;
}

@media (max-width: 1100px) {
  .theme-control__choice {
    min-width: 1.75rem;
    min-height: 1.75rem;
    padding: 0.28rem 0.35rem;
    font-size: 0.66rem;
  }

  .theme-control__label {
    display: none;
  }

  .theme-control__label-short {
    display: inline;
  }
}

@media (forced-colors: active) {
  .theme-control__group {
    border-color: ButtonText;
    background: Canvas;
  }

  .theme-control__input:checked + .theme-control__choice {
    outline: 2px solid ButtonText;
    outline-offset: -2px;
    background: Highlight;
    color: HighlightText;
  }

  .theme-control__input:focus-visible + .theme-control__choice {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}
