/* The night section opens with the same slanted ribbon edge as the footer, built the same way.
   Its ::before is the night background clipped to the slant, and its ::after draws the stripes.
   The comments on .site-footer and its pseudo-elements in theme.css explain the technique. Unlike
   the footer, the section is its own query container. 100cqw measures only its content box, so
   the skew adds both root paddings back to get its full width. The section's inline padding is
   set to the root padding here so that it always matches what the skew adds back. */
.wp-block-group:is(.is-style-section-night, .is-style-section-jubilee) {
	position: relative;
	isolation: isolate;
	container-type: inline-size;
	padding-block: calc(var(--edge-height) + var(--wp--preset--spacing--70)) calc(var(--wp--preset--spacing--70) + var(--room-below, 0px));
	padding-inline: var(--wp--style--root--padding-left) var(--wp--style--root--padding-right);
}

.wp-block-group:is(.is-style-section-night, .is-style-section-jubilee)::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--section-background, var(--wp--preset--color--night));
	clip-path: polygon(
		0 var(--edge-height),
		100% calc(var(--edge-height) - var(--edge-rise)),
		100% 100%,
		0 100%
	);
}

.wp-block-group:is(.is-style-section-night, .is-style-section-jubilee)::after {
	content: "";
	position: absolute;
	top: var(--edge-rise);
	left: 0;
	right: 0;
	z-index: -1;
	height: var(--edge-band);
	background: var(--wp--preset--color--sky);
	box-shadow:
		0 calc(var(--edge-band) + var(--edge-gap)) 0 var(--wp--custom--color--stripe-2),
		0 calc(2 * (var(--edge-band) + var(--edge-gap))) 0 var(--wp--custom--color--stripe-3),
		0 calc(3 * (var(--edge-band) + var(--edge-gap))) 0 var(--wp--custom--color--stripe-4);
	transform: skewY(calc(-1 * atan2(var(--edge-rise), 100cqw + var(--wp--style--root--padding-left) + var(--wp--style--root--padding-right))));
	transform-origin: left top;
}

/* The ice style's padding is set here rather than in its style file so that, like the night
   style's, it can include --room-below. That is the extra room a section gets at its end when a
   ribbon edge overlaps it, set by the rules for a following night section and for the footer. */
.wp-block-group.is-style-section-ice {
	padding-block: var(--wp--preset--spacing--70) calc(var(--wp--preset--spacing--70) + var(--room-below, 0px));
}

/* The night section overlaps the section before it only when that section has its own
   background. It is then pulled up by the edge's height, and the section before gets the same
   room at its end, so that its colour fills the gaps between the stripes. A section style takes
   the room as --room-below, and a plain group with a background as a spacer after its content,
   for the reasons given on the end-of-page rules in theme.css. After a plain section no overlap
   is needed, because the night section leaves its top unpainted and the page shows through. */
:where(.is-layout-constrained, .is-layout-flow) > [class*="is-style-section-"]:has(+ :is(.is-style-section-night, .is-style-section-jubilee)) {
	--room-below: var(--edge-height);
}

:where(.is-layout-constrained, .is-layout-flow) > .has-background:not([class*="is-style-section-"]):has(+ :is(.is-style-section-night, .is-style-section-jubilee))::after {
	content: "";
	display: block;
	height: var(--edge-height);
}

:where(.is-layout-constrained, .is-layout-flow) > :is(.has-background, [class*="is-style-section-"]) + .wp-block-group:is(.is-style-section-night, .is-style-section-jubilee) {
	margin-block-start: calc(-1 * var(--edge-height));
}

/* The offset clears the sticky header, and the admin bar for a logged-in user, with some room to
   spare. At 781px and below, where core stacks columns, the box stops sticking, because in a
   single column it would cover the text that follows it. */
.wp-block-group.is-style-sticky {
	position: sticky;
	top: calc(var(--header-offset) + 100px);
}

@media (max-width: 781px) {
	.wp-block-group.is-style-sticky {
		position: static;
	}
}

/* The callout is a night blue box of its own rather than a group in the night section style,
   because that style also draws the ribbon edge. */
.wp-block-group.is-style-callout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 24px 48px;
	align-items: center;
	padding: clamp(28px, 4vw, 48px);
	border-radius: var(--wp--custom--radius);
	background: var(--wp--preset--color--night);
	color: var(--wp--preset--color--white);
}

/* The callout lays its children out on a grid, where core's block-gap margins would shift them
   out of line with each other. */
.wp-block-group.is-style-callout > * {
	margin: 0;
}

.is-style-callout h2 {
	margin: 0 0 0.3em;
	font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.125rem);
}

.is-style-callout p {
	max-width: 36em;
	margin: 0;
}

.is-style-callout a:not(.wp-element-button) {
	color: var(--wp--preset--color--sky);
}

.is-style-callout a:not(.wp-element-button):hover {
	color: var(--wp--preset--color--white);
}

@media (max-width: 760px) {
	.wp-block-group.is-style-callout {
		grid-template-columns: 1fr;
	}
}

.wp-block-group.is-style-section-jubilee {
	--section-background: var(--wp--preset--color--jubilee-night);
}

@property --fork-band {
	syntax: "<length>";
	inherits: true;
	initial-value: 0px;
}

@property --fork-gap {
	syntax: "<length>";
	inherits: true;
	initial-value: 0px;
}

.wp-block-group.is-style-fork {
	--fork-band: clamp(18px, 2.2vw, 34px);
	--fork-gap: calc(var(--fork-band) * var(--wp--custom--stripe-gap-ratio));
	--fork-half: calc((4 * var(--fork-band) + 3 * var(--fork-gap)) / 2);
	--stagger: 0px;
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding-block: 0;
	background: var(--wp--preset--color--ice);
}

.wp-block-group.is-style-fork::before,
.wp-block-group.is-style-fork::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	z-index: -1;
	transform: skewX(calc(-1 * var(--wp--custom--slant)));
}

.wp-block-group.is-style-fork::before {
	left: calc(50% - var(--fork-half));
	width: var(--fork-band);
	background: var(--wp--preset--color--sky);
	box-shadow:
		calc(var(--fork-band) + var(--fork-gap)) 0 0 var(--wp--custom--color--stripe-2),
		calc(2 * (var(--fork-band) + var(--fork-gap))) 0 0 var(--wp--custom--color--stripe-3),
		calc(3 * (var(--fork-band) + var(--fork-gap))) 0 0 var(--wp--custom--color--stripe-4);
}

.wp-block-group.is-style-fork::after {
	left: calc(50% + var(--fork-half) + var(--fork-gap));
	width: 100%;
	background: var(--wp--preset--color--night);
}

.is-style-fork > .wp-block-columns {
	gap: 0;
	margin-block: 0;
}

.is-style-fork > .wp-block-columns > .wp-block-column {
	padding-block: var(--wp--preset--spacing--70);
}

.is-style-fork > .wp-block-columns > .wp-block-column:first-child {
	align-self: flex-start;
	padding-right: clamp(110px, 15vw, 230px);
	padding-bottom: calc(var(--wp--preset--spacing--70) + var(--stagger));
}

.is-style-fork > .wp-block-columns > .wp-block-column:last-child {
	align-self: flex-end;
	padding-left: clamp(110px, 15vw, 230px);
	padding-top: calc(var(--wp--preset--spacing--70) + var(--stagger));
	color: var(--wp--preset--color--white);
}

.is-style-fork h2 {
	max-width: 11ch;
}

.is-style-fork p {
	max-width: 30em;
}

@media (max-width: 1100px) {
	.wp-block-group.is-style-fork::before,
	.wp-block-group.is-style-fork::after {
		display: none;
	}

	.is-style-fork > .wp-block-columns {
		flex-direction: column;
	}

	.is-style-fork > .wp-block-columns > .wp-block-column:first-child,
	.is-style-fork > .wp-block-columns > .wp-block-column:last-child {
		align-self: stretch;
		flex-basis: auto !important;
		padding-inline: 0;
	}

	.is-style-fork > .wp-block-columns > .wp-block-column:first-child {
		padding-bottom: calc(var(--wp--preset--spacing--70) + var(--edge-height));
	}

	.is-style-fork > .wp-block-columns > .wp-block-column:last-child {
		position: relative;
		isolation: isolate;
		margin-block-start: calc(-1 * var(--edge-height));
		margin-inline: calc(-1 * var(--wp--style--root--padding-left)) calc(-1 * var(--wp--style--root--padding-right));
		padding: calc(var(--edge-height) + var(--wp--preset--spacing--70)) var(--wp--style--root--padding-right) var(--wp--preset--spacing--70) var(--wp--style--root--padding-left);
	}

	.is-style-fork > .wp-block-columns > .wp-block-column:last-child::before {
		content: "";
		position: absolute;
		inset: 0;
		z-index: -1;
		background: var(--wp--preset--color--night);
		clip-path: polygon(
			0 var(--edge-height),
			100% calc(var(--edge-height) - var(--edge-rise)),
			100% 100%,
			0 100%
		);
	}

	/* The column is full-bleed at these widths, with negative inline margins equal to the root
	   padding, so 100vw is its width. The skew uses 100vw where the night section uses container
	   units, because the column must not be a query container. A query container's width can't
	   depend on its content, so browsers measure the height of this flex item with its content
	   laid out at almost no width. The text then wraps after nearly every word, and the column
	   grows many times taller than it should be. */
	.is-style-fork > .wp-block-columns > .wp-block-column:last-child::after {
		content: "";
		position: absolute;
		top: var(--edge-rise);
		left: 0;
		right: 0;
		z-index: -1;
		height: var(--edge-band);
		background: var(--wp--preset--color--sky);
		box-shadow:
			0 calc(var(--edge-band) + var(--edge-gap)) 0 var(--wp--custom--color--stripe-2),
			0 calc(2 * (var(--edge-band) + var(--edge-gap))) 0 var(--wp--custom--color--stripe-3),
			0 calc(3 * (var(--edge-band) + var(--edge-gap))) 0 var(--wp--custom--color--stripe-4);
		transform: skewY(calc(-1 * atan2(var(--edge-rise), 100vw)));
		transform-origin: left top;
	}
}

.wp-block-group.is-style-contact-list {
	border-top: 2px solid var(--wp--preset--color--night);
}

.wp-block-group.is-style-contact-list > * {
	margin-block: 0;
	padding-block: 24px;
	border-bottom: 1px solid var(--wp--custom--color--rule);
}

.wp-block-group.is-style-contact-list > * > * {
	margin-block: 4px 0;
}

.wp-block-group.is-style-contact-list > * > :first-child {
	margin-block-start: 0;
}

.wp-block-group.is-style-contact-list h2 {
	font-size: 1.125rem;
	font-weight: var(--wp--custom--display-weight);
}

.wp-block-group.is-style-contact-list h2 + p {
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.25rem, 1rem + 1.2vw, 2rem);
	font-weight: var(--wp--custom--display-weight);
	overflow-wrap: anywhere;
}

.wp-block-group.is-style-contact-list h2 + p ~ p {
	color: var(--wp--preset--color--muted);
}
