/* ============================================================
   UH investigation section: one series or report, its posts laid
   out as a grid or a stacked list.
   Shared by index.hbs and investigative-series.hbs.
   ============================================================ */

/* Fallback required: a page that never sets the token would collapse the band. */
.uh-series {
  padding: var(--uh-section-gap, clamp(32px, 4vw, 72px)) 0;
  background-color: var(--background-color);
  color: var(--text-color);
  --uh-row-ink: var(--text-color);
  --uh-row-paper: var(--background-color);
}

/* Flipping the two tokens recolours every child that reads them. */
.homepage .uh-series {
  --text-color: #000000;
  --background-color: #ffffff;
}

/* "of .uh-series" counts only series, so the book row in the stack keeps the
   alternation intact. Kept apart: a browser that rejects the selector would
   drop the whole rule. */
.uh-investigation-stack > :nth-child(odd of .uh-series) {
  --text-color: #000000;
  --background-color: #ffffff;
}

.uh-series-inner {
  padding: 0 42px;
}

.uh-series-description {
  font: var(--t-series-intro);
  max-width: 75ch;
  opacity: var(--t-dim-intro);
  margin: 0 0 clamp(18px, 2vw, 34px);
}

.uh-series-description:empty {
  display: none;
}

.uh-series-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 2.6vw, 48px);
}

.uh-series-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.uh-series-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.45fr);
  gap: clamp(20px, 3vw, 56px);
  align-items: center;
  padding: clamp(20px, 2.2vw, 40px) 0;
  border-top: 1px solid color-mix(in srgb, var(--text-color) 20%, transparent);
}

.uh-series-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.uh-series-row-body {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1vw, 16px);
  min-width: 0;
}

.uh-series-row-title {
  font: var(--t-display-sm);
  text-transform: uppercase;
  margin: 0;
}

.uh-series-row-title a {
  color: var(--text-color);
}

.uh-series-row-excerpt {
  font: var(--t-dek-feature);
  opacity: var(--t-emph);
  max-width: 68ch;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--uh-row-excerpt-lines, 5);
  line-clamp: var(--uh-row-excerpt-lines, 5);
  overflow: hidden;
}

.uh-series-row-excerpt:empty {
  display: none;
}

.uh-series-row-meta {
  font: var(--t-meta-lg);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(6px, 0.8vw, 14px);
}

.uh-series-row-authors {
  font-weight: 600;
  opacity: var(--t-emph);
}

.uh-series-row-date {
  opacity: var(--t-emph-soft);
}

.uh-series-row-image {
  display: block;
}

.uh-series-row-image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.uh-series-solo .uh-series-row {
  grid-template-columns: minmax(0, 0.6fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(20px, 3vw, 56px);
}

.uh-series-solo .uh-series-row-image {
  order: -1;
}

/* Row height, and so the 16:9 width of the image cell beside it. */
.uh-series-compact {
  --uh-row-h: clamp(200px, 18.8vw, 330px);
  margin-left: -42px;
  margin-right: -42px;
}

.uh-series-compact .uh-series-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--text-color) 25%, transparent);
}

.uh-series-compact .uh-series-row + .uh-series-row {
  margin-top: -1px;
}

.uh-series-compact .uh-series-row-body {
  --uh-row-excerpt-lines: 3;
  justify-content: flex-start;
  height: var(--uh-row-h);
  overflow: hidden;
  padding: clamp(16px, 1.6vw, 30px) 0 clamp(16px, 1.6vw, 30px) 42px;
}

/* Keeps the part and the title together at the top of a tall row. */
.uh-series-compact .uh-series-row-meta {
  margin-top: auto;
}

.uh-series-compact .uh-series-row-title {
  font: var(--t-display-lg);
}

.uh-series-compact .uh-series-row-image {
  width: calc(var(--uh-row-h) * 16 / 9);
}

@media (min-width: 992px) {
  .uh-series-compact .uh-series-row:hover,
  .uh-series-compact .uh-series-row:focus-within {
    --text-color: var(--uh-row-paper);
    --background-color: var(--uh-row-ink);
    background-color: var(--background-color);
    color: var(--text-color);
  }
}

.uh-series-more {
  font: var(--t-label);
  display: block;
  width: max-content;
  margin-left: auto;
  margin-top: clamp(20px, 2.2vw, 40px);
  text-transform: uppercase;
  letter-spacing: var(--t-track-label);
  color: var(--text-color);
  border-bottom: 2px solid var(--text-color);
  padding-bottom: 3px;
}

.uh-series-more:hover {
  opacity: 0.7;
}

@media (max-width: 1200px) {
  .uh-series-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 991px) {
  .uh-series-grid {
    grid-template-columns: 1fr;
  }

  .uh-series-inner {
    padding: 0 20px;
  }

  .uh-series-description {
    display: none;
  }

  .uh-series-solo .uh-series-row-image,
  .uh-series-grid .uh-card-image {
    margin-left: -20px;
    margin-right: -20px;
  }

  .uh-series-row,
  .uh-series-solo .uh-series-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .uh-series-compact {
    margin-left: -20px;
    margin-right: -20px;
  }

  .uh-series-compact .uh-series-row {
    grid-template-columns: 1fr;
    border: 0;
  }

  .uh-series-compact .uh-series-row + .uh-series-row {
    margin-top: 0;
  }

  .uh-series-compact .uh-series-row-body {
    --uh-row-excerpt-lines: 4;
    height: auto;
    overflow: visible;
    padding: 16px 20px;
  }

  .uh-series-compact .uh-series-row-image {
    width: auto;
  }

  .uh-series-row-image {
    order: -1;
  }
}

/* The row's gap is wider than a card's, and a Bebas title adds little blank
   above its caps, so the label needs pulling back toward it. */
.uh-series-row-body .uh-post-part {
  margin-bottom: -0.5em;
}
