@layer lotek {
  .lt-radio {
    box-sizing: border-box;
    appearance: none;
    flex: none;
    display: inline-block;
    inline-size: var(--lt-radio-size, var(--lt-spacing-5));
    block-size: var(--lt-radio-size, var(--lt-spacing-5));
    margin: 0;
    background-color: var(--lt-color-neutral-canvas);
    border: 1px solid var(--lt-color-neutral-border);
    border-radius: 50%;
    cursor: pointer;
  }

  /* Without `:not(:disabled)`. It raised the specificity above the states
     below, so the mouse removed both the error border and the border of a
     selected button. The rules for selected, disabled and invalid come
     after this one and win on order. */
  .lt-radio:hover {
    border-color: var(--lt-color-neutral-border-strong);
  }

  .lt-radio:focus-visible {
    outline: var(--lt-focus-ring);
    outline-offset: 2px;
  }

  /* The dot is a gradient and not an image, so it takes its colour from the
     token directly and needs no separate variant for the dark theme. */
  .lt-radio:checked {
    background-color: var(--lt-color-accent-fill);
    border-color: var(--lt-color-accent-fill);
    background-image: radial-gradient(
      circle at center,
      var(--lt-color-accent-content) 0 32%,
      transparent 34%
    );
  }

  .lt-radio:disabled {
    background-color: var(--lt-color-disabled-surface);
    border-color: var(--lt-color-disabled-surface);
    cursor: not-allowed;
  }

  .lt-radio:disabled:checked {
    background-color: var(--lt-color-disabled-text);
    border-color: var(--lt-color-disabled-text);
  }

  .lt-radio[data-state="invalid"] {
    border-color: var(--lt-color-danger-text);
  }

  .lt-radio[data-state="invalid"]:focus-visible {
    outline-color: var(--lt-color-danger-text);
  }

  .lt-radio[data-state="success"] {
    border-color: var(--lt-color-success-text);
  }

  /* Disabled wins over a state. `[data-state]` used to come after
     `:disabled` with the same specificity, and an invalid field in a form
     that was disabled during submission looked red, not disabled. */
  .lt-radio:disabled[data-state] {
    background-color: var(--lt-color-disabled-surface);
    border-color: var(--lt-color-disabled-surface);
  }

  .lt-radio:disabled:checked[data-state] {
    background-color: var(--lt-color-disabled-text);
    border-color: var(--lt-color-disabled-text);
  }

  .lt-radio-row {
    display: flex;
    align-items: flex-start;
    gap: var(--lt-spacing-2);
    line-height: var(--lt-line-height-default);
  }

  /* High contrast: the dot is a gradient, and gradients are removed in the
     mode. The browser's own radio button is drawn correctly in every
     theme. */
  @media (forced-colors: active) {
    .lt-radio,
    .lt-radio:checked {
      appearance: auto;
      background-image: none;
    }
  }
}
