/* ==========================================================================
   Product catalogue

   The middle of the Products page: a category panel down the left, a wall of
   square photographs on the right.

   The arrangement follows the client's reference. The tile does not: the
   reference frames every photo in a hard one-pixel grey box, which reads as a
   spec sheet and was rejected. These are the cards the home page already uses
   for its newest eight — rounded corner, hairline border, soft shadow — so the
   catalogue and the home page speak the same language. The name stays centred
   under the photo, as in the reference, which is what keeps this page reading
   as a catalogue rather than a second copy of the home page.

   Hover is the home page's four linked moves, same durations: the card lifts,
   the photo pushes in, an amber rule runs out along the foot, and "View
   Product" rises out of a scrim. Each alone would feel twitchy; together they
   read as one gesture.
   ========================================================================== */

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

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

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

.sc-pgrid__card {
	position: relative;
	display: flex;
	flex-direction: column;
	inline-size: 100%;
	overflow: hidden;

	/* 14px, the home page's card radius: a soft corner is the quickest 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-pgrid__card:hover,
.sc-pgrid__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-pgrid__card:focus-visible {
	outline: 2px solid var(--sc-accent);
	outline-offset: 3px;
}

/* The amber rule that runs under the card on hover. */
.sc-pgrid__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-pgrid__card:hover::after,
.sc-pgrid__card:focus-visible::after {
	transform: scaleX(1);
}

/* ---- the photograph ----------------------------------------------------- */

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

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

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

/* Scrim for the reveal line to sit on, so the white text does not land on
   whatever the garment's shoulder happens to be. */
.sc-pgrid__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-pgrid__card:hover .sc-pgrid__media::after,
.sc-pgrid__card:focus-visible .sc-pgrid__media::after {
	opacity: 1;
}

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

	display: flex;
	align-items: center;
	gap: .35rem;
	padding: 0 clamp(.6rem, 1vw, .9rem) clamp(.6rem, 1vw, .8rem);

	color: #fff;
	font-size: .68rem;
	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-pgrid__view svg {
	flex: none;
}

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

/* ---- the name ----------------------------------------------------------- */

.sc-pgrid__body {
	display: block;
	flex: 1 1 auto;
	padding: clamp(.6rem, .95vw, .8rem) clamp(.55rem, .9vw, .8rem) clamp(.7rem, 1.1vw, .9rem);
}

/* Two lines, then an ellipsis. The reserved second line keeps every card in a
   row on the same baseline. */
.sc-pgrid__name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;

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

/* ---- breakpoints -------------------------------------------------------- */

/* Four, then three, then two. Two is the floor: a single column of tiles on a
   phone turns the catalogue into a scroll of single photographs. */
@media (max-width: 900px) {
	.sc-pgrid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 620px) {
	.sc-pgrid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: .7rem;
	}

	.sc-pgrid__name {
		font-size: .84rem;
	}

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

@media (prefers-reduced-motion: reduce) {
	.sc-pgrid__card,
	.sc-pgrid__media img,
	.sc-pgrid__media::after,
	.sc-pgrid__view,
	.sc-pgrid__card::after {
		transition: none;
	}
}

/* ==========================================================================
   The left column: panel heads, and the Hot Product block

   Both panels share one shell — a filled head bar over a bordered body — so the
   column reads as one index rather than two lists that happen to be stacked.
   ========================================================================== */

.sc-catnav__head,
.sc-hotpanel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;

	margin: 0;
	padding: .68rem 1rem;

	background: var(--sc-ink);
	color: #fff;
	border: 1px solid var(--sc-ink);

	font-size: .875rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.sc-catnav__head svg {
	flex: 0 0 auto;
	opacity: .5;
}

/* The head is the panel's top edge now, so the list drops its own. */
.sc-products-page .sc-catnav__list,
.sc-collection-page .sc-catnav__list {
	border-block-start: 0;
}

/* ---- hot product -------------------------------------------------------- */

.sc-hotpanel {
	margin-block-start: 1.25rem;
}

.sc-hotpanel__list {
	margin: 0;
	padding: 0;
	list-style: none;
	background: #fff;
	border: 1px solid var(--sc-line);
	border-block-start: 0;
}

.sc-hotpanel__item {
	display: flex;
	gap: .6rem;
	padding: .55rem;
	border-block-start: 1px solid var(--sc-line);
	color: inherit;
	text-decoration: none;
}

.sc-hotpanel__list li:first-child .sc-hotpanel__item {
	border-block-start: 0;
}

.sc-hotpanel__pic {
	flex: 0 0 84px;
	inline-size: 84px;
	block-size: 84px;
	overflow: hidden;
	background: #F4F2ED;
	border: 1px solid color-mix(in srgb, var(--sc-ink) 16%, transparent);
}

.sc-hotpanel__pic img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	transition: transform 520ms cubic-bezier(.2, .7, .3, 1);
}

.sc-hotpanel__item:hover .sc-hotpanel__pic img {
	transform: scale(1.06);
}

.sc-hotpanel__text {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-inline-size: 0;
}

.sc-hotpanel__name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;

	font-size: .8125rem;
	line-height: 1.4;
	color: var(--sc-ink);
}

.sc-hotpanel__more {
	margin-block-start: .3rem;
	font-size: .75rem;
	font-weight: 700;
	letter-spacing: .02em;
	color: var(--sc-text-muted);
	transition: color var(--sc-transition);
}

.sc-hotpanel__item:hover .sc-hotpanel__more,
.sc-hotpanel__item:focus-visible .sc-hotpanel__more {
	color: var(--sc-ink);
}

/*
 * The column no longer pins.
 *
 * The category list plus the Hot Product block comes to roughly a thousand
 * pixels — taller than most windows. A sticky element taller than the viewport
 * keeps its own head pinned and its last rows permanently below the fold, so
 * the column scrolls with the page instead, exactly as the reference's does.
 */
.sc-products-page .sc-cats__aside,
.sc-collection-page .sc-cats__aside {
	position: static;

	/*
	 * Line the panel head up with the first row of tiles.
	 *
	 * The aside sat 24px below the hero while the catalogue's own section
	 * padding put the tiles 80px below it, so the column started 56px higher
	 * than the grid and the page opened with two different top edges. Borrowing
	 * the section's own variable — rather than repeating a pixel value — keeps
	 * them together at every breakpoint the stylesheet retunes it.
	 */
	padding-block-start: var(--sc-section-pad);
}

/* Stacked: the panel sits directly above the grid, so the gap the aside's own
   padding adds is enough and the section's 80px would double it. */
@media (max-width: 1080px) {
	.sc-products-page .sc-cats__aside,
	.sc-collection-page .sc-cats__aside {
		padding-block-start: 0;
	}

	/*
	 * The Hot Product rows do not need the whole page width — an 84px thumbnail
	 * at one end of a 900px row and a three-line name at the other reads as a
	 * table, not a card. Capped, they keep the proportion they have in the
	 * column. The category list above stays full width, which is right for a
	 * list of links.
	 */
	.sc-hotpanel {
		max-inline-size: 26rem;
		margin-block-end: 1.5rem;
	}
}

/* ==========================================================================
   The category archives (/collection/<slug>/)

   Same page as the catalogue, so the tiles, the panel and the hover above are
   reused as-is — what is added here is only what the products page gets from
   its own template: a banner that stops at header height, the block padding the
   section wrapper would otherwise supply, and an empty state.
   ========================================================================== */

/* Header-sized banner, exactly as on the products page: the panel has to be on
   the first screen, not a whole viewport below it. */
.sc-collection-page .sc-hero {
	min-block-size: 17.5rem;
}

.sc-collection-page .sc-hero__inner {
	padding-block: 2rem;
}

/*
 * The grid's vertical rhythm.
 *
 * On the products page the tiles sit inside a section, which paints the 80px.
 * Here they are printed straight into the column, so the same variable is
 * applied to the column itself — the two pages then open at the same height,
 * and retuning --sc-section-pad moves both.
 */
.sc-collection-page .sc-cats__main {
	padding-block: var(--sc-section-pad) clamp(2.5rem, 5vw, 4rem);
}

/* Nothing in the term yet — a line of text, not an empty grid. */
.sc-collection-page .sc-empty {
	margin: 0;
	padding-block: 3rem;
	color: var(--sc-text-muted);
}

.sc-collection-page .sc-empty a {
	color: var(--sc-ink);
	text-decoration: underline;
	text-underline-offset: .2em;
}
