/*
 * Wheel divider (patterns/wheel-divider-left.php, -right.php).
 *
 * A zero-height full-width row placed between two sections; the Wheel is
 * centred on the seam with its centre --kt-wheel-inset inside the page edge,
 * so most of it bleeds off the page. Tune per use with the custom
 * properties (e.g. a larger Wheel: `--kt-wheel-size: 232px`).
 */

:root {
	--kt-wheel-divider-size: clamp(120px, 12.5vw, 180px);
}

.kt-wheel-divider.wp-block-group {
	--kt-wheel-size: var(--kt-wheel-divider-size);
	--kt-wheel-inset: 16px;
	position: relative;
	z-index: 2;
	height: 0;
	margin-block: 0;
	pointer-events: none;
}

.kt-wheel-divider .kt-wheel-divider__wheel {
	position: absolute;
	top: 0;
	width: var(--kt-wheel-size);
	margin: 0;
	transform: translateY(-50%);
}

.kt-wheel-divider .kt-wheel-divider__wheel img {
	display: block;
	width: 100% !important; /* Overrides the image block's inline width. */
	height: auto;
}

.kt-wheel-divider--left .kt-wheel-divider__wheel {
	left: calc(var(--kt-wheel-inset) - var(--kt-wheel-size) / 2);
}

.kt-wheel-divider--right .kt-wheel-divider__wheel {
	right: calc(var(--kt-wheel-inset) - var(--kt-wheel-size) / 2);
}

/* The Wheel bleeds off the edge without a horizontal scrollbar. `clip`
   (not `hidden`) keeps sticky descendants working; never set on body. */
.wp-site-blocks > main {
	overflow-x: clip;
}

/* Narrow screens: sections are short and their text runs to the edges, so
   the sections on either side of a divider make room for half a Wheel plus
   a gap. !important: section padding is an inline style from the editor. */
@media (max-width: 781px) {

	.wp-block-post-content > :has(+ .kt-wheel-divider) {
		padding-block-end: max(var(--wp--preset--spacing--70), calc(var(--kt-wheel-divider-size) / 2 + var(--wp--preset--spacing--40))) !important;
	}

	.wp-block-post-content > .kt-wheel-divider + * {
		padding-block-start: max(var(--wp--preset--spacing--70), calc(var(--kt-wheel-divider-size) / 2 + var(--wp--preset--spacing--40))) !important;
	}
}
