/* ============================================================================
   Home page: "What's bugging you?" — the numbered category board.
   ----------------------------------------------------------------------------
   Same rows as the plain collection tiles, arranged as a set: a number, a
   stamped symbol, the name, one line of copy, and a tally under a hairline.
   Nothing here introduces a colour — cream, forest, mustard, sage, plus the
   orange the site already uses for arrows.
   ========================================================================== */

.cat-band {
  --cb-forest: #22392c;
  --cb-muted: rgba(34, 57, 44, 0.62);
  --cb-hair: rgba(34, 57, 44, 0.16);
  --cb-orange: #e8663a;
}

/* ------------------------------------------------------------- section head */

/* The eyebrow gets a short rule after it, the way a magazine kicker is set off
   from the headline. Cheap, and it keeps the title from floating. */
.cat-band .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.cat-band .eyebrow::after {
  content: "";
  width: 36px;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}

.cat-band__lede {
  max-width: 58ch;
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--cb-muted);
}

/* A folio line, not a stat block: it says the tiles below are a numbered
   series, which is the only thing that keeps five similar boxes from reading
   as five unrelated ones. */
.cat-band__aside {
  margin: 0 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: rgba(34, 57, 44, 0.45);
}

/* -------------------------------------------------------------------- board */

.cat-band .category-grid {
  /* auto-fit, not a fixed 4: with five collections a fixed grid leaves one card
     stranded on a second row with three empty cells beside it. This way the row
     fills itself — five tiles fit on one line, four get wider, eight wrap. */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.cat-band .cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  /* `justify-content: space-between` comes from the plain tile, which pushes the
     tally away from the copy. On the board the tally is pinned with margin-top
     instead, so a short lede does not leave a hole in the middle. */
  justify-content: flex-start;
  gap: 0;
  min-height: 224px;
  padding: 20px 21px 18px;
  background: #e8ecda;
  border: 1px solid transparent;
  color: var(--cb-forest);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease,
    box-shadow 0.25s ease;
}

/* Five tints, cycled. Wide enough apart that a row reads as a set of different
   things rather than one colour with a gradient; all five still sit inside the
   cream / sage / mustard family the rest of the page uses. */
.cat-band .cat-card:nth-child(5n + 1) {
  background: #e8ecda;
}

.cat-band .cat-card:nth-child(5n + 2) {
  background: #f2e8d4;
}

.cat-band .cat-card:nth-child(5n + 3) {
  background: #e6e3d9;
}

.cat-band .cat-card:nth-child(5n + 4) {
  background: #dde4d1;
}

.cat-band .cat-card:nth-child(5n + 5) {
  background: #f4edcc;
}

/* A collection with nothing in it is still listed — that is how its owner sees
   it — but it should not pull the eye the way a stocked shelf does. */
.cat-band .cat-card.is-empty {
  background: #efeee6;
}

.cat-band .cat-card.is-empty .cat-card__mark {
  color: rgba(34, 57, 44, 0.34);
  border-style: dashed;
}

.cat-band .cat-card.is-empty .cat-card__name {
  color: rgba(34, 57, 44, 0.72);
}

.cat-band .cat-card:hover,
.cat-band .cat-card:focus-visible {
  background: #f5efdb;
  border-color: rgba(34, 57, 44, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 18px 30px -26px rgba(24, 42, 32, 0.7);
  outline: none;
}

.cat-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.cat-card__no {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  line-height: 1;
  color: rgba(34, 57, 44, 0.5);
  font-variant-numeric: tabular-nums;
}

/* The symbol is still the one typed in the admin, just held inside a ring. A
   bare glyph sits at a different weight on every operating system; a ring makes
   them all read as stamps from the same drawer. */
.cat-card__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-top: -5px;
  border: 1px solid var(--cb-hair);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  color: var(--cb-orange);
  transition: background 0.25s ease, border-color 0.25s ease;
}

.cat-band .cat-card:hover .cat-card__mark {
  background: rgba(34, 57, 44, 0.06);
  border-color: rgba(34, 57, 44, 0.34);
}

.cat-band .cat-card__name {
  display: block;
  /* Two lines reserved whatever the name length: "Garden & outdoors" wraps at
     this column width and used to push its description a line lower than its
     neighbours, so the row of cards lost its common baseline. */
  min-height: 2.28em;
  margin: 0 0 9px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.025em;
}

.cat-card__go {
  display: inline-block;
  margin-left: 6px;
  font-size: 13px;
  vertical-align: 3px;
  color: var(--cb-orange);
  transition: transform 0.22s ease;
}

.cat-band .cat-card:hover .cat-card__go {
  transform: translate(3px, -3px);
}

.cat-band .cat-lede {
  -webkit-line-clamp: 3;
  font-size: 12.5px;
  line-height: 1.58;
  color: var(--cb-muted);
}

.cat-band .cat-count {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding-top: 18px;
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cb-muted);
}

.cat-band .cat-count::before {
  content: "";
  width: 20px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .cat-band .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cat-band .cat-card {
    min-height: 210px;
  }

  .cat-band__aside {
    display: none;
  }
}

/* site.css paints a corner arrow on every `.category` tile below 760px, and the
   board already has one beside the name. Without this the phone view shows two
   arrows per card, the second sitting on top of the tally. */
@media (max-width: 760px) {
  .cat-band .cat-card::after {
    content: none;
  }
}

@media (max-width: 560px) {
  .cat-band__lede {
    font-size: 14px;
    margin-top: 12px;
  }

  .cat-band .category-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .cat-band .cat-card {
    min-height: 0;
    padding: 18px 18px 16px;
  }

  .cat-band .cat-card__name {
    /* One column, so nothing has to line up across cards — a reserved second
       line here just reads as a gap under every short name. */
    min-height: 0;
    font-size: 22px;
  }

  .cat-band .cat-lede {
    font-size: 13px;
  }

  .cat-card__top {
    margin-bottom: 14px;
  }
}

/* ------------------------------------------------------------ sub-shelves
   The names of a shelf's sub-shelves, printed on its card.

   A count ("3 sub-shelves") is a statistic; the names are an invitation, and
   this is the only place on the site where a reader can see what is inside a
   shelf without opening it first. They sit in the same quiet brown the rest of
   the small print uses, with the branch mark doing the nesting work. */

.cat-kids {
  display: block;
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.55;
  color: #96613f;
  letter-spacing: 0.005em;
}

.cat-kids::before {
  content: '↳';
  margin-right: 6px;
  opacity: 0.7;
}

/* `.category` lays its children out with space-between, which would float the
   new line into the middle of the tile. Pin it under the lede and let the count
   keep the floor. */
.category .cat-kids {
  margin-top: 6px;
}

.category .cat-count {
  margin-top: auto;
}
