/* ============ HISTORIA ============ */
.history {
  background: var(--color-cream);
}

/* The side inset lives on the section, not here: padding on the grid would
   come out of the cell width and stop the columns reaching their full size.
   minmax(0, 1fr) rather than 1fr: an auto minimum lets a track grow to its
   content's intrinsic width, which the photos would push past the viewport. */
.history__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(583px, 1fr);
  gap: 2.5rem;
  max-width: 1440px;
  padding: 4rem;
  margin: 0 auto;
}

.history__media {
  position: relative;
  min-width: 0;
}

/* Out of flow so its intrinsic height cannot feed back into the row. Both
   rows are 1fr, so any height a photo contributed would propagate to the
   other row as well. */
.history__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1.5rem;
}

.history__image--portrait {
  object-position: center bottom;
}

.history__card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  padding: 3rem;
  border-radius: 1.5rem;
  color: var(--color-white);
}

.history__card--green {
  background: var(--color-green-900);
}

.history__card--navy {
  background: var(--color-navy-900);
}

.history__label {
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-flat);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history__card--green .history__label {
  color: var(--color-green-400);
}

.history__title {
  font-size: var(--font-size-h3);
  text-transform: uppercase;
  color: var(--color-white);
}

.history__text {
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
}

@media (max-width: 1024px) {
  .history {
    padding: 3.5rem 1.5rem;
  }

  .history__grid {
    padding: 0;
    gap: 1rem;
  }

  .history__card {
    padding: 2.5rem;
  }
}

/* Below this width each card becomes a full-bleed band with its photo inside
   it: no radius, no gutter, and the bands butt directly against each other. */
@media (max-width: 768px) {
  .history {
    padding: 0;
  }

  .history__grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 0;
    max-width: none;
    padding: 0;
  }

  .history__card--green {
    order: 1;
  }

  .history__media--comunidad {
    order: 2;
    background: var(--color-green-900);
  }

  .history__card--navy {
    order: 3;
  }

  .history__media--estela {
    order: 4;
    background: var(--color-navy-900);
  }

  .history__card {
    padding: 2.5rem 1.5rem 1.5rem;
    border-radius: 0;
  }

  .history__media {
    position: static;
    padding: 0 1.5rem 2.5rem;
    border-radius: 0;
  }

  /* Back in flow: the bands are sized by their content, not by a row. */
  .history__image {
    position: static;
    height: auto;
    aspect-ratio: 644 / 557.29;
    border-radius: 0.75rem;
  }
}
