/* -------------------------------------------------------------------------
   7.2 Cards
   ------------------------------------------------------------------------- */

.tg-card__link {
	display: block;
}

.tg-card__link:hover {
	text-decoration: none;
}

/* Media */
.tg-card__media {
	aspect-ratio: 4 / 5;
	margin-bottom: var(--space-2);
	overflow: hidden;
	background: var(--stone);
}

.tg-card__media--artwork {
	display: grid;
	place-items: center;
	aspect-ratio: 1;
	padding: var(--space-2);
}

.tg-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s ease;
}

.tg-card__image--contain {
	object-fit: contain;
}

.tg-card__image--empty {
	width: 100%;
	height: 100%;
}

.tg-card__link:hover .tg-card__image {
	transform: scale(1.03);
}

/* Text */
/* Underline drawn left to right on hover, like the navigation links.
   Inline, so the line follows the text (line by line on long titles). */
.tg-card__title {
	display: inline;
	margin: 0;
	padding-bottom: 0.1em;
	font-family: var(--font-serif);
	font-size: 1.25rem;
	background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
	transition: background-size 0.35s ease;
}

.tg-card__link:hover .tg-card__title,
.tg-card__link:focus-visible .tg-card__title {
	background-size: 100% 1px;
}

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

.tg-card__year {
	color: var(--mute);
}

.tg-card__artist {
	margin: 0 0 0.15rem;
	font-size: var(--size-s);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.tg-card__meta,
.tg-card__count {
	margin: 0.15rem 0 0;
	font-size: var(--size-s);
	color: var(--mute);
}

/* "Price on request" */
.tg-card__price {
	margin: var(--space-1) 0 0;
	font-size: 0.8rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* Artwork card variant: bigger image padding and title */
.tg-card--artwork .tg-card__media {
	margin-bottom: var(--space-3);
	padding: var(--space-3);
}

.tg-card--artwork .tg-card__title {
	font-size: 1.5rem;
}

.tg-card--artwork .tg-card__artist,
.tg-card--artwork .tg-card__meta {
	font-size: 0.95rem;
}

/* Justified variant: row item, image at its real shape, no frame */
/* Never narrower than 8rem (MIN_WIDTH in justified-rows.js), so the text
   fits; the image of a narrow work keeps its width (--image-width, set by
   the script) and the card is widened around it. */
.tg-card--justified {
	flex: var(--ratio, 1) 1 calc(var(--ratio, 1) * var(--row-height));
	min-width: 8rem;
	max-width: calc(var(--ratio, 1) * var(--row-height) * 1.5);
	/* no-JS: a card alone on its row is not blown up */
}

.tg-card--justified .tg-card__media {
	display: block;
	aspect-ratio: auto;
	margin-bottom: var(--space-2);
	padding: 0;
	background: none;
}

.tg-card--justified .tg-card__image {
	display: block;
	width: 100%;
	max-width: var(--image-width, 100%);
	height: auto;
}

.tg-card--justified .tg-card__link:hover .tg-card__image {
	transform: scale(1.02);
}

/* No image yet: a plain stone square */
.tg-card--justified .tg-card__image--empty {
	aspect-ratio: 1;
	background: var(--stone);
}

.tg-card--justified .tg-card__artist {
	margin-bottom: 0.25rem;
	font-size: 0.8rem;
	color: var(--mute);
}

.tg-card--justified .tg-card__title {
	font-size: 1.25rem;
	line-height: 1.3;
}

.tg-card--justified .tg-card__meta {
	font-size: var(--size-s);
}

@media (max-width: 639px) {
	.tg-card--justified .tg-card__title {
		font-size: 1.0625rem;
	}
}
