/*
 * Design System - AELITA
 * components/ai-moto-banner.css - AI moto selection card in /moto.
 *
 * A poster-like promo card: one sharp-cornered link, a CSS background photo,
 * real HTML copy and a DS primary CTA. The composition keeps the motorcycle
 * visible on the right while the editorial copy sits in a dark top-left
 * field. It fills the same Bootstrap column as a moto card and relies on the
 * existing .eheight/matchHeight rhythm, so its height always matches the
 * neighbouring product cards. No fixed 700px height, no radius, no shadow.
 *
 * Consumes tokens.css and button.css only. Loaded on is_post_type_archive(
 * 'motopost' ) only (see inc/enqueue.php); no other catalog is affected.
 */

/* -------------------------------------------------------------------- */
/* Card                                                                  */
/* -------------------------------------------------------------------- */
.a-ai-moto-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: flex-start;
	height: 100%;
	min-height: 0;
	padding: var(--space-5);
	overflow: hidden;
	/* Fallback if the background file is unavailable. */
	background-color: var(--c-ink-900);
	background-position: 84% center;
	background-repeat: no-repeat;
	background-size: cover;
	border-radius: var(--radius);
	color: var(--text-on-brand);
	text-decoration: none;
}

/* Editorial scrim: a dark top-left field for the copy, a light bottom
 * vignette for depth, and an untouched right side for the motorcycle. */
.a-ai-moto-card::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(120% 90% at 0% 0%, rgba(22, 22, 24, 0.84) 0%, rgba(22, 22, 24, 0.46) 42%, rgba(22, 22, 24, 0) 72%),
		linear-gradient(180deg, rgba(22, 22, 24, 0.28) 0%, rgba(22, 22, 24, 0) 30%),
		linear-gradient(0deg, rgba(22, 22, 24, 0.42) 0%, rgba(22, 22, 24, 0) 32%);
	pointer-events: none;
}

/* Beat the theme/Bootstrap link hover (blue color + underline). */
.a-ai-moto-card:hover,
.a-ai-moto-card:focus {
	color: var(--text-on-brand);
	text-decoration: none;
}

/* Keyboard focus stays visible inside the card, like the car card. */
.a-ai-moto-card:focus-visible {
	box-shadow: inset 0 0 0 2px var(--focus-ring);
}

/* -------------------------------------------------------------------- */
/* Content                                                               */
/* -------------------------------------------------------------------- */
.a-ai-moto-card__content {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-3);
	max-width: 82%;
}

/* Small AI marker: red square + wide-tracked label. */
.a-ai-moto-card__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	color: var(--text-on-brand);
	font-family: var(--font-body);
	font-size: 11px;
	font-weight: var(--fw-bold);
	line-height: 1;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.a-ai-moto-card__eyebrow-mark {
	display: block;
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	background-color: var(--c-red-600);
}

/* Poster headline: two deliberate lines, tight leading, large enough to
 * carry the card without becoming a wall of text. */
.a-ai-moto-card__title {
	display: block;
	max-width: 8.5em;
	font-family: var(--font-display-strong);
	font-size: clamp(26px, 2.3vw, 32px);
	font-weight: var(--fw-bold);
	line-height: 1.03;
	letter-spacing: -0.01em;
	color: var(--text-on-brand);
	text-transform: uppercase;
	text-wrap: balance;
}

.a-ai-moto-card__text {
	display: block;
	max-width: 29ch;
	font-family: var(--font-body);
	font-size: clamp(15px, 1.1vw, 16px);
	font-weight: var(--fw-regular);
	line-height: 1.45;
	color: var(--text-on-brand);
}

/* -------------------------------------------------------------------- */
/* CTA                                                                   */
/* -------------------------------------------------------------------- */
.a-ai-moto-card__cta {
	width: 100%;
	max-width: 200px;
	justify-content: space-between;
	gap: var(--space-1);
	margin-block-start: var(--space-2);
	padding-inline: var(--space-3);
	white-space: nowrap;
}

.a-ai-moto-card__cta-label {
	display: block;
}

.a-ai-moto-card__cta-arrow {
	display: block;
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	transition: transform var(--dur-press) var(--ease-out);
}

/* -------------------------------------------------------------------- */
/* States                                                               */
/* -------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
	.a-ai-moto-card:hover .a-ai-moto-card__cta {
		background-color: var(--c-red-700);
		border-color: var(--c-red-700);
		color: var(--text-on-brand);
	}

	.a-ai-moto-card:hover .a-ai-moto-card__cta-arrow {
		transform: translateX(3px);
	}
}

/* Tablet/mobile: a slightly narrower CTA keeps the red block clear of the
 * motorcycle windscreen at 768-991px. */
@media (max-width: 991px) {
	.a-ai-moto-card {
		background-position: 88% center;
	}

	.a-ai-moto-card__cta {
		max-width: 190px;
		font-size: 15px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.a-ai-moto-card__cta-arrow {
		transition-duration: 0.01ms;
	}
}

/* -------------------------------------------------------------------- */
/* Grid rhythm                                                          */
/* -------------------------------------------------------------------- */
/* Mirrors car-card.css: columns containing a card keep the same 24px row
 * gap. :has() leaves every other catalog/legacy card untouched. */
@supports selector(:has(*)) {
	.col-xs-12:has(> .a-ai-moto-card),
	.col-sm-6:has(> .a-ai-moto-card),
	.col-md-4:has(> .a-ai-moto-card) {
		margin-block-end: var(--space-5);
	}
}

/* Empty catalog (0 results): there is no neighbouring moto card to match,
 * so fall back to the design's 768:700 proportion instead of collapsing to
 * the text height. The normal grid is unaffected. */
.a-ai-moto-card-cell--empty .a-ai-moto-card {
	aspect-ratio: 768 / 700;
	padding: var(--space-4);
}

.a-ai-moto-card-cell--empty .a-ai-moto-card__content {
	max-width: 64%;
	gap: var(--space-2);
}

.a-ai-moto-card-cell--empty .a-ai-moto-card__title {
	max-width: 7em;
	font-size: 24px;
	line-height: 1.05;
}

.a-ai-moto-card-cell--empty .a-ai-moto-card__text {
	max-width: 24ch;
	font-size: var(--fs-small);
}

.a-ai-moto-card-cell--empty .a-ai-moto-card__cta {
	max-width: 170px;
	padding-inline: 10px;
	font-size: 14px;
}

.a-ai-moto-card-cell--empty .a-ai-moto-card__cta-arrow {
	width: 16px;
	height: 16px;
}

/* -------------------------------------------------------------------- */
/* Mobile                                                               */
/* -------------------------------------------------------------------- */
@media (max-width: 767px) {
	.a-ai-moto-card {
		padding: var(--space-4);
	}

	.a-ai-moto-card__content {
		max-width: 88%;
	}

	.a-ai-moto-card__title {
		font-size: clamp(26px, 7vw, 30px);
	}

	.a-ai-moto-card__text {
		font-size: var(--fs-small);
	}

	.a-ai-moto-card__cta {
		max-width: 180px;
		padding-inline: 10px;
	}
}
