/* ============================================================
   Text Cards section (Programme "Therapies" grid)
   Design ref: scratchpad analysis pa-10 / pa-11. Light-grey band
   (cream variant for reuse), centred intro, pale cream text-only
   tile cards (serif teal title + grey body, no icon). Seven cards
   = 4-up row 1 + 3 centred row 2 via flex-wrap + justify-content.
   Linked cards get a read-more link + caramel bottom-bar hover.
   Mobile: horizontal scroll-snap carousel with a thin scrollbar.
   Tablet: 2-up. Desktop: 4-up.
   ============================================================ */

.text-cards {
	padding-block: var(--section-padding);
}

.text-cards--light-grey {
	background: var(--color-light-grey);
}

.text-cards--cream {
	background: var(--color-cream);
}

/* ---- Intro ---- */

.text-cards__heading {
	margin-bottom: var(--space-md);
}

.text-cards__text {
	margin-bottom: 0;
	max-width: 48rem;
}

.text-cards__text p {
	margin-bottom: var(--space-sm);
}

.text-cards__text p:last-child {
	margin-bottom: 0;
}

/* ---- Cards: mobile scroll-snap carousel ---- */

.text-cards__scroller {
	margin-top: var(--space-lg);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding-left: var(--container-pad);
	padding-bottom: var(--space-md);
	/* visible progress track (per the design's carousel indicator) */
	scrollbar-width: thin;
	scrollbar-color: var(--color-teal-dark) var(--color-grey);
}

.text-cards__scroller::-webkit-scrollbar {
	height: 4px;
	border-radius: 2px;
}

.text-cards__scroller::-webkit-scrollbar-track {
	background: var(--color-grey);
}

.text-cards__scroller::-webkit-scrollbar-thumb {
	background: var(--color-teal-dark);
}

.text-cards__grid {
	display: flex;
	flex-wrap: nowrap;
	gap: var(--space-md);
}

.text-cards__card {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	flex: 0 0 79%;
	max-width: 320px;
	scroll-snap-align: start;
	padding: 2rem 1.875rem;
	background: var(--color-cream-light);
	border: 1px solid var(--color-grey);
	border-radius: var(--radius-sm);
	box-shadow: 0 4px 18px rgb(0 31 38 / 0.06);
}

/* Caramel bottom bar sweeps in on hover - linked cards only */
.text-cards__card--linked::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 4px;
	background: var(--color-caramel-light);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.text-cards__card--linked:hover::after,
.text-cards__card--linked:focus-within::after {
	transform: scaleX(1);
}

.text-cards__card-title {
	margin-bottom: var(--space-sm);
	font-size: 1.3125rem;
	line-height: 1.3;
}

.text-cards__card-text {
	margin-bottom: 0;
	font-size: 1rem;
}

.text-cards__card-text p {
	margin-bottom: var(--space-sm);
}

.text-cards__card-text p:last-child {
	margin-bottom: 0;
}

/* ---- Read more link: inline underlined, flows after the sentence (per design) ---- */

.text-cards__link {
	font-weight: 600;
	color: var(--color-teal-dark);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.text-cards__link:hover,
.text-cards__link:focus-visible {
	color: var(--color-accent);
}

/* ---- Button ---- */

.text-cards__actions {
	margin-top: var(--space-lg);
	display: flex;
	justify-content: center;
}

/* ---- Tablet: 2-up, centred intro ---- */

@media (min-width: 768px) {
	.text-cards__intro {
		text-align: center;
		max-width: 48rem;
		margin-inline: auto;
	}

	.text-cards__text {
		margin-inline: auto;
	}

	.text-cards__scroller {
		overflow-x: visible;
		scroll-snap-type: none;
		padding-bottom: 0;
	}

	.text-cards__grid {
		flex-wrap: wrap;
		justify-content: center;
	}

	.text-cards__card {
		flex: 0 0 calc((100% - var(--space-md)) / 2);
		max-width: none;
	}

	.text-cards__actions {
		margin-top: var(--space-xl);
	}
}

/* ---- Desktop: 4-up row 1, incomplete rows centre ---- */

@media (min-width: 1024px) {
	.text-cards__card {
		flex: 0 0 calc((100% - 3 * var(--space-md)) / 4);
	}
}
