/*
 * Italthai Thank You Panel
 *
 * The Thank You page's one section: an unfilled panel with a gradient edge, a mint heading, a
 * short message, a plain pill button and a photo overlapping the panel's right-hand side.
 *
 * It borrows the CTA panel's shape and nothing else. The panel has no fill of its own -- it is
 * an edge and its contents, sitting on whatever the section behind it is set to, which is why
 * the navy is nowhere in this file.
 */

.itty {
	--itty-panel-h: 456px;
	--itty-panel-radius: 60px;
	--itty-pad-x: 16.5%;
	--itty-pad-y: 56px;
	--itty-body-w: 52%;
	--itty-gap: 26px;

	--itty-border-w: 2px;
	--itty-border-from: #90d2c1;
	--itty-border-to: #387ea8;

	/*
	 * Where the edge starts to go and where it has gone. Two numbers, not one: the design's
	 * line holds its strength across the copy and is already absent behind the photo, and a
	 * single stop cannot say both.
	 */
	--itty-border-fade-start: 35%;
	--itty-border-fade: 70%;

	--itty-heading: #90d2c1;
	--itty-message: #ffffff;

	/*
	 * The CTA panel's button, copied across. Same two pills, same gradient ring, same measured
	 * padding -- the only thing left out is the arrow circle, and with it the right-hand padding
	 * that existed to seat it.
	 */
	--itty-btn-bg: #ffffff;
	--itty-btn-text: #02274c;
	--itty-btn-bg-hover: #90d2c1;
	--itty-btn-text-hover: #02274c;
	--itty-btn-border-from: #90d2c1;
	--itty-btn-border-to: #387ea8;
	--itty-btn-border-w: 2px;

	/*
	 * The photo is sized by its height, not its width.
	 *
	 * At 100% it is exactly as tall as the panel -- flush along the top and bottom edges, which
	 * is what the design draws -- and its width follows from the file's own proportions. Sizing
	 * by width instead put the height at the mercy of whatever crop the file happened to have,
	 * and no two of them agreed with the panel.
	 */
	--itty-media-h: 100%;
	--itty-media-x: 91px;
	--itty-media-y: 0px;

	position: relative;
	display: flex;
	align-items: center;
}

/* ---------------------------------------------------------------------------
 * The panel
 * ------------------------------------------------------------------------ */

.itty__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--itty-gap);
	width: 100%;
	min-height: var(--itty-panel-h);
	padding: var(--itty-pad-y) var(--itty-pad-x);
	border-radius: var(--itty-panel-radius);
}

/*
 * The edge is a masked ring, not a border.
 *
 * border-color takes a colour and not a gradient, and a gradient clipped to the border box
 * paints across the whole element -- it would wash the panel in mint. Masking the middle out of
 * the gradient leaves the rim and nothing else.
 */
.itty__panel::before {
	content: "";
	position: absolute;
	inset: 0;
	padding: var(--itty-border-w);
	border-radius: inherit;
	background: linear-gradient(
		90deg,
		var(--itty-border-from) 0%,
		var(--itty-border-to) var(--itty-border-fade-start),
		transparent var(--itty-border-fade)
	);
	-webkit-mask:
		linear-gradient(#000 0 0) content-box,
		linear-gradient(#000 0 0);
	mask:
		linear-gradient(#000 0 0) content-box,
		linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
}

.itty__body {
	position: relative;

	/* Above the photo, which overlaps the panel and would otherwise cover the copy's right. */
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--itty-gap);
	width: var(--itty-body-w);
}

/* ---------------------------------------------------------------------------
 * Copy
 *
 * Both of these are qualified by .itty. The Elementor kit styles bare h1/h2/p at (0,1,1),
 * which outranks a single class -- unqualified, the kit's own size and colour would win.
 * ------------------------------------------------------------------------ */

.itty .itty__heading {
	margin: 0;
	color: var(--itty-heading);
	font-size: 42px;
	line-height: 1.12;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.itty .itty__message {
	margin: 0;
	color: var(--itty-message);
	font-size: 20px;
	line-height: 1.55;
}

/* ---------------------------------------------------------------------------
 * The button
 *
 * Lifted from the CTA panel. Two pills, one inside the other: the outer one is the gradient
 * ring (drawn as a masked rim, because border-color takes a colour and not a gradient), the
 * inner one is the white fill, and the section shows through the gap between them. One pill
 * with a border cannot do that.
 *
 * The arrow is gone, so the inner pill's padding is even -- 37px each side, where the CTA had
 * 37px to the label and 3px to the circle that sat on the end.
 *
 * Qualified by .itty__btn-row: Elementor's own `a` colour and text-decoration rules would
 * otherwise win.
 * ------------------------------------------------------------------------ */

/* The design leaves 60 above the button and 20 under the heading; this adds the difference. */
.itty__btn-row {
	margin-top: var(--itty-btn-gap, 0px);
}

.itty__btn-row .itty__btn {
	position: relative;
	display: inline-flex;
	padding: 7px 7.5px;
	border-radius: 999px;
	text-decoration: none;
}

.itty__btn::before {
	content: "";
	position: absolute;
	inset: 0;
	padding: var(--itty-btn-border-w);
	border-radius: inherit;
	background: linear-gradient(
		90deg,
		var(--itty-btn-border-from),
		var(--itty-btn-border-to)
	);
	-webkit-mask:
		linear-gradient(#000 0 0) content-box,
		linear-gradient(#000 0 0);
	mask:
		linear-gradient(#000 0 0) content-box,
		linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
}

.itty__btn-inner {
	display: flex;
	align-items: center;
	/* The design's own spec: 19 above and below the label, 30 either side. */
	padding: 19px 30px;
	border-radius: 999px;
	background-color: var(--itty-btn-bg);
	color: var(--itty-btn-text);
	font-size: 13px;
	line-height: 1.3;
	letter-spacing: 1.3px;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background-color 0.3s ease, color 0.3s ease;
}

/*
 * The hover lives on the inner pill, not the link, so the ring is left alone -- it is the one
 * part of the button that does not change.
 */
.itty__btn-row .itty__btn:hover .itty__btn-inner,
.itty__btn-row .itty__btn:focus-visible .itty__btn-inner {
	background-color: var(--itty-btn-bg-hover);
	color: var(--itty-btn-text-hover);
}

/* ---------------------------------------------------------------------------
 * The photo
 *
 * Supplied already cut: the notched corner is part of the file. Positioned over the panel's
 * right-hand side and, with a negative offset, past its edge -- which is why the panel's own
 * edge has faded to nothing by the time it gets there.
 * ------------------------------------------------------------------------ */

.itty__media {
	position: absolute;
	right: var(--itty-media-x);
	top: 50%;
	translate: 0 calc(-50% + var(--itty-media-y));
	z-index: 1;
	height: var(--itty-media-h);
}

/*
 * Qualified by the parent, and both properties matter: Elementor ships
 * ".elementor img{height:auto;max-width:100%}" at (0,1,1), which outranks a bare class and
 * would hand the height back to the file. max-width goes too, or a tall photo would be clamped
 * to the box's width and stop being as tall as it was asked to be.
 */
.itty__media img {
	display: block;
	width: auto;
	max-width: none;
	height: 100%;
}

/* ---------------------------------------------------------------------------
 * Tablet: the panel loses some of its height and the photo some of its overlap.
 * ------------------------------------------------------------------------ */

@media (max-width: 1024px) {
	.itty .itty__heading {
		font-size: 42px;
	}

	.itty .itty__message {
		font-size: 18px;
	}

	.itty__media {
		--itty-media-x: -16px;
	}
}

/* ---------------------------------------------------------------------------
 * Phones: the photo stops overlapping and sits under the copy, as it does on the CTA panel.
 * ------------------------------------------------------------------------ */

@media (max-width: 767px) {
	.itty {
		flex-direction: column;
	}

	.itty__panel {
		order: 1;
		min-height: 0;

		/*
		 * The extra bottom padding carries the panel's side edges on down behind the photo
		 * instead of closing above it. The photo's negative margin below is the same 40%, so
		 * growing the panel does not push the photo down the page -- both are percentages of
		 * the same width, which keeps them in step at any screen size.
		 */
		padding: var(--itty-pad-y) var(--itty-pad-x) calc(var(--itty-pad-y) + 40%);

		/* Open at the bottom: the panel runs on under the photo rather than closing above it. */
		border-radius: var(--itty-panel-radius) var(--itty-panel-radius) 0 0;
	}

	/* Down the sides rather than across, and gone before the panel ends. */
	.itty__panel::before {
		background: linear-gradient(
			180deg,
			var(--itty-border-from) 0%,
			var(--itty-border-to) 22%,
			transparent 100%
		);
	}

	.itty__body {
		width: 100%;
	}

	.itty .itty__heading {
		font-size: 34px;
	}

	.itty .itty__message {
		font-size: 16px;
	}

	.itty__media img {
		width: 100%;
		height: auto;
	}

	.itty__media {
		position: static;
		order: 2;
		translate: none;

		/* Back to width-driven here: stacked, the photo has the whole column and its height is
		 * whatever the file makes it. */
		height: auto;
		width: 100%;

		/* Written as "40px below the button": the distance from the button to the panel's lower
		 * edge is the panel's own bottom padding, so taking both away and adding 40 back leaves
		 * exactly that gap, whatever those two values are later changed to. */
		margin-top: calc(var(--itty-media-gap, 40px) - var(--itty-pad-y) - 40%);
	}
}

/* Mobile V1 (Figma 4775:13818): the button the copy's full width with its label Medium 16 .8
 * grey, the photo 76 under the button (its visible top; the cut file has no margin above). Padding, gaps, radius and type sizes (heading 32/44,
 * message 22/32) are the widget's phone values. */
@media (max-width: 767px) {
	.itty {
		--itty-media-gap: 76px;
	}

	/* The message's line breaks are set for the wide panel; on a phone it wraps on its own. */
	.itty .itty__message br {
		display: none;
	}

	.itty__btn-row {
		align-self: stretch;
	}

	.itty__btn-row .itty__btn {
		display: flex;
	}

	.itty__btn-inner {
		flex: 1;
		justify-content: center;
		color: #58595b;
		font-size: 16px;
		font-weight: 500;
		letter-spacing: 0.8px;
	}
}
