.houses {
  padding: var(--section-space) 0;
}

.houses__title {
  padding-left: 19.9rem;
}

.houses__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6rem 2.6rem;
  margin-top: 6.4rem;
  padding: 0 15.8rem 0 16.4rem;
}

/* The card is drawn in Figma units (px / 10) in em, 1em is derived from the column width */
.houses__item {
  container-type: inline-size;
}

/* House card
   ========================================================================== */

.house-card {
  display: flex;
  flex-direction: column;
  max-width: 46.8em;
  margin-inline: auto;
  font-size: min(calc(100cqw / 46.8), 1.4rem);
  cursor: pointer;
}

.house-card__head {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Two lines high as in the design, so the house image never covers a short name */
.house-card__name {
  min-height: 2.4666em;
  margin-right: 0.1em;
  font-size: max(3em, 16px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.2333;
  text-align: right;
  text-transform: uppercase;
  color: var(--color-sand);
}


/* Above the house image, whose roof may reach under the tag */
.house-card__price {
  position: relative;
  z-index: 1;
  margin-top: 0.25em;
  font-size: max(2em, 12px);
}

.house-card__stats .house-stats__label,
.house-card__stats .house-stats__value {
  font-size: max(2em, 12px);
}

.house-card__panel {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  margin-left: 3.3em;
  padding-bottom: 2.3em;
  background-color: var(--color-beige);
}

.house-card__image {
  position: relative;
  width: 39.8em;
  height: 17.3em;
  margin: -5.5em 0 0 -3.3em;
  background-position: left bottom;
  background-repeat: no-repeat;
  background-size: contain;
  transition: transform 0.5s ease;
}

.house-card:hover .house-card__image {
  transform: translateY(-0.6em);
}

.house-card__stats {
  gap: 1em 5.9em;
  margin: 1.3em 0 0 3.5em;
}

.house-card__btn {
  align-self: center;
  margin-top: 1.733em;
  font-size: max(1.5em, 11px);
}

/* Small desktops: small text keeps its minimum size, so the parameters get a narrower gap to stay on one line */
@media (min-width: 1280px) and (max-width: 1439.98px) {
  .house-card__stats {
    column-gap: 2.5em;
  }
}

/* Tablet & mobile
   ========================================================================== */

@media (max-width: 1279.98px) {
  .houses__title {
    padding-inline: var(--gutter);
  }

  .houses__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5.6rem 3.2rem;
    margin-top: 4rem;
    padding-inline: var(--gutter);
  }

  .house-card {
    font-size: calc(100cqw / 46.8);
  }
}

@media (max-width: 599.98px) {
  .houses__list {
    grid-template-columns: minmax(0, 1fr);
    gap: 4.8rem;
  }
}

@media (max-width: 767.98px) {
  /* The card is sized in em, which makes the button text too small to read on a phone */
  .house-card__btn {
    font-size: 1.4rem;
  }
}

/* Meta line, flag and the note under the projects */
.house-card__meta {
  margin: 1.2em 3.5em 0;
  font-size: max(1.5em, 11px);
  font-weight: 500;
  line-height: 1.3;
}

.house-card__flag {
  align-self: flex-end;
  margin: 0 0.1em 0.5em 0;
  padding: 0.3em 1em;
  font-size: max(1.4em, 11px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-dark);
  background-color: var(--color-sand);
  border-radius: 1em;
}

.houses__note {
  max-width: 96rem;
  margin: 3.2rem 0 0 19.9rem;
  font-size: max(1.6rem, 13px);
  font-weight: 300;
  line-height: 1.4;
}

@media (max-width: 1279.98px) {
  .houses__note {
    margin: 2.4rem var(--gutter) 0;
  }
}
