/*
 * Recipe card: image bleeding from the top, body with title, tag row and an
 * outline pill bottom-right. Mobile first: the small hub card on phones,
 * the full-size card from the md breakpoint up.
 */

.card-recipe {
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: var(--border-radius--xs);
  box-shadow: none;
  overflow: hidden;
}

/*
 * The box holds 420:224 whatever the image's intrinsic size: the image is
 * taken out of flow so its height can't stretch the box, and covers it.
 */
.card-recipe__media {
  position: relative;
  display: block;
  flex: 0 0 auto;
  aspect-ratio: 420 / 224;
  overflow: hidden;
}

.card-recipe__media .card__image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.card-recipe__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--spacer--md);
  padding: var(--spacer--sm);
}

.card-recipe .card__headline {
  margin: 0;
  font-size: var(--tag-font-size);
  font-weight: var(--font-weight--bold);
  line-height: var(--h6-line-height);
}

.card-recipe .card__headline a {
  color: inherit;
  text-decoration: none;
}

.card-recipe__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacer--sm) var(--spacer--xl);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card-recipe__tag {
  display: flex;
  align-items: center;
  gap: var(--spacer--2xs);
  font-size: var(--small-font-size--mobile);
  font-weight: var(--font-weight--bold);
  line-height: var(--small-line-height);
  text-transform: uppercase;
}

.card-recipe__tag-icon {
  display: inline-flex;
  flex: 0 0 auto;
}

.card-recipe__tag-icon svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}

.card-recipe__body > .button {
  margin-top: auto;
  align-self: flex-end;
}

/*
 * Phones: tags one per line, 1.625rem apart top to top (a 1.125rem line + a
 * 0.5rem gap). The parent gives every `li` a --body-margin-bottom (1rem) that
 * would add to the gap, so the tag drops it here. Also a one-line 0.75rem bold
 * pill about 2rem tall instead of the kit's md size.
 */
@media not all and (min-width: 768px) {
  .card-recipe__tags {
    flex-direction: column;
    gap: var(--spacer--xs);
  }

  .card-recipe__tag {
    margin-bottom: 0;
  }

  .card-recipe__body > .button {
    padding: var(--spacer--xs) var(--spacer--md);
    font-size: var(--small-font-size--mobile);
    font-weight: var(--font-weight--bold);
    /* 1.25 x 0.75rem + 2 x spacer-xs + two hairline borders: about 2.06rem,
       the design's one-line pill; the kit's 1.5 would make it 2.25rem. */
    line-height: 1.25;
    white-space: nowrap;
  }
}

@media (min-width: 768px) {
  .card-recipe {
    border-radius: var(--border-radius--md);
  }

  .card-recipe__body {
    padding: var(--spacer--lg);
  }

  .card-recipe .card__headline {
    font-size: var(--h4-font-size);
    line-height: var(--h4-line-height);
  }

  .card-recipe__tag {
    font-size: var(--tag-font-size);
    text-transform: none;
  }

  .card-recipe__tag-icon svg {
    width: 1rem;
    height: 1rem;
  }
}
