/* ditis Search – storefront search bar. Inherits the theme's font; colours via --ds-accent. */
.ditis-search {
	--ds-accent: #1f4e46;
	--ds-radius: 12px;
	--ds-ink: #1c1c1a;
	--ds-muted: #5f5e58;
	--ds-line: #e4e2dc;
	--ds-soft: #f4f3ef;
	position: relative;
	width: 100%;
	max-width: 720px;
	font: inherit;
	color: var(--ds-ink);
}
.ditis-search *,
.ditis-search *::before,
.ditis-search *::after { box-sizing: border-box; }
/* Themes add their own icon to search forms (Storefront: `.widget_product_search form::before`); ours has its own. */
form.ditis-search::before,
form.ditis-search::after { content: none !important; }

.ditis-search .ds-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.ditis-search .ds-field {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 6px 0 14px;
	background: #fff;
	border: 2px solid var(--ds-line);
	border-radius: var(--ds-radius);
	transition: border-color .15s;
}
.ditis-search .ds-field:focus-within { border-color: var(--ds-accent); }
.ditis-search .ds-icon { flex: 0 0 auto; color: var(--ds-muted); }
.ditis-search .ds-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 44px;
	border: 0 !important;
	outline: none;
	box-shadow: none !important;
	background: transparent !important;
	padding: 0 !important;
	font: inherit;
	font-size: 16px; /* 16px stops iOS zooming in. */
	color: inherit;
}
.ditis-search .ds-input::-webkit-search-cancel-button { display: none; }
.ditis-search .ds-clear {
	/* Reset theme button styles (Storefront's padding stretched it into an oval). */
	display: inline-flex; align-items: center; justify-content: center;
	flex: 0 0 36px;
	width: 36px; height: 36px; min-height: 0; margin: 0; padding: 0;
	border: 0; border-radius: 50%;
	background: transparent; box-shadow: none;
	color: var(--ds-muted);
	font-size: 22px; line-height: 1;
	cursor: pointer;
}
.ditis-search .ds-clear[hidden] { display: none; }
.ditis-search .ds-clear:hover { background: var(--ds-soft); }
.ditis-search .ds-submit {
	height: 36px;
	padding: 0 14px;
	border: 0;
	border-radius: calc(var(--ds-radius) - 4px);
	background: var(--ds-accent);
	color: var(--ds-on-accent, #fff);
	font: inherit; font-weight: 600;
	cursor: pointer;
}
.ditis-search--suggest .ds-submit,
.ditis-search--simple .ds-submit { display: none; } /* Enter submits; shown again when JS is off (see below). */
.ditis-search:not(.ds-ready) .ds-submit { display: inline-block; }

/* Panel */
/* Alignment under the bar (setting); --ds-shift (script) keeps a wide panel on screen. */
.ditis-search .ds-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	translate: var(--ds-shift, 0px) 0;
	z-index: 9999;
	width: 100%;
	max-height: min(75vh, 720px);
	overflow-y: auto;
	background: #fff;
	/* Follows the bar's corners, but a "pill" bar must not make a pill-shaped panel. */
	border-radius: min(calc(var(--ds-radius) + 4px), 16px);
	box-shadow: 0 16px 40px rgba(28, 28, 26, .16), 0 0 0 1px rgba(28, 28, 26, .06);
	padding: 20px;
}
.ditis-search .ds-panel[hidden] { display: none; }

/* Open and close motion. JS sets is-entering / is-closing and gives staggered items --ds-i. */
@keyframes ds-panel-in { from { opacity: 0; transform: translateY(var(--ds-from)) scale(.985); } }
@keyframes ds-item-in { from { opacity: 0; transform: translateY(6px); } }
.ditis-search .ds-panel { --ds-from: -6px; transform-origin: top center; }
.ditis-search .ds-panel.is-up { --ds-from: 6px; transform-origin: bottom center; }
.ditis-search .ds-panel.is-entering { animation: ds-panel-in .18s cubic-bezier(.2, .8, .2, 1); }
.ditis-search .ds-panel.is-entering [style*="--ds-i"] {
	animation: ds-item-in .28s cubic-bezier(.2, .8, .2, 1) both;
	animation-delay: calc(var(--ds-i) * 18ms + 40ms);
}
.ditis-search .ds-panel.is-closing {
	opacity: 0;
	transform: translateY(var(--ds-from)) scale(.985);
	transition: opacity .15s ease, transform .15s ease;
	pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
	.ditis-search .ds-panel.is-entering,
	.ditis-search .ds-panel.is-entering [style*="--ds-i"] { animation: none; }
	.ditis-search .ds-panel.is-closing { transition: none; }
}
.ditis-search--suggest .ds-panel { width: max(100%, min(880px, calc(100vw - 32px))); }
.ditis-search--simple .ds-panel { width: max(100%, min(680px, calc(100vw - 32px))); }

.ditis-search .ds-discovery,
.ditis-search .ds-typing {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
}
.ditis-search .ds-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ditis-search .ds-col--side { flex: 1 1 200px; }
.ditis-search .ds-col--main { flex: 3 1 340px; }
.ditis-search .ds-typing--single .ds-col--main { flex-basis: 100%; }

.ditis-search .ds-section { display: flex; flex-direction: column; gap: 8px; }
.ditis-search .ds-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ditis-search .ds-section-title {
	margin: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ds-muted);
}
.ditis-search .ds-link-button {
	border: 0; background: none; padding: 4px;
	font: inherit; font-size: 13px;
	color: var(--ds-accent);
	cursor: pointer;
}

.ditis-search a { color: inherit; text-decoration: none; }
.ditis-search [role="option"].is-active,
.ditis-search a:hover { background: var(--ds-soft); }
.ditis-search a:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }

.ditis-search .ds-list { list-style: none; margin: 0; padding: 0; }
.ditis-search .ds-row {
	display: flex; align-items: center; gap: 10px;
	padding: 8px 6px;
	border-radius: 8px;
	min-height: 40px;
}
.ditis-search .ds-row--split { justify-content: space-between; }
.ditis-search .ds-row-icon,
.ditis-search .ds-num { color: var(--ds-muted); width: 18px; text-align: center; font-weight: 600; }
.ditis-search .ds-count,
.ditis-search .ds-meta { color: var(--ds-muted); font-size: 13px; }
.ditis-search mark { background: none; color: inherit; font-weight: 700; padding: 0; }

.ditis-search .ds-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Recent searches: one row across the top of the panel. Chips scroll sideways instead of wrapping. */
.ditis-search .ds-recent-bar {
	display: flex; align-items: center; gap: 12px;
	margin: -4px 0 20px; padding-bottom: 16px;
	border-bottom: 1px solid var(--ds-line);
}
.ditis-search .ds-recent-bar .ds-section-title { flex: 0 0 auto; white-space: nowrap; }
.ditis-search .ds-recent-bar .ds-chips {
	flex: 1 1 auto; min-width: 0;
	flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
}
.ditis-search .ds-recent-bar .ds-chips::-webkit-scrollbar { display: none; }
.ditis-search .ds-recent-bar .ds-chip { flex: 0 0 auto; white-space: nowrap; }
.ditis-search .ds-recent-bar .ds-link-button { flex: 0 0 auto; margin-left: auto; }

/* Theme containers (e.g. Storefront's phone footer bar) centre text and underline links; not in our panel. */
.ditis-search .ds-panel { text-align: left; }
.ditis-search .ds-panel a,
.ditis-search .ds-panel a:hover,
.ditis-search .ds-panel a:focus { text-decoration: none; }
.ditis-search .ds-chip {
	display: inline-flex; align-items: center;
	min-height: 36px;
	border-radius: 18px;
	background: var(--ds-soft);
}
.ditis-search .ds-chip-link { padding: 6px 12px; border-radius: 18px; }
.ditis-search .ds-chip-remove {
	/* Reset theme button styles (Storefront adds padding and line-height that push the × down). */
	display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 30px; min-height: 0; margin: 0 3px 0 0; padding: 0;
	border: 0; border-radius: 50%;
	background: none; box-shadow: none; color: var(--ds-muted);
	font-size: 18px; line-height: 1; cursor: pointer;
}
.ditis-search .ds-chip-remove:hover,
.ditis-search .ds-chip-remove:focus-visible { background: var(--ds-line); color: var(--ds-ink); }

.ditis-search .ds-thumb {
	display: block;
	width: 56px; height: 56px;
	object-fit: cover;
	border-radius: 8px;
	background: var(--ds-soft);
	flex: 0 0 auto;
}
.ditis-search .ds-thumb--empty { display: block; }

/* Categories and trending: horizontal carousels (CSS scroll-snap; arrows from the script for mouse users). */
.ditis-search .ds-carousel { position: relative; }
.ditis-search .ds-tiles,
.ditis-search .ds-cards {
	display: grid;
	grid-auto-flow: column;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}
.ditis-search .ds-tiles::-webkit-scrollbar,
.ditis-search .ds-cards::-webkit-scrollbar { display: none; }
.ditis-search .ds-tiles > *,
.ditis-search .ds-cards > * { scroll-snap-align: start; }
@media (prefers-reduced-motion: no-preference) {
	.ditis-search .ds-tiles,
	.ditis-search .ds-cards { scroll-behavior: smooth; }
}
.ditis-search .ds-tiles { grid-auto-columns: 110px; gap: 12px; }
.ditis-search .ds-tile { display: flex; flex-direction: column; gap: 6px; padding: 4px; border-radius: 10px; font-weight: 600; }
.ditis-search .ds-tile .ds-thumb { width: 100%; height: auto; aspect-ratio: 1 / 1; }

.ditis-search .ds-cards { grid-auto-columns: 150px; gap: 14px; }
.ditis-search .ds-arrow {
	/* Reset theme button styles. */
	display: none;
	position: absolute; top: 40px; z-index: 1;
	align-items: center; justify-content: center;
	width: 32px; height: 32px; min-height: 0; margin: 0; padding: 0;
	border: 0; border-radius: 50%;
	background: #fff; color: var(--ds-ink);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
	cursor: pointer;
}
.ditis-search .ds-arrow--prev { left: -6px; }
.ditis-search .ds-arrow--next { right: -6px; }
.ditis-search .ds-arrow:disabled { visibility: hidden; } /* Not opacity: themes set it on disabled buttons with !important. */
.ditis-search .ds-arrow:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
	.ditis-search .ds-arrow { display: flex; }
}
.ditis-search .ds-carousel.is-fit .ds-arrow { display: none; }
.ditis-search .ds-card { display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 10px; }
.ditis-search .ds-card .ds-thumb { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.ditis-search .ds-card-name {
	font-weight: 600; line-height: 1.3;
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}

.ditis-search .ds-products { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ditis-search .ds-product { display: flex; align-items: center; gap: 14px; padding: 8px; border-radius: 10px; }
.ditis-search .ds-product-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ditis-search .ds-product-name { font-weight: 600; line-height: 1.3; }
.ditis-search .ds-price { font-weight: 600; white-space: nowrap; color: var(--ds-ink); }
.ditis-search .ds-card .ds-price { font-weight: 400; color: var(--ds-muted); }

.ditis-search .ds-show-all {
	display: flex; align-items: center; justify-content: center;
	min-height: 44px; margin-top: 10px; padding: 0 16px;
	border-radius: calc(var(--ds-radius) - 2px);
	background: var(--ds-accent);
	color: var(--ds-on-accent, #fff) !important;
	font-weight: 600; text-align: center;
}
.ditis-search .ds-show-all:hover,
.ditis-search .ds-show-all.is-active { background: var(--ds-accent); filter: brightness(1.1); }

/* Articles & pages */
.ditis-search .ds-content-row { display: flex; align-items: center; gap: 10px; }
.ditis-search .ds-content-row .ds-thumb { width: 40px; height: 40px; border-radius: 6px; }
.ditis-search .ds-content-text { display: flex; flex-direction: column; min-width: 0; }
.ditis-search .ds-content-title { line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.ditis-search .ds-empty + .ds-section,
.ditis-search .ds-section + .ds-empty { margin-top: 16px; }

.ditis-search .ds-empty p { margin: 0 0 10px; }
.ditis-search .ds-message { margin: 0; color: var(--ds-muted); }

/* Phones: full-width panel under the header. */
.ditis-search--align-center .ds-panel { left: 50%; translate: calc(-50% + var(--ds-shift, 0px)) 0; }
.ditis-search--align-right .ds-panel { left: auto; right: 0; }

/* Long category names: break after a slash (added by the script), at most two lines. */
.ditis-search .ds-tile-name { overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; line-height: 1.3; }

@media (max-width: 640px) {
	.ditis-search .ds-panel,
	.ditis-search--suggest .ds-panel,
	.ditis-search--simple .ds-panel {
		translate: none;
		position: fixed;
		left: 8px !important;
		right: 8px;
		width: auto;
		top: auto;
		margin-top: 8px;
		max-height: 70vh;
		padding: 16px;
	}
	/* A part-card at the edge shows there is more to swipe. */
	.ditis-search .ds-cards { grid-auto-columns: 42%; }
	.ditis-search .ds-tiles { grid-auto-columns: 28%; }
	/* Recent searches: title + Clear on the first line, chips full width below. */
	.ditis-search .ds-recent-bar { flex-wrap: wrap; row-gap: 10px; }
	.ditis-search .ds-recent-bar .ds-chips { order: 3; flex-basis: 100%; }
}

/* Live prices (B2B, currency): the indexed price shows faded until this shopper's price arrives. */
.ds-price-loading { opacity: .35; transition: opacity .2s; }

/* Screen readers only. */
.ditis-search .ds-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Shopping assistant entry in the suggestions. */
.ditis-search .ds-assistant-row {
	display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin: 0; padding: 8px 12px;
	border: 1px solid color-mix(in srgb, var(--ds-accent) 35%, transparent); border-radius: 10px;
	background: color-mix(in srgb, var(--ds-accent) 7%, #fff); box-shadow: none; color: var(--ds-ink);
	font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.ditis-search .ds-assistant-row:hover,
.ditis-search .ds-assistant-row.is-active { border-color: var(--ds-accent); }

/* Details box (computers): the product pointed at, in the side column. */
.ditis-search .ds-details { display: flex; flex-direction: column; gap: 8px; }
@media (prefers-reduced-motion: no-preference) {
	.ditis-search .ds-details { animation: ds-details-in .18s ease; }
}
@keyframes ds-details-in { from { opacity: 0; transform: translateX(6px); } }
.ditis-search .ds-details-img { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--ds-soft); }
.ditis-search .ds-details-img img { width: 100%; height: 100%; object-fit: contain; }
.ditis-search .ds-details-name { font-weight: 600; line-height: 1.3; color: var(--ds-ink); }
.ditis-search .ds-details-price { font-weight: 600; color: var(--ds-ink); }
.ditis-search .ds-details-price del { font-weight: 400; color: var(--ds-muted); }
.ditis-search .ds-details-price ins { text-decoration: none; }
.ditis-search .ds-details-stock { margin: 0; font-size: 13px; color: #1a7f37; }
.ditis-search .ds-details-stock.is-out { color: #b32d2e; }
.ditis-search .ds-details-text { margin: 0; color: var(--ds-muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.ditis-search .ds-details-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.ditis-search .ds-details-qty { width: 64px; min-height: 40px; padding: 0 8px; border: 1px solid var(--ds-line); border-radius: 8px; font: inherit; }
.ditis-search .ds-details-add {
	display: inline-flex; align-items: center; justify-content: center; flex: 1 1 auto; min-height: 40px; margin: 0; padding: 0 14px;
	border: 0; border-radius: calc(var(--ds-radius) - 4px); background: var(--ds-accent); color: var(--ds-on-accent, #fff) !important;
	font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; box-shadow: none;
}
.ditis-search .ds-details-add:disabled { opacity: .6; }
.ditis-search .ds-details-added { color: #1a7f37; font-weight: 600; }
.ditis-search .ds-details-cart { font-weight: 600; }
