:host {
  --border-radius-input: var(--pine-border-radius-200);
  --box-shadow-focus: 0 0 0 1px #ffffff, 0 0 0 3px var(--color-outline-focus);
  --box-shadow-focus-error: 0 0 0 1px #ffffff, 0 0 0 3px var(--color-outline-focus-error);
  --box-shadow-input-toggle: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.08);
  --color-background-checked: var(--pine-color-purple-500);
  --color-background-checked-hover: var(--pine-color-purple-600);
  --color-background-error: var(--pine-color-red-500);
  --color-background-input-disabled: var(--pine-color-grey-200);
  --color-background-input-default: var(--pine-color-grey-300);
  --color-background-input-hover: var(--pine-color-grey-400);
  --color-input-toggle-default: var(--pine-color-white);
  --color-input-toggle-disabled: var(--pine-color-grey-100);
  --color-message-text: var(--pine-color-grey-700);
  --color-outline-focus: var(--pine-color-purple-300);
  --color-outline-focus-error: var(--pine-color-red-200);
  --color-text-default: var(--pine-color-grey-900);
  --color-text-disabled: var(--pine-color-grey-500);
  --color-text-error: var(--pine-color-red-500);
  --font-weight-label-default: var(--pine-font-weight-body-medium);
  --dimension-input-height: 20px;
  --dimension-input-width: 36px;
  --sizing-input-toggle-size: calc(var(--dimension-input-height) - (var(--spacing-input-toggle-offset) * 2));
  --spacing-label-gap-size: var(--pine-spacing-150);
  --spacing-input-toggle-offset: calc(var(--pine-spacing-050) / 2);
  --spacing-message-block: calc(var(--pine-spacing-150) / 2);
  --spacing-message-inline: calc(var(--dimension-input-width) + var(--spacing-label-gap-size));
  --number-transition-timing: 0.15s ease-out;
  align-items: flex-start;
  color: var(--color-text-default);
  display: inline-flex;
  flex-flow: row wrap;
  margin-block-end: var(--pine-spacing-md);
  position: relative;
}

:host(.pds-switch--error) {
  color: var(--color-text-error);
}
:host(.pds-switch--error) input,
:host(.pds-switch--error) input:checked,
:host(.pds-switch--error) input:hover:not(:disabled):not(:checked) {
  background-color: var(--color-background-error);
}
:host(.pds-switch--error) input:focus-visible:not(:disabled):not(:checked) {
  box-shadow: var(--box-shadow-focus-error);
}
:host(.pds-switch--error) label {
  color: var(--color-text-error);
}

input {
  appearance: none;
  background: var(--color-background-input-default);
  border: 0;
  border-radius: var(--border-radius-input);
  cursor: pointer;
  display: inline-block;
  height: var(--dimension-input-height);
  margin: 0;
  padding: 0;
  position: relative;
  transition: var(--number-transition-timing);
  transition-property: background, border, color;
  width: var(--dimension-input-width);
}
input::after {
  background: var(--color-input-toggle-default);
  border-radius: 50%;
  box-shadow: var(--box-shadow-input-toggle);
  content: "";
  display: block;
  height: var(--sizing-input-toggle-size);
  inset-block-start: 50%;
  inset-inline-start: 50%;
  position: absolute;
  transform: translate3d(-100%, -50%, 0);
  transition: transform var(--number-transition-timing);
  width: var(--sizing-input-toggle-size);
}

label {
  cursor: pointer;
  display: inline-flex;
  flex-grow: 1;
  font-weight: var(--font-weight-label-default);
  margin-inline-start: var(--spacing-label-gap-size);
}
.pds-switch--error label {
  color: inherit;
}

.pds-switch__message {
  color: var(--color-message-text);
  flex: 1 0 100%;
  font-size: var(--pine-font-size-body-md);
  margin-block-start: var(--spacing-message-block);
  margin-inline-start: var(--spacing-message-inline);
}

.pds-switch__message--error {
  align-items: center;
  color: inherit;
  display: flex;
  font-size: var(--pine-font-size-085);
  gap: var(--pine-spacing-050);
}

input:disabled {
  background-color: var(--color-background-input-disabled);
  cursor: not-allowed;
}
input:disabled ~ label {
  color: var(--color-text-disabled);
  cursor: initial;
}
input:disabled:hover::after {
  background-color: var(--color-input-toggle-disabled);
}
input:disabled .pds-switch__message {
  color: initial;
}

input:hover:not(:disabled) {
  background-color: var(--color-background-input-hover);
}

input:focus-visible:not(:disabled) {
  box-shadow: var(--box-shadow-focus);
  outline: none;
}

input:checked::after {
  transform: translate3d(0, -50%, 0);
}

input:checked:not(:disabled) {
  background-color: currentColor;
  color: var(--color-background-checked);
}
input:checked:not(:disabled):hover {
  border-color: currentColor;
  color: var(--color-background-checked-hover);
}