.segmented-control {
  box-sizing: border-box;
  --segment-highlight-width: 0;
  --segment-highlight-x: var(--size-4);
}

.segmented-control__segments {
  display: inline-flex;
  position: relative;
  padding: var(--size-4);
  width: 100%;
  justify-content: center;
  align-items: center;
  background: var(--color-background-neutral);
  border-radius: var(--size-24);  
  transition: outline 300ms;
  outline: 2px solid transparent;
}

.segmented-control--input:has(:focus-visible) > .segmented-control__segments::after {
  outline: 2px solid var(--color-interactive-primary);
}

.segmented-control__segments::after {
  content: "";
  position: absolute;
  width: var(--segment-highlight-width);
  top: var(--size-4);
  bottom: var(--size-4);
  left: var(--segment-highlight-x);
  z-index: 0;
  background: var(--color-background-screen);
  border-radius: var(--size-24);
  transition: left 300ms;
}

.segmented-control__segments--no-animate::after {
  transition: none !important;
}

.segmented-control__segment {
  position: relative;
  flex: 1 1 100%;
  flex-flow: column;
  padding: var(--size-8) var(--size-16);
  margin: 0 0 0 var(--size-4);
  min-width: 0;
  line-height: inherit;
  align-items: center;
  text-align: center;
  vertical-align: middle;
  border-radius: var(--size-24);
  z-index: 1;
  cursor: pointer;
  transition: background 300ms;
  color: var(--color-interactive-primary);
}

.segmented-control__segment:first-child {
  margin-left: 0;
}

.segmented-control__segment:hover {
  background: var(--color-background-overlay);
}

.segmented-control__radio-input {
  position: fixed;
  opacity: 0;
  pointer-events: none;
}

.segmented-control__button {
  width: 100%;
  height: 100%;
  background: none;
  appearance: none;
  border: none;
  outline: none;
  font: inherit;
  outline: 2px solid transparent;
}

.segmented-control__button:focus {
  outline-offset: 0px;
}

.segmented-control__button:focus-visible {
  outline-color: var(--color-interactive-primary);
}

.segmented-control__selected-segment:hover {
  background: transparent;
}

.segmented-control__text {
  word-wrap: break-word;
  word-break: break-word;
  color: var(--color-interactive-primary);
  transition: font-weight 300ms;
}
