// Button base styles

button {
  overflow-wrap: normal;
}

%button,
.button,
button,
input[type="button"],
input[type="submit"],
.form-submit:not([data-drupal-selector^="edit-reset"]) {
  display: inline-block;
  margin-bottom: 1em;
  padding: 0.5em 2em;
  text-decoration: none;
  color: $color-interaction;
  border-width: 1px;
  border-style: solid;
  border-color: $color-interaction;
  border-radius: $button-border-radius;
  background-color: $color-bg-light;

  .inverted & {
    border-color: $color-text-inverted;
  }

  &:focus,
  &:not([disabled]):hover {
    color: $color-text-inverted;
    background-color: $color-interaction;
  }
}

%button-small,
.button-small {
  @extend %button;

  padding: 0.25em 1em;
  font-size: var(--font-size-s);
}

// stylelint-disable scss/percent-placeholder-pattern
// prettier-ignore
.form-submit:not([data-drupal-selector^="edit-reset"]),
.button--cta,
%oc-button--primary {
  color: $color-text-inverted;
  border-color: $color-link;
  background-color: $color-link;
}
// stylelint-enable scss/percent-placeholder-pattern

%button-active {
  color: $color-text-inverted;
  border-color: $color-interaction;
  background-color: $color-interaction;

  &:focus,
  &:not([disabled]):hover {
    color: $color-interaction;
    background-color: $color-bg-light;
  }
}

// Danger/alert buttons (potentially destructive function).
%button-danger,
.form-submit.danger,
.button.danger,
.button--danger,
a.button.danger,
input[type="submit"].danger,
button[type="submit"].button--danger {
  color: $color-danger;
  border-color: $color-danger;
  background-color: $color-bg-light;

  &:focus,
  &:not([disabled]):hover {
    color: $color-text-inverted;
    border-color: $color-danger;
    background-color: $color-danger;
  }
  @include icon(xmark) {
    margin-right: 0.5rem;
  }
}

.shariff {
  // margin-top: $grid-gutter;
  ul {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none outside;
  }
  li {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .button-style-icon a {
    @extend %button;

    width: 2em;
    height: 2em;
    padding: 0.5em;
    text-align: center;
    border-radius: 50%;
    font-size: var(--font-size-icon);
    line-height: 1;
  }
}

// active pseudo class must be declared last
%button,
.button,
button,
input[type="button"],
input[type="submit"] {
  &:active {
    color: $color-interaction;
    border-color: $color-bg-light;
    outline: $outline-active;
    background-color: $color-bg-light;
  }
}

// special icons in buttons

.button--add {
  margin-left: 0;
  @include icon(circle-plus) {
    margin-right: 0.5rem;
    margin-left: -0.5rem;
  }
}

button.close,
dialog.modal button.close {
  @include icon(xmark);

  top: 0.5rem;
  right: 0.5rem;
  width: var(--font-size-icon);
  height: var(--font-size-icon);
  margin: 0;
  padding: 0;
  border-color: var(--color-text-inverted);
  font-size: var(--font-size-default);
  font-weight: normal;

  &::before,
  &::after {
    padding: 0;
    line-height: var(--font-size-icon);
  }
}
