/* ============================================================
   UH tag page: the vendor article grid on a light band, headed
   by the marker label used everywhere else.
   Loaded by tag.hbs after cards.css.
   ============================================================ */

/* ---- Intro: tag image left, name and description right ----- */

.uh-tag-intro {
  display: grid;
  grid-template-columns: clamp(240px, 30vw, 560px) minmax(
      0,
      clamp(320px, 32vw, 600px)
    );
  justify-content: center;
  align-items: center;
  gap: clamp(24px, 3.3vw, 64px);
  padding: clamp(28px, 3.3vw, 64px) 42px clamp(40px, 4.5vw, 88px);
}

/* global.css sets height:100% on every image. */
.uh-tag-intro-image img {
  display: block;
  width: 100%;
  height: auto;
}

.uh-tag-intro-body {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.2vw, 20px);
  min-width: 0;
}

.uh-tag-intro-title {
  font: var(--t-display-2xl);
  text-transform: uppercase;
  margin: 0;
}

.uh-tag-intro-description {
  font: var(--t-dek-lg);
  opacity: var(--t-dim-intro);
  margin: 0;
}

/* A tag with no image keeps the centred block the page had before. */
.uh-tag-intro-plain {
  grid-template-columns: min(100%, 620px);
  text-align: center;
}

.uh-tag-intro-plain .uh-tag-intro-body {
  align-items: center;
}

@media (max-width: 991px) {
  .uh-tag-intro {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px 20px 32px;
  }

  /* Image first, then the text: the source order the grid falls back to. */
  .uh-tag-intro-image {
    margin-left: -20px;
    margin-right: -20px;
  }
}

/* global.css colours text with --text-color, so a light band flips it. */
.articles-grid-section {
  --text-color: #000000;
  --background-color: #ffffff;
  background-color: var(--background-color);
  color: var(--text-color);
  padding: clamp(32px, 4vw, 72px) 0;
}

.tag-page .uh-tag-row {
  --text-color: #ffffff;
  --background-color: #000000;
}

.uh-tag-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(20px, 2.2vw, 40px);
}

.uh-tag-heading .uh-section-heading {
  margin-bottom: 0;
}

.uh-tag-heading-count {
  font: var(--t-display-xs);
  flex: 0 0 auto;
  text-transform: uppercase;
}

/* The grid gap separates the cards; cards.css draws a rule as well. */
.articles-grid-section .grid-small-card {
  border-top: none;
  border-bottom: none;
}

/* Column counts and gaps of .uh-card-grid, which every other post list uses. */
@media (min-width: 992px) {
  .articles-grid-section .pagination-grid {
    grid-template-columns: repeat(2, 1fr);
    column-gap: clamp(24px, 2.6vw, 48px);
    row-gap: clamp(24px, 2.6vw, 48px);
  }
}

@media (min-width: 1201px) {
  .articles-grid-section .pagination-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* The vendor spaces this card with per-element margins, which left uneven
   gaps around the label; one row gap replaces them. Type matches .uh-card. */
.grid-small-card {
  row-gap: 10px;
}

.grid-small-card .small-card-image-link {
  margin-top: 0;
  margin-bottom: 0;
}

/* Optical: the title line box carries blank space above its caps, so without
   the negative margin the label reads as further from the title than from the
   image. */
.grid-small-card .small-card-heading {
  font: var(--t-headline);
  grid-row: 3;
  margin-top: -0.4em;
  text-transform: uppercase;
}

.grid-small-card .small-card-text {
  font: var(--t-dek-sm);
  grid-row: 4;
  margin-bottom: 0;
  opacity: var(--t-emph);
}

.grid-small-card .small-card-small-text {
  font: var(--t-meta);
  grid-row: 5;
  opacity: var(--t-emph-soft);
}

.grid-small-card .small-card-bottom-text {
  font: var(--t-byline);
  grid-row: 5;
  opacity: var(--t-emph);
}

/* An extra row between the image and the title shifts the rest down one. */
.grid-small-card:has(.uh-post-part) {
  grid-template-rows: auto auto auto 1fr auto;
}

.grid-small-card .uh-post-part {
  grid-column: 1 / -1;
  grid-row: 2;
}

/* Same reservation as the uh-card grids: one labelled card sets the row for
   all of them, so the titles line up. */
@media (min-width: 992px) {
  .pagination-grid:has(.uh-post-part) .grid-small-card {
    grid-template-rows:
      auto minmax(clamp(12px, 0.85vw, 15px), auto)
      auto 1fr auto;
  }
}
