/**
 * Variant CSS: hero--overlap-card-on-photo
 * Layer 2 — Variants Library (Path B Recipes architecture).
 *
 * Concept: a LARGE dominant photo anchored at the top (full-width, ~16:8),
 * with a WHITE content card overlapping the photo's LOWER edge — lifted onto
 * the white page with a soft elevated shadow + generous padding. Editorial
 * "card-on-image" lift designed to read premium on a white-background page.
 *
 * The photo is a real <img> (NOT a CSS background) so the recipe pipeline can
 * override it by swapping the first <img src>. Cropping is done here via
 * object-fit:cover + aspect-ratio. The card is a plain wp:group (NOT wp:cover).
 *
 * White-bg safety: card uses --background-card with --text-primary inside, so
 * it stays AA-legible both over the photo and grounded on the white page. The
 * card is driven by tokens — light themes get a solid card; should a dark theme
 * adopt this variant, --background-card / --text-primary follow the theme.
 *
 * @package AI_Base_Theme
 * @since 2026-05-29 (Phase 2 Path B — overlap-card-on-photo hero)
 */

body.aibt-universal .universal-hero--overlap-card-on-photo {
	position: relative;
	background: var(--background, #fff);
	/* Bottom padding gives the overlapping card room to sit on the white page. */
	padding-bottom: calc(clamp(var(--space-lg), 7vw, var(--space-xl)) * var(--density, 1));
	overflow: hidden;
}

/* === Dominant top photo (full-width, ~16:8) === */
body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__photo {
	margin: 0;
	width: 100%;
	position: relative;
	z-index: 0;
}

body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__photo img {
	display: block;
	width: 100%;
	/* 16:8 — tall, dominant. height capped so the photo never eats huge screens. */
	aspect-ratio: 16 / 8;
	max-height: 78vh;
	object-fit: cover;
	object-position: center 42%;
	border-radius: var(--decor-radius-photo, var(--decor-radius, 0));
}

/* === Content wrapper: constrained, pulled UP to overlap the photo edge === */
body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__content {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: var(--max-wide, 1280px);
	margin-left: auto;
	margin-right: auto;
	padding-left: clamp(var(--space-md), 5vw, var(--space-xl));
	padding-right: clamp(var(--space-md), 5vw, var(--space-xl));
	/* Lift the card onto the photo's lower edge — the editorial overlap. */
	margin-top: clamp(-9rem, -10vw, -5rem);
}

/* === White overlapping card === */
body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__card {
	max-width: 46rem;
	background: var(--background-card, #fff);
	color: var(--text-primary, var(--ink));
	padding: clamp(var(--space-lg), 4.5vw, var(--space-xl));
	border: var(--decor-border-width, 1px) solid var(--divider-primary, var(--line, rgba(15, 20, 25, 0.1)));
	border-radius: var(--decor-radius, 0);
	/* Soft elevated lift so the card floats above both photo and white page. */
	box-shadow: var(--decor-shadow-elevated, 0 8px 32px rgba(15, 20, 25, 0.12));
}

body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__kicker {
	font-family: var(--font-body) !important;
	font-size: var(--text-xs) !important;
	font-weight: 600 !important;
	letter-spacing: var(--tracking-widest) !important;
	text-transform: uppercase !important;
	color: var(--accent, var(--text-secondary)) !important;
	margin: 0 0 var(--space-md) 0 !important;
}

body.aibt-universal .universal-hero--overlap-card-on-photo h1.universal-hero__headline,
body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__headline {
	font-family: var(--font-display) !important;
	color: var(--text-primary, var(--ink)) !important;
	margin: 0 0 var(--space-md) 0 !important;
	max-width: 16ch;
	/* font-size + line-height inherited z block inline style.typography */
}

body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__headline em {
	font-style: italic;
	color: var(--italic-color, var(--accent, currentColor));
	font-weight: var(--italic-weight, 600);
}

body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__deck {
	font-family: var(--font-body) !important;
	font-size: var(--text-lg) !important;
	line-height: var(--leading-normal) !important;
	color: var(--text-secondary, var(--ink-soft)) !important;
	margin: 0 0 var(--space-lg) 0 !important;
	max-width: 52ch;
}

/* === Primary CTA — solid fill (the one clear action) === */
body.aibt-universal .universal-hero--overlap-card-on-photo .wp-block-button.universal-hero__cta .wp-block-button__link {
	font-family: var(--font-body);
	font-weight: 600;
	font-size: var(--text-base);
	letter-spacing: var(--tracking-wide);
	padding: 1.1rem 2.5rem;
	color: var(--cta-text-primary, #fff);
	background: var(--cta-bg-primary, var(--ink));
	border: var(--decor-border-width, 1px) solid var(--cta-border-primary, var(--ink));
	border-radius: var(--decor-radius, 0);
	transition: background var(--duration-fast, 240ms) var(--ease-snappy, ease),
		border-color var(--duration-fast, 240ms) var(--ease-snappy, ease),
		transform var(--duration-fast, 240ms) var(--ease-snappy, ease);
	min-height: var(--target-min, 44px);
	display: inline-flex;
	align-items: center;
}

body.aibt-universal .universal-hero--overlap-card-on-photo .wp-block-button.universal-hero__cta .wp-block-button__link:hover {
	background: var(--accent-hover, var(--accent, currentColor));
	border-color: var(--accent-hover, var(--accent, currentColor));
	transform: translateY(-2px);
}

/* Keyboard focus ring — visible outline for non-pointer navigation (a11y). */
body.aibt-universal .universal-hero--overlap-card-on-photo .wp-block-button.universal-hero__cta .wp-block-button__link:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: var(--focus-offset, 4px);
}

/* === Tablet / smaller desktop: shrink the overlap so it stays intentional === */
@media (max-width: 781px) {
	body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__photo img {
		aspect-ratio: 16 / 10;
		object-position: center 40%;
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__content {
		/* Gentle overlap only — card still kisses the photo edge. */
		margin-top: clamp(-4rem, -8vw, -2rem);
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__card {
		/* WP's constrained layout centres the card with auto/auto margins
		   (!important) + max-width:100%. We can't beat the margins, so instead
		   cap the width below the wrapper — auto margins then yield symmetric
		   gutters on both sides (fixes the flush-right card bleed). */
		max-width: calc(100% - 2 * var(--space-md));
		padding: clamp(var(--space-md), 6vw, var(--space-lg));
	}
}

/* === Mobile: clean STACK — card sits fully below the photo, no overlap === */
@media (max-width: 640px) {
	/* Drop uppercase kicker tracking on the smallest screens (KI-003). */
	body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__kicker {
		letter-spacing: 0 !important;
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo {
		padding-bottom: var(--space-lg);
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__photo img {
		aspect-ratio: 4 / 3;
		max-height: 60vh;
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__content {
		/* No negative pull on phones — avoids awkward overlap on narrow screens. */
		margin-top: 0;
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__card {
		/* Lift the stacked card up just enough to overlap the photo seam cleanly.
		   Width capped below wrapper so WP's auto margins give equal gutters. */
		margin-top: calc(-1 * var(--space-lg));
		max-width: calc(100% - 2 * var(--space-md));
		position: relative;
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo .universal-hero__headline {
		max-width: none;
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo .wp-block-button.universal-hero__cta .wp-block-button__link {
		width: 100%;
		justify-content: center;
		/* Trim side padding so the label stays on one line in the narrow card. */
		padding-left: var(--space-md);
		padding-right: var(--space-md);
		white-space: nowrap;
	}
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
	body.aibt-universal .universal-hero--overlap-card-on-photo .wp-block-button.universal-hero__cta .wp-block-button__link {
		transition: none;
	}

	body.aibt-universal .universal-hero--overlap-card-on-photo .wp-block-button.universal-hero__cta .wp-block-button__link:hover {
		transform: none;
	}
}
