/**
 * @file
 * Image panel.
 *
 * Provides styles for the image panel paragraph.
 */

.text-image {
  display: grid;
  grid-template-columns: 1fr;
}

.text-image__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 4rem);
  color: var(--color--gray-5);
  background-color: var(--color--gray-90);
}

/*
 * Provides a positioning context for the absolutely positioned image.
 */
.text-image__media {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

/*
 * `position: static` is applied to the contextual region because another
 * element provides the positioning context for the contextual links button.
 */
.text-image__media .contextual-region.media--type-image {
  position: static;
}

.text-image__media img {
  position: static;
  width: 100%;
  height: auto;
}

@media (min-width: 43.75rem) {
  .text-image {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .text-image--image-left .text-image__media {
    order: -1;
  }

  .text-image__content,
  .text-image__media {
    grid-row: auto;
    grid-column: auto;
  }

  .text-image__media {
    min-height: 300px;
  }

  /*
   * The image is positioned absolutely to fill the height of the text column,
   * regardless of the wrappers generated by Drupal.
   */
  .text-image__media img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
