/* DKLens catalog page title banner
 * Shop, product category and tag pages: hidden H1, compact vehicle finder,
 * category slider. Markup comes from woodmart_product_categories_nav()
 * (functions.php) and inc/dklens-title-banner.php. */

/* ---------------------------------------------------------------- Banner */

/* The H1 stays in the page for Google and screen readers, it is just not
 * shown. Scoped with :has() so the title comes back by itself if the finder
 * ever stops rendering. */
.wd-page-title:has(.dkl-title-finder) .wd-title-wrapp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.wd-page-title:has(.dkl-title-finder) .wd-back-btn,
.wd-page-title .wd-btn-show-cat {
	display: none !important;
}

.wd-page-title.page-title:has(.dkl-title-finder) {
	padding-top: 34px;
	padding-bottom: 30px;
}

/* ---------------------------------------------------------------- Photo */

/* Plain grey on the left, the headlight photo filling the right 75% and
 * melting into the grey. The image URL comes from inc/dklens-title-banner.php
 * as --dkl-banner-img. Woodmart's own title image is hidden. */
.wd-page-title.page-title:has(.dkl-title-finder) {
	position: relative;
	overflow: hidden;
	background: #f3f3f3;
}

.wd-page-title:has(.dkl-title-finder) .wd-page-title-bg {
	display: none;
}

.wd-page-title.page-title:has(.dkl-title-finder)::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 0;
	width: 75%;
	background-image: var(--dkl-banner-img, none);
	background-position: right 50%;
	background-size: cover;
	background-repeat: no-repeat;
	-webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 30%);
	mask-image: linear-gradient(90deg, transparent 0%, #000 30%);
	pointer-events: none;
}

.wd-page-title.page-title:has(.dkl-title-finder) > .container {
	position: relative;
	z-index: 1;
}

@media (max-width: 767px) {
	/* Phones: photo behind the lower half, top stays grey for the text. */
	.wd-page-title.page-title:has(.dkl-title-finder)::before {
		width: 100%;
		background-image: var(--dkl-banner-img-sm, var(--dkl-banner-img, none));
		background-position: 65% 50%;
		-webkit-mask-image: linear-gradient(180deg, transparent 0%, transparent 25%, #000 65%);
		mask-image: linear-gradient(180deg, transparent 0%, transparent 25%, #000 65%);
	}
}

/* ---------------------------------------------------------------- Finder */

.dkl-title-finder {
	width: 100%;
	max-width: 760px;
	margin: 0 auto;
	text-align: left;
	color-scheme: light;
}

.dkl-title-finder .dkvf-finder {
	--dkvf-surface: #fff;
	--dkvf-surface-hover: #fafafa;
	--dkvf-control: 44px;
	color-scheme: light;
}

/* The heading sits over the photo, so it gets a soft grey glow behind it
 * and a white halo on the letters. */
.dkl-title-finder .dkvf-finder__head {
	position: relative;
	isolation: isolate;
	margin-bottom: 14px;
	text-align: center;
}

.dkl-title-finder .dkvf-finder__head::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: -1;
	width: 560px;
	max-width: 100%;
	height: 190%;
	transform: translate(-50%, -50%);
	background: radial-gradient(closest-side, rgba(243, 243, 243, 0.95) 40%, rgba(243, 243, 243, 0));
	pointer-events: none;
}

.dkl-title-finder .dkvf-finder__eyebrow {
	justify-content: center;
	font-size: 11px;
	font-weight: 800;
	color: #111;
	text-shadow: 0 0 6px #fff, 0 0 12px #fff;
}

.dkl-title-finder .dkvf-finder__title {
	margin-top: 8px;
	font-size: 22px;
	color: #111;
	text-shadow: 0 0 8px #fff, 0 0 16px rgba(255, 255, 255, 0.9);
}

.dkl-title-finder .dkvf-select {
	padding-left: 18px;
	font-size: 14px;
	color-scheme: light;
}

.dkl-title-finder .dkvf-btn {
	padding: 0 24px;
	font-size: 13px;
}

/* The banner uses Woodmart's light-text scheme, which makes browsers draw
 * the open dropdown list dark. Force a white list with dark text. */
.dkl-title-finder .dkvf-select option,
.dkl-title-finder .dkvf-select optgroup {
	background-color: #fff !important;
	color: #111 !important;
}

.dkl-title-finder .dkvf-select option:disabled {
	color: #a3a3a3 !important;
}

/* ---------------------------------------------------------------- Slider */

.dkl-catslider {
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: 1200px;
	margin: 26px auto 0;
}

.dkl-catslider__track {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	gap: 12px;
	min-width: 0;
	padding: 6px 2px 10px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.dkl-catslider__track::-webkit-scrollbar {
	display: none;
}

.dkl-catslider .dkl-catslider__tile {
	display: flex;
	flex: 0 0 132px;
	flex-direction: column;
	align-items: center;
	padding: 10px 8px 12px;
	border-radius: 12px;
	background: #fff;
	color: #111;
	text-align: center;
	text-decoration: none;
	scroll-snap-align: start;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dkl-catslider .dkl-catslider__tile:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.28);
}

.dkl-catslider .dkl-catslider__tile:focus-visible {
	outline: 2px solid #ff5a00;
	outline-offset: 2px;
}

.dkl-catslider .dkl-catslider__tile.is-current {
	box-shadow: inset 0 0 0 2px #ff5a00, 0 2px 10px -4px rgba(0, 0, 0, 0.18);
}

/* Soft edges so the white tiles and fields still read on the light banner
 * photo. Hover and focus rules above are more specific and still win. */
.dkl-catslider .dkl-catslider__tile,
.dkl-title-finder .dkvf-select,
.dkl-title-finder .dkvf-btn:disabled {
	box-shadow: 0 2px 10px -4px rgba(0, 0, 0, 0.18);
}

/* Same crop as the homepage tiles: square, filled. */
.dkl-catslider__media {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 8px;
}

.dkl-catslider__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.dkl-catslider__name {
	display: block;
	margin-top: 8px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.25;
	color: #111;
}

.dkl-catslider__tag {
	display: block;
	margin-top: 3px;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.25;
	color: #8a8a8a;
}

.dkl-catslider .dkl-catslider__nav {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #111;
	box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.dkl-catslider .dkl-catslider__nav:hover:not(:disabled) {
	background: #111;
	color: #fff;
}

.dkl-catslider .dkl-catslider__nav:disabled {
	opacity: 0.4;
	box-shadow: none;
	cursor: default;
}

.dkl-catslider .dkl-catslider__nav svg {
	width: 16px;
	height: 16px;
}

.dkl-catslider.is-static .dkl-catslider__nav {
	visibility: hidden;
}

/* ---------------------------------------------------------------- Phones */

@media (max-width: 767px) {
	.dkl-catslider {
		display: none;
	}

	.dkl-title-finder .dkvf-finder {
		--dkvf-control: 50px;
	}

	.dkl-title-finder .dkvf-select {
		/* 16px stops iOS Safari zooming the page on focus */
		font-size: 16px;
	}

	.wd-page-title.page-title:has(.dkl-title-finder) {
		padding-top: 26px;
		padding-bottom: 26px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dkl-catslider .dkl-catslider__tile {
		transition: none;
	}

	.dkl-catslider .dkl-catslider__tile:hover {
		transform: none;
	}
}
