/*
 * Core blocks on block editor pages.
 * The theme's own ACF blocks output full-width sections, so only constrain core content blocks.
 */
main > :where(p, h1, h2, h3, h4, h5, h6, ul, ol, blockquote, table, figure, hr, .wp-block-buttons, .wp-block-group, .wp-block-columns, .wp-block-embed, .wp-block-image, .wp-block-table, .wp-block-separator, .wp-block-quote, .gform_wrapper),
.is-root-container > :where(p, h1, h2, h3, h4, h5, h6, ul, ol, blockquote, table, figure, hr, .wp-block-buttons, .wp-block-group, .wp-block-columns, .wp-block-embed, .wp-block-image, .wp-block-table, .wp-block-separator, .wp-block-quote) {
    box-sizing: border-box;
    max-width: calc(var(--wp--style--global--content-size, 700px) + 2em);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1em;
    padding-right: 1em;
}

main > :where(p, ul, ol) {
    margin-bottom: 1.5em;
}

/* ACF block previews are full width in the editor (editor styles are prefixed with .editor-styles-wrapper automatically) */
.is-root-container > .wp-block[data-type^="acf/"] {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

/* Wide blocks (e.g. multi-column text) and full-width coloured sections */
main > .alignwide {
    box-sizing: border-box;
    max-width: calc(var(--wp--style--global--wide-size, 1200px) + 6em);
    margin-left: auto;
    margin-right: auto;
    padding-left: 3em;
    padding-right: 3em;
}

main > .alignfull {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

main > .wp-block-group.alignfull.has-background {
    padding: 2em 1em;
}

/* Full-width coloured sections sit flush against each other, like the legacy sections.
   Other groups/columns get their default margins from theme.json (styles.blocks). */
main > .alignfull.has-background,
main > .wp-block-media-text.alignfull {
    margin-top: 0;
    margin-bottom: 0;
}

/* The section's padding provides the spacing, so its first/last blocks don't add margins on top */
.wp-block-group.has-background > :first-child,
.wp-block-media-text__content > :first-child {
    margin-top: 0;
}

.wp-block-group.has-background > :last-child,
.wp-block-media-text__content > :last-child {
    margin-bottom: 0;
}

/* Coloured sections - text and links take the section's text colour, as legacy text boxes did */
.wp-block-group.has-text-color :is(h1, h2, h3, h4, h5, h6, p, li, a),
.wp-block-media-text.has-text-color :is(h1, h2, h3, h4, h5, h6, p, li) {
    color: inherit;
}

.wp-block-media-text.alignfull .wp-block-media-text__content {
    padding: 3em 8%;
}
