/* Shared introduction: emblem on the left, details in the centre, photos on the right. */
.ML-biography-intro {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 1fr) minmax(0, 250px);
  grid-template-areas: "badges details photos";
  gap: 10px;
  align-items: center;
  width: 100%;
  margin: 0 0 20px;
  padding: 10px;
}

.ML-biography-badges {
  grid-area: badges;
}

.ML-biography-details {
  grid-area: details;
  min-width: 0;
  color: #faed93;
  font-family: Arial, sans-serif;
  font-size: 24px;
  /* A computed length lets the larger name inherit the same line height. */
  line-height: 1.35em;
  text-align: center;
  overflow-wrap: break-word;
}

.ML-biography-intro .ML-biography-name {
  margin: 0;
  color: inherit;
  font-family: inherit;
  font-size: 36px;
  font-weight: normal;
  line-height: inherit;
}

.ML-biography-intro .ML-biography-rank {
  margin: 0;
}

.ML-biography-intro .ML-biography-group {
  margin: 0 0 16px;
}

.ML-biography-intro .ML-biography-group:last-child {
  margin-bottom: 0;
}

.ML-biography-photos {
  grid-area: photos;
}

/* Keep both image columns in the grid when a biography has no image for a slot. */
.ML-biography-badges,
.ML-biography-photos {
  display: grid;
  min-width: 0;
  gap: 20px;
  justify-items: center;
}

.ML-biography-intro figure {
  max-width: 100%;
  margin: 0;
  text-align: center;
}

.ML-biography-intro img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* Keep paired badges beside each other, including in a narrow image column. */
.ML-biography-intro .ML-biography-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.ML-biography-badge-row img {
  min-width: 0;
}

.ML-biography-intro figcaption {
  font-family: Arial, sans-serif;
  margin-top: 8px;
  color: #333;
  font-size: 16px;
  line-height: 1.45;
  font-weight: bold;
}

/* Let James Poole's text set the row height, then fit his complete portrait to it. */
.ML-biography-intro--fit-photo .ML-biography-photos {
  position: relative;
  align-self: stretch;
  min-height: 0;
}

.ML-biography-intro--fit-photo .ML-biography-photos figure {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ML-biography-intro--fit-photo .ML-biography-photos img {
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Remembrance row: poppies, the soldier's gravestone, cemetery or memorial. */
.ML-biography-remembrance {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 12px;
  clear: both;
  width: 100%;
  margin: 20px 0;
}

.ML-biography-remembrance > .ML-col {
  min-width: 0;
  width: auto !important;
  float: none;
  text-align: center;
}

.ML-biography-remembrance .ML-spacer-default {
  display: none;
}

.ML-biography-remembrance .ML-image-wrapper-1 {
  max-width: 100%;
  height: auto !important;
}

.ML-biography-remembrance .ML-image-crop {
  height: auto;
}

.ML-biography-remembrance .ML-image-crop img {
  display: block;
  max-width: 100%;
  height: auto !important;
  margin: 0 auto;
}

.ML-biography-remembrance figure {
  box-sizing: border-box;
  max-width: 100%;
  margin: 0;
  padding: 10px;
  text-align: center;
}

.ML-biography-remembrance figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

@media screen and (max-width: 999px) {
  .ML-biography-intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr);
  }
}

@media screen and (max-width: 699px) {
  .ML-biography-intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "details details" "badges photos";
    gap: 24px 16px;
    padding: 10px 8px;
  }

  .ML-biography-details {
    font-size: 22px;
  }

  .ML-biography-intro .ML-biography-name {
    font-size: clamp(28px, 7vw, 36px);
  }

  .ML-biography-intro--fit-photo .ML-biography-photos {
    position: static;
    align-self: center;
  }

  .ML-biography-intro--fit-photo .ML-biography-photos figure {
    position: static;
    display: block;
  }

  .ML-biography-intro--fit-photo .ML-biography-photos img {
    height: auto;
    max-height: 400px;
  }

  .ML-biography-remembrance {
    gap: 4px;
  }

  .ML-biography-remembrance .ML-container,
  .ML-biography-remembrance figure {
    padding: 4px;
  }

  .ML-biography-remembrance .ML-text {
    overflow-wrap: anywhere;
  }
}

@media screen and (max-width: 599px) {
  .ML-biography-remembrance {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}
