/* ==========================================================================
   Tausi — image product card (alternative to the type-led .ts-product card)
   Used on the products page and product archives when
   Tausi settings › Display › Product card style = Image card.
   Tokens come from tausi.css. Class prefix: ts-product-card.
   ========================================================================== */

/* Grid: 1 → 2 → 3 columns. Cards in a row share height; the foot sits at the bottom. */
.ts-product-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-xl);
	list-style: none;
	margin: 0;
	padding: 0;
}
@media (min-width: 640px) { .ts-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .ts-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter-desktop); } }
@media (min-width: 1024px) { .ts-product-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Card */
.ts-product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	overflow: hidden;
	transition: border-color var(--duration-instant) var(--ease-standard), box-shadow var(--duration-quick) var(--ease-standard);
}
.ts-product-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.ts-product-card:focus-within { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* Media: fixed ratio, never text over the photo */
.ts-product-card__media {
	position: relative;
	aspect-ratio: var(--ts-card-ratio, 4 / 3);
	background: var(--surface-subtle);
	overflow: hidden;
}
.ts-product-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform var(--duration-considered) var(--ease-standard);
}
.ts-product-card__media[data-focus="top"] img { object-position: center top; }
.ts-product-card__media[data-focus="bottom"] img { object-position: center bottom; }
.ts-product-card__media[data-focus="left"] img { object-position: left center; }
.ts-product-card__media[data-focus="right"] img { object-position: right center; }
.ts-product-card:hover .ts-product-card__media img { transform: scale(1.03); }

/* Ratio switches, set on the grid by Display › Image ratio */
.ts-product-grid[data-ratio="16-9"] { --ts-card-ratio: 16 / 9; }
.ts-product-grid[data-ratio="1-1"] { --ts-card-ratio: 1 / 1; }

/* No image (fallback = type): an icon panel the same height as a photo, so rows stay aligned */
.ts-product-card__media--empty {
	display: grid;
	place-items: center;
	background: var(--brand-primary-soft);
	color: var(--brand-primary);
}
.ts-product-card__media--empty .ts-icon { width: var(--icon-xl); height: var(--icon-xl); }

/* Body */
.ts-product-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
	flex: 1;
	padding: var(--space-lg) var(--space-xl) var(--space-xl);
}
.ts-product-card__cat {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	font-size: 12px;
	line-height: 16px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-muted);
}
.ts-product-card__cat .ts-icon { width: var(--icon-sm); height: var(--icon-sm); color: var(--brand-primary); }
.ts-product-card__title { margin: 0; font-size: 20px; line-height: 26px; font-weight: 500; letter-spacing: -0.005em; text-wrap: balance; }
.ts-product-card__title a { color: var(--text-primary); text-decoration: none; }
.ts-product-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* whole card is the link */
.ts-product-card__title a:focus-visible { outline: none; }
.ts-product-card:hover .ts-product-card__title a { color: var(--brand-primary); }
.ts-product-card__summary { margin: 0; font-size: 15px; line-height: 24px; color: var(--text-secondary); }

/* Foot: tag left, action right, pinned to the bottom */
.ts-product-card__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	margin-top: auto;
	padding-top: var(--space-md);
	font-size: 15px;
	font-weight: 500;
	color: var(--brand-primary);
}
.ts-product-card__foot .ts-icon { width: 18px; height: 18px; transition: transform var(--duration-quick) var(--ease-standard); }
.ts-product-card:hover .ts-product-card__foot .ts-icon { transform: translateX(3px); }
.ts-product-card__foot .ts-tag { position: relative; z-index: 2; }

@media (max-width: 639px) {
	/* Phones: compact horizontal card so a 39-item list stays scannable */
	.ts-product-grid--compact-mobile .ts-product-card { flex-direction: row; }
	.ts-product-grid--compact-mobile .ts-product-card__media { flex: 0 0 112px; aspect-ratio: auto; min-height: 100%; }
	.ts-product-grid--compact-mobile .ts-product-card__body { padding: var(--space-md) var(--space-lg); }
	.ts-product-grid--compact-mobile .ts-product-card__summary { display: none; }
	.ts-product-grid--compact-mobile .ts-product-card__title { font-size: 17px; line-height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.ts-product-card__media img, .ts-product-card__foot .ts-icon { transition: none; }
	.ts-product-card:hover .ts-product-card__media img { transform: none; }
}
