/**
 * For the full copyright and license information, please view the
 * docs/licenses/LICENSE.txt file that was distributed with this source code.
 */
//
// Base styles
//

.card {
  position: relative;
  display: block;
  margin-bottom: var(--#{$cdk}size-16);
  background-color: $card-bg;
  border: $card-border-width solid $card-border-color;
  @include border-radius($card-border-radius);
}

.card-block {
  padding: $card-spacer-x;
}

.card-title {
  margin-bottom: $card-spacer-y;
}

.card-subtitle {
  margin-top: -($card-spacer-y / 2);
  margin-bottom: 0;
}

.card-text:last-child {
  margin-bottom: 0;
}

.card-link {
  @include hover () {
    text-decoration: none;
  }

  + .card-link {
    margin-left: $card-spacer-x;
  }
}

.card-body {
  padding: var(--#{$cdk}size-16);
}

//
// Optional textual caps
//

.card-header {
  padding: var(--#{$cdk}size-16);
  font-size: var(--#{$cdk}size-18);
  font-weight: 600;
  line-height: 1.5rem;
  background-color: $card-cap-bg;

  .badge {
    vertical-align: middle;
  }

  .card-header-title {
    font-size: var(--#{$cdk}size-18);
    font-weight: 600;
    line-height: 1.5rem;
  }

  &:not(:has(.dropdown-item)) {
    .material-icons {
      margin-right: var(--#{$cdk}size-6);
      color: var(--#{$cdk}primary-500);
      vertical-align: calc(-1 * var(--#{$cdk}size-4));
    }
  }

  h3 {
    margin-bottom: 0;
  }

  // toolbar buttons at the top of the card
  .btn-toolbar {
    .btn {
      padding: 0 0.125rem;
    }
  }

  @include media-breakpoint-down("xs") {
    font-size: var(--#{$cdk}size-20);
  }
}

.card-footer {
  padding: var(--#{$cdk}size-16);
  background-color: $card-cap-bg;
  border-top: $card-border-width solid $card-border-color;

  &:last-child {
    @include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner);
  }
}

//
// Background variations
//

.card-primary {
  @include card-variant($brand-primary, $brand-primary);
}

.card-success {
  @include card-variant($brand-success, $brand-success);
}

.card-info {
  @include card-variant($brand-info, $brand-info);
}

.card-warning {
  @include card-variant($brand-warning, $brand-warning);
}

.card-danger {
  @include card-variant($brand-danger, $brand-danger);
}

// Remove all backgrounds
.card-primary-outline {
  @include card-outline-variant($btn-primary-bg);
}

.card-secondary-outline {
  @include card-outline-variant($btn-secondary-border);
}

.card-info-outline {
  @include card-outline-variant($btn-info-bg);
}

.card-success-outline {
  @include card-outline-variant($btn-success-bg);
}

.card-warning-outline {
  @include card-outline-variant($btn-warning-bg);
}

.card-danger-outline {
  @include card-outline-variant($btn-danger-bg);
}

//
// Inverse text within a card for use with dark backgrounds
//

.card-inverse {
  @include card-inverse ();
}

//
// Blockquote
//

.card-blockquote {
  padding: 0;
  margin-bottom: 0;
  border-left: 0;
}

// Card image
.card-img {
  // margin: -1.325rem;
  @include border-radius(0.25rem);
}

.card-img-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 1.25rem;
}


// Card image caps
.card-img-top {
  @include border-radius($card-border-radius-inner $card-border-radius-inner 0 0);
}

.card-img-bottom {
  @include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner);
}

//
// Card set
//

@include media-breakpoint-up(sm) {
  .card-deck {
    display: flex;
    flex-flow: row wrap;
    margin-right: -0.625rem;
    margin-left: -0.625rem;

    .card {
      flex: 1 0 0;
      margin-right: 0.625rem;
      margin-left: 0.625rem;
    }
  }
}

//
// Card groups
//

@include media-breakpoint-up(sm) {
  .card-group {
    display: flex;
    flex-flow: row wrap;

    .card {
      flex: 1 0 0;

      + .card {
        margin-left: 0;
        border-left: 0;
      }

      // Handle rounded corners and disabling stylelint because there are no mixins for these properties
      @if $enable-rounded {
        /* stylelint-disable property-blacklist */
        &:first-child {
          @include border-right-radius(0);

          .card-img-top {
            @include border-top-right-radius(0);
          }

          .card-img-bottom {
            @include border-bottom-right-radius(0);
          }
        }

        &:last-child {
          @include border-left-radius(0);

          .card-img-top {
            @include border-top-left-radius(0);
          }

          .card-img-bottom {
            @include border-bottom-left-radius(0);
          }
        }
        /* stylelint-enable property-blacklist */

        &:not(:first-child):not(:last-child) {
          @include border-radius(0);

          .card-img-top,
          .card-img-bottom {
            @include border-radius(0);
          }
        }
      }
    }
  }
}


//
// Card
//

@include media-breakpoint-up(sm) {
  .card-columns {
    column-count: 3;
    column-gap: 1.25rem;

    .card {
      display: inline-block;
      width: 100%; // Don't let them exceed the column width
    }
  }
}
