/* ==========================================================================
   Wild Earth – Category header (.we-ch)
   Used by headers/category, headers/sale-page and headers/ss_search.
   Sits below the main nav, above the Searchspring filters/sort bar.
   Everything is scoped to .we-ch so the rest of the site is untouched.
   ========================================================================== */

.we-ch {
	--we-ch-orange: #f0772f;
	--we-ch-text: #1f1f1f;
	--we-ch-muted: #4a4a4a;
	--we-ch-line: #e2e2e2;

	padding: 14px 15px 0;
	box-sizing: border-box;
	color: var(--we-ch-text);
}

/* Breadcrumb – keeps the theme's existing .breadcrumb styling */
.we-ch .we-ch__crumbs .breadcrumb {
	margin: 0;
	padding: 0;
}

/* Title block + optional intro/tabs, with divider underneath */
.we-ch .we-ch__head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	margin-top: 14px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--we-ch-line);
}
/* Tabs present: their underline sits on the divider */
.we-ch .we-ch__head--tabs { padding-bottom: 0; }
/* Nothing below the title (no tabs, no chips): no divider */
.we-ch:not(:has(.we-ch__cats li)) .we-ch__head:not(.we-ch__head--tabs) { border-bottom: 0; }

.we-ch .we-ch__title-row {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 4px 14px;
}
.we-ch .we-ch__title {
	margin: 0;
	font-size: 30px;
	/*font-weight: 800;*/
	line-height: 1.1;
	letter-spacing: -0.01em;
	text-transform: uppercase;
	color: var(--we-ch-text);
}
.we-ch .we-ch__count { font-size: 14px; color: #5a5a5a; }

.we-ch .we-ch__intro {
	max-width: 560px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--we-ch-muted);
}
.we-ch .we-ch__intro > :first-child { margin-top: 0; }
.we-ch .we-ch__intro > :last-child { margin-bottom: 0; }

/* Gender tabs (left aligned, "All" lines up with the title) */
.we-ch .we-ch__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.we-ch .we-ch__tabs:empty { display: none; }
.we-ch .we-ch__tabs > li:first-child .we-ch__tab { padding-left: 0; }
.we-ch .we-ch__tab {
	display: block;
	padding: 12px 14px;
	margin-bottom: -1px;          /* overlap the divider */
	border-bottom: 3px solid transparent;
	font-size: 15px;
	font-weight: 500;
	color: var(--we-ch-muted);
	text-decoration: none;
	white-space: nowrap;
}
.we-ch .we-ch__tab:hover,
.we-ch .we-ch__tab:focus { color: var(--we-ch-text); border-bottom-color: #d4d4d4; text-decoration: none; }
.we-ch .we-ch__tab.is-active,
.we-ch .we-ch__tab[aria-current="page"] {
	font-weight: 700;
	color: var(--we-ch-text);
	border-bottom-color: var(--we-ch-orange);
}

/* Sub-category chips – desktop: wrap onto as many rows as needed */
.we-ch .we-ch__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
	padding: 18px 0 14px;
	list-style: none;
}
/* No children (or only brand children) – hide the row */
.we-ch .we-ch__cats:not(:has(li)) { display: none; }

.we-ch .we-ch__cat {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 54px;
	padding: 6px 16px 6px 6px;
	box-sizing: border-box;
	border: 1px solid var(--we-ch-line);
	border-radius: 10px;
	background: #fff;
	font-size: 14px;
	font-weight: 600;
	color: var(--we-ch-text);
	text-decoration: none;
	white-space: nowrap;
	transition: border-color 0.15s ease;
}
.we-ch .we-ch__cat:hover,
.we-ch .we-ch__cat:focus { border-color: var(--we-ch-orange); color: var(--we-ch-text); text-decoration: none; }
.we-ch .we-ch__cat img {
	flex: none;
	width: 40px;
	height: 40px;
	max-width: none;
	object-fit: contain;
}

/* Keyboard focus (overrides the theme's global a:focus outline reset) */
.we-ch a:focus-visible {
	outline: 2px solid var(--we-ch-orange) !important;
	outline-offset: 2px;
}

/* ==========================================================================
   Mobile: tabs and chips scroll sideways, chips in 2 rows
   ========================================================================== */
@media (max-width: 767px) {
	.we-ch { padding: 10px 16px 0; }

	.we-ch .we-ch__crumbs { font-size: 11px; }
	.we-ch .we-ch__head { margin-top: 8px; }
	.we-ch .we-ch__title { font-size: 26px; }
	.we-ch .we-ch__count { font-size: 13px; }
	.we-ch .we-ch__intro { font-size: 13px; }

	.we-ch .we-ch__tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		margin: 0 -16px;
		padding: 0 16px;
		scroll-padding-inline: 16px;
		scrollbar-width: none;
		align-self: stretch;
		-webkit-overflow-scrolling: touch;
	}
	.we-ch .we-ch__tabs::-webkit-scrollbar { display: none; }

	.we-ch .we-ch__cats {
		display: grid;
		grid-template-rows: repeat(2, auto);
		grid-auto-flow: column;
		grid-auto-columns: max-content;
		gap: 8px;
		overflow-x: auto;
		margin: 0 -16px;
		padding: 14px 16px 10px;
		scroll-padding-inline: 16px;
		scroll-snap-type: x proximity;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}
	.we-ch .we-ch__cats::-webkit-scrollbar { display: none; }
	.we-ch .we-ch__cats > li { scroll-snap-align: start; }

	.we-ch .we-ch__cat { min-height: 48px; font-size: 13px; }

	/* Scroll indicator under the chips */
	.we-ch .we-ch__scroll {
		position: relative;
		height: 3px;
		margin: 0 0 12px;
		border-radius: 3px;
		background: var(--we-ch-line);
		overflow: hidden;
	}
	.we-ch .we-ch__scroll-thumb {
		position: absolute;
		top: 0;
		left: 0;
		height: 100%;
		border-radius: 3px;
		background: var(--we-ch-orange);
	}
}
@media (min-width: 768px) {
	.we-ch .we-ch__scroll { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.we-ch .we-ch__cat { transition: none; }
}
