/* Buttons (brandbook "Buttons"). Submits get these classes from
   templates/form/input--submit.html.twig; action-row links from ActionRow.
   48 px tall, 6 px corners; compact 44 px (title-bar action only); text 44 px
   with a padded hit area; icon-only 48 x 48.

   Module links that cannot carry the classes take them by alias: the sign
   form's Preview (.signing-document__preview, DocumentStrip) is secondary,
   the signing panel's back-out (.signing-panel__cancel, SigningDialog) is a
   text button. */
.mm-btn,
.signing-document__preview,
.signing-panel__cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--mm-space-2);
  min-height: 48px;
  max-width: 100%;
  margin: 0;
  padding: 11px var(--mm-space-5);
  border: 1px solid transparent;
  border-radius: var(--mm-radius-control);
  font: 600 16px/1.25 var(--mm-sans);
  text-align: center;
  text-decoration: none;
  /* A long label wraps inside the button; <input> submits wrap too. */
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}

.mm-btn svg,
.signing-document__preview svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

/* base.css gives every :focus-visible a 4 px radius; a button keeps its own. */
.mm-btn:focus-visible,
.signing-document__preview:focus-visible,
.signing-panel__cancel:focus-visible {
  outline: none;
  box-shadow: var(--mm-focus);
  border-radius: var(--mm-radius-control);
}

.mm-btn--primary {
  background: var(--mm-primary);
  color: var(--mm-surface);
}

.mm-btn--primary:hover,
.mm-btn--primary:active {
  background: var(--mm-primary-pressed);
}

.mm-btn--secondary,
.signing-document__preview {
  background: var(--mm-surface);
  color: var(--mm-primary);
  border-color: var(--mm-primary);
}

.mm-btn--secondary:hover,
.mm-btn--secondary:active,
.signing-document__preview:hover,
.signing-document__preview:active {
  background: var(--mm-primary-surface);
}

.mm-btn--danger {
  background: var(--mm-danger);
  color: var(--mm-surface);
}

.mm-btn--danger:hover,
.mm-btn--danger:active {
  background: var(--mm-danger-pressed);
}

.mm-btn--text,
.signing-panel__cancel {
  min-height: 44px;
  padding: 0 var(--mm-space-2);
  background: none;
  color: var(--mm-primary);
  text-decoration: underline;
  text-decoration-color: var(--mm-underline);
  text-underline-offset: 4px;
}

.mm-btn--text:hover,
.mm-btn--text:active,
.signing-panel__cancel:hover,
.signing-panel__cancel:active {
  color: var(--mm-primary-pressed);
  text-decoration-color: currentColor;
}

.mm-btn--compact {
  min-height: 44px;
  padding: 0 14px;
  font-size: 15px;
}

.mm-btn--icon {
  width: 48px;
  padding: 0;
  flex: 0 0 48px;
}

.mm-btn[disabled],
.mm-btn.is-disabled {
  background: var(--mm-disabled);
  color: var(--mm-disabled-text);
  border-color: transparent;
  cursor: default;
}

.mm-btn--text[disabled],
.mm-btn--text.is-disabled {
  background: none;
  color: var(--mm-disabled-text);
}

/* Busy: the button carries aria-busy="true" and the spinner icon in place of
   its label (and an aria-label). A text button is never busy. */
.mm-btn[aria-busy="true"] {
  cursor: progress;
}

.mm-btn[aria-busy="true"] svg {
  animation: mm-spin .8s linear infinite;
}

@keyframes mm-spin {
  to {
    transform: rotate(360deg);
  }
}
