/*
 * WordPress constrained layout
 *
 * These three rules are what make theme.json's contentSize apply to blocks.
 * They come from the parent's pb_output_spacing_utilities(), which this theme
 * removes so as not to carry the 588 spacing utility classes printed alongside
 * them — see eao_decline_spacing_utilities() in functions.php.
 *
 * They live in their own file, enqueued ahead of Bootstrap, because where they
 * sit in the cascade is the whole point. They are defaults: both Bootstrap and
 * this theme's own style.css have to be able to override them at equal
 * specificity. Put them in style.css instead and `.is-layout-constrained > *`
 * beats Bootstrap's `.container`, capping a 1320px container at the 1140px
 * content size. Print them after the stylesheets, as the parent does at
 * wp_head priority 20, and the reverse happens: nothing can override them
 * without !important, and the card component's 32px padding silently becomes
 * the 12px below.
 */

/* The gutter goes through a custom property so that nesting can switch it off
   without touching the padding declaration itself. */
.is-layout-constrained {
    --pb-layout--gutter: calc(1.5rem * .5);
    margin-right: auto;
    margin-left: auto;
    padding-right: var(--pb-layout--gutter);
    padding-left: var(--pb-layout--gutter);
}

/*
 * A constrained container inside another would otherwise be guttered twice, so
 * the inner one gives the gutter up — and only the gutter. This used to be
 * `padding: initial`, which reset all four sides at (0,2,0) and so outranked
 * any component's own padding: a card that is itself a constrained Group lost
 * all 32px of it the moment the Group around it became constrained too. The
 * parent made the same correction in its copy of these rules; this follows it.
 */
.is-layout-constrained .is-layout-constrained {
    --pb-layout--gutter: 0px;
}

/*
 * Mirrors core's own rule, including its exclusion. Without the
 * :where(:not(...)) an aligned child is given the content width too, and core's
 * alignfull and alignwide rules only set margins — they never restate
 * max-width, because core assumes this exclusion did the work. Without it
 * neither alignment does anything inside a constrained container.
 *
 * The margins are not !important: that stops a child ever sitting to one side
 * of its container, which is a legitimate thing for a layout to want.
 */
.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
    max-width: var(--wp--style--global--content-size);
    margin-right: auto;
    margin-left: auto;
}
