/**
 * @file
 * Card.
 */

:root {
  --card-bg-color: var(--color-white);
  --card-border-size: 1px;
  --card-border-color: var(--color-gray-200-o-80);
  --card-border-radius-size: var(--base-border-radius);
  --card-image-border-radius-size: calc(var(--card-border-radius-size) - var(--card-border-size));
  --card-box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-items: flex-start;
  padding: 0;
  border: var(--card-border-size) solid var(--card-border-color);
  border-radius: var(--card-border-radius-size);
  background-color: var(--card-bg-color);
  box-shadow: var(--card-box-shadow);
}

/* 588px theme screenshot width */
@media screen and (min-width: 36.75rem) {
  .card--horizontal {
    flex-direction: row;
  }

  .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card--horizontal {
    flex-direction: column;
  }
}

/* 53.75rem it is width of screenshot image + toolbar width(15rem) + 2rem of margins. */
@media screen and (min-width: 53.75rem) {
  .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card--horizontal {
    flex-direction: row;
  }
}

/**
 * Card image.
 */
.card__image {
  overflow: hidden;
  border-radius: var(--card-image-border-radius-size) var(--card-image-border-radius-size) 0 0;
  line-height: 0;
}

@media screen and (min-width: 36.75rem) {
  .card--horizontal .card__image {
    flex-basis: 35%;
    border-start-start-radius: var(--card-image-border-radius-size);
    border-start-end-radius: 0;
    border-end-start-radius: var(--card-image-border-radius-size);
    border-end-end-radius: 0;
  }
}

/* 53.75rem it is width of screenshot image + toolbar width(15rem) + 2rem of margins. */
@media screen and (max-width: 53.75rem) {
  .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card--horizontal .card__image {
    flex-basis: auto;
  }
}

@media screen and (min-width: 85.375rem) {
  .card--horizontal .card__image {
    flex-basis: 45%;
  }

  /* .card--vertical .card__image {
    flex-basis: auto;
  } */
}

/**
 * Card content.
 */
.card__content-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: var(--space-l);
}

@media screen and (min-width: 36.75rem) {
  .card--horizontal .card__content-wrapper {
    flex-basis: 65%;
  }

  /* Card content with image. */
  .card--horizontal .card__image ~ .card__content-wrapper {
    padding-inline-start: var(--space-m);
  }
}

@media screen and (max-width: 53.75rem) {
  .toolbar-tray-open.toolbar-vertical.toolbar-fixed .card--horizontal .card__content-wrapper {
    flex-basis: auto;
  }
}

@media screen and (min-width: 85.375rem) {
  .card--horizontal .card__content-wrapper {
    flex-basis: 55%;
  }
}

/**
 * Card content.
 */
.card__content {
  flex-grow: 1;
}

/**
 * Card content items (title, description).
 */
.card__content-item {
  margin-block: 0 var(--space-m);

  &:last-child {
    margin-block-end: 0;
  }
}

/**
 * Card footer.
 */
.card__footer {
  order: 100;
  margin-block-start: var(--space-l);
}

.card__footer .action-links {
  margin-block: 0;
  text-align: right; /* LTR */

  @nest [dir="rtl"] & {
    text-align: left;
  }
}
