/**
 * gp/recently-viewed
 *
 * Four compact cards across, as on the live site: a small cover on the left
 * and the details stacked beside it, rather than the tall grid card the rows
 * above use.
 */

.gp-recent__heading {
	margin: 0 0 16px;
	font-size: 18px;
	font-weight: 600;
}

.gp-recent__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

@media (max-width: 1000px) {
	.gp-recent__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* minmax(0, …) here too: a bare 1fr is never narrower than the card's longest
   unbreakable line, which on a 320px phone pushed the whole page sideways. */
@media (max-width: 560px) {
	.gp-recent__grid { grid-template-columns: minmax(0, 1fr); }
}

.gp-recent-card {
	display: flex;
	gap: 12px;
	box-sizing: border-box;
	padding: 14px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
}

.gp-recent-card__media {
	flex: none;
	align-self: flex-start;
	/* 90 wide by 120 tall, which the 3/4 ratio on the image below gives us.
	   72 was a guess and read a size small next to the live card. */
	inline-size: 90px;
	border-radius: 6px;
	background: var(--wp--preset--color--surface-muted);
	overflow: hidden;
}

.gp-recent-card__image {
	display: block;
	inline-size: 100%;
	block-size: auto;
	aspect-ratio: 3 / 4;
	object-fit: cover;
}

.gp-recent-card__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	min-inline-size: 0;
	flex: 1;
}

/* One line, clipped: the cards are narrow and a two-line title would push the
   button out of line with its neighbours. */
.gp-recent-card__title {
	margin: 0;
	inline-size: 100%;
	font-size: var(--wp--preset--font-size--base);
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.gp-recent-card__title a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

/* Same card as the grid uses on live, and the title there is inert. */
.gp-recent-card__title a:hover {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.gp-recent-card__publisher {
	max-inline-size: 100%;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--ink);
	text-decoration: underline;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.gp-recent-card__price {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
}

.gp-recent-card__price-now {
	font-size: var(--wp--preset--font-size--base);
	font-weight: 700;
	color: var(--wp--preset--color--brand-green);
}

.gp-recent-card__price-was {
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--ink);
	text-decoration: line-through;
}

/* WooCommerce wraps prices in <bdi> and its own del/ins. */
.gp-recent-card__price del,
.gp-recent-card__price ins {
	text-decoration: none;
	background: none;
	color: inherit;
}

.gp-recent-card__buy { margin: 0; }

.gp-recent-card__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-block-size: 38px;
	box-sizing: border-box;
	padding: 6px 12px;
	border: 2px solid var(--wp--preset--color--brand-green);
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--surface-dark);
	font-family: inherit;
	font-size: 13px;
	line-height: 1.3;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

/* Same outline button the grid card carries. */
.gp-recent-card__button:hover {
	background: #121212;
	color: #e3f0e9;
	border-color: #000;
}

.gp-recent-card__button-icon {
	flex: none;
	inline-size: 16px;
	block-size: 16px;
	background: currentColor;
	mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 10a4 4 0 0 1-8 0"/><path d="M3.103 6.034h17.794"/><path d="M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z"/></svg>') center / contain no-repeat;
}

/* theme.json underlines links on hover; the tile is a picture and live draws
   no rule under it. */
.gp-recent-card__media:hover { text-decoration: none; }
