/* Layout: global width and padding, block layout resets. */

:root :where(.is-layout-constrained) > * {
	padding-block-start: 0;
	padding-block-end: 0;
	margin-block-start: 0;
	margin-block-end: 0;
}

.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	max-width: unset;
}

/* Side gutter: the same steps as .global-padding. */
:root {
	--th-gutter: 20px;
	--th-max-width: var(--wp--custom--layout--max-width, 1500px);
}

@media (min-width: 768px) {
	:root { --th-gutter: 30px; }
}

@media (min-width: 1000px) {
	:root { --th-gutter: 40px; }
}

@media (min-width: 1200px) {
	:root { --th-gutter: 50px; }
}

.global-width {
	max-width: var(--wp--custom--layout--max-width, 1500px);
	margin-left: auto;
	margin-right: auto;
}

.global-padding {
	padding-left: var(--th-gutter);
	padding-right: var(--th-gutter);
}

/* Loose blocks: a heading, paragraph, image, list etc. placed straight in the page content gets the
   global width and side padding automatically, so it lines up with the content inside a Container.
   Left alone: "Full width" blocks (alignfull, they bleed to the edges), floated blocks, and the theme's
   own blocks (theme/*), which manage their own width and padding. */
.wp-block-post-content > :where(:not(.alignfull, .alignleft, .alignright, [class*="wp-block-theme-"])) {
	box-sizing: content-box; /* a block's own max-width (for example a Large paragraph) then applies to its content */
	padding-left: max(var(--th-gutter), calc((100% - var(--th-max-width)) / 2));
	padding-right: max(var(--th-gutter), calc((100% - var(--th-max-width)) / 2));
}

/* Lists: same size as paragraphs, with the bullets or numbers inside the page margin
   (the indent is added on top of the gutter, so the markers line up with the paragraph text edge). */
.wp-block-post-content > :where(ul, ol):not(.alignfull, .alignleft, .alignright) {
	padding-left: calc(max(var(--th-gutter), (100% - var(--th-max-width)) / 2) + 1.5em);
}

:where(ul, ol).wp-block-list,
.wp-block-list li {
	font-size: clamp(15px, 3.4vw, 18px);
}
