/*
 * "The complete US property database" - Detect / Defend / Decide bento.
 *
 * Measured off the 1440px frame: 1280 container, three 411px columns with a
 * 24px gutter, cells at the design's 411x378 ratio. Text cards sit on the
 * surface-muted grey; imagery fills the alternating cells.
 */

.usdb {
	padding-block: var(--section-y);
	background: var(--color-bg-default);
}

.usdb__head {
	max-width: 760px;
	margin-inline: auto;
	margin-bottom: var(--space-64);
	text-align: center;
}

.usdb__title {
	margin: 0;
	color: var(--color-text-primary);
}

.usdb__title em {
	color: var(--color-primary);
}

.usdb__lead {
	max-width: 720px;
	margin: var(--space-16) auto 0;
	font-family: var(--font-body);
	font-size: var(--text-body);
	line-height: var(--lh-body);
	color: var(--color-text-muted);
}

/* --- Bento ---------------------------------------------------------------- */

.usdb__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-24);
}

.usdb-card,
.usdb-media {
	aspect-ratio: 411 / 378;
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.usdb-card {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: var(--space-24);
	padding: var(--space-32);
	position: relative;
	isolation: isolate;
	background: var(--color-surface-muted);
	cursor: pointer;
	transition: color 380ms var(--ease-out-quart);
}

/* The hover fill lives on a pseudo-element and cross-fades in via opacity:
   `background` cannot transition from a solid colour into a gradient, so
   animating the shorthand snaps. Opacity animates smoothly for all three. */
.usdb-card::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: 0;
	transition: opacity 380ms var(--ease-out-quart);
}

.usdb-card--detect::before {
	background: var(--color-primary);
}

.usdb-card--defend::before {
	background: var(--color-primary-light);
}

.usdb-card--decide::before {
	background: linear-gradient(135deg, #6c2d8e 0%, #a8446a 52%, #ca5744 100%);
}

/* Hover reveals the fill and turns the content white. The icon is a dark PNG,
   so brightness/invert flips it to white to match. */
.usdb-card:hover::before {
	opacity: 1;
}

.usdb-card:hover {
	color: var(--color-text-inverse);
}

.usdb-card:hover .usdb-card__title,
.usdb-card:hover .usdb-card__text {
	color: var(--color-text-inverse);
}

.usdb-card__icon {
	transition: filter 380ms var(--ease-out-quart);
}

.usdb-card:hover .usdb-card__icon {
	filter: brightness(0) invert(1);
}

@media (prefers-reduced-motion: reduce) {
	.usdb-card,
	.usdb-card__icon {
		transition: none;
	}
}

.usdb-card__icon {
	width: 48px;
	height: 48px;
	object-fit: contain;
	object-position: left center;
}

.usdb-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-12);
}

.usdb-card__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--text-h4);
	font-weight: 600;
	line-height: 1.2;
	color: var(--color-text-primary);
}

.usdb-card__text {
	margin: 0;
	font-family: var(--font-body);
	font-size: var(--text-body);
	line-height: var(--lh-body);
	color: var(--color-text-muted);
}

/* --- Media cells ---------------------------------------------------------- */

.usdb-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.usdb-media--dark {
	background: #14112b;
}

.usdb-media--surface {
	background: var(--color-surface-muted);
}

/* --- Mobile --------------------------------------------------------------- */

/* No dedicated mobile artboard for this section yet: stack to one column so the
   concept card and its image read as a pair. */
@media (max-width: 900px) {
	.usdb__grid {
		grid-template-columns: 1fr;
	}

	.usdb-card,
	.usdb-media {
		aspect-ratio: auto;
	}

	.usdb-card {
		gap: var(--space-32);
		min-height: 300px;
	}

	.usdb-media {
		aspect-ratio: 16 / 10;
	}
}

@media (max-width: 767px) {
	/* Mobile sets the heading and lead flush left, and lets the headline flow
	   instead of breaking where the desktop measure wanted it. */
	.usdb__head {
		text-align: left;
	}

	.usdb__title br {
		display: none;
	}
}

@media (max-width: 767px) {
	/* Mobile keeps the three claims and drops the imagery between them. */
	.usdb-media {
		display: none;
	}
}
