@mixin rufi-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-items: flex-start;
  box-sizing: border-box;
  padding: 0;
  max-width: var(--arg-card-max-width, $arg-card-max-width);
  border: var(--arg-card-border-size, $arg-card-border-size) solid var(--arg-card-border-color, $arg-card-border-color);
  border-radius: var(--arg-card-border-radius-size, $arg-card-border-radius-size);
  background-color: var(--arg-card-bg-color, $arg-card-bg-color);
  box-shadow: var(--arg-card-box-shadow, $arg-card-box-shadow);

  &-list {
    margin-bottom: 2rem;
  }

  &:target {
    outline: 2px dotted transparent;
    box-shadow: 0 0 0 2px #fff, 0 0 0 5px #26a769;
    z-index: 1;
  }
}

@mixin rufi-card__image {
  img {
    border-radius: $borderDefault $borderDefault 0 0;

    @include mq($breakpointXSmall) {
      border-radius: $borderDefault 0 0 $borderDefault;
    }
  }
}

@mixin rufi-card__content-wrapper {
  background-color: var(--arg-card-content-background-color, transparent);
  border-radius: 0 0 $borderSmall $borderSmall;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  flex-shrink: 0;
  padding: 1.5rem;
}

@mixin rufi-card__prevent_nesting {
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  box-shadow: none;
  border-left: 0;
  border-right: 0;
}
@mixin rufi-card__prevent_nesting_top {
  margin-top: -1.5rem;
  border-top: 0;
}
@mixin rufi-card__prevent_nesting_bot {
  margin-bottom: -1.5rem;
  border-bottom: 0;
}

@mixin rufi-card-spacer() {
  width: 100%;
  padding: .75rem;
  background: var(--arg-card-layer-background, transparent);
  border: 1px solid var(--arg-card-border-color, $arg-card-border-color);
  box-sizing: border-box;

  @include mq($breakpointSmall) {
    padding: 1.5rem;
  }

  @include mq($breakpointLarge) {
    min-width: 100%;
    width: fit-content;
  }
}

@mixin rufi-card-header() {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;

  margin: -1.5rem -1.5rem .5rem;
  padding: .8rem 1.5rem;
  border-bottom: 1px solid var(--arg-card-border-color, $arg-card-border-color);
}

@mixin rufi-card-header__icon {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  margin-right: 1rem;
  position: relative;
  text-decoration: none;

  .rufi-icon {
    font-size: 34px;
    z-index: 1;
  }

  &:before {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 48px;
    height: 48px;
    background-color: var(--arg-card-header-icon-bg-on-card, rgba(0, 0, 0, 0.54));
    z-index: 0;
    border-radius: 12%;
  }
}

@mixin rufi-card-header__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;

  a {
    &,
    &:hover,
    &:focus,
    &:active {
      cursor: pointer;
      color: inherit;
      text-decoration: none;
    }
  }
}

@mixin rufi-card-header__text__top {
  margin: 0;

  a {
    &,
    &:hover,
    &:focus,
    &:active {
      text-decoration: none;
    }
  }
}

@mixin rufi-card-header__text__bot {
  margin: 0;
  color: var(--arg-card-header-text-bot-color, $arg-card-metadata-color);
}

@mixin rufi-card__content-item {
  margin-top: 0;
  margin-bottom: 1rem;
}

@mixin rufi-card__metadata {
  margin: .25rem 0;
  color: var(--arg-card-metadata-color, $arg-card-metadata-color);
}

/**
  Used for extendable details as in arguments.
  Requires js and data-height attr to extend.
 */
@mixin card__content-item__extend {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding: 0 1.5rem;
  overflow: hidden;
  transition: height ease-in-out .4s;

  &.content-dense {
    &:after {
      transform: translateY(0);
    }
  }

  &:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    height: 1.5em;
    background: transparent;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
    transition: transform ease-in-out .4s;
  }
}

@mixin card__content-item__extend__toggle {
  align-self: center;
  background-color: transparent;
  display: none;

  &.button,
  &.button:hover,
  &.button:focus,
  &.button:active {
    background-color: transparent;
    box-shadow: unset;
  }

  & + .card-footer {
    margin-top: 0;
  }

  &.listen-extend {
    display: inline-block;

    & .less {
      display: none;
    }

    &.show-extend .less {
      display: inline-block;
    }

    &.show-extend .more {
      display: none;
    }
  }

}

@mixin rufi-card__content-item__row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  padding: 0;
  margin: -1rem -1rem 1rem;

  > * {
    flex: 1 1 auto;
    margin: 1rem;
  }
}


@mixin rufi-card-footer() {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;

  margin: 1rem -1.5rem -1.5rem;
  padding: .8rem 1.5rem;
  border-top: 1px solid var(--arg-card-border-color, $arg-card-border-color);
}


@mixin rufi-card-footer__action-buttons() {
  flex: 1 1 50%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

@mixin rufi-card-footer__action-icons() {
  flex: 1 1 50%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}
