/* Shared section rhythm, measured from the homepage demo-to-footer gap.
   Component padding, card grids and editorial paragraph spacing stay independent. */
:root { --factor-section-gap: 64px; --factor-gap: var(--factor-section-gap); }
@media (max-width: 767px) {
  :root { --factor-section-gap: 48px; }
}

main.factor-main,
main.factor-main .factor-unique-content {
  gap: var(--factor-section-gap);
}

/* Native block margins must not add to the section container's gap. */
main.factor-main .factor-unique-content > * {
  margin-block: 0 !important;
}

/* Empty legacy article wrappers must not create an extra flex gap. */
main.factor-main .factor-article-layout:has(> .factor-article-text:empty:only-child) {
  display: none;
}
.factor-blog-listing main.factor-directory-main > * {
  margin-block: 0 !important;
}

/* Resource templates use normal flow rather than the block page's flex stack. */
.factor-resource-page .factor-resource-main > :is(
  .factor-resource-reading, .factor-related, .factor-resource-back, .factor-resource-demo
) {
  margin-top: var(--factor-section-gap);
  margin-bottom: 0;
}
.factor-resource-page .factor-related-group + .factor-related-group {
  margin-top: var(--factor-section-gap);
}

/* The shared footer owns the final gap; remove the duplicate page padding. */
.factor-directory-listing main.factor-directory-main,
.factor-resource-page main.factor-resource-main {
  padding-bottom: 0;
}
.wp-site-blocks .factor-footer.factor-footer-v2 {
  margin-top: var(--factor-section-gap) !important;
}
