/* ============================================================
   ChinaCare — grid last-row balance
   When a card grid's final row holds fewer items than the
   column count, the leftover card sits hard against the left
   edge and the row reads as broken. These rules pull that
   orphan into the middle of the row so both margins match.

   Every rule is scoped to one page + one breakpoint, because
   the column count changes with the viewport. Rules are keyed
   to the body class of the page they belong to (.page-home,
   .page-checkup, …) so a page that reuses a class name — both
   the home page and the check-up page own a .cards grid —
   can never be affected by the other's rule.

   home      .cards 4 · .dest-grid 5 · .cond-grid 50 (JS)
   checkup   .pkg-grid 3 · .cards 4 · .dest-grid 5 · .steps 4
   pricing   .price-grid 4 per group
   blog      .post-grid 64 (JS, filterable)
   ============================================================ */

/* ---- .dest-grid (5) — 2 columns at 601–980px → 1 orphan ---- */
@media (min-width: 601px) and (max-width: 980px) {
  .page-home .dest-grid > .dest:nth-child(5),
  .page-checkup .dest-grid > .dest:nth-child(5) {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(100%, 340px);
  }
}

/* ---- check-up page: .pkg-grid (3) — 2 columns → 1 orphan ---- */
@media (min-width: 601px) and (max-width: 980px) {
  .page-checkup .pkg-grid > .pkg:nth-child(3) {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(100%, 340px);
  }
}
/* ---- check-up page: .cards (4 entry paths) — 2 columns → 2 + 2, no orphan ---- */

/* ---- check-up page: .steps (4) — 3 columns → last row holds 1 ---- */
@media (min-width: 601px) {
  .page-checkup .steps > .step:nth-child(4) {
    grid-column: 2 / span 1;
  }
}

/* ---- pricing: .price-grid (4 per group) — 3 columns at 841–1100px → 1 orphan ---- */
@media (min-width: 841px) and (max-width: 1100px) {
  .page-pricing .price-grid > .price-card:nth-child(4) {
    grid-column: 2 / span 1;
  }
}
/* ---- pricing: .price-grid — 2 columns at 561–840px → last row holds 2 ---- */
@media (min-width: 561px) and (max-width: 840px) {
  .page-pricing .price-grid > .price-card:nth-child(3) { grid-column: 1 / span 1; }
  .page-pricing .price-grid > .price-card:nth-child(4) { grid-column: 2 / span 1; }
}

/* ---- blog: .post-grid ----
   The guide grid holds 64 articles and is filterable (12 topics + search),
   so both the column count and the number of cards in the final row change
   at runtime. A static nth-child() rule cannot describe that — an old
   `article:nth-child(10)` rule written when the blog had only 10 posts
   pushed the 10th card into column 2 and punched a hole in row 4.
   The last row is now centred by assets/grid.js, which measures the real
   column count and the real number of visible cards. */

/* ---- shared footer: .foot-grid (4 columns: brand · Explore · Partnership
   · Contact). At 601–980px it falls back to 2 columns, so the four cells
   fill two even rows (2 + 2) and no cell is ever left orphaned.
   The old 3-column footer needed a `nth-child(3)` rule to centre its
   third cell; that rule is gone now that a fourth column exists. ---- */

/* ---- home page: .cond-grid (50, filterable) is handled by assets/grid.js,
       because the visible item count changes with the category filter.
       Its last row is aligned to the LEFT edge (align:"left"), matching the
       rest of the page; only the blog guide grid keeps a centred last row. ---- */
