/**
 * Brokerage Comparison Block 
 */

.cr-compare {
	--cr-gap: 1rem;
	--cr-radius: 4px;
	--cr-border: #e2e2e2;
	--cr-bg: #fff;
	--cr-text: #333;
	--cr-text-muted: #666;
	--cr-primary: #0073aa;
	--cr-primary-hover: #005a87;
	--cr-star-color: #f5a623;
	--cr-star-empty: #ddd;
	--cr-green: #166534;
	--cr-green-hover: #14532d;
	--cr-slate: #475569;
	--cr-slate-hover: #334155;
	--cr-text-light: #fff;

	margin: 0 auto;
	
	container-type: inline-size;
	container-name: compare-block;
}

.cr-compare a {
	text-decoration: none;
}

.cr-compare a:hover {
	text-decoration: underline;
}

/* List container - card grid */
.cr-compare__list {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	align-items: stretch;
	gap: var(--cr-gap);
	margin-bottom: 1rem;
}

/* Progressive enhancement: viewport fallbacks when container queries are unavailable */
@supports not (container-type: inline-size) {
	@media (max-width: 1000px) {
		.cr-compare__list {
			grid-template-columns: repeat(4, 1fr);
		}
	}

	@media (max-width: 900px) {
		.cr-compare__list {
			grid-template-columns: repeat(3, 1fr);
		}
	}

	@media (max-width: 600px) {
		.cr-compare__list {
			grid-template-columns: repeat(2, 1fr);
		}
	}

	@media (max-width: 480px) {
		.cr-compare__list {
			grid-template-columns: 1fr;
		}
	}
}


/* Browsers that support container queries will use these */
@supports (container-type: inline-size) {
	.cr-compare__list {
		grid-template-columns: repeat(5, 1fr); /* Reset to default */
	}

	@container compare-block (max-width: 1000px) {
		.cr-compare__list {
			grid-template-columns: repeat(4, 1fr);
		}
	}

	@container compare-block (max-width: 900px) {
		.cr-compare__list {
			grid-template-columns: repeat(3, 1fr);
		}
	}

	@container compare-block (max-width: 600px) {
		.cr-compare__list {
			grid-template-columns: repeat(2, 1fr);
		}
	}

	@container compare-block (max-width: 480px) {
		.cr-compare__list {
			grid-template-columns: 1fr;
		}
	}
}

.cr-compare__item {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0.75rem;
	background: var(--cr-bg);
	border: 1px solid var(--cr-border);
	border-radius: var(--cr-radius);
	width: 100%;
	min-width: 0;
	box-sizing: border-box;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);

}

.cr-compare__content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	min-height: 0;
}

/* Desktop: Align details across items */

@supports not (container-type: inline-size) {
	@media (min-width: 768px) {
		.cr-compare__content {
			display: flex;
			flex-direction: column;
			min-height: 180px;
		}
		
		.cr-compare__details {
			margin-top: auto;
		}
	}
}


@supports (container-type: inline-size) {
	@container compare-block (min-width: 768px) {
		.cr-compare__content {
			display: flex;
			flex-direction: column;
			min-height: 180px;
		}
		
		.cr-compare__details {
			margin-top: auto;
		}
	}
}

/* Identity */
.cr-compare__identity {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.75rem;
}

.cr-compare__logo {
	flex-shrink: 0;
	width: 120px;
	height: 75px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cr-compare__logo-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	text-decoration: none;
}

.cr-compare__logo-link:hover,
.cr-compare__logo-link:focus {
	text-decoration: none;
}

.cr-compare__logo-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cr-compare__logo-fallback {
	font-size: 1rem;
	font-weight: 600;
	color: var(--cr-text-muted);
}

.cr-compare__identity-text {
	min-width: 0;
	text-align: center;
}

.cr-compare__name {
	font-size: 1rem;
	font-weight: 600;
	margin: 0;
	line-height: 1.3;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cr-compare__name-link {
	color: var(--cr-primary);
	text-decoration: none;
}

.cr-compare__name-link:hover {
	text-decoration: underline;
}


/* Metrics */
.cr-compare__metrics {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0;
	padding: 0.75rem 0;
}

.cr-compare__metric {
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
}

/* Rating: column layout, centered, label hidden */
.cr-compare__metric--rating {
	flex-direction: column;
	gap: 0.25rem;
}

.cr-compare__metric--rating .cr-compare__metric-value {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
}

.cr-compare__metric:has(.cr-compare__price) {
	flex-direction: row;
}

.cr-compare__metric-label {
	font-size: 0.8125rem;
	color: var(--cr-text-muted);
}

/* Hide rating label visually but keep for accessibility */
.cr-compare__metric--rating .cr-compare__metric-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}


.cr-compare__metric:has(.cr-compare__price) .cr-compare__metric-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

.cr-compare__metric:has(.cr-compare__price) .cr-compare__metric-label::after {
	display: none;
}

.cr-compare__metric-value {
	font-size: 0.875rem;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 0.375rem;
	margin: 0;
}


.cr-compare__metric:has(.cr-compare__price) .cr-compare__metric-value {
	font-size: 1rem;
}

.cr-compare__rating-line {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.cr-compare__rating-value {
	font-weight: 600;
	font-size: 1rem;
}

/* Star rating */
.cr-compare__stars {
	display: inline-block;
	width: 120px;
	height: 24px;
	position: relative;
	background: linear-gradient(
		to right,
		var(--cr-star-color) var(--rating-width, 0%),
		var(--cr-star-empty) var(--rating-width, 0%)
	);
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 16'%3E%3Cpath d='M8 0l2.47 5.01 5.53.8-4 3.9.94 5.5L8 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L8 0zm16 0l2.47 5.01 5.53.8-4 3.9.94 5.5L24 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L24 0zm16 0l2.47 5.01 5.53.8-4 3.9.94 5.5L40 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L40 0zm16 0l2.47 5.01 5.53.8-4 3.9.94 5.5L56 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L56 0zm16 0l2.47 5.01 5.53.8-4 3.9.94 5.5L72 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L72 0z' fill='%23000'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 16'%3E%3Cpath d='M8 0l2.47 5.01 5.53.8-4 3.9.94 5.5L8 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L8 0zm16 0l2.47 5.01 5.53.8-4 3.9.94 5.5L24 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L24 0zm16 0l2.47 5.01 5.53.8-4 3.9.94 5.5L40 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L40 0zm16 0l2.47 5.01 5.53.8-4 3.9.94 5.5L56 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L56 0zm16 0l2.47 5.01 5.53.8-4 3.9.94 5.5L72 12.77l-4.94 2.6.94-5.5-4-3.9 5.53-.8L72 0z' fill='%23000'/%3E%3C/svg%3E");
	mask-size: contain;
	-webkit-mask-size: contain;
	mask-repeat: no-repeat;
	-webkit-mask-repeat: no-repeat;
}

.cr-compare__stars--empty {
	opacity: 0.6;
}

.cr-compare__review-count {
	display: block;
	font-size: 0.75rem;
	color: var(--cr-text-muted);
	font-weight: 400;
	text-align: center;
	margin-top: 0.25rem;
}

.cr-compare__review-count--link {
	cursor: pointer;
}

.cr-compare__review-count--link:hover {
	color: var(--cr-primary);
}

.cr-compare__price {
	white-space: nowrap;
	font-size: 1rem;
	font-weight: 600;
	color: var(--cr-green);
}

/* CTA */
.cr-compare__cta {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.5rem;
	margin-top: auto;
	padding-top: 0.75rem;
	order: 2; 
}

.cr-compare__cta-btn {
	display: block;
	padding: 0.625rem 1rem;
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
	border-radius: 6px;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.cr-compare__cta-btn:hover,
.cr-compare__cta-btn:focus {
	text-decoration: underline;
}

.cr-compare__cta-btn--primary {
	background: var(--cr-primary);
	color: var(--cr-text-light);
	border: none;
}

.cr-compare__cta-btn--primary:hover,
.cr-compare__cta-btn--primary:focus {
	background: var(--cr-primary-hover);
	color: var(--cr-text-light);
}

.cr-compare__cta-btn--intro {
	background: var(--cr-green);
	color: var(--cr-text-light);
}

.cr-compare__cta-btn--intro:hover,
.cr-compare__cta-btn--intro:focus {
	background: var(--cr-green-hover);
	color: var(--cr-text-light);
}

.cr-compare__cta-btn--review {
	background: var(--cr-slate);
	color: var(--cr-text-light);
}

.cr-compare__cta-btn--review:hover,
.cr-compare__cta-btn--review:focus {
	background: var(--cr-slate-hover);
	color: var(--cr-text-light);
}

/* Larger targets at smaller component sizes */
@supports (container-type: inline-size) {
	@container compare-block (max-width: 900px) {
		.cr-compare__cta {
			gap: 0.75rem;
		}

		.cr-compare__cta-btn {
			padding: 1rem 1rem;
			font-size: 0.9375rem;
		}

		.cr-compare__toggle {
			padding: 1rem 1rem;
			font-size: 0.9375rem;
		}
	}
}

@supports not (container-type: inline-size) {
	@media (max-width: 900px) {
		.cr-compare__cta {
			gap: 0.75rem;
		}

		.cr-compare__cta-btn {
			padding: 1rem 1rem;
			font-size: 0.9375rem;
		}

		.cr-compare__toggle {
			padding: 1rem 1rem;
			font-size: 0.9375rem;
		}
	}
}

.cr-compare .cr-compare__toggle {
	background: none;
	border: none;
	padding: 0.625rem 1rem;
	font-size: 0.8125rem;
	color: var(--cr-text-muted);
	cursor: pointer;
	align-items: center;
	justify-content: center;
	box-shadow: none;
	outline: none;
	text-decoration: none;
}

.cr-compare .cr-compare__toggle:hover {
	background: none;
	border: none;
	box-shadow: none;
	text-decoration: underline;
	color: var(--cr-text);
}

.cr-compare .cr-compare__toggle:focus {
	background: none;
	border: none;
	box-shadow: none;
	outline: 2px solid var(--cr-border);
	outline-offset: 2px;
	text-decoration: none;
	color: var(--cr-text-muted);
}

.cr-compare .cr-compare__toggle:focus:hover {
	text-decoration: underline;
	color: var(--cr-text);
}


/* Details - Desktop: visible,  Mobile: accordion */
.cr-compare__details {

	position: static;
	order: 1; 
}

.cr-compare__details-text {
	font-size: 0.75rem;
	color: var(--cr-text-muted);
	margin: 0;
	padding: 0.5rem 0;
	text-align: center;
	line-height: 1.5;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	gap: 0.25rem;
}

.cr-compare__detail-item {
	display: block;
}

.cr-compare__detail-item:not(:last-child)::after {
	content: none;
}


@supports (container-type: inline-size) {
	@container compare-block (min-width: 521px) {
		.cr-compare__details {
			display: flex;
			flex-direction: column;
		}
	}
}

@supports not (container-type: inline-size) {
	@media (min-width: 521px) {
		.cr-compare__details {
			display: flex;
			flex-direction: column;
		}
	}
}

/* Hide toggle on desktop */
.cr-compare .cr-compare__toggle {
	display: none;
}

/* Mobile: condensed card layout (excluding actions area) */
@media (max-width: 520px) {
	.cr-compare__content {
		display: grid;
		grid-template-columns: 1fr 75px;
		grid-template-areas:
			"name logo"
			"metrics logo";
		column-gap: 0.75rem;
		row-gap: 0.5rem;
	}

	/* Flatten identity wrapper so logo/name can be placed on the grid */
	.cr-compare__identity {
		display: contents;
	}

	.cr-compare__identity-text {
		grid-area: name;
		text-align: left;
	}

	.cr-compare__name {
		font-size: 1.2rem;
		justify-content: flex-start;
	}

	.cr-compare__metrics {
		grid-area: metrics;
		align-items: flex-start;
		padding: 0.25rem 0 0;
	}

	.cr-compare__metric {
		justify-content: flex-start;
	}

	.cr-compare__metric--rating .cr-compare__metric-value {
		align-items: flex-start;
	}

	.cr-compare__review-count {
		text-align: left;
	}

	.cr-compare__logo {
		grid-area: logo;
		width: 75px;
		height: 75px;
		justify-self: end;
		align-self: start;
	}

	.cr-compare__logo:not(:has(.cr-compare__logo-img)) {
		display: none;
	}

	.cr-compare__logo-img {
		object-position: top;
	}

	.cr-compare__stars {
		width: 90px;
		height: 19px;
	}

	.cr-compare__details-text {
		text-align: left;
	}
}

/* Mobile: accordion behavior  */
@supports (container-type: inline-size) {
	@container compare-block (max-width: 520px) {
		.cr-compare__item {
			overflow: visible;
		}

		.cr-compare__cta {
			order: 2;
			width: 100%;
			box-sizing: border-box;
			min-width: 0;
		}

		.cr-compare__toggle {
			width: 100%;
			box-sizing: border-box;
			text-align: center;
		}

		.cr-compare__details {
			position: relative;
			padding: 0;
			background: transparent;
			border: none;
			border-radius: 0;
			order: 1;
			width: 100%;
			box-sizing: border-box;
			min-width: 0;
			max-height: 0;
			overflow: hidden;
			transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
			opacity: 0;
		}

		.cr-compare__details[data-mobile-hidden] {
			max-height: 0;
			opacity: 0;
		}

		.cr-compare__details:not([data-mobile-hidden]) {
			max-height: 500px;
			opacity: 1;
		}

		.cr-compare__details-text {
			flex-direction: column;
			gap: 12px;
			padding: 1rem 0;
			font-size: 1rem;
		}

		.cr-compare__detail-item {
			display: block;
		}

		.cr-compare__detail-item:not(:last-child)::after {
			content: none;
		}

		.cr-compare .cr-compare__toggle {
			display: flex;
		}

		.cr-compare__name {
			font-size: 1.2rem;
		}
	}
}

@supports not (container-type: inline-size) {
	@media (max-width: 520px) {
	.cr-compare__item {
		overflow: visible;
	}

	.cr-compare__cta {
		order: 2;
		width: 100%;
		box-sizing: border-box;
		min-width: 0; 
	}

	.cr-compare__toggle {
		width: 100%;
		box-sizing: border-box;
		text-align: center;
	}

	.cr-compare__details {
		position: relative;
		padding: 0;
		background: transparent;
		border: none;
		border-radius: 0;
		order: 1; 
		width: 100%;
		box-sizing: border-box;
		min-width: 0;
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
		opacity: 0;
	}

	.cr-compare__details[data-mobile-hidden] {
		max-height: 0;
		opacity: 0;
	}

	.cr-compare__details:not([data-mobile-hidden]) {
		max-height: 500px;
		opacity: 1;
	}

	.cr-compare__details-text {
		flex-direction: column;
		gap: 12px;
		padding: 1rem 0;
		font-size: 1rem;
	}

	.cr-compare__detail-item {
		display: block;
	}

	.cr-compare__detail-item:not(:last-child)::after {
		content: none;
	}

	.cr-compare .cr-compare__toggle {
		display: flex;
	}

	.cr-compare__name {
		font-size: 1.6rem;
	}
}
}

/* Empty state */
.cr-compare--empty {
	padding: 2rem;
	text-align: center;
	background: #f9f9f9;
	border: 1px dashed var(--cr-border);
	border-radius: var(--cr-radius);
}

.cr-compare--empty p {
	margin: 0;
	color: var(--cr-text-muted);
}


