:host {
  align-items: center;
  display: flex;
  flex-flow: row wrap;
}

:host(.is-invalid) input {
  border-color: var(--pine-color-border-danger);
}
:host(.is-invalid) input:checked {
  background: var(--pine-color-danger);
}
:host(.is-invalid) input:checked:hover {
  background: var(--pine-color-danger-hover);
  border-color: var(--pine-color-border-danger-hover);
}
:host(.is-invalid) input:focus-visible {
  outline-color: var(--pine-color-focus-ring-danger);
}
:host(.is-invalid) label,
:host(.is-invalid) .pds-checkbox__message--error {
  color: var(--pine-color-text-message-danger);
}

:host(.is-indeterminate) input {
  background: var(--pine-color-accent);
  border-color: var(--pine-color-accent);
}
:host(.is-indeterminate) input:hover {
  background: var(--pine-color-accent);
  border-color: var(--pine-color-accent-hover);
}
:host(.is-indeterminate) input::after {
  /* stylelint-disable-next-line pine-design-system/prefer-semantic-tokens */
  border: 1px solid var(--pine-color-white);
  border-block-end: var(--pine-border-width-none);
  border-block-start: var(--pine-border-width-none);
  border-inline-start: var(--pine-border-width-none);
  content: "";
  display: block;
  height: 7px;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  position: absolute;
  transform: translate(-50%, -50%) rotate(90deg);
  width: 4px;
}

input {
  appearance: none;
  background: var(--pine-color-background-container);
  border: var(--pine-border);
  border-radius: var(--pine-dimension-2xs);
  flex: none;
  height: var(--pine-dimension-sm);
  margin: 0;
  margin-block-start: var(--pine-dimension-025);
  position: relative;
  width: var(--pine-dimension-sm);
}
input:hover {
  background: var(--pine-color-background-container-hover);
  border: var(--pine-border-hover);
}
input:checked {
  background: var(--pine-color-accent);
  border-color: var(--pine-color-accent);
}
input:checked:hover {
  background: var(--pine-color-accent-hover);
  border-color: var(--pine-color-accent-hover);
}
input:checked::after {
  /* stylelint-disable-next-line pine-design-system/prefer-semantic-tokens */
  border: 1px solid var(--pine-color-white);
  border-block-start: var(--pine-border-width-none);
  border-inline-start: var(--pine-border-width-none);
  content: "";
  display: block;
  height: 7px;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  position: absolute;
  transform: translate(-50%, -60%) rotate(43deg);
  width: 4px;
}
input:disabled {
  background: var(--pine-color-background-container-disabled);
  border-color: var(--pine-color-border-disabled);
  cursor: not-allowed;
}
input:disabled:checked {
  background: var(--pine-color-background-container-disabled);
  border-color: var(--pine-color-border-disabled);
}
input:disabled:checked::after {
  border-color: var(--pine-color-border);
}
input:disabled + label {
  cursor: not-allowed;
}
input:disabled ~ .pds-checkbox__message {
  color: var(--pine-color-text-disabled);
}
input:focus-visible {
  outline: var(--pine-outline-focus);
}

:host-context([dir=rtl]) input:checked::after {
  transform: translate(-50%, -60%) rotate(-43deg);
}

label {
  display: flex;
  gap: var(--pine-dimension-xs);
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: polygon(0 0, 0 0, 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.pds-checkbox__message {
  color: var(--pine-color-text-message);
  font: var(--pine-typography-body-sm-medium);
  margin-block-start: 6px;
  margin-inline-start: var(--pine-dimension-md);
  width: 100%;
}

.pds-checkbox__message--error {
  display: flex;
  gap: var(--pine-dimension-2xs);
}
.pds-checkbox__message--error pds-icon {
  margin-block-start: var(--pine-dimension-025);
}