/* ---------------------------------------------------------------------------
   Core block classes ride along with ours.

   The pages are core blocks now, so every element carries a wp-block class in
   addition to the one the design uses. Those classes bring a little of
   WordPress's own styling with them, and this file removes only the parts that
   the static build did not have. It is deliberately short: anything longer
   would mean the conversion had reshaped something, and the conversion is
   checked against the approved markup rather than trusted.
   --------------------------------------------------------------------------- */

/* core gives every image figure a bottom margin. Ours are positioned by the
   layout around them, so it shows up as a gap under every photograph. */
figure.wp-block-image { margin: 0; }
.wp-block-image img { height: auto; max-width: 100%; vertical-align: bottom; }
.wp-block-image :where(figcaption) { margin: 0; }

/* groups and lists are ours entirely: they carry the site's own spacing */
.wp-block-group { box-sizing: border-box; }
ul.wp-block-list, ol.wp-block-list { box-sizing: border-box; }

/* the questions blocks are <details> with the site's own chrome */
.wp-block-details { box-sizing: border-box; }
.wp-block-details > summary { cursor: pointer; }

/* WordPress adds an anchor offset helper that fights the fixed header */
.wp-block-heading { scroll-margin-top: 0; }

/* ---------------------------------------------------------------------------
   Room for a fifth clinician.

   The deck on the home page is set to exactly four columns, because there
   were exactly four clinicians when it was designed. Adding a fifth card to a
   four column grid leaves it stranded on its own second row, which is the one
   way the practice can break this page by doing something entirely reasonable.

   So the fixed count stands down as soon as a fifth card exists: five or six
   go three across, seven or more go back to four. Below 1180px the base sheet
   already drops to two columns and then to one, and none of this applies
   there, which is why it is inside the width query.
   --------------------------------------------------------------------------- */
@media (min-width: 1181px) {
  .clinicians.four:has(> :nth-child(5)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .clinicians.four:has(> :nth-child(7)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------------------------------------------------------------------------
   Belt and braces against the group inner container.

   theme.json stops WordPress injecting .wp-block-group__inner-container on
   the front end, which is the real fix. This is the second line of defence,
   because the block editor can put one back into the saved markup if somebody
   edits and re-saves a group, and the failure it causes is severe and silent:
   a grid whose two children became one wrapper renders as a single column and
   looks like a broken stylesheet rather than a broken structure.

   display:contents removes the wrapper's box and hands its children straight
   back to the grid, so even if one reappears the layout is unaffected.
   --------------------------------------------------------------------------- */
.wp-block-group > .wp-block-group__inner-container { display: contents; }
