/*
 * Recipe tile: CARD | RECEITAS - CONFEITARIA, inside node 813:45703.
 *
 * 392 x 412 in the node, photo 240 tall and a white body with 24 of padding. The tile
 * fills the width its grid or carousel gives it and never sets its own, so the same rules
 * serve the 3 column listing, the 1 column mobile and the 392px carousel item.
 *
 * Written mobile first: no rule below needs a breakpoint.
 */

.recipe-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	border-radius: var(--radius-card);
	background-color: var(--color-surface);
	box-shadow: var(--shadow-recipe-tile);
	overflow: hidden;
}

/* No featured image leaves an empty gray box, never an <img> with an empty src. */
.recipe-tile__media {
	/* Context of the clip over the photo (media-motion.css). */
	position: relative;
	flex: none;
	height: 240px;
	background-color: var(--color-surface-muted);
	overflow: hidden;
}

.recipe-tile__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--duration-thumb-hover) var(--ease-out);
}

/*
 * Provisional: the node has no hover. The zoom is the one of the article thumbnails, so
 * every photo card of the site reacts the same way.
 */
.recipe-tile:hover .recipe-tile__image,
.recipe-tile:focus-within .recipe-tile__image,
.recipe-tile:hover .media-motion,
.recipe-tile:focus-within .media-motion {
	transform: scale(1.06);
}

/* The clip over the photo (media-motion.css) zooms with it. */
.recipe-tile .media-motion {
	transition:
		opacity var(--duration-thumb-hover) var(--ease-out),
		transform var(--duration-thumb-hover) var(--ease-out);
}

/* justify-content: space-between in the node: the footer sits at the bottom of the 172. */
.recipe-tile__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: space-between;
	gap: var(--space-4);
	min-height: 172px;
	padding: var(--space-4);
}

.recipe-tile__heading {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}

/* The hat comes after the title in the DOM, so a screen reader hears the title first. */
/*
 * One line, as in the node. The catalogue names are longer than the Figma placeholders
 * ("Requeijão Culinário Profissional Cheddar"), so the product name gives way with an
 * ellipsis and the tag keeps its size. The full name is on the recipe page.
 */
.recipe-tile__hat {
	order: -1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-1);
	min-width: 0;
}

.recipe-tile__product {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	color: var(--color-text);
	font-size: var(--font-p3);
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Pushed right even when the product is missing, as in the node. */
.recipe-tile__tag {
	display: inline-flex;
	flex: none;
	align-items: center;
	height: 24px;
	margin-inline-start: auto;
	padding-inline: var(--space-3);
	border-radius: var(--radius-pill);
	background-color: var(--color-tag-segment-bg);
	color: var(--color-heading);
	font-size: var(--font-p4);
	line-height: 1.2;
	text-transform: uppercase;
	white-space: nowrap;
}

.recipe-tile__title {
	font-size: var(--font-h6);
}

/* The whole tile is the link: same pattern as .article-card__link in school.css. */
.recipe-tile__link::before {
	position: absolute;
	z-index: 1;
	inset: 0;
	content: '';
}

/*
 * The ring goes around the tile, not around the title text: the link covers the tile, so
 * that is the target the keyboard user is on. :has() keeps it keyboard only, which
 * :focus-within would not.
 */
.recipe-tile__link:focus-visible {
	outline: none;
}

.recipe-tile:has(.recipe-tile__link:focus-visible) {
	outline: 2px solid var(--color-focus-ring);
	outline-offset: 2px;
}

.recipe-tile__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-1) var(--space-3);
}

.recipe-tile__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-1);
}

.recipe-tile__meta-item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--color-text);
	font-size: var(--font-p3);
	line-height: 1.3;
	white-space: nowrap;
}

.recipe-tile__meta-icon {
	flex: none;
	width: 18px;
	height: 18px;
}

.recipe-tile__meta-icon--yield {
	width: 20px;
	height: 19px;
}

/* LINK | MENU dark: P3 16 M Blue 10, 12px arrow, 8 of gap, 12 of vertical padding. */
.recipe-tile__cta {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	margin-inline-start: auto;
	padding-block: var(--space-2);
	color: var(--color-heading);
	font-size: var(--font-p3);
	font-weight: 500;
	line-height: 1.3;
}

.recipe-tile__cta-icon {
	width: 12px;
	height: 12px;
}

/* The underline follows the tile, the element that is actually the link. */
.recipe-tile:hover .recipe-tile__cta-text::after,
.recipe-tile:focus-within .recipe-tile__cta-text::after {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.recipe-tile__image {
		transition: none;
	}

	.recipe-tile:hover .recipe-tile__image,
	.recipe-tile:focus-within .recipe-tile__image,
	.recipe-tile:hover .media-motion,
	.recipe-tile:focus-within .media-motion {
		transform: none;
	}
}
