/* Responsive Card Section — front-end styles */

.rcs-section {
	--rcs-gap: 24px;
	--rcs-radius: 22px;
	--rcs-overlay: rgba(16, 20, 24, 0.92);
	box-sizing: border-box;
	width: 100%;
	max-width: 1200px;
	margin-inline: auto;
}

.rcs-section *,
.rcs-section *::before,
.rcs-section *::after {
	box-sizing: border-box;
}

.rcs-heading {
	margin: 0 0 1.5rem;
	font-size: clamp(1.5rem, 1rem + 2vw, 2.25rem);
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
}

/* ---------- Grid (desktop / tablet) ---------- */

.rcs-grid {
	display: grid;
	gap: var(--rcs-gap);
}

.rcs-cols-2 .rcs-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rcs-cols-3 .rcs-grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rcs-cols-4 .rcs-grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ---------- Card ---------- */

.rcs-card {
	position: relative;
	display: block;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	border-radius: var(--rcs-radius);
	background: #e7e9ec;
	color: #fff;
	text-decoration: none;
	box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
	isolation: isolate;
	transform: translateZ(0);
	transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
		box-shadow 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Fallback for browsers without aspect-ratio support. */
@supports not (aspect-ratio: 1) {
	.rcs-card {
		height: 0;
		padding-top: 133.33%;
	}
}

.rcs-card:focus-visible {
	outline: 3px solid #2563eb;
	outline-offset: 3px;
}

a.rcs-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 22px 48px rgba(15, 23, 42, 0.20);
}

.rcs-section .rcs-card__img {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	min-height: 0;
	margin: 0;
	padding: 0;
	object-fit: cover !important;
	object-position: center;
	display: block;
	transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

a.rcs-card:hover .rcs-card__img {
	transform: scale(1.06);
}

/* Gradient for text legibility. */
.rcs-card::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: linear-gradient(
		to top,
		var(--rcs-overlay) 0%,
		rgba(16, 20, 24, 0.55) 26%,
		rgba(16, 20, 24, 0.12) 48%,
		rgba(16, 20, 24, 0) 64%
	);
}

.rcs-card__content {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 22px 22px 24px;
}

.rcs-card__title {
	margin: 0 0 0.4rem;
	font-size: 1.3rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--rcs-title-color, #fff);
	text-shadow: 0 1px 10px rgba(0, 0, 0, 0.25);
}

.rcs-card__desc {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.85);
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Arrow / link button. */
.rcs-card__icon {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: #15181c;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
		opacity 0.35s ease,
		background-color 0.35s ease;
}

.rcs-card__icon svg {
	width: 19px;
	height: 19px;
}

/* On hover-capable devices (desktop), hide the icon until the card is hovered. */
@media (hover: hover) {
	.rcs-card__icon {
		opacity: 0;
		transform: translateY(-6px) scale(0.9);
	}

	a.rcs-card:hover .rcs-card__icon,
	a.rcs-card:focus-visible .rcs-card__icon {
		opacity: 1;
		background: #fff;
		transform: translate(2px, -2px) scale(1.05);
	}
}

/* ---------- Pagination dots (mobile only) ---------- */

.rcs-section .rcs-dots {
	display: none;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 18px;
}

/* Scoped + hard-reset so theme button styles can't inflate the dots. */
.rcs-section .rcs-dot {
	box-sizing: border-box;
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	min-width: 0;
	min-height: 0;
	max-width: none;
	max-height: none;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.22);
	box-shadow: none;
	color: inherit;
	font-size: 0;
	line-height: 0;
	cursor: pointer;
	transition: width 0.3s ease, background-color 0.3s ease;
	-webkit-appearance: none;
	appearance: none;
}

.rcs-section .rcs-dot:hover {
	background: rgba(15, 23, 42, 0.4);
}

.rcs-section .rcs-dot:focus,
.rcs-section .rcs-dot:focus-visible {
	outline: 2px solid rgba(15, 23, 42, 0.5);
	outline-offset: 2px;
}

.rcs-section .rcs-dot.is-active {
	width: 24px;
	height: 8px;
	background: rgba(15, 23, 42, 0.7);
}

/* ---------- Tablet ---------- */

@media (max-width: 1024px) {
	.rcs-cols-3 .rcs-grid,
	.rcs-cols-4 .rcs-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ---------- Mobile: turn grid into a touch slider ---------- */

@media (max-width: 640px) {
	.rcs-section {
		--rcs-radius: 18px;
	}

	.rcs-heading {
		margin-bottom: 1.1rem;
		text-align: left;
		padding-inline: 4px;
	}

	.rcs-grid,
	.rcs-cols-2 .rcs-grid,
	.rcs-cols-3 .rcs-grid,
	.rcs-cols-4 .rcs-grid {
		display: flex;
		grid-template-columns: none;
		gap: 14px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		/* Edge padding so the first/last card isn't flush to the screen edge. */
		padding-inline: 16px;
		scroll-padding-inline: 16px;
		margin-inline: -16px;
		padding-bottom: 6px;
		scrollbar-width: none;
	}

	.rcs-grid::-webkit-scrollbar {
		display: none;
	}

	.rcs-card {
		/* Slightly narrower than the viewport so the next card peeks in. */
		flex: 0 0 85%;
		max-width: 340px;
		/* A little less tall than desktop reads better on a phone. */
		aspect-ratio: 4 / 5;
		scroll-snap-align: center;
		scroll-snap-stop: always;
	}

	@supports not (aspect-ratio: 1) {
		.rcs-card {
			height: 0;
			padding-top: 125%;
		}
	}

	.rcs-card__content {
		padding: 18px 18px 20px;
	}

	.rcs-card__title {
		font-size: 1.15rem;
	}

	.rcs-card__desc {
		font-size: 0.875rem;
		-webkit-line-clamp: 2;
		line-clamp: 2;
	}

	/* The icon has no hover on touch, so keep it visible. */
	.rcs-card__icon {
		width: 40px;
		height: 40px;
		top: 14px;
		right: 14px;
	}

	/* Disable lift on touch so the slider feels native. */
	a.rcs-card:hover {
		transform: none;
		box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
	}

	a.rcs-card:hover .rcs-card__img {
		transform: none;
	}

	.rcs-section .rcs-dots {
		display: flex;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rcs-card,
	.rcs-card__img,
	.rcs-card__icon,
	.rcs-dot {
		transition: none;
	}
}
