:host {
  --background-color: var(--wa-form-control-background-color);
  --background-color-checked: var(--background-color);
  --border-color: var(--wa-form-control-resting-color);
  --border-color-checked: var(--wa-form-control-activated-color);
  --border-style: var(--wa-border-style);
  --border-width: var(--wa-form-control-border-width);
  --box-shadow: none;
  --checked-icon-color: var(--wa-form-control-activated-color);
  --checked-icon-scale: 0.75;
  --toggle-size: calc(1em * var(--wa-form-control-value-line-height));

  display: inline-block;
}

:host(:focus-visible) {
  outline: none;
}

.radio {
  display: flex;
  align-items: top;
  font: inherit;
  color: var(--wa-form-control-value-color);
  vertical-align: middle;
  cursor: pointer;
}

.radio--small {
  font-size: var(--wa-font-size-s);
}

.radio--medium {
  font-size: var(--wa-font-size-m);
}

.radio--large {
  font-size: var(--wa-font-size-l);
}

.radio__checked-icon {
  display: flex;
  fill: currentColor;
  width: var(--toggle-size);
  height: var(--toggle-size);
  scale: var(--checked-icon-scale);
}

.radio__control {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--toggle-size);
  height: var(--toggle-size);
  border-color: var(--border-color);
  border-style: var(--border-style);
  border-width: var(--border-width);
  border-radius: 50%;
  background-color: var(--background-color);
  box-shadow: var(--box-shadow);
  color: transparent;
  transition:
    background var(--wa-transition-normal) var(--wa-transition-easing),
    border-color var(--wa-transition-normal) var(--wa-transition-easing),
    box-shadow var(--wa-transition-normal) var(--wa-transition-easing),
    color var(--wa-transition-normal) var(--wa-transition-easing);
}

.radio__input {
  position: absolute;
  opacity: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
}

/* Checked */
.radio--checked .radio__control {
  color: var(--checked-icon-color);
  border-color: var(--border-color-checked);
  background-color: var(--background-color-checked);
}

/* Checked + focus */
:host(:focus-visible) .radio__control {
  outline: var(--wa-focus-ring);
  outline-offset: var(--wa-focus-ring-offset);
}

/* Disabled */
.radio--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* When the control isn't checked, hide the circle for Windows High Contrast mode a11y */
.radio:not(.radio--checked) svg circle {
  opacity: 0;
}

.radio__label {
  display: inline-block;
  color: var(--wa-form-control-value-color);
  line-height: var(--toggle-size);
  margin-inline-start: 0.5em;
  user-select: none;
  -webkit-user-select: none;
}
