/*
 * Image & Text Swirl — shared editor + frontend styles.
 * Plain CSS — no Sass / Vite style entry.
 * Desktop: Figma HOME — Side Streets (node 4168:288).
 *   Content box 1756×927; copy ~1062 / media 694 (~60.5/39.5);
 *   text inset 259×196; swirl overflows the teal box (rotate 66.04°).
 * Mobile: Figma HOME Mobile — Side Streets (node 152:322).
 *   Stack media → copy; teal copy 503×576; image 446×415;
 *   centered type (30/44 title, 16/35 body); swirl frame ~1067×1011.
 */

.lwt-image-text-swirl {
	box-sizing: border-box;
	position: relative;
	isolation: isolate;
	width: 100%;
	/* Swirl spills below/left onto the page; clip only horizontal scroll. */
	overflow-x: clip;
	overflow-y: visible;
	background-color: var(--wp--preset--color--sea);
	color: var(--wp--preset--color--white);
}

.lwt-image-text-swirl *,
.lwt-image-text-swirl *::before,
.lwt-image-text-swirl *::after {
	box-sizing: border-box;
}

/*
 * Decorative swirl — img (frontend) or empty span stand-in (editor).
 * Figma: 1251×1441 vector, rotate 66.04°, sitting in an 1824×1728
 * frame whose top-left is (−508, −266) relative to the teal box.
 * Forced white + opacity so the tint reads against any block background.
 */
.lwt-image-text-swirl__swirl {
	position: absolute;
	z-index: 0;
	top: -28.7%;
	left: -28.9%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 103.9%; /* 1824 / 1756 */
	height: 186.4%; /* 1728 / 927 */
	max-width: none;
	margin: 0;
	border: 0;
	padding: 0;
	pointer-events: none;
	overflow: visible;
}

.lwt-image-text-swirl__swirl img {
	display: block;
	width: 68.6%; /* 1251 / 1824 of frame */
	height: auto;
	max-width: none;
	margin: 0;
	aspect-ratio: 1250.928 / 1440.741;
	opacity: 0.22;
	filter: brightness(0) invert(1);
	object-fit: contain;
	transform: rotate(66.04deg);
	transform-origin: center center;
}

/* Editor stand-in: empty span uses ::before as the rotated glyph. */
span.lwt-image-text-swirl__swirl:empty::before {
	content: "";
	display: block;
	width: 68.6%;
	aspect-ratio: 1250.928 / 1440.741;
	background-color: transparent;
	background-image: url(../../assets/images/image-text-swirl.svg);
	background-position: center;
	background-size: contain;
	background-repeat: no-repeat;
	opacity: 0.22;
	filter: brightness(0) invert(1);
	transform: rotate(66.04deg);
	transform-origin: center center;
}

.lwt-image-text-swirl--image-left .lwt-image-text-swirl__swirl {
	left: auto;
	right: -28.9%;
}

.lwt-image-text-swirl--image-left .lwt-image-text-swirl__swirl img,
.lwt-image-text-swirl--image-left span.lwt-image-text-swirl__swirl:empty::before {
	transform: rotate(-66.04deg) scaleX(-1);
}

.lwt-image-text-swirl__layout {
	position: relative;
	z-index: 1;
	display: grid;
	/* Figma: copy 1062 / media 694 within 1756 */
	grid-template-columns: minmax(0, 1.53fr) minmax(0, 1fr);
	grid-template-areas: "copy media";
	align-items: stretch;
	width: 100%;
	/* Floor only. The photo’s aspect ratio sets the usual height. */
	min-height: 42rem;
}

.lwt-image-text-swirl--image-left .lwt-image-text-swirl__layout {
	grid-template-areas: "media copy";
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.53fr);
}

.lwt-image-text-swirl__copy,
.lwt-image-text-swirl__layout > .lwt-image-text-swirl__copy,
.lwt-image-text-swirl__layout > .wp-block-group.lwt-image-text-swirl__copy {
	grid-area: copy;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	/* Figma title→excerpt 61px; excerpt→CTA 69px — use 61 + CTA nudge */
	gap: 3.8125rem; /* 61px */
	width: 100%;
	max-width: 100%;
	margin: 0;
	/* Inset tightened from the 196 / 179 Figma vertical padding. */
	padding: clamp(2.5rem, 8vw, 9.5rem) clamp(1.5rem, 8vw, 10rem)
		clamp(2.5rem, 7.25vw, 8.5rem) clamp(1.5rem, 14.75vw, 16.1875rem);
}

.lwt-image-text-swirl__media,
.lwt-image-text-swirl__layout > .lwt-image-text-swirl__media,
.lwt-image-text-swirl__layout > .wp-block-group.lwt-image-text-swirl__media {
	grid-area: media;
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	min-height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

.lwt-image-text-swirl__copy .wp-block-heading,
.lwt-image-text-swirl__copy h2 {
	margin-top: 0;
	margin-bottom: 0;
	max-width: 31.5625rem; /* 505px — Figma title width */
	font-weight: 200;
	line-height: 1.4; /* 63/45 */
	font-synthesis: none;
}

.lwt-image-text-swirl__copy .wp-block-paragraph,
.lwt-image-text-swirl__copy p {
	margin-top: 0;
	margin-bottom: 0;
	max-width: 31.5625rem; /* 505px */
	font-weight: 300;
	line-height: 2.14; /* 45/21 */
}

.lwt-image-text-swirl__copy .wp-block-buttons {
	margin-top: 0.5rem; /* 61 + 8 ≈ 69px to CTA */
}

.lwt-image-text-swirl__copy .wp-block-button {
	margin: 0;
}

/*
 * Underline CTA — Figma 4168:292: white Manrope label + white rule
 * ~11px under text (not the global sea Primary CTA underline).
 */
.lwt-image-text-swirl .wp-block-button.is-style-underline .wp-block-button__link {
	color: inherit !important;
	padding-bottom: 0.6875rem; /* 11px */
}

.lwt-image-text-swirl .wp-block-button.is-style-underline .wp-block-button__link::after {
	background-color: currentColor;
}

.lwt-image-text-swirl .wp-block-button.is-style-underline .wp-block-button__link:hover,
.lwt-image-text-swirl .wp-block-button.is-style-underline .wp-block-button__link:focus {
	color: inherit !important;
}

.lwt-image-text-swirl__media .wp-block-image,
.lwt-image-text-swirl__media .lwt-image-text-swirl__image,
.lwt-image-text-swirl__media figure {
	display: flex;
	flex: 1 1 auto;
	width: 100%;
	height: 100%;
	min-height: inherit;
	margin: 0;
}

.lwt-image-text-swirl__media .wp-block-image img,
.lwt-image-text-swirl__media .lwt-image-text-swirl__image img,
.lwt-image-text-swirl__media figure img {
	display: block;
	width: 100%;
	height: auto;
	/* A little shorter than the photo’s natural 3:4, so the section
	   does not grow with the column width. */
	aspect-ratio: 5 / 5.5;
	min-height: 0;
	object-fit: cover;
	object-position: center;
}

@media (max-width: 781px) {
	.lwt-image-text-swirl {
		overflow-x: clip;
		overflow-y: visible;
	}

	/*
	 * Figma 152:322 — media always stacks above copy (both image sides).
	 * Section height ≈ 415 image + 576 teal ≈ 991; swirl sits mostly on teal.
	 */
	.lwt-image-text-swirl__layout,
	.lwt-image-text-swirl--image-left .lwt-image-text-swirl__layout {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"media"
			"copy";
		min-height: 0;
	}

	/* Swirl frame: left −368 / width 1067 / height 1011 vs ~440 viewport. */
	.lwt-image-text-swirl__swirl,
	.lwt-image-text-swirl--image-left .lwt-image-text-swirl__swirl {
		top: 26%;
		left: -84%;
		right: auto;
		width: 243%;
		height: 102%;
	}

	.lwt-image-text-swirl__swirl img,
	span.lwt-image-text-swirl__swirl:empty::before,
	.lwt-image-text-swirl--image-left .lwt-image-text-swirl__swirl img,
	.lwt-image-text-swirl--image-left span.lwt-image-text-swirl__swirl:empty::before {
		width: 68.6%;
		opacity: 0.22;
		transform: rotate(66.04deg);
	}

	.lwt-image-text-swirl__copy,
	.lwt-image-text-swirl__layout > .lwt-image-text-swirl__copy,
	.lwt-image-text-swirl__layout > .wp-block-group.lwt-image-text-swirl__copy {
		align-items: center;
		/* Figma teal was 85 top / ~64 bottom; pulled in a little. */
		--wp--style--block-gap: 2rem;
		padding: 4.25rem 3.3125rem 3.25rem;
		gap: 2rem !important;
		text-align: center;
	}

	.lwt-image-text-swirl__copy .wp-block-heading,
	.lwt-image-text-swirl__copy h2 {
		max-width: 20.3125rem; /* 325px */
		margin-inline: auto;
		font-size: 1.875rem !important; /* 30px — beat has-heading-2-font-size */
		line-height: 1.4667 !important; /* 44/30 */
		text-align: center;
	}

	.lwt-image-text-swirl__copy .wp-block-paragraph,
	.lwt-image-text-swirl__copy p {
		max-width: 20.875rem; /* 334px */
		margin-inline: auto;
		font-size: 1rem !important; /* 16px — beat has-body-font-size */
		line-height: 2.1875 !important; /* 35/16 */
		text-align: center;
	}

	.lwt-image-text-swirl__copy .wp-block-buttons {
		justify-content: center !important;
		margin-top: 0;
	}

	.lwt-image-text-swirl .wp-block-button.is-style-underline .wp-block-button__link {
		font-size: 0.8125rem !important; /* 13px — Figma 7:458 */
	}

	.lwt-image-text-swirl__media {
		min-height: 0;
	}

	.lwt-image-text-swirl__media .wp-block-image,
	.lwt-image-text-swirl__media .lwt-image-text-swirl__image,
	.lwt-image-text-swirl__media figure {
		flex: 0 0 auto;
		min-height: 0;
	}

	.lwt-image-text-swirl__media .wp-block-image img,
	.lwt-image-text-swirl__media .lwt-image-text-swirl__image img,
	.lwt-image-text-swirl__media figure img {
		min-height: 0;
		aspect-ratio: 446 / 415;
		height: auto;
	}
}
