/*
 * Subcategory Browse strip — auto-rendered on product category archives that
 * have direct child subcategories. Background spans the full viewport; inner
 * content is capped at 1440px. Cards show image + name only, arranged in a
 * horizontally scrollable track with CSS scroll-snap.
 */

.coastal-subcat-browse {
	/*
	 * Same negative-margin escape hatch used by .coastal-category-content —
	 * stretches the section background to viewport edges while Astra's
	 * .ast-container keeps the product grid capped at 1440px.
	 */
	width: auto;
	max-width: none;
	margin-inline: calc(50% - 50vw);
	padding: 64px 0;
}

/* ── Inner container ────────────────────────────────────────────────────── */

.coastal-subcat-browse__inner {
	box-sizing: border-box;
	width: 100%;
	max-width: 1440px;
	margin-inline: auto;
	padding-inline: 85px;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	text-align: center;
}

/* ── Heading & subheading ───────────────────────────────────────────────── */

.coastal-subcat-browse__heading {
	margin: 0 0 16px;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 700;
	font-size: 36px;
	line-height: 1.2;
	color: #2c2c75;
}

.coastal-subcat-browse__subheading {
	margin: 0 0 40px;
	font-family: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, sans-serif;
	font-weight: 400;
	font-size: 18px;
	line-height: 1.5;
	color: #000000;
}

/* ── Scroll wrapper: carries overflow-x scroll, hides scrollbar ─────────── */

.coastal-subcat-browse__scroll-wrap {
	overflow-x: auto;
	overflow-y: visible;
	/* hide scrollbar — scroll is still touch/drag accessible */
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.coastal-subcat-browse__scroll-wrap::-webkit-scrollbar {
	display: none;
}

/* ── Track ──────────────────────────────────────────────────────────────── */

.coastal-subcat-browse__track {
	display: flex;
	flex-wrap: nowrap;
	/*
	 * flex-start so that when items overflow the left edge stays reachable.
	 * justify-content: center clips the left overflow on centered tracks,
	 * making it impossible to scroll back to item 1.
	 */
	justify-content: flex-start;
	gap: 16px;
	list-style: none;
	margin: 0;
	padding: 4px 2px 16px; /* bottom pad so box-shadows aren't clipped */
	/*
	 * max-content lets the track be exactly as wide as its cards.
	 * margin-inline: auto centers it when it fits in the scroll-wrap.
	 * When it overflows the margin collapses and scrolling takes over.
	 */
	width: max-content;
	margin-inline: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.coastal-subcat-browse__card {
	/*
	 * Fixed 180px base — cards don't grow so short lists don't balloon.
	 * The track's min-width: 100% ensures a short list fills the row.
	 */
	flex: 0 0 180px;
	max-width: 220px;
	scroll-snap-align: start;
}

.coastal-subcat-browse__card-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	text-decoration: none !important;
	background: #ffffff;
	border: 1px solid #dce9f5;
	border-radius: 12px;
	padding: 24px 16px 20px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	height: 100%;
	box-sizing: border-box;
	transition: box-shadow 150ms ease-in-out, border-color 150ms ease-in-out;
}

.coastal-subcat-browse__card-link:hover,
.coastal-subcat-browse__card-link:focus-visible {
	box-shadow: 0 4px 16px rgba(44, 44, 117, 0.14);
	border-color: #2c2c75;
}

/* ── Image area ─────────────────────────────────────────────────────────── */

.coastal-subcat-browse__image-wrap {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	margin-bottom: 16px;
}

.coastal-subcat-browse__image {
	display: block;
	max-width: 100%;
	max-height: 120px;
	width: auto;
	height: auto;
	object-fit: contain;
}

.coastal-subcat-browse__image-placeholder {
	width: 80px;
	height: 80px;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.05);
}

/* ── Name ───────────────────────────────────────────────────────────────── */

.coastal-subcat-browse__name {
	display: block;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 600;
	font-size: 15px;
	line-height: 1.3;
	color: #1a1a1a;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.coastal-subcat-browse__inner {
		padding-inline: 48px;
	}

	.coastal-subcat-browse__heading {
		font-size: 28px;
	}
}

@media (max-width: 640px) {
	.coastal-subcat-browse {
		padding: 25px 0;
	}

	.coastal-subcat-browse__inner {
		padding-inline: 24px;
	}

	.coastal-subcat-browse__heading {
		font-size: 24px;
	}

	.coastal-subcat-browse__subheading {
		font-size: 16px;
		margin-bottom: 28px;
	}

	.coastal-subcat-browse__card {
		/* ~2.2 cards visible on mobile — peek signals more to the right */
		flex: 0 0 calc((100% - 16px) / 2.2);
		max-width: 220px;
	}
}
