/* =========================================
   1. PATTERNS PAGE (The Vertical Stack)
   ========================================= */
/* Root container: scope and vertical rhythm via gap */
.patterns-list-container {
	display: flex !important;
	flex-direction: column !important;
	row-gap: clamp(1.25rem, 2vw, 2.25rem) !important;
}

/* The Container Link (a.pattern-row) */
.patterns-list-container .pattern-row {
	display: flex !important;           /* Force row layout */
	width: 100% !important;             /* Force full width to create a stack */
	align-items: baseline !important;   /* Align image bottom to text baseline */
	/* Drive scale from the row so text and thumbs share the same font metrics */
	font-family: var(--font-serif) !important;
	font-size: clamp(2.5rem, 5.5vw + 0.5rem, 8rem) !important;
	text-decoration: none !important;
	margin: 0 !important;               /* Use container gap for spacing, not margins */
	border-bottom: none !important;     /* Remove any link underlines */
}

/* The Text (h2.pattern-title) */
.patterns-list-container .pattern-title {
	/* Inherit the row's scale so cap-height math matches the thumbnails */
	font-size: 1em !important;
	line-height: 0.95 !important;
	font-weight: 400 !important;
	letter-spacing: -0.02em !important;
	margin: 0 !important;
	white-space: nowrap !important;     /* Prevent "Black & White" split */
	color: var(--text-main, #000) !important;
}

/* Gap between the title and the first thumbnail */
.patterns-list-container .pattern-thumbnails {
	display: inline-flex !important;
	align-items: baseline !important;
	margin-left: var(--title-thumb-gap) !important;
	/* Ensure identical overlap behavior to the main Patterns page */
	--thumb-overlap: 20px;
	--thumb-gap: 2px;
	--thumb-shift: var(--thumb-overlap);
	white-space: nowrap !important;
	overflow: hidden !important;
	gap: 0 !important;
	position: relative !important;
}

/* The Images (Siblings inside .pattern-row) */
.patterns-list-container .pattern-row img {
	/* Fallback for browsers without cap unit support */
	height: 0.65em !important;
	/* Exact capital-height when supported (matches baseline→cap of title) */
	height: 1cap !important;
	width: auto !important;
	object-fit: cover !important;
	align-self: baseline !important;
	/* Use negative margin overlap to mirror main Patterns page */
	margin-left: calc(var(--thumb-gap, 2px) - var(--thumb-overlap, 20px)) !important;
}

/* First Image Gap */
.patterns-list-container .pattern-row img:first-of-type {
	margin-left: 0 !important;
}

/* Utility: allow JS to hide randomized thumbs */
.patterns-list-container .pattern-thumbnails .ws-hidden {
	display: none !important;
}

/* Mobile behavior: keep thumbnails visible for parity with article footer list */
@media (max-width: 599px) {
	/* Tighter vertical rhythm between rows on mobile */
	.patterns-list-container {
		row-gap: clamp(0.25rem, 1.2vw, 0.75rem) !important;
	}
	/* Ensure the image strip remains inline and aligned on small screens */
	.patterns-list-container .pattern-thumbnails {
		margin-left: var(--title-thumb-gap) !important;
		/* Preserve overlap behaviour on mobile to match Patterns page */
		gap: 0 !important;
		white-space: nowrap !important;
	}
	/* Lock row/title line-height to match article footer list */
	.patterns-list-container .pattern-row,
	.patterns-list-container .pattern-title {
		line-height: 0.95 !important;
	}
	/* Ensure baseline alignment identical to article footer */
	.patterns-list-container .pattern-row {
		align-items: baseline !important;
	}
	/* Mirror exact thumbnail metrics (height + micro-nudge) */
	.patterns-list-container .pattern-thumbnails img {
		height: 0.65em !important;
		top: 0.02em !important;
		position: relative !important;
		/* Keep the same negative overlap spacing on mobile */
		margin-left: calc(var(--thumb-gap, 2px) - var(--thumb-overlap, 20px)) !important;
	}
	.patterns-list-container .pattern-thumbnails img:first-child {
		margin-left: 0 !important;
	}
	/* Kill hover-shift transforms on touch */
	.patterns-list-container .pattern-thumbnails:hover img,
	.patterns-list-container .pattern-thumbnails img:hover {
		transform: none !important;
	}
}

/* Gradient fade-out when thumbnails overflow and hit the page edge */
.patterns-list-container .pattern-thumbnails.ws-has-overflow {
	position: relative !important;
}

.patterns-list-container .pattern-thumbnails.ws-has-overflow.ws-fade-right::after {
	content: "";
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	width: clamp(24px, 8%, 120px);
	pointer-events: none;
	background: linear-gradient(to right, rgba(250,249,246,0), var(--bg-main, #FAF9F6));
	z-index: 10;
}

html.dark-mode .patterns-list-container .pattern-thumbnails.ws-has-overflow.ws-fade-right::after {
	background: linear-gradient(to right, rgba(22,21,20,0), var(--bg-main, #161514));
}
