:host {
  --background-color: var(--pine-color-neutral-grey-400);
  --background-color-checked: var(--pine-color-neutral-charcoal-400);
  --background-color-checked-hover: var(--pine-color-neutral-charcoal-400);
  --background-color-disabled: var(--pine-color-neutral-grey-300);
  --background-color-hover: var(--pine-color-neutral-grey-500);
  --input-border-radius: var(--pine-border-radius-lg);
  --input-height: 20px;
  --input-width: 36px;
  --input-toggle-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.08);
  --input-toggle-color: var(--pine-color-base-white);
  --input-toggle-offset: 2px;
  --input-toggle-size: calc(var(--input-height) - (var(--input-toggle-offset) * 2));
  --label-gap-size: 12px;
  --label-line-height: var(--pine-line-height-md);
  --message-spacing-block: var(--pine-spacing-xxs);
  --message-spacing-inline: calc(var(--input-width) + var(--label-gap-size));
  --message-text-color: var(--pine-color-neutral-charcoal-200);
  --outline-color-focus: var(--pine-color-primary-200);
  --outline-color-focus-error: var(--pine-color-red-200);
  --text-color-default: var(--pine-color-neutral-charcoal-400);
  --text-color-disabled: var(--pine-color-neutral-grey-500);
  --text-color-error: var(--pine-color-red-300);
  --transition-timing: 0.15s ease-out;
  align-items: flex-start;
  color: var(--text-color-default);
  display: inline-flex;
  flex-flow: row wrap;
  margin-block-end: var(--pine-spacing-md);
  position: relative;
}

:host(.pds-switch--error) {
  color: var(--text-color-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(--text-color-error);
}
:host(.pds-switch--error) input:focus-visible:not(:disabled):not(:checked) {
  box-shadow: 0 0 0 4px var(--outline-color-focus-error);
}

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

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

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

.pds-switch__message--error {
  color: inherit;
}

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

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

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

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

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