/**
 * Variant CSS: before-after--hover-swap-cards
 * Layer 2 — Path B before-after role (2026-06-06).
 * A grid of case cards. At rest each card shows the "before" frame; on hover the
 * "after" frame cross-fades in over it (pure CSS, no JS). Corner tags swap with
 * it (Przed visible at rest, Po visible on hover). Distinct from gallery-pairs
 * (two frames side-by-side at once): here one frame toggles into the other.
 * Text stays --ink (polarity-aware); kicker, em and the Po tag take --accent.
 * Reduced-motion: both frames are stacked vertically so the comparison is never
 * hidden behind a hover the user can't trigger. Images are literal uploads.
 */

body.aibt-universal .universal-before-after--hover-swap-cards {
	padding-block: calc(clamp(3rem, 7vw, 5rem) * var(--density, 1));
	color: var(--ink);
}

/* Intro — centred block, A8-safe (horizontal-auto margins preserved). */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__intro {
	margin-bottom: clamp(2rem, 4.5vw, 3rem);
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__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) !important;
	margin: 0 auto var(--space-sm) auto !important;
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__headline {
	font-family: var(--font-display) !important;
	color: var(--ink) !important;
	margin: 0 auto !important;
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__headline em {
	color: var(--accent) !important;
	font-style: italic;
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__deck {
	font-family: var(--font-body) !important;
	font-size: var(--text-base) !important;
	line-height: var(--leading-relaxed) !important;
	color: var(--ink) !important;
	opacity: 0.78;
	margin: var(--space-sm) auto 0 auto !important;
	max-width: 52ch;
}

/* Cards grid — 3 equal columns. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(1.2rem, 3vw, 2rem);
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card {
	display: flex;
	flex-direction: column;
}

/* Swap stage — relative box that overlays after-on-before. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__swap {
	position: relative;
	overflow: hidden;
	border-radius: var(--decor-radius, 14px);
	border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
	box-shadow: 0 16px 40px -28px color-mix(in srgb, var(--ink) 42%, transparent);
	transition: box-shadow var(--duration-fast, 240ms) var(--ease-default, ease);
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__swap:hover {
	box-shadow: 0 22px 52px -26px color-mix(in srgb, var(--ink) 50%, transparent);
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__img {
	margin: 0 !important;
	display: block;
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__img img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	filter: var(--photo-filter, none);
}

/* Before = base layer (in flow, sets the box height). */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__img--before {
	position: relative;
	z-index: 1;
}

/* After = overlay, hidden until hover. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__img--after {
	position: absolute;
	inset: 0;
	z-index: 2;
	opacity: 0;
	transition: opacity var(--duration-fast, 240ms) var(--ease-default, ease);
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__img--after img {
	height: 100%;
}

/* Reveal "after" on hover / keyboard focus within the card. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__swap:hover .universal-before-after__img--after,
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card:focus-within .universal-before-after__img--after {
	opacity: 1;
}

/* Corner tags — fixed rgba drop-shadow lifts each chip off the photo
   (theme-independent, correct text-on-photo pattern). */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__tag {
	position: absolute;
	top: var(--space-sm);
	left: var(--space-sm);
	z-index: 3;
	font-family: var(--font-body) !important;
	font-size: var(--text-xs) !important;
	font-weight: 700 !important;
	letter-spacing: var(--tracking-wide) !important;
	text-transform: uppercase !important;
	margin: 0 !important;
	padding: 0.35em 0.8em !important;
	border-radius: var(--decor-radius-pill);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28), 0 1px 2px rgba(0, 0, 0, 0.22);
	transition: opacity var(--duration-fast, 240ms) var(--ease-default, ease);
}

/* "Przed" — neutral dark chip, visible at rest. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__tag--before {
	background: var(--background-dark, #141414);
	color: var(--text-on-dark, #fff) !important;
	opacity: 1;
}

/* "Po" — accent chip, hidden until hover. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__tag--after {
	background: var(--cta-bg-primary);
	color: var(--cta-text-primary) !important;
	opacity: 0;
}

/* Swap which tag is visible on hover / focus-within. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__swap:hover .universal-before-after__tag--before,
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card:focus-within .universal-before-after__tag--before {
	opacity: 0;
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__swap:hover .universal-before-after__tag--after,
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card:focus-within .universal-before-after__tag--after {
	opacity: 1;
}

/* Card title under the stage. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card-title {
	font-family: var(--font-display) !important;
	font-size: var(--text-lg) !important;
	font-weight: 600 !important;
	line-height: 1.25 !important;
	color: var(--ink) !important;
	margin: var(--space-sm) 0 0 0 !important;
}

/* A hint that hover reveals more — subtle underline that fills on hover. */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card-title::after {
	content: "";
	display: block;
	width: 2rem;
	height: 2px;
	margin-top: 0.55rem;
	background: var(--accent);
	border-radius: var(--decor-radius-pill);
	transition: width var(--duration-fast, 240ms) var(--ease-default, ease);
}

body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card:hover .universal-before-after__card-title::after,
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card:focus-within .universal-before-after__card-title::after {
	width: 3.5rem;
}

/* Focus-visible ring on the interactive card stage (keyboard parity). */
body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__swap:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Tablet — 2 columns. */
@media (max-width: 900px) {
	body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Mobile — one card per row. */
@media (max-width: 560px) {
	body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__grid {
		grid-template-columns: 1fr;
		gap: clamp(1.4rem, 5vw, 2rem);
	}
}

/* Cap uppercase tracking on small screens (A5). */
@media (max-width: 640px) {
	body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__kicker,
	body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__tag {
		letter-spacing: 0 !important;
	}
}

/* Reduced-motion — no hover swap. Show BOTH frames stacked vertically so the
   comparison is always available without a hover the user can't perform. */
@media (prefers-reduced-motion: reduce) {
	body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__img--after {
		position: static;
		inset: auto;
		opacity: 1;
		margin-top: 3px !important;
	}
	body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__img--after img {
		height: auto;
	}
	body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__tag--after {
		opacity: 1;
		top: auto;
		bottom: var(--space-sm);
	}
	body.aibt-universal .universal-before-after--hover-swap-cards .universal-before-after__card-title::after {
		transition: none;
	}
}
