/* Rabin Craft — section joins (includes/joins.php). Stands alone; core.css isn't needed.

   .mkit-sheet rises over the section above with rounded top corners. With .mkit-sheet--grow it starts
   inset and widens to full width as it scrolls in: joins.js sets --mkit-p (0 → 1) and adds .is-settled
   at 1, when the clip comes off.
   .mkit-card sits inside the page as a rounded card. .mkit-card--into overlaps the next section (joins.js
   first pads that section, then adds .is-joined); .mkit-card--rise lifts it into place as it scrolls in.
   Without the script sheets are simply full width, and cards sit in place without overlapping.

   Settings (on the element or any ancestor): --mkit-join-r (corner radius), --mkit-join-overlap (how far a
   sheet covers the section above; default the radius), --mkit-join-inset (a growing sheet's inset on each
   side, default 2%), --mkit-card-gap (space between a card and the page edges), --mkit-card-overlap,
   --mkit-card-lift (how far a rising card travels) and --mkit-card-shadow. */

:where(.mkit-sheet, .mkit-card) {
	--_r: var(--mkit-join-r, clamp(1.5rem, .9rem + 2.6vw, 3rem));
	position: relative;
}

.mkit-sheet {
	z-index: 1;
	margin-top: calc(var(--mkit-join-overlap, var(--_r)) * -1);
	border-top-left-radius: var(--_r);
	border-top-right-radius: var(--_r);
}

.mkit-sheet--grow:not(.is-settled) {
	clip-path: inset(0 calc((1 - var(--mkit-p, 1)) * var(--mkit-join-inset, 2%)) round var(--_r) var(--_r) 0 0);
}

/* body raises it above layout classes such as Bricks' .brxe-section {width: 100%} */
body .mkit-card {
	z-index: 2;
	width: calc(100% - 2 * var(--mkit-card-gap, clamp(.5rem, 1.6vw, 1.5rem)));
	margin-inline: auto;
	border-radius: var(--_r);
	box-shadow: var(--mkit-card-shadow, none);
}

body .mkit-card--into {
	box-shadow: var(--mkit-card-shadow, 0 40px 80px -40px rgba(0, 0, 0, .55));
}

body .mkit-card--into.is-joined {
	margin-bottom: calc(var(--mkit-card-overlap, clamp(3rem, 7vw, 6rem)) * -1);
}

.mkit-card--rise:not(.is-settled) {
	translate: 0 calc((1 - var(--mkit-p, 1)) * var(--mkit-card-lift, 4rem));
	scale: calc(.96 + .04 * var(--mkit-p, 1));
}
