/*
 * Components: cards. Loaded by the asset loader when a block on the page
 * carries a card or container style class (inc/assets.php, entry "cards").
 * The static look of each style (background, border, radius, padding,
 * shadow) is a partial in styles/blocks; this file adds the motion, sizing
 * and layout that theme.json cannot express.
 */

/* ---------- hover lift ---------- */

.is-style-revsults-card,
.is-style-card-featured {
	transition:
		transform var(--wp--custom--transition--base, 0.2s ease),
		box-shadow var(--wp--custom--transition--base, 0.2s ease);
}

@media (hover: hover) {
	.is-style-revsults-card:hover {
		transform: translateY(-6px);
		box-shadow: var(--wp--preset--shadow--lift);
	}

	.is-style-card-featured:hover {
		transform: translateY(-6px);
	}
}

/* The featured card stands out of the row on wide screens. */
@media (min-width: 1000px) {
	.is-style-card-featured {
		transform: scale(1.03);
	}
}

@media (min-width: 1000px) and (hover: hover) {
	.is-style-card-featured:hover {
		transform: scale(1.03) translateY(-6px);
	}
}

/* ---------- icon tile ---------- */

.is-style-icon-tile {
	display: grid;
	place-items: center;
	box-sizing: border-box;
	width: 56px;
	height: 56px;
	padding: 0;
	font-size: 1.6rem;
	line-height: 1;
}

.is-style-icon-tile > * {
	margin: 0;
}

/* ---------- avatar (initials or a small photo) ---------- */

.is-style-avatar {
	display: grid;
	place-items: center;
	flex: none;
	box-sizing: border-box;
	width: 42px;
	height: 42px;
	padding: 0;
	overflow: hidden;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: var(--wp--custom--typography--font-weight--heading, 600);
	line-height: 1;
	text-align: center;
}

.is-style-avatar.is-large {
	width: 88px;
	height: 88px;
	font-size: var(--wp--preset--font-size--x-large);
}

.is-style-avatar > * {
	margin: 0;
}

.is-style-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
}

/* ---------- media area (group variant; the cover variant is in blocks/cover.css) ---------- */

.is-style-media {
	position: relative;
	overflow: hidden;
}

.wp-block-group.is-style-media > .wp-block-image,
.wp-block-group.is-style-media > figure {
	margin: 0;
}

.wp-block-group.is-style-media img {
	display: block;
	width: 100%;
	border-radius: 0;
}

/* ---------- price row (name left, amount right) ---------- */

.is-style-price-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 14px;
}

.is-style-price-row > * {
	margin: 0;
}

.is-style-price-row > :first-child {
	flex: 1 1 auto;
	min-width: 0;
}

.is-style-price-row > :last-child {
	flex: none;
}

/* ---------- natural (uncropped: the whole picture, the box follows its ratio) ----------
 * Style "Uncropped" on Image, Featured image, Group and Cover. "Media area"
 * stays the cropping frame for decorative images. */

.is-style-natural img {
	width: 100%;
	height: auto;
	object-fit: contain;
	aspect-ratio: auto;
}

/* A crop the block itself carries (aspect ratio, scale or height set in the
 * editor sidebar prints as an inline style) must not win over "Uncropped". */
.is-style-natural img[style*="aspect-ratio"],
.is-style-natural img[style*="object-fit"],
.is-style-natural img[style*="height"] {
	height: auto !important;
	object-fit: contain !important;
	aspect-ratio: auto !important;
}

/* Cover keeps its frame and positioning; the picture is letterboxed, not cropped.
 * height stays 100%: the generic rule above would shrink the absolutely
 * positioned background to its own height and the frame would crop it. */
.wp-block-cover.is-style-natural .wp-block-cover__image-background {
	height: 100%;
	object-fit: contain;
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.is-style-revsults-card,
	.is-style-card-featured {
		transition: none;
	}
}
