/*
 * Balanced method grid.
 * Keeps method cards visually complete for any desktop item count while
 * preserving the existing 2-column tablet and 1-column mobile layouts.
 */
.method-grid{
	display:grid;
	grid-template-columns:repeat(12,minmax(0,1fr));
	gap:14px;
}

/* Default desktop layout: 4 cards per row. */
.method-grid > .method-card{
	grid-column:span 3;
}

/*
 * Remainder 1 (5, 9, 13, ...): rebalance the last five cards as 3 + 2,
 * avoiding a single orphan card on the final row.
 */
.method-grid:has(> .method-card:nth-child(4n+1):last-child) > .method-card:nth-last-child(-n+5){
	grid-column:span 4;
}
.method-grid:has(> .method-card:nth-child(4n+1):last-child) > .method-card:nth-last-child(-n+2){
	grid-column:span 6;
}

/* Remainder 2 (6, 10, 14, ...): rebalance the last six cards as 3 + 3. */
.method-grid:has(> .method-card:nth-child(4n+2):last-child) > .method-card:nth-last-child(-n+6){
	grid-column:span 4;
}

/* Remainder 3 (3, 7, 11, ...): make the final row three equal cards. */
.method-grid:has(> .method-card:nth-child(4n+3):last-child) > .method-card:nth-last-child(-n+3){
	grid-column:span 4;
}

/* Small sets get the whole available row. */
.method-grid:has(> .method-card:first-child:last-child) > .method-card{
	grid-column:span 12;
}
.method-grid:has(> .method-card:nth-child(2):last-child) > .method-card{
	grid-column:span 6;
}
.method-grid:has(> .method-card:nth-child(3):last-child) > .method-card{
	grid-column:span 4;
}

@media(max-width:1080px){
	.method-grid{
		grid-template-columns:repeat(2,minmax(0,1fr));
	}

	.method-grid > .method-card{
		grid-column:auto !important;
	}
}

@media(max-width:760px){
	.method-grid{
		grid-template-columns:1fr;
	}
}
