:where(
  button,
  input[type="submit"],
  input[type="reset"],
  input[type="button"]
) {
  /* Replaced <input> elements ignore flex. Lock the box so submit inputs and
     <button> paint the same height on one line. */
  appearance: none;
  display: inline-block;
  background-color: var(--marx-primary);
  border: 1px solid transparent;
  border-radius: var(--marx-radius);
  color: var(--marx-on-primary);
  block-size: calc(
    (var(--marx-text-base) * var(--marx-leading)) + (2 * var(--marx-space-xs)) +
      2px
  );
  padding-block: 0;
  padding-inline: var(--marx-space-md);
  font-weight: 500;
  font-size: var(--marx-text-base);
  line-height: calc(
    (var(--marx-text-base) * var(--marx-leading)) + (2 * var(--marx-space-xs))
  );
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  cursor: pointer;
  /* Skip the 300ms tap delay on touch devices. */
  touch-action: manipulation;
}

/* `:not(:disabled)` inside `:where()` keeps the guard at zero specificity. */
:where(
  button:not(:disabled),
  input:not(:disabled):is([type="submit"], [type="reset"], [type="button"])
):hover,
:where(
  button:not(:disabled),
  input:not(:disabled):is([type="submit"], [type="reset"], [type="button"])
):active {
  background-color: var(--marx-primary-strong);
  border-color: var(--marx-primary-strong);
}

:where(
  button,
  input[type="submit"],
  input[type="reset"],
  input[type="button"]
):focus-visible {
  outline: 2px solid var(--marx-ring);
  outline-offset: 2px;
}

:where(
  button,
  input[type="submit"],
  input[type="reset"],
  input[type="button"]
):disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: no-preference) {
  :where(
    button,
    input[type="submit"],
    input[type="reset"],
    input[type="button"]
  ) {
    transition:
      background-color 0.15s ease,
      border-color 0.15s ease,
      color 0.15s ease;
  }
}
