/*
  /topics — tag cloud + filtered views.

  Auto-loaded by header.php when the active template is `topics`
  (via the template-css loader in the <head>). Scoped by the top
  .topics class on <article> so these rules can't leak into other
  pages.

  Layout: a narrow-ish editorial column (~44rem) for cloud view
  since dense chip text reads best when wrapped; wider for the
  filtered grid view so covers get room.
*/

.topics { max-width: 44rem; margin: 2rem auto 5rem; padding: 0 1rem; }
.topics .back { font-size: .85rem; color: var(--color-text-grey); margin-bottom: .75rem; }
.topics .back a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }

.topics-intro { color: var(--color-text-grey); margin: .5rem 0 2.25rem; }
.topics-count { color: var(--color-text-grey); margin: 0 0 2rem; }

/* ── Cloud sections ──────────────────────────────────────── */
.topics-section { margin-bottom: 2.75rem; }
.topics-section-label {
  font-size: .78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-grey);
  border-top: 1px solid currentColor;
  padding-top: .5rem;
  margin: 0 0 1.25rem;
}

.topics-cloud {
  list-style: none;
  padding: 0;
  margin: 0;
  /* Flex-wrap so chips flow like text; align-items: baseline so
     the chips (which vary in font-size) sit on a shared baseline
     rather than their boxes' centres, mimicking prose. */
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .5rem;
}
.topics-cloud li { margin: 0; }

/* ── Chips ───────────────────────────────────────────────── */
.topics .topics-chip {
  display: inline-flex;
  align-items: baseline;
  gap: .35em;
  color: inherit;
  text-decoration: none;
  line-height: 1.1;
  padding: .15em .1em;
  transition: color .12s;
}
/* Hover (mouse) + focus (keyboard) + active (touch tap) all flip
   the chip to BPP magenta. :active covers touch devices where
   :hover is unreliable, so a tap shows a visible confirmation
   before the next page loads. Extra specificity with .topics to
   beat any later-cascade .menu/.social hover rules. */
.topics .topics-chip:hover,
.topics .topics-chip:focus,
.topics .topics-chip:active { color: #EC008C !important; }
.topics .topics-chip:hover .topics-chip-count,
.topics .topics-chip:focus .topics-chip-count,
.topics .topics-chip:active .topics-chip-count { color: #EC008C !important; }

.topics .topics-chip-count {
  font-size: .55em;
  color: var(--color-text-grey);
  font-weight: 400;
  vertical-align: super;
}
/* Primary (sub-category) chips read heavier so the editorial
   taxonomy dominates the cloud; the font-size itself is scaled
   per-chip in the template via inline style based on frequency. */
.topics .topics-chip--primary {
  font-weight: 500;
  color: #000;
}

/* ── Filtered grid view (/topics/<slug>) ─────────────────── */
.topics-grid {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1.5rem;
}
.topics-grid-item { margin: 0; }
.topics-grid-item a {
  display: block;
  color: inherit;
  text-decoration: none;
}
.topics-grid-cover {
  margin: 0 0 .5rem;
  aspect-ratio: 2/3;
  background: var(--color-light);
  overflow: hidden;
}
.topics-grid-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.topics-grid-title {
  font-size: .95rem;
  font-weight: 500;
  margin: 0 0 .1rem;
  line-height: 1.2;
}
.topics-grid-byline {
  font-size: .8rem;
  color: var(--color-text-grey);
  margin: 0;
}

@media screen and (max-width: 43.999rem) {
  .topics-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}
