/* YB Mobile Bar. Colours, sizes and shape come from the widget's controls (selectors with {{WRAPPER}}); the values here are only the structure and neutral fallbacks. */

.ybsb-mbar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
	display: flex;
	justify-content: center;
	padding-inline: 1rem;
	box-sizing: border-box;
	pointer-events: none;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.ybsb-mbar-inner {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	pointer-events: auto;
	background-color: #fff;
	box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.18);
	/* Frosted glass: blur + colour boost of whatever is behind the bar. Visible when the Background colour is partly transparent. */
	-webkit-backdrop-filter: blur(var(--ybsb-mbar-blur, 0px)) saturate(var(--ybsb-mbar-sat, 100%));
	backdrop-filter: blur(var(--ybsb-mbar-blur, 0px)) saturate(var(--ybsb-mbar-sat, 100%));
}

/* Optional line between the Filters and the Search button. */
.ybsb-mbar-divider {
	flex: none;
	align-self: center;
	width: 0;
	height: 50%;
	margin-inline: 0.25rem;
	border-left: 1px solid rgba(0, 0, 0, 0.15);
}

.ybsb-mbar-full {
	padding-inline: 0;
	bottom: 0;
}

.ybsb-mbar-full .ybsb-mbar-inner {
	width: 100%;
	justify-content: space-around;
	border-radius: 0;
	padding-bottom: calc(0.375rem + env(safe-area-inset-bottom, 0px));
}

.ybsb-mbar.ybsb-mbar-away {
	transform: translateY(calc(100% + 2rem));
	opacity: 0;
	visibility: hidden;
	transition: transform 0.25s ease, opacity 0.25s ease, visibility 0s linear 0.25s;
}

/* Buttons: every state is set here so the theme's own button colours (the pink hover) cannot leak in. */
.ybsb-mbar-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	border: 0 solid transparent;
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	text-decoration: none;
	box-shadow: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition-property: background-color, color, border-color, transform;
	transition-duration: var(--ybsb-btn-ms, 200ms);
	transition-timing-function: ease;
}

.ybsb-mbar-btn svg,
.ybsb-mbar-btn i {
	flex: none;
	display: block;
	fill: currentColor;
}

.ybsb-mbar-label {
	display: inline-grid;
	grid-template-columns: 1fr;
	white-space: nowrap;
}

.ybsb-mbar-label-text {
	min-width: 0;
	overflow: hidden;
}

/* Text appears only while the button is pressed or has keyboard focus. */
.ybsb-mbar-labels-touch .ybsb-mbar-label {
	grid-template-columns: 0fr;
	opacity: 0;
	transition: grid-template-columns 0.2s ease, opacity 0.2s ease;
}

.ybsb-mbar-labels-touch .ybsb-mbar-btn:focus-visible .ybsb-mbar-label,
.ybsb-mbar-labels-touch .ybsb-mbar-btn.ybsb-mbar-pressed .ybsb-mbar-label {
	grid-template-columns: 1fr;
	opacity: 1;
}

.ybsb-mbar-labels-never .ybsb-mbar-label {
	display: none;
}

/* Search panel: opens from the top. */
.ybsb-mbar-backdrop {
	position: fixed;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.25s var(--ybsb-mbar-ease, ease);
}

.ybsb-mbar-backdrop.ybsb-mbar-open {
	opacity: 1;
}

.ybsb-mbar-search-panel {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	max-height: 90vh;
	max-height: 90dvh;
	overflow: auto;
	overscroll-behavior: contain;
	box-sizing: border-box;
	padding: 0.75rem 1rem 1rem;
	padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
	background-color: #fff;
	transform: translateY(-100%);
	transition: transform 0.25s var(--ybsb-mbar-ease, ease);
}

.ybsb-mbar-search-panel.ybsb-mbar-open {
	transform: translateY(0);
}

.ybsb-mbar-search-panel[hidden],
.ybsb-mbar-backdrop[hidden] {
	display: none;
}

.ybsb-mbar-search-head {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.ybsb-mbar-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0 0 0 auto;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	box-shadow: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.ybsb-mbar-close svg,
.ybsb-mbar-close i {
	display: block;
	fill: currentColor;
}

html.ybsb-mbar-lock {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.ybsb-mbar,
	.ybsb-mbar.ybsb-mbar-away,
	.ybsb-mbar-btn,
	.ybsb-mbar-label,
	.ybsb-mbar-backdrop,
	.ybsb-mbar-search-panel {
		transition: none;
	}
}

/* Search form inside the panel: one field (with a clear icon) and one button. Colours come from the controls. */
.ybsb-mbar-form {
	display: grid;
	gap: 0.75rem;
	margin: 0;
}

.ybsb-mbar-field {
	position: relative;
	display: flex;
	align-items: center;
}

.ybsb-mbar-search-panel input.ybsb-mbar-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	border: 1px solid #d0d0d0;
	background-color: #f5f5f5;
	color: #1b1b1b;
	font: inherit;
	font-size: max(1rem, 16px); /* 16px or more: iOS Safari zooms the page into smaller fields */
	-webkit-appearance: none;
	appearance: none;
}

/* The browser's own clear cross would double ours. */
.ybsb-mbar-search-panel input.ybsb-mbar-input::-webkit-search-cancel-button,
.ybsb-mbar-search-panel input.ybsb-mbar-input::-webkit-search-decoration {
	-webkit-appearance: none;
	display: none;
}

.ybsb-mbar-search-panel input.ybsb-mbar-input.ybsb-mbar-has-text {
	padding-inline-end: 3rem;
}

button.ybsb-mbar-clear {
	position: absolute;
	inset-inline-end: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition-property: background-color, color;
	transition-duration: var(--ybsb-btn-ms, 200ms);
}

button.ybsb-mbar-clear[hidden] {
	display: none;
}

/* Search button (inside the panel, under the field). Colours, border and radius come from the controls. */
.ybsb-mbar-search-panel button.ybsb-mbar-show {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	font: inherit;
	text-align: center;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

/* YB Button System look: bar buttons, the Search button and the Close button lift and grow (icon and text together) on hover, keyboard focus and finger-down (touch).
   Values come from the Button Motion controls. The hover rule is limited to real hover devices so a tap does not leave it stuck. */
.ybsb-mbar-search-panel button.ybsb-mbar-show,
.ybsb-mbar-search-panel button.ybsb-mbar-close {
	transition-property: background-color, color, border-color, transform;
	transition-duration: var(--ybsb-btn-ms, 200ms);
	touch-action: manipulation;
}

@media (hover: hover) {
	.ybsb-mbar button.ybsb-mbar-btn:hover,
	.ybsb-mbar-search-panel button.ybsb-mbar-show:hover,
	.ybsb-mbar-search-panel button.ybsb-mbar-close:hover {
		transform: translateY(calc(-1 * var(--ybsb-btn-lift, 0.1875rem))) scale(var(--ybsb-btn-scale, 1.02));
	}
}

.ybsb-mbar button.ybsb-mbar-btn:focus-visible,
.ybsb-mbar button.ybsb-mbar-btn:active,
.ybsb-mbar button.ybsb-mbar-btn.ybsb-mbar-pressed,
.ybsb-mbar-search-panel button.ybsb-mbar-show:focus-visible,
.ybsb-mbar-search-panel button.ybsb-mbar-show:active,
.ybsb-mbar-search-panel button.ybsb-mbar-close:focus-visible,
.ybsb-mbar-search-panel button.ybsb-mbar-close:active {
	transform: translateY(calc(-1 * var(--ybsb-btn-lift, 0.1875rem))) scale(var(--ybsb-btn-scale, 1.02));
}

@media (prefers-reduced-motion: reduce) {
	.ybsb-mbar button.ybsb-mbar-btn,
	.ybsb-mbar-search-panel button.ybsb-mbar-show,
	.ybsb-mbar-search-panel button.ybsb-mbar-close,
	button.ybsb-mbar-clear {
		transition: none;
		transform: none !important;
	}

	button.ybsb-mbar-clear {
		transform: translateY(-50%) !important;
	}
}
