/**
 * MRMVR Elements — Option Cards.
 *
 * A short row of cards that sends each kind of visitor to the page written
 * for them — "own a property? / a Realtor?" — before they reach a general
 * form. Each card is an icon, a heading, a line of text and one link, and the
 * whole card is the target.
 *
 * Kept deliberately light: hairline borders on white, no heavy shadows, so a
 * row of them reads as a fork in the road rather than a section of its own.
 *
 * @package MRMVR\Elements
 * @since   1.45.0
 */

.mrx-opt-wrap {
	container-type: inline-size;
	container-name: mrxo;
	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-opt-wrap,
.mrx-opt-wrap *,
.mrx-opt-wrap *::before,
.mrx-opt-wrap *::after {
	box-sizing: border-box;
}

.mrx-opt {
	/* Layout */
	--mrx-o-cols: 2;
	--mrx-o-gap: clamp(14px, 2.4cqi, 24px);
	--mrx-o-max: 980px;

	/* Card */
	--mrx-o-bg: var(--mrmvr-white, #ffffff);
	--mrx-o-bg-hover: var(--mrmvr-white, #ffffff);
	--mrx-o-border: rgba(207, 161, 144, .42);
	--mrx-o-border-hover: rgba(207, 161, 144, .9);
	--mrx-o-radius: 14px;
	--mrx-o-pad: clamp(22px, 3cqi, 30px);
	--mrx-o-rule: var(--mrmvr-amber, #f57528);

	/* Icon */
	--mrx-o-icon: var(--mrmvr-amber, #f57528);
	--mrx-o-icon-bg: var(--mrmvr-blush-soft, #f9e9e0);
	--mrx-o-icon-box: 48px;
	--mrx-o-icon-size: 19px;

	/* Type */
	--mrx-o-label: var(--mrmvr-amber, #f57528);
	--mrx-o-title: var(--mrmvr-navy, #1a2142);
	--mrx-o-body: var(--mrmvr-navy, #1a2142);
	--mrx-o-body-opacity: .74;

	/* Button */
	--mrx-o-btn-text: var(--mrmvr-navy, #1a2142);
	--mrx-o-btn-bg: transparent;
	--mrx-o-btn-border: rgba(26, 33, 66, .3);
	--mrx-o-btn-text-hover: var(--mrmvr-white, #ffffff);
	--mrx-o-btn-bg-hover: var(--mrmvr-navy, #1a2142);
	--mrx-o-btn-border-hover: var(--mrmvr-navy, #1a2142);
	--mrx-o-btn-radius: 999px;

	max-width: var(--mrx-o-max);
	margin-inline: auto;
	font-family: var(--mrmvr-font-body);
	color: var(--mrx-o-body);
}

/* Solid: the button carries the weight instead of the card. */
.mrx-opt--btn-solid {
	--mrx-o-btn-text: var(--mrmvr-white, #ffffff);
	--mrx-o-btn-bg: var(--mrmvr-navy, #1a2142);
	--mrx-o-btn-border: var(--mrmvr-navy, #1a2142);
	--mrx-o-btn-bg-hover: var(--mrmvr-amber, #f57528);
	--mrx-o-btn-border-hover: var(--mrmvr-amber, #f57528);
}

/* Text link: the quietest form, for cards that sit right above a form. */
.mrx-opt--btn-link {
	--mrx-o-btn-text: var(--mrmvr-navy, #1a2142);
	--mrx-o-btn-text-hover: var(--mrmvr-amber, #f57528);
}

.mrx-opt__grid {
	display: grid;
	grid-template-columns: repeat(var(--mrx-o-cols), minmax(0, 1fr));
	gap: var(--mrx-o-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* -------------------------------------------------------------------------
 * Card
 * ---------------------------------------------------------------------- */

.mrx-opt__card {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas: "icon body";
	align-items: stretch;
	column-gap: 18px;
	min-width: 0;
	margin: 0;
	padding: var(--mrx-o-pad);
	overflow: hidden;
	background-color: var(--mrx-o-bg);
	border: 1px solid var(--mrx-o-border);
	border-radius: var(--mrx-o-radius);
	transition:
		background-color var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease),
		border-color var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease),
		box-shadow var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease),
		transform var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease);
}

/* The accent rule along the top, drawn from the left on hover — the same
   gesture the Signature Panels and Service Index use. */
.mrx-opt__card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	background-color: var(--mrx-o-rule);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 600ms var(--mrmvr-ease, ease);
}

.mrx-opt__card:hover,
.mrx-opt__card:focus-within {
	background-color: var(--mrx-o-bg-hover);
	border-color: var(--mrx-o-border-hover);
	box-shadow: var(--mrmvr-shadow-md, 0 18px 40px -22px rgba(26, 33, 66, .35));
	transform: translateY(-3px);
}

.mrx-opt__card:hover::before,
.mrx-opt__card:focus-within::before {
	transform: scaleX(1);
}

/* Icon over the words rather than beside them. */
.mrx-opt--icon-top .mrx-opt__card {
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "icon" "body";
	row-gap: 18px;
}

.mrx-opt--noicon .mrx-opt__card {
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "body";
}

.mrx-opt--center .mrx-opt__card {
	justify-items: center;
	text-align: center;
}

.mrx-opt__icon {
	grid-area: icon;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--mrx-o-icon-box);
	height: var(--mrx-o-icon-box);
	font-size: var(--mrx-o-icon-size);
	line-height: 1;
	color: var(--mrx-o-icon);
	background-color: var(--mrx-o-icon-bg);
	border-radius: 50%;
	align-self: start;
	transition:
		color var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease),
		background-color var(--mrmvr-duration, 400ms) var(--mrmvr-ease, ease);
}

.mrx-opt__icon svg,
.mrx-opt__icon i {
	width: 1em;
	height: 1em;
	font-size: inherit;
	fill: currentColor;
}

.mrx-opt__body {
	grid-area: body;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
}

.mrx-opt--center .mrx-opt__body {
	align-items: center;
}

.mrx-opt__label {
	display: block;
	margin: 0 0 8px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 1.8px;
	line-height: 1.2;
	text-transform: uppercase;
	color: var(--mrx-o-label);
}

.mrx-opt__title {
	margin: 0;
	font-family: var(--mrmvr-font-display);
	font-size: clamp(21px, 2.4cqi, 25px);
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.2px;
	text-wrap: balance;
	color: var(--mrx-o-title);
}

.mrx-opt__text {
	margin: 8px 0 0;
	font-size: 15px;
	line-height: 1.55;
	text-wrap: pretty;
	color: var(--mrx-o-body);
	opacity: var(--mrx-o-body-opacity);
}

/* -------------------------------------------------------------------------
 * Button
 * ---------------------------------------------------------------------- */

.mrx-opt__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	max-width: 100%;
	padding: 12px 22px;
	font-family: var(--mrmvr-font-body);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 1.3px;
	line-height: 1.25;
	text-align: center;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--mrx-o-btn-text);
	background-color: var(--mrx-o-btn-bg);
	border: 1px solid var(--mrx-o-btn-border);
	border-radius: var(--mrx-o-btn-radius);
	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);
}

/* The foot sinks to the bottom of the card, so buttons in a row of cards of
   different lengths still line up; its padding is the minimum gap above. */
.mrx-opt__foot {
	margin-top: auto;
	padding-top: 18px;
}

.mrx-opt__card:hover .mrx-opt__btn,
.mrx-opt__btn:focus-visible {
	color: var(--mrx-o-btn-text-hover);
	background-color: var(--mrx-o-btn-bg-hover);
	border-color: var(--mrx-o-btn-border-hover);
}

.mrx-opt__btn:focus-visible {
	outline: 2px solid var(--mrx-o-rule);
	outline-offset: 3px;
}

.mrx-opt--btn-link .mrx-opt__btn {
	padding: 4px 0;
	background-color: transparent;
	border: 0;
	border-bottom: 1px solid currentColor;
	border-radius: 0;
}

.mrx-opt--btn-link .mrx-opt__card:hover .mrx-opt__btn,
.mrx-opt--btn-link .mrx-opt__btn:focus-visible {
	background-color: transparent;
}

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

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

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

/*
 * The whole card as the target. The link's box is stretched over the card
 * rather than the card being wrapped in an <a>, so a screen reader still
 * announces one short link with the button's own words — not the heading,
 * the text and the button run together.
 */
.mrx-opt--stretch .mrx-opt__btn::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: var(--mrx-o-radius);
}

.mrx-opt--stretch .mrx-opt__card {
	cursor: pointer;
}

/* -------------------------------------------------------------------------
 * Container guardrails
 * ---------------------------------------------------------------------- */

@container mrxo (max-width: 600px) {
	.mrx-opt-wrap.mrx-opt-wrap .mrx-opt__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

@container mrxo (max-width: 380px) {
	/* No room for the icon beside the words: it goes on top. */
	.mrx-opt-wrap.mrx-opt-wrap .mrx-opt__card {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "icon" "body";
		row-gap: 14px;
	}
}

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

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

	.mrx-opt__card:hover,
	.mrx-opt__card:focus-within,
	.mrx-opt__card:hover .mrx-opt__btn-icon {
		transform: none;
	}
}

@media print {
	.mrx-opt__card::before {
		display: none;
	}
}
