/* ==========================================================================
   Text and image
   --------------------------------------------------------------------------
   Copy and a picture side by side on a wide screen, picture first on a
   phone. The picture is capped in height and cropped rather than stretched
   to match a long body of text.
   ========================================================================== */

.tmedia__inner {
  display: grid;
  gap: clamp(var(--sp-5), 4vw, var(--sp-8));
  align-items: center;
}

.tmedia__copy { max-width: var(--width-content); }
.tmedia--no-image .tmedia__copy { margin-inline: 0; }

.tmedia__heading {
  color: var(--color-heading);
  font-size: var(--fs-h3);
  margin: 0 0 var(--sp-4);
  text-wrap: balance;
}

.tmedia__body > * { margin: 0; }
.tmedia__body > * + * { margin-block-start: var(--sp-4); }
.tmedia__body h3 {
  font-size: var(--fs-h5);
  color: var(--color-heading);
  margin-block-start: var(--sp-6);
}
.tmedia__body ul { padding-inline-start: 1.2em; }
.tmedia__body li + li { margin-block-start: var(--sp-2); }
.tmedia__body li::marker { color: var(--color-accent-gold); }
.tmedia__body a { color: var(--color-link); }

.tmedia__action { margin: var(--sp-5) 0 0; }

.tmedia__media {
  margin: 0;
  order: -1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-md);
}

.tmedia__image { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (min-width: 56rem) {
  .tmedia__inner { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  /* Beside the text, the photo runs the full height of the copy, top to
     bottom (Liam, 6 Oct 2026: "this image should match the length of the
     text"). The grid stretches both columns to the taller one and the image
     covers its box, so a long section gets a taller crop rather than a small
     picture floating in white space. The minimum height stops a short
     section producing a thin letterbox strip. */
  .tmedia__inner { align-items: stretch; }
  .tmedia__copy { align-self: center; }
  .tmedia__media { order: 0; aspect-ratio: auto; min-height: 22rem; height: 100%; }
  .tmedia--image-left .tmedia__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .tmedia--image-left .tmedia__media { order: -1; }
  .tmedia--no-image .tmedia__inner { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 55.99rem) {
  .tmedia__inner { gap: var(--sp-5); }
}

/* Phones and tablets, stacked: the photo runs the full width of the screen,
   edge to edge, with square corners (Liam, 22 Oct 2026). The negative margin
   cancels the container's side padding. */
@media (max-width: 55.99rem) {
  .tmedia__media {
    margin-inline: calc(var(--gutter) * -1);
    border-radius: 0;
    box-shadow: none;
  }
}
