/* --------------------------------------------------------------------------------------------
   Top spacing now that the site header sits in the page flow (see site-header.css). The old
   transparent header was laid over the page, so each page cleared it by itself: <main> took a
   160px top margin on pages with a navy header, and header blocks (page header, featured page
   header) padded 130–215px on pages with a white one. Both are taken out here and replaced
   with one rule: content starts 3rem below the header, and full-width sections start right
   at it with their own padding.
   ----------------------------------------------------------------------------------------- */
.site-header + .site-main,
.site-header + .tribe-events,
body.single header.site-header + main,
body.single header.site-header.dark-text + main {
  margin-top: 0 !important;
}

/* ":first-child" skips the <style> tags some blocks print ahead of themselves. */
.site-main {
  padding-top: 3rem;
}
.site-main > :nth-child(1 of :not(style, script, link)):not(.alignfull),
.site-main > article:nth-child(1 of :not(style, script, link)) > .entry-content {
  margin-top: 0;
}
/* The donor login gate cleared the old header with its own 185px margin. */
.site-main > article.access-login {
  margin-top: 0 !important;
}
/* Full-width first sections (page headers, covers, banners, the post header) start at the header. */
.site-main:has(> :nth-child(1 of :not(style, script, link)):is(.alignfull, .single-post-header, .single-team-header)),
.site-main.hide-title:has(> article > .entry-content > :nth-child(1 of :not(style, script, link)):is(.alignfull, .wp-block-spacer)) {
  padding-top: 0;
}

/* Header blocks: their top padding was sized to clear the overlaid header. */
/* The page's opening header block gets more room than an ordinary section (5rem), so it reads
   as the page header: 7rem desktop, 4.5rem phones. */
.hide-title .entry-content > .page-header:nth-child(1 of :not(style, script, link)) {
  padding-top: 7rem;
  padding-bottom: 7rem;
}
.site-main .page-header-featured,
.site-main.hide-title .page-header-featured {
  padding-top: 6rem;
}
.site-main .single-post-header {
  margin-top: 0;
}

@media screen and (max-width: 767px) {
  .site-main {
    padding-top: 2rem;
  }
  .hide-title .entry-content > .page-header:nth-child(1 of :not(style, script, link)),
  .site-main .page-header-featured,
  .site-main.hide-title .page-header-featured {
    padding-top: 4.5rem;
  }
  .hide-title .entry-content > .page-header:nth-child(1 of :not(style, script, link)) {
    padding-bottom: 4.5rem;
  }
}

/* The same for a page header that opens a full-width group (Philanthropic Freedom opens with the
   section submenu, then a group whose first block is the page header). */
.hide-title .entry-content > .wp-block-group.alignfull > .wp-block-group__inner-container > .page-header:first-child {
  padding-top: 7rem;
  padding-bottom: 7rem;
}
@media screen and (max-width: 767px) {
  .hide-title .entry-content > .wp-block-group.alignfull > .wp-block-group__inner-container > .page-header:first-child {
    padding-top: 4.5rem;
    padding-bottom: 4.5rem;
  }
}
