.Card {
  --card-radius: var(--radius-md);
  overflow: hidden;
  border-radius: var(--card-radius);
  background: @card-bg;

  &--xl {
    width: @card-size-xl;
  }
  &--lg {
    width: @card-size-lg;
  }
  &--md {
    width: @card-size-md;
  }
  &--sm {
    width: @card-size-sm;
  }
  &--xs {
    width: @card-size-xs;
  }
  &--fluid {
    width: calc(100% - var(--msg-gutter));
    max-width: @card-max-width;
    min-width: @card-min-width;
  }
}

.Card[data-fluid="order"] {
  max-width: 360px;
}

/* CardMedia */
.CardMedia {
  position: relative;
  background-repeat: no-repeat;
  background-position: 50%;
  background-size: cover;

  &:after {
    display: block;
    height: 0;
    content: '';
  }
  &--wide {
    &:after {
      padding-top: 56.25%;
    }
  }
  &--square {
    &:after {
      padding-top: 100%;
    }
  }
  &-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
}

/* CardHeader */
.CardHeader {
  position: relative;
  padding: @card-padding @card-padding 9px;

  &[data-has-bg="true"] {
    padding-bottom: calc(9px + var(--card-radius));
    // box-shadow: inset 0 1px 0 0 #fff;
    // 用 box-shadow 会残留一条曲线，所以用 margin 来模拟内阴影
    margin-top: 1Px;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;

    & + [class^="Card"] {
      position: relative;
      margin-top: calc(-1 * var(--card-radius));
      border-top-left-radius: inherit;
      border-top-right-radius: inherit;
      // border-radius: @card-border-radius @card-border-radius 0 0;
      background-color: inherit;
    }
  }
}

.CardHeader-logo {
  display: block;
  height: 24px;
}

.CardHeader-icon {
  margin: 2px 6px 2px 0;
  font-size: 20px;
  height: 20px;
}

.CardHeader-title {
  margin: 0;
  color: var(--color-text-1);
  font-size: 16px;
  font-weight: 500;
}

.CardHeader-desc {
  margin: 2px 0 0;
  color: var(--color-text-2);
  font-size: 14px;
  font-weight: 500;
}

.CardHeader-badge {
  width: 90px;
  margin: -12px;
  background: center right/contain no-repeat;
}

.CardHeader-slot,
.CardHeader-badge {
  margin-left: 9px;
}

.CardHeader-slot {
  display: flex;

  .Btn {
    min-width: auto;
    padding: 2px 9px;
    font-size: 12px;
  }
  > a {
    display: flex;
    align-items: center;
    color: var(--color-text-2);
    text-decoration: none;
    font-size: 14px;

    .Icon {
      font-size: 16px;
    }
  }
}

/* CardTitle */
.CardTitle {
  padding: @card-title-padding;

  &--center {
    padding: 4px 2px; // FIXME
    text-align: center;
  }
  &-title {
    margin: 0;
    font-size: @card-title-font-size;
    font-weight: @card-title-font-weight;
  }
  &-subtitle {
    margin: 0;
    color: @card-subtitle-color;
    font-size: @card-subtitle-font-size;
  }
}

/* CardContent */
.CardContent {
  padding: @card-padding;
}

/* CardText */
.CardText {
  padding: @card-padding;
  color: @card-text-color;

  p {
    margin: 0;
  }
}

/* CardActions */
.CardActions {
  display: flex;
  padding: @card-padding @card-padding 18px;

  .Btn {
    flex: 1;
    line-height: @card-btn-line-height;
  }
  .Btn + .Btn {
    margin-left: @card-btn-spacing-x;
  }
}

.CardActions--column {
  flex-direction: column;
  padding: 0;

  .Btn {
    padding: @card-btn-padding;
    border: 0;
    border-top: 1px solid @card-btn-border-color;
    border-radius: 0;
    background: @card-column-btn-bg;
    color: var(--color-text-2);

    &:last-child {
      border-radius: 0 0 var(--card-radius) var(--card-radius);
    }
    &:active {
      background: @card-column-btn-active-bg;
    }
  }
  .Btn + .Btn {
    margin: @card-btn-spacing-y;
  }
  .Btn--primary {
    color: @card-column-btn-primary-color;
  }
}

@media (hover: hover) {
  .CardActions--column {
    .Btn {
      &:hover {
        background: @card-column-btn-hover-bg;
      }
    }
  }
}

.CardHeader[data-has-bg="false"],
.CardTitle,
.CardText,
.CardContent {
  & + [class^="Card"] {
    padding-top: 0;
  }
}
