/**
 * HP Cards — standalone BEM (do not rely on hp-hero).
 * ≥768px: 6-column grid — cards span 2 (= 1/3). Incomplete last row:
 * 1 card → full width (span 6); 2 cards → 50/50 (span 3 each). Those rows: max-height 350px, no square aspect.
 * <768px: 2-column grid; ≤568px: horizontal swipe carousel (smooth snap via JS). ≥768px: grid as above.
 */
.hp-cards {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
	color: #000;
}

.hp-cards-wrap {
	position: relative;
}

.hp-cards__nav {
	display: none;
}

.hp-cards__card {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: stretch;
	overflow: hidden;
	box-sizing: border-box;
	aspect-ratio: 1 / 1;
	padding: 20px;
	background: var(--hp-gradient-surface);
}

@media (min-width: 768px) {
	.hp-cards {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}

	.hp-cards__card {
		grid-column: span 2;
	}

	/* e.g. 4, 7, 10… cards: last card alone on its row → full width */
	.hp-cards__card:nth-child(3n + 1):last-child {
		grid-column: span 6;
	}

	/* e.g. 5, 8… cards: last two share the row → half width each */
	.hp-cards__card:nth-child(3n + 1):nth-last-child(2) {
		grid-column: span 3;
	}

	.hp-cards__card:nth-child(3n + 2):last-child {
		grid-column: span 3;
	}

	/* Last row 1-up or 2-up: not square, cap height */
	.hp-cards__card:nth-child(3n + 1):last-child,
	.hp-cards__card:nth-child(3n + 1):nth-last-child(2),
	.hp-cards__card:nth-child(3n + 2):last-child {
		aspect-ratio: unset;
		height: 350px;
	}
}

.hp-cards__card-img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	pointer-events: none;
	z-index: 0;
}

.hp-cards__card-body {
	position: relative;
	z-index: 1;
	width: 100%;
	text-align: left;
}

.hp-cards__card-title {
	margin: 0 0 8px;
	font-size: 30px;
	font-weight: 700;
	line-height: 1.1;
	color: #000;
}

.hp-cards__card-text {
	margin-bottom: 8px;
}

.hp-cards__card-btn {
	margin-top: 8px;
}

@media (max-width: 767px) {

	/* Last row single card in 2-col layout → full width; same height cap as desktop */
	.hp-cards__card:nth-child(2n + 1):last-child {
		grid-column: 1 / -1;
		aspect-ratio: unset;
		height: 350px;
	}

	.hp-cards__card-title {
		font-size: 22px;
	}
}

@media (max-width: 568px) {

	/* Horizontal swipe carousel (narrow phones) */
	.hp-cards-wrap {
		padding-bottom: 50px;
	}

	.hp-cards {
		display: flex;
		grid-template-columns: none;
		gap: 12px;
		overflow-x: auto;
		/* scroll-behavior only affects programmatic scroll; touch snap animation is done in JS */
		scroll-behavior: smooth;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior-x: contain;
		scrollbar-width: none;
	}

	.hp-cards::-webkit-scrollbar {
		display: none;
	}

	.hp-cards__card {
		flex: 0 0 100%;
		grid-column: auto;
	}

	.hp-cards__card:nth-child(2n + 1):last-child {
		grid-column: auto;
		aspect-ratio: 1 / 1;
		max-height: none;
		height: auto;
	}

	.hp-cards__nav-wrap {
		position: absolute;
		bottom: 0;
		z-index: 2;
		display: flex;
		gap: 8px;
	}

	.hp-cards__nav {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 38px;
		height: 38px;
		border: 0;
		border-radius: 999px;
		background: #000;
		color: #fff;
		font-size: 26px;
		line-height: 1;
		font-weight: 600;
		cursor: pointer;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
		transition: all 0.3s ease;
	}

	.hp-cards__nav:hover {
		background: #333;
	}

	.hp-cards__nav-icon {
		display: block;
	}

	.hp-cards__nav[disabled] {
		opacity: 0.45;
		cursor: default;
	}
}