/* ==========================================================================
   Latest products

   The newest eight pieces, as rounded cards on the ivory band above the
   category carousel. The rounded shape and the title folded into the card are
   what separate a product from a category tile; the square photo stays, so the
   two bands still read as one page.

   Hover is the point of this band. A static grid of identical squares is flat,
   so the card lifts, the photo pushes in a little, and a "View Product" line
   rises out of a soft scrim at the foot of the picture. Four small moves at
   the same duration read as one gesture; each one alone would feel twitchy.
   ========================================================================== */

.sc-latest {
	/* The renderer writes `--sc-latest-base` inline (the "per row" setting).
	   The column count is derived from it so the media queries below can step
	   it down — an inline value would beat them. */
	--sc-latest-cols: var(--sc-latest-base, 4);

	display: grid;
	grid-template-columns: repeat(var(--sc-latest-cols), minmax(0, 1fr));
	gap: clamp(.85rem, 1.6vw, 1.5rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.sc-latest__item {
	display: flex;
	min-width: 0;
}

.sc-latest__card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	overflow: hidden;

	/* 14px, not the 4px the rest of the page uses: a soft corner is the
	   fastest way to say "card" rather than "photograph". */
	border: 1px solid rgba(17, 17, 17, .09);
	border-radius: 14px;
	background: #fff;
	color: inherit;
	text-decoration: none;

	transition:
		transform 340ms cubic-bezier(.2, .7, .3, 1),
		box-shadow 340ms cubic-bezier(.2, .7, .3, 1),
		border-color 340ms ease;
}

.sc-latest__card:hover,
.sc-latest__card:focus-visible {
	border-color: rgba(17, 17, 17, .16);
	box-shadow: 0 24px 44px -26px rgba(17, 17, 17, .5);
	transform: translateY(-6px);
}

.sc-latest__card:focus-visible {
	outline: 2px solid var(--sc-accent);
	outline-offset: 3px;
}

/* The amber rule that runs under the card on hover. Two pixels, from the left:
   enough to tie the tile to the brand without turning the grid into stripes. */
.sc-latest__card::after {
	content: "";
	position: absolute;
	inset-block-end: 0;
	inset-inline: 0;
	height: 2px;
	background: var(--sc-accent);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 420ms cubic-bezier(.2, .7, .3, 1);
}

.sc-latest__card:hover::after,
.sc-latest__card:focus-visible::after {
	transform: scaleX(1);
}

.sc-latest__media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--sc-ivory);
}

.sc-latest__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 620ms cubic-bezier(.2, .7, .3, 1);
}

.sc-latest__card:hover .sc-latest__media img,
.sc-latest__card:focus-visible .sc-latest__media img {
	transform: scale(1.06);
}

/* Scrim for the reveal line to sit on. Without it the white text lands on
   whatever the garment's shoulder happens to be. */
.sc-latest__media::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	height: 52%;
	background: linear-gradient(to top, rgba(0, 0, 0, .58), rgba(0, 0, 0, 0));
	opacity: 0;
	pointer-events: none;
	transition: opacity 340ms ease;
}

.sc-latest__card:hover .sc-latest__media::after,
.sc-latest__card:focus-visible .sc-latest__media::after {
	opacity: 1;
}

.sc-latest__view {
	position: absolute;
	z-index: 1;
	inset-block-end: 0;
	inset-inline: 0;

	display: flex;
	align-items: center;
	gap: .35rem;
	padding: 0 clamp(.75rem, 1.2vw, 1rem) clamp(.7rem, 1.2vw, .95rem);

	color: #fff;
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .13em;
	line-height: 1.2;
	text-transform: uppercase;

	opacity: 0;
	transform: translateY(10px);
	transition:
		opacity 300ms ease,
		transform 360ms cubic-bezier(.2, .7, .3, 1);
}

.sc-latest__view svg {
	flex: none;
}

.sc-latest__card:hover .sc-latest__view,
.sc-latest__card:focus-visible .sc-latest__view {
	opacity: 1;
	transform: translateY(0);
}

.sc-latest__body {
	display: block;
	padding: clamp(.7rem, 1.1vw, .95rem) clamp(.75rem, 1.2vw, 1rem) clamp(.85rem, 1.3vw, 1.05rem);
}

/* Two lines, then an ellipsis. The reserved second line is what keeps eight
   cards of uneven title length on the same baseline. */
.sc-latest__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;

	min-block-size: 2.9em;
	font-size: .92rem;
	font-weight: 600;
	letter-spacing: -.006em;
	line-height: 1.45;
	color: var(--sc-ink);
}

/* --------------------------------------------------------------------------
   Steps down before the squares stop being readable as garments.
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
	.sc-latest {
		--sc-latest-cols: 3;
	}
}

@media (max-width: 760px) {
	.sc-latest {
		--sc-latest-cols: 2;
		gap: .7rem;
	}

	/* No pointer to hover with, and the lift would leave a gap in the grid. */
	.sc-latest__card:hover {
		box-shadow: none;
		transform: none;
	}

	.sc-latest__title {
		font-size: .86rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sc-latest__card,
	.sc-latest__media img,
	.sc-latest__media::after,
	.sc-latest__view,
	.sc-latest__card::after {
		transition: none;
	}
}
