/*
 * SMDM – Publications page layout fixes
 * Target: /publications/
 */

/* ------------------------------
   Top grid block: stack on mobile
   ------------------------------ */

@media (max-width: 860px) {

  /* The big grid wrapper on this page */
  body.page .entry-content .wp-block-group.is-layout-grid {
    display: flex !important;          /* override core grid */
    flex-direction: column;
    gap: var(--wp--preset--spacing--50, 2rem);
  }

  /* Remove weird extra margins between children */
  body.page .entry-content .wp-block-group.is-layout-grid > * {
    margin: 0;
  }

  /* Columns inside those grid items should stack */
  body.page .entry-content .wp-block-group.is-layout-grid .wp-block-columns {
    flex-wrap: wrap;
  }

  body.page .entry-content .wp-block-group.is-layout-grid .wp-block-columns > .wp-block-column {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Center the small journal cover images on mobile */
  body.page .entry-content .wp-block-group.is-layout-grid figure.wp-block-image {
    text-align: center;
  }

  body.page .entry-content .wp-block-group.is-layout-grid figure.wp-block-image img {
    margin: 0 auto;
    height: auto;
  }
}

/* ------------------------------
   Quick Links row: stack columns
   ------------------------------ */

@media (max-width: 700px) {

  /* The Quick Links two-column row at the bottom */
  body.page .wp-block-columns.wp-container-core-columns-is-layout-eae17e81 {
    flex-wrap: wrap;
  }

  body.page .wp-block-columns.wp-container-core-columns-is-layout-eae17e81 > .wp-block-column {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Make sure the quick-link buttons fill the width nicely */
  body.page .quick-link .wp-block-button__link {
    width: 100%;
    text-align: center;
  }
}
