/*
 * Shared layout.
 *
 * Column geometry, from the approved design: a 740px outer column with 40px
 * side padding leaves a 660px content column (theme.json layout.contentSize).
 * The vertical spine hangs in the left gutter at --bl-spine-offset from the
 * content column's left edge.
 *
 *   desktop: gutter 40px, spine 64px left of the column
 *   <= 820px: gutter 28px, spine 15px left of the column
 *
 * The desktop gutter is the root padding from theme.json (spacing preset 50).
 * It is not an editor-selectable preset at mobile width, so the 28px gutter
 * is set here.
 *
 * --bl-spine-offset is measured from the LEFT EDGE OF THE CONTENT COLUMN: the
 * left edge of the centred, max-width content box (660px, or 684px at <= 820px)
 * that header, <main> and footer children share. In the design this is
 * `.inner`, where the spine sits at `left: -64px`.
 *
 * Every template wraps the header and <main> in a .bl-page Group. The spine
 * runs down that wrapper, so it stops above the footer without measuring it.
 */

:root {
	--bl-spine-offset: 64px;
}

/* Contains the spine and wide elements, which extend outside the column. */
.wp-site-blocks {
	position: relative;
	overflow-x: clip;
}

/*
 * Header, main and footer sit flush: each section owns its own vertical
 * padding, so the root block gap must not add space between them.
 */
.wp-site-blocks > *,
.bl-page > * {
	margin-block: 0;
}

.bl-page {
	position: relative;
}

/*
 * Wide: from the column's left edge to 240px past its right edge, at 1181px
 * and up only. Narrower, a wide block is as wide as the column. Core's
 * constrained layout centres wide blocks with !important margins, hence the
 * !important here.
 */
.is-layout-constrained > .alignwide {
	max-width: var(--wp--style--global--content-size);
}

@media (min-width: 1181px) {
	.is-layout-constrained > .alignwide {
		max-width: none;
		margin-left: calc((100% - var(--wp--style--global--content-size)) / 2) !important;
		margin-right: calc((100% - var(--wp--style--global--content-size)) / 2 - 240px) !important;
	}
}

@media (max-width: 820px) {
	:root {
		--bl-spine-offset: 15px;
	}

	body,
	.editor-styles-wrapper {
		--wp--style--root--padding-left: 28px;
		--wp--style--root--padding-right: 28px;
	}

	/*
	 * Below 820px the design's column is min(100vw, 740px) with 28px padding,
	 * so the content box is up to 684px, not 660px.
	 */
	html:root,
	.editor-styles-wrapper {
		--wp--style--global--content-size: 684px;
	}
}
