/**
 * MRMVR Elements — CTA Block.
 *
 * A heading, a line of text and one or two buttons: the small, contextual
 * prompt that sits between two sections and points at the next step. Built
 * for the places a full-height CTA section would be too much — after a
 * services grid, under a row of points, beside an existing button.
 *
 * Four surfaces (card, cream, midnight, plain), two layouts (inline, stacked)
 * and two sizes (standard, compact). Sizes itself against its own container
 * rather than the viewport, so it behaves inside a narrow Elementor column.
 *
 * @package MRMVR\Elements
 * @since   1.45.0
 */

.mrx-cta-wrap {
	container-type: inline-size;
	container-name: mrxc;
	min-height: 0;
}

/* Padding inside the stated width, whatever the theme resets or does not:
   a full-width button on a phone must not run past the edge of its card. */
.mrx-cta-wrap,
.mrx-cta-wrap *,
.mrx-cta-wrap *::before,
.mrx-cta-wrap *::after {
	box-sizing: border-box;
}

.mrx-cta {
	/* Layout */
	--mrx-c-max: 1040px;
	--mrx-c-gap: clamp(20px, 4cqi, 56px);
	--mrx-c-actions-max: 48%;
	--mrx-c-align: center;
	--mrx-c-justify: center;

	/* Panel */
	--mrx-c-bg: var(--mrmvr-white, #ffffff);
	--mrx-c-border: rgba(207, 161, 144, .42);
	--mrx-c-radius: 16px;
	--mrx-c-pad-y: clamp(28px, 4.2cqi, 48px);
	--mrx-c-pad-x: clamp(24px, 5cqi, 60px);
	--mrx-c-shadow: 0 16px 34px -26px rgba(26, 33, 66, .32);
	--mrx-c-frame: rgba(207, 161, 144, .5);
	--mrx-c-frame-offset: 10px;
	--mrx-c-glow: rgba(249, 233, 224, .95);

	/* Type */
	--mrx-c-eyebrow: var(--mrmvr-amber, #f57528);
	--mrx-c-title: var(--mrmvr-navy, #1a2142);
	--mrx-c-accent: var(--mrmvr-amber, #f57528);
	--mrx-c-body: var(--mrmvr-navy, #1a2142);
	--mrx-c-body-opacity: .78;
	--mrx-c-ornament: var(--mrmvr-clay, #cfa190);
	--mrx-c-measure: 52ch;
	--mrx-c-title-size: clamp(27px, 3.6cqi, 38px);
	--mrx-c-text-size: 16.5px;

	/* Primary button — solid */
	--mrx-c-p-bg: var(--mrmvr-navy, #1a2142);
	--mrx-c-p-text: var(--mrmvr-white, #ffffff);
	--mrx-c-p-border: var(--mrmvr-navy, #1a2142);
	--mrx-c-p-bg-hover: var(--mrmvr-amber, #f57528);
	--mrx-c-p-text-hover: var(--mrmvr-white, #ffffff);
	--mrx-c-p-border-hover: var(--mrmvr-amber, #f57528);

	/* Secondary button — outline */
	--mrx-c-s-bg: transparent;
	--mrx-c-s-text: var(--mrmvr-navy, #1a2142);
	--mrx-c-s-border: rgba(26, 33, 66, .32);
	--mrx-c-s-bg-hover: var(--mrmvr-navy, #1a2142);
	--mrx-c-s-text-hover: var(--mrmvr-white, #ffffff);
	--mrx-c-s-border-hover: var(--mrmvr-navy, #1a2142);

	--mrx-c-btn-radius: 999px;
	--mrx-c-btn-pad: 16px 30px;
	--mrx-c-btn-size: 13px;

	position: relative;
	font-family: var(--mrmvr-font-body);
	color: var(--mrx-c-body);
}

/* -------------------------------------------------------------------------
 * Surfaces
 *
 * Each one only re-points the custom properties above, so a colour chosen in
 * the Style tab — written at a higher specificity — still wins over the
 * surface it sits on.
 * ---------------------------------------------------------------------- */

/* Cream: the warm field the rest of the site's soft sections use. */
.mrx-cta--cream {
	--mrx-c-bg: var(--mrmvr-cream, #fdf8f5);
	--mrx-c-border: rgba(207, 161, 144, .28);
	--mrx-c-shadow: none;
}

/* Midnight: for a block that has to stand apart from the section above it. */
.mrx-cta--navy {
	--mrx-c-bg: var(--mrmvr-navy, #1a2142);
	--mrx-c-border: transparent;
	--mrx-c-shadow: 0 22px 44px -28px rgba(26, 33, 66, .6);
	--mrx-c-glow: rgba(245, 117, 40, .16);
	--mrx-c-title: var(--mrmvr-white, #ffffff);
	--mrx-c-body: var(--mrmvr-white, #ffffff);
	--mrx-c-body-opacity: .8;
	--mrx-c-ornament: rgba(255, 255, 255, .5);

	--mrx-c-p-bg: var(--mrmvr-amber, #f57528);
	--mrx-c-p-text: var(--mrmvr-white, #ffffff);
	--mrx-c-p-border: var(--mrmvr-amber, #f57528);
	--mrx-c-p-bg-hover: var(--mrmvr-white, #ffffff);
	--mrx-c-p-text-hover: var(--mrmvr-navy, #1a2142);
	--mrx-c-p-border-hover: var(--mrmvr-white, #ffffff);

	--mrx-c-s-text: var(--mrmvr-white, #ffffff);
	--mrx-c-s-border: rgba(255, 255, 255, .45);
	--mrx-c-s-bg-hover: var(--mrmvr-white, #ffffff);
	--mrx-c-s-text-hover: var(--mrmvr-navy, #1a2142);
	--mrx-c-s-border-hover: var(--mrmvr-white, #ffffff);
}

/* Plain: no panel at all — the block borrows the section it sits in. */
.mrx-cta--plain {
	--mrx-c-bg: transparent;
	--mrx-c-border: transparent;
	--mrx-c-shadow: none;
	--mrx-c-pad-y: 0px;
	--mrx-c-pad-x: 0px;
	--mrx-c-radius: 0px;
}

/* -------------------------------------------------------------------------
 * Compact
 *
 * A secondary prompt — one that should never compete with the content around
 * it. Everything steps down a size: the panel, the heading, the buttons.
 * ---------------------------------------------------------------------- */

.mrx-cta--compact {
	--mrx-c-max: 860px;
	--mrx-c-pad-y: clamp(20px, 3cqi, 30px);
	--mrx-c-pad-x: clamp(20px, 3.6cqi, 38px);
	--mrx-c-radius: 12px;
	--mrx-c-title-size: clamp(22px, 2.6cqi, 27px);
	--mrx-c-text-size: 15px;
	--mrx-c-btn-pad: 13px 22px;
	--mrx-c-btn-size: 12px;
	--mrx-c-frame-offset: 8px;
	--mrx-c-gap: clamp(16px, 3cqi, 36px);
}

.mrx-cta--compact.mrx-cta--plain {
	--mrx-c-pad-y: 0px;
	--mrx-c-pad-x: 0px;
	--mrx-c-radius: 0px;
}

/* -------------------------------------------------------------------------
 * Panel
 * ---------------------------------------------------------------------- */

.mrx-cta__frame {
	position: relative;
	max-width: var(--mrx-c-max);
	margin-inline: auto;
}

/*
 * The offset hairline frame the arched media blocks and the Ask CTA already
 * use: depth without a heavy shadow. Card surface only — on cream it reads as
 * a stray line, and the midnight panel needs no help standing out.
 */
:where(.mrx-cta--card.mrx-cta--framed) .mrx-cta__frame::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	border: 1px solid var(--mrx-c-frame);
	border-radius: var(--mrx-c-radius);
	transform: translate(var(--mrx-c-frame-offset), var(--mrx-c-frame-offset));
	pointer-events: none;
}

.mrx-cta__panel {
	position: relative;
	z-index: 1;
	overflow: hidden;
	display: grid;
	grid-template-columns: minmax(0, 1fr) fit-content(var(--mrx-c-actions-max));
	grid-template-areas: "copy actions";
	align-items: center;
	gap: var(--mrx-c-gap);
	padding: var(--mrx-c-pad-y) var(--mrx-c-pad-x);
	background-color: var(--mrx-c-bg);
	border: 1px solid var(--mrx-c-border);
	border-radius: var(--mrx-c-radius);
	box-shadow: var(--mrx-c-shadow);
}

/* A soft wash in the leading corner, under the type. Cream and midnight
   only: a large flat field of colour reads as unfinished without it. */
.mrx-cta--cream .mrx-cta__panel::before,
.mrx-cta--navy .mrx-cta__panel::before {
	content: "";
	position: absolute;
	top: -180px;
	left: -150px;
	z-index: -1;
	width: 460px;
	height: 460px;
	background-image: radial-gradient(circle, var(--mrx-c-glow) 0%, rgba(255, 255, 255, 0) 68%);
	pointer-events: none;
}

:where(.mrx-cta--noglow) .mrx-cta__panel::before {
	display: none;
}

/* Stacked: one column, the buttons under the words. */
.mrx-cta--stacked .mrx-cta__panel {
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "copy" "actions";
	justify-items: var(--mrx-c-justify);
	text-align: var(--mrx-c-align);
	gap: clamp(18px, 2.4cqi, 26px);
}

.mrx-cta--left {
	--mrx-c-align: left;
	--mrx-c-justify: start;
}

/* Buttons only: nothing above them, so no gap to hold open either. */
.mrx-cta--bare .mrx-cta__panel {
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "actions";
}

.mrx-cta__copy {
	grid-area: copy;
	min-width: 0;
}

/* -------------------------------------------------------------------------
 * Type
 * ---------------------------------------------------------------------- */

.mrx-cta__eyebrow {
	display: block;
	margin: 0 0 12px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 1.9px;
	line-height: 1.2;
	text-transform: uppercase;
	color: var(--mrx-c-eyebrow);
}

.mrx-cta__title {
	margin: 0;
	font-family: var(--mrmvr-font-display);
	/* Fallback for browsers without container query units. */
	font-size: clamp(27px, 3vw, 38px);
	font-size: var(--mrx-c-title-size);
	font-weight: 600;
	line-height: 1.1;
	letter-spacing: -0.3px;
	text-wrap: balance;
	color: var(--mrx-c-title);
}

/* The word the sentence turns on: marked by colour, not weight. */
.mrx-cta__title em {
	font-style: italic;
	font-weight: 600;
	color: var(--mrx-c-accent);
}

/* The rule-and-diamond used across the rest of the site. */
.mrx-cta__ornament {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 96px;
	margin: 14px 0 0;
}

.mrx-cta--stacked.mrx-cta--center .mrx-cta__ornament {
	margin-inline: auto;
}

.mrx-cta__ornament i {
	flex: 1 1 auto;
	height: 1px;
	background-color: var(--mrx-c-ornament);
	opacity: .6;
}

.mrx-cta__ornament b {
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	background-color: var(--mrx-c-accent);
	transform: rotate(45deg);
}

.mrx-cta__text {
	max-width: var(--mrx-c-measure);
	margin: 12px 0 0;
	font-size: var(--mrx-c-text-size);
	line-height: 1.6;
	text-wrap: pretty;
	color: var(--mrx-c-body);
	opacity: var(--mrx-c-body-opacity);
}

.mrx-cta__ornament + .mrx-cta__text {
	margin-top: 14px;
}

.mrx-cta--stacked.mrx-cta--center .mrx-cta__text {
	margin-inline: auto;
}

/* -------------------------------------------------------------------------
 * Buttons
 * ---------------------------------------------------------------------- */

.mrx-cta__actions {
	grid-area: actions;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	min-width: 0;
}

.mrx-cta--stacked .mrx-cta__actions,
.mrx-cta--bare .mrx-cta__actions {
	justify-content: var(--mrx-c-justify);
}

.mrx-cta__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	max-width: 100%;
	padding: var(--mrx-c-btn-pad);
	font-family: var(--mrmvr-font-body);
	font-size: var(--mrx-c-btn-size);
	font-weight: 500;
	letter-spacing: 1.4px;
	line-height: 1.25;
	text-align: center;
	text-transform: uppercase;
	text-decoration: none;
	border: 1px solid transparent;
	border-radius: var(--mrx-c-btn-radius);
	cursor: pointer;
	transition:
		color var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease),
		background-color var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease),
		border-color var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease),
		transform var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease);
}

.mrx-cta__btn--primary {
	color: var(--mrx-c-p-text);
	background-color: var(--mrx-c-p-bg);
	border-color: var(--mrx-c-p-border);
}

.mrx-cta__btn--primary:hover,
.mrx-cta__btn--primary:focus-visible {
	color: var(--mrx-c-p-text-hover);
	background-color: var(--mrx-c-p-bg-hover);
	border-color: var(--mrx-c-p-border-hover);
}

.mrx-cta__btn--secondary {
	color: var(--mrx-c-s-text);
	background-color: var(--mrx-c-s-bg);
	border-color: var(--mrx-c-s-border);
}

.mrx-cta__btn--secondary:hover,
.mrx-cta__btn--secondary:focus-visible {
	color: var(--mrx-c-s-text-hover);
	background-color: var(--mrx-c-s-bg-hover);
	border-color: var(--mrx-c-s-border-hover);
}

.mrx-cta__btn:hover {
	transform: translateY(-2px);
}

.mrx-cta__btn:focus-visible {
	outline: 2px solid var(--mrx-c-accent);
	outline-offset: 3px;
}

.mrx-cta__btn-icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	font-size: 14px;
	line-height: 1;
	transition: transform var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease);
}

.mrx-cta__btn-icon svg,
.mrx-cta__btn-icon i {
	width: .9em;
	height: .9em;
	font-size: inherit;
	fill: currentColor;
}

.mrx-cta__btn:hover .mrx-cta__btn-icon {
	transform: translateX(4px);
}

/* -------------------------------------------------------------------------
 * Container guardrails
 *
 * These set properties rather than the custom properties the Elementor
 * controls write to, so a control never fights them. The wrapper class is
 * repeated to lift them above the layout rules above.
 * ---------------------------------------------------------------------- */

@container mrxc (max-width: 720px) {
	/* Inline has no room left: the buttons drop under the words. */
	.mrx-cta-wrap.mrx-cta-wrap .mrx-cta--inline .mrx-cta__panel {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "copy" "actions";
		gap: 20px;
	}

	.mrx-cta-wrap.mrx-cta-wrap .mrx-cta--inline .mrx-cta__actions {
		justify-content: flex-start;
	}

	.mrx-cta-wrap.mrx-cta-wrap .mrx-cta__frame::before {
		display: none;
	}
}

@container mrxc (max-width: 480px) {
	/* One button to a line, full width — a thumb target, not a tag. */
	.mrx-cta-wrap.mrx-cta-wrap .mrx-cta__actions {
		flex-direction: column;
		align-items: stretch;
	}

	.mrx-cta-wrap.mrx-cta-wrap .mrx-cta__btn {
		width: 100%;
	}

	.mrx-cta-wrap.mrx-cta-wrap .mrx-cta__text {
		font-size: 15px;
	}
}

/* -------------------------------------------------------------------------
 * Accessibility & print
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.mrx-cta__btn,
	.mrx-cta__btn-icon {
		transition: none !important;
	}

	.mrx-cta__btn:hover,
	.mrx-cta__btn:hover .mrx-cta__btn-icon {
		transform: none;
	}
}

@media print {
	.mrx-cta__frame::before,
	.mrx-cta__panel::before {
		display: none;
	}
}
