/* CategoryPicker - two-level cascading category selector.
   Desktop: fixed dropdown anchored under the trigger.
   Mobile (<768px): bottom sheet + dim backdrop.
   Zoom-safe: the panel is portaled to body while open and JS writes
   rect/zoom-corrected coordinates (see AGENTS.md popup rules). */

.ino-catpicker {
	position: relative;
	width: 100%;
	display: flex;
	flex-direction: column;
}
.ino-catpicker-trigger {
	flex: 1 0 auto;
}

/* ── Trigger ─────────────────────────────────────────────────────── */
.ino-catpicker-trigger {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	min-height: 3.5rem;
	padding: 0.375rem 1rem;
	border: 0;
	background: transparent;
	text-align: start;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 500;
	color: var(--bs-body-color);
}
.ino-catpicker-trigger:focus-visible {
	outline: 2px solid var(--bs-primary, #196cdb);
	outline-offset: -2px;
	border-radius: 12px;
}
.ino-catpicker-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.4rem;
	color: #717171;
}
.ino-catpicker-icon img { vertical-align: middle; }
.ino-catpicker-label {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ino-catpicker-trigger .cp-caret {
	flex: 0 0 auto;
	font-size: 0.8rem;
	color: #717171;
	transition: transform 0.2s ease;
}
.ino-catpicker.is-open .ino-catpicker-trigger .cp-caret { transform: rotate(180deg); }

/* Hero variant: mirrors .ino-field inside the joined search rows.
   The border, seam hairlines, corner logic, hover lift and shimmer
   must stay identical to the sibling fields - the picker is part of
   the same continuous bar, not a separate control. */
.ino-catpicker--hero {
	background: rgba(255, 255, 255, 0.88);
	backdrop-filter: blur(16px) saturate(180%);
	-webkit-backdrop-filter: blur(16px) saturate(180%);
	border: 2px solid var(--ino-field-border, rgba(255, 255, 255, 0.45)) !important;
	border-start-start-radius: 16px;
	border-start-end-radius: 16px;
	border-end-start-radius: 16px;
	border-end-end-radius: 16px;
	transition: background 0.35s cubic-bezier(0.4, 0, 0.2, 1),
		border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
		box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
		transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	overflow: hidden;
}
/* Same flex/stretch contract .ino-field has inside .search-col */
.search-row .search-col .ino-catpicker--hero {
	flex: 1;
	min-height: 3.5rem;
}
.ino-catpicker--hero .ino-catpicker-trigger {
	padding: 0.375rem 1rem;
}
.ino-catpicker--hero:hover,
.ino-catpicker--hero:focus-within {
	background: rgba(255, 255, 255, 0.96);
	border-color: rgba(34, 34, 34, 0.5) !important;
	box-shadow: 0 0 0 4px rgba(34, 34, 34, 0.08),
	            0 10px 35px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}
/* Same sheen sweep the fields show on hover */
.ino-catpicker--hero::before {
	content: '';
	position: absolute;
	top: 0; left: -100%;
	width: 100%; height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
	transition: left 0.6s ease;
	pointer-events: none;
}
.ino-catpicker--hero:hover::before { left: 100%; }
/* Field-icon parity: same size, resting opacity and hover pop */
.ino-catpicker--hero .ino-catpicker-icon {
	font-size: 1.5rem;
	min-width: 1.625rem;
	opacity: 0.5;
	transition: opacity 0.3s ease, transform 0.3s ease;
}
.ino-catpicker--hero .ino-catpicker-icon img {
	width: 1.35rem;
	height: 1.35rem;
}
.ino-catpicker--hero:hover .ino-catpicker-icon,
.ino-catpicker--hero:focus-within .ino-catpicker-icon {
	opacity: 1;
	transform: scale(1.15) rotate(-5deg);
}
/* Seamless joining on desktop - identical rules to .ino-field */
@media (min-width: 768px) {
	.search-row .search-col .ino-catpicker--hero {
		border-start-start-radius: 0 !important;
		border-start-end-radius: 0 !important;
		border-end-start-radius: 0 !important;
		border-end-end-radius: 0 !important;
	}
	.search-row .search-col:first-child .ino-catpicker--hero {
		border-start-start-radius: 16px !important;
		border-end-start-radius: 16px !important;
	}
	.search-row .search-col:last-child .ino-catpicker--hero {
		border-start-end-radius: 16px !important;
		border-end-end-radius: 16px !important;
	}
	.search-row .search-col:not(:first-child) .ino-catpicker--hero {
		border-inline-start: 1px solid rgba(0, 0, 0, 0.06) !important;
	}
	.search-row .search-col:not(:last-child) .ino-catpicker--hero {
		border-inline-end: 1px solid rgba(0, 0, 0, 0.06) !important;
	}
}
/* Mobile parity with .ino-field inside the unified card */
@media (max-width: 767.98px) {
	.ino-catpicker--hero {
		border-radius: 12px !important;
		border: 1.5px solid rgba(255, 255, 255, 0.5) !important;
		background: rgba(255, 255, 255, 0.92);
	}
	.ino-catpicker--hero .ino-catpicker-trigger {
		padding: 0.25rem 0.625rem;
	}
	.ino-catpicker--hero .ino-catpicker-icon {
		font-size: 0.95rem;
		min-width: 1.125rem;
		opacity: 0.6;
	}
	.ino-catpicker--hero .ino-catpicker-icon img {
		width: 1rem;
		height: 1rem;
	}

	/* Unified glass card (mobile only): the whole form becomes one frosted
	   panel of stacked label-above-value rows separated by hairlines. The
	   picker flattens into a row exactly like .ino-field does - transparent,
	   borderless except the bottom divider, label on its own row. */
	html:not([data-a11y-typography="custom"]) #homepage .home-search-form .ino-catpicker--hero {
		background: transparent !important;
		border: none !important;
		border-radius: 0 !important;
		backdrop-filter: none !important;
		-webkit-backdrop-filter: none !important;
		box-shadow: none !important;
		min-height: 4rem;
		margin: 0 !important;
		border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
	}
	html:not([data-a11y-typography="custom"]) #homepage .home-search-form .ino-catpicker--hero .ino-catpicker-trigger {
		flex-wrap: wrap;
		align-content: center;
		min-height: 4rem;
		padding: 0.5rem 1.25rem;
	}
	/* Label gets its own row; icon/caret hide like .ino-field-icon does
	   (the label carries the meaning inside the card). */
	html:not([data-a11y-typography="custom"]) #homepage .home-search-form .ino-catpicker--hero .ino-card-label {
		flex: 0 0 100%;
	}
	html:not([data-a11y-typography="custom"]) #homepage .home-search-form .ino-catpicker--hero .ino-catpicker-icon,
	html:not([data-a11y-typography="custom"]) #homepage .home-search-form .ino-catpicker--hero .cp-caret {
		display: none;
	}
	html:not([data-a11y-typography="custom"]) #homepage .home-search-form .ino-catpicker--hero .ino-catpicker-label {
		font-size: 1rem !important; /* >=16px prevents iOS focus-zoom */
		font-weight: 500;
		margin-top: 0.125rem;
	}
	/* Same inner ring the fields show on hover/focus inside the card */
	html:not([data-a11y-typography="custom"]) #homepage .home-search-form .ino-catpicker--hero:hover,
	html:not([data-a11y-typography="custom"]) #homepage .home-search-form .ino-catpicker--hero:focus-within {
		background: rgba(255, 255, 255, 0.6) !important;
		transform: none;
		box-shadow: inset 0 0 0 2px rgba(34, 34, 34, 0.4) !important;
	}
}

/* a11y custom-typography mode: wrapped fields become independent controls
   with uniform rounding - the picker follows the same rule as .ino-field. */
[data-a11y-typography="custom"] .search-row .search-col .ino-catpicker--hero {
	border-start-start-radius: 16px !important;
	border-start-end-radius: 16px !important;
	border-end-start-radius: 16px !important;
	border-end-end-radius: 16px !important;
}
[data-a11y-typography="custom"] #homepage .search-row .search-col .ino-catpicker--hero {
	border-start-start-radius: 24px !important;
	border-start-end-radius: 24px !important;
	border-end-start-radius: 24px !important;
	border-end-end-radius: 24px !important;
}

/* Bar variant: form-control look next to the results-page inputs */
.ino-catpicker--bar .ino-catpicker-trigger {
	border: var(--bs-border-width) solid var(--bs-border-color, #dee2e6);
	border-radius: var(--bs-border-radius, 0.375rem);
	background: var(--bs-body-bg, #fff);
}
.ino-catpicker--bar .ino-catpicker-trigger:hover,
.ino-catpicker--bar .ino-catpicker-trigger:focus-visible {
	border-color: #86b7fe;
	box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ── Panel (desktop dropdown) ──────────────────────────────────────
   The panel is portaled to document.body while open: an ancestor with
   backdrop-filter/filter/transform (hero + search card glass) would
   otherwise hijack its containing block. JS writes top/left/min-width
   in zoom-corrected units; the sheet mode anchors itself via CSS. */
.ino-catpicker-panel {
	position: fixed;
	z-index: 1080;
	min-width: 280px;
	max-width: min(560px, 92vw);
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
	overflow: hidden;
}
.ino-catpicker-sheet {
	display: flex;
	flex-direction: column;
	max-height: min(60vh, 480px);
}
.ino-catpicker-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.625rem 1rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.ino-catpicker-title {
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: #717171;
}
.ino-catpicker-close {
	display: none;
	border: 0;
	background: transparent;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	font-size: 1rem;
	color: #222;
}
.ino-catpicker-close:hover { background: rgba(0, 0, 0, 0.06); }

.ino-catpicker-list {
	list-style: none;
	margin: 0;
	padding: 0.375rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}
.cp-root-btn,
.cp-opt {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	width: 100%;
	padding: 0.625rem 0.75rem;
	border: 0;
	background: transparent;
	border-radius: 10px;
	text-align: start;
	cursor: pointer;
	font-size: 0.925rem;
	font-weight: 500;
	color: #222;
}
.cp-root-btn:hover,
.cp-opt:hover { background: rgba(0, 0, 0, 0.05); }
.cp-root-btn:focus-visible,
.cp-opt:focus-visible {
	outline: 2px solid var(--bs-primary, #196cdb);
	outline-offset: -2px;
}
.cp-root-btn .cp-caret {
	margin-inline-start: auto;
	font-size: 0.8rem;
	color: #717171;
	transition: transform 0.2s ease;
}
.cp-root-btn[aria-expanded="true"] .cp-caret { transform: rotate(90deg); }
.cp-opt .cp-check {
	margin-inline-start: auto;
	font-size: 0.95rem;
	color: var(--bs-primary, #196cdb);
	visibility: hidden;
}
.cp-opt.is-selected {
	background: rgba(25, 108, 219, 0.09);
	font-weight: 600;
}
.cp-opt.is-selected .cp-check { visibility: visible; }

.cp-leaves {
	list-style: none;
	margin: 0.125rem 0 0.25rem;
	padding: 0.125rem 0.25rem 0.125rem 0.5rem;
	border-inline-start: 2px solid rgba(25, 108, 219, 0.18);
	margin-inline-start: 1.05rem;
}
.cp-opt--allin { font-weight: 600; }
.cp-opt--anything { font-weight: 600; }
.cp-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.35rem;
	color: #717171;
}
.cp-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ── Backdrop + scroll lock (bottom-sheet mode) ──────────────────── */
/* 1075/1080 sit above the mobile map sheet (z-index 1060) - same tier the
   mobile offcanvas filters use. */
.ino-catpicker-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1075;
	background: rgba(0, 0, 0, 0.4);
}
html.ino-catpicker-locked,
html.ino-catpicker-locked body {
	overflow: hidden;
}

/* ── Mobile bottom sheet ─────────────────────────────────────────── */
@media (max-width: 767.98px) {
	.ino-catpicker-panel {
		left: 0;
		right: 0;
		top: auto;
		bottom: 0;
		min-width: 0;
		max-width: none;
		border-radius: 18px 18px 0 0;
		border-bottom: 0;
		z-index: 1080;
		animation: inoCpSheetUp 0.25s ease-out;
	}
	.ino-catpicker-sheet { max-height: 72dvh; }
	.ino-catpicker-head { padding: 0.75rem 1rem; }
	.ino-catpicker-close { display: inline-flex; align-items: center; justify-content: center; }
	.ino-catpicker-title { font-size: 0.85rem; }
	.cp-root-btn,
	.cp-opt {
		padding: 0.75rem;
		font-size: 1rem;
	}
}
@keyframes inoCpSheetUp {
	from { transform: translateY(24px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	.ino-catpicker-panel { animation: none; }
	.ino-catpicker-trigger .cp-caret,
	.cp-root-btn .cp-caret { transition: none; }
}
