/*
 * Bottom Tab Bar
 *
 * The device style comes from a class on <html>, set by a small script in <head>:
 *   .boa-btb-ios      iPhone and iPad: floating "Liquid Glass" capsule
 *   .boa-btb-android  Android: Material 3 navigation bar
 *   .boa-btb-other    everything else, and no JavaScript: classic translucent bar
 * .boa-btb-dark is added when the settings allow following the device's dark mode.
 *
 * Every icon is printed three times (iOS, Android outlined, Android filled); the rules
 * below show the right one.
 */

/* ---------- Shared values ---------- */

:root {
	--boa-btb-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--boa-btb-tint: var(--boa-btb-accent, #0a63ce);
	--boa-btb-space: 58px; /* room kept free at the bottom of the page */
}

html.boa-btb-ios {
	--boa-btb-space: 78px;
}

html.boa-btb-android {
	--boa-btb-font: Roboto, "Google Sans Text", "Google Sans", system-ui, sans-serif;
	--boa-btb-space: 80px;
}

body.boa-btb-active {
	padding-bottom: calc(var(--boa-btb-space) + env(safe-area-inset-bottom, 0px)) !important;
}

html.boa-btb-sheet-open,
html.boa-btb-sheet-open body {
	overflow: hidden;
}

/* ---------- Bar: classic style (other devices) ---------- */

.boa-btb {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 9990;
	box-sizing: border-box;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	color: #6c6c70;
	background: rgba(248, 248, 250, 0.92);
	-webkit-backdrop-filter: saturate(180%) blur(20px);
	backdrop-filter: saturate(180%) blur(20px);
	border-top: 1px solid rgba(60, 60, 67, 0.18);
	font-family: var(--boa-btb-font);
	-webkit-tap-highlight-color: transparent;
	-webkit-font-smoothing: antialiased;
}

.boa-btb .boa-btb__list {
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	max-width: 640px;
	margin: 0 auto;
	padding: 0;
	list-style: none;
}

.boa-btb .boa-btb__item {
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.boa-btb .boa-btb__item::before,
.boa-btb .boa-btb__item::after {
	content: none;
}

/* Links and the "More" button share one look, whatever the theme does to a/button. */
.boa-btb .boa-btb__tab {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 5px 2px 4px;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	font: inherit;
	font-size: 10px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0.01em;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.boa-btb .boa-btb__tab:hover {
	color: #3a3a3c;
	background: none;
	text-decoration: none;
}

.boa-btb .boa-btb__tab.is-current {
	color: var(--boa-btb-tint);
}

.boa-btb .boa-btb__tab:focus-visible {
	outline: 2px solid var(--boa-btb-tint);
	outline-offset: -3px;
	border-radius: 8px;
}

.boa-btb .boa-btb__label {
	display: block;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- Icons ---------- */

.boa-btb__icon {
	position: relative;
	display: grid;
	place-items: center;
	flex: none;
	width: 28px;
	height: 28px;
}

.boa-btb-icon {
	display: none;
	width: 25px;
	height: 25px;
	flex: none;
	overflow: visible;
}

.boa-btb-icon--ios {
	display: block;
	stroke-width: 1.8;
}

html.boa-btb-android .boa-btb-icon--ios {
	display: none;
}

html.boa-btb-android .boa-btb-icon--md {
	display: block;
}

html.boa-btb-android .is-current > .boa-btb__icon > .boa-btb-icon--md {
	display: none;
}

html.boa-btb-android .is-current > .boa-btb__icon > .boa-btb-icon--md-fill {
	display: block;
}

/* ---------- Bar: iOS ("Liquid Glass" floating capsule) ---------- */

html.boa-btb-ios .boa-btb {
	right: 0;
	bottom: max(10px, env(safe-area-inset-bottom, 0px));
	left: 0;
	width: calc(100% - 24px);
	max-width: 480px;
	margin: 0 auto;
	padding: 4px;
	color: #3a3a3c;
	background: rgba(255, 255, 255, 0.78);
	-webkit-backdrop-filter: blur(18px) saturate(190%);
	backdrop-filter: blur(18px) saturate(190%);
	border: 1px solid rgba(255, 255, 255, 0.8);
	border-radius: 999px;
	box-shadow:
		0 10px 30px rgba(0, 0, 0, 0.12),
		0 1px 3px rgba(0, 0, 0, 0.08),
		inset 0 1px 0 rgba(255, 255, 255, 0.9),
		inset 0 -1px 1px rgba(0, 0, 0, 0.04);
}

html.boa-btb-ios .boa-btb .boa-btb__tab {
	min-height: 54px;
	padding: 5px 2px 4px;
	gap: 1px;
	border-radius: 999px;
	font-size: 10px;
	font-weight: 600;
	transition: background-color 0.2s ease;
}

html.boa-btb-ios .boa-btb .boa-btb__tab:hover {
	color: #1c1c1e;
}

html.boa-btb-ios .boa-btb .boa-btb__tab.is-current {
	color: var(--boa-btb-tint);
	background: rgba(118, 118, 128, 0.14);
}

html.boa-btb-ios .boa-btb .boa-btb__tab:active {
	background: rgba(118, 118, 128, 0.22);
}

html.boa-btb-ios .boa-btb .boa-btb__tab:focus-visible {
	border-radius: 999px;
}

html.boa-btb-ios .boa-btb .boa-btb-icon {
	width: 26px;
	height: 26px;
}

/* ---------- Bar: Android (Material 3 navigation bar) ---------- */

html.boa-btb-android .boa-btb {
	color: #49454f;
	background: var(--boa-btb-md-surface, #f3edf7);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	border-top: 0;
}

html.boa-btb-android .boa-btb .boa-btb__list {
	max-width: 720px;
}

html.boa-btb-android .boa-btb .boa-btb__tab {
	min-height: 80px;
	padding: 12px 0 16px;
	gap: 4px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.04em;
}

html.boa-btb-android .boa-btb .boa-btb__tab:hover {
	color: #1d1b20;
}

html.boa-btb-android .boa-btb .boa-btb__tab.is-current {
	color: #1d1b20;
	font-weight: 700;
}

html.boa-btb-android .boa-btb .boa-btb__icon {
	width: 64px;
	height: 32px;
	border-radius: 16px;
	transition: background-color 0.2s ease;
}

html.boa-btb-android .boa-btb .boa-btb-icon {
	width: 24px;
	height: 24px;
}

html.boa-btb-android .boa-btb .is-current > .boa-btb__icon {
	color: #1d192b;
	background: var(--boa-btb-md-indicator, #e8def8);
}

/* Material "state layer" while pressed. */
html.boa-btb-android .boa-btb .boa-btb__tab:active > .boa-btb__icon {
	background: rgba(29, 27, 32, 0.1);
}

html.boa-btb-android .boa-btb .boa-btb__tab.is-current:active > .boa-btb__icon {
	background: color-mix(in srgb, var(--boa-btb-md-indicator, #e8def8) 85%, #1d1b20);
}

html.boa-btb-android .boa-btb .boa-btb__tab:focus-visible {
	outline-color: #6750a4;
}

/* ---------- "More" sheet: shared and iOS ---------- */

.boa-btb-sheet {
	position: fixed;
	inset: 0;
	z-index: 9995;
	font-family: var(--boa-btb-font);
	-webkit-font-smoothing: antialiased;
}

.boa-btb-sheet[hidden] {
	display: none;
}

.boa-btb-sheet__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.32);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.boa-btb-sheet__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	box-sizing: border-box;
	max-width: 640px;
	max-height: 85vh;
	max-height: 85dvh;
	margin: 0 auto;
	padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
	overflow-y: auto;
	overscroll-behavior: contain;
	color: #1c1c1e;
	background: #f2f2f7;
	border-radius: 16px 16px 0 0;
	box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
	transform: translateY(100%);
	transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.boa-btb-sheet.is-open .boa-btb-sheet__backdrop {
	opacity: 1;
}

.boa-btb-sheet.is-open .boa-btb-sheet__panel {
	transform: none;
}

.boa-btb-sheet__panel:focus {
	outline: none;
}

.boa-btb-sheet__handle {
	width: 36px;
	height: 5px;
	margin: 0 auto 6px;
	background: rgba(60, 60, 67, 0.3);
	border-radius: 3px;
}

.boa-btb-sheet__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 4px 4px 12px;
}

.boa-btb-sheet .boa-btb-sheet__title {
	margin: 0;
	padding: 0;
	color: inherit;
	font: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: 0;
	text-transform: none;
}

.boa-btb-sheet .boa-btb-sheet__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0 14px;
	color: var(--boa-btb-tint);
	background: rgba(118, 118, 128, 0.08); /* light enough for 4.5:1 with the blue text */
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	font: inherit;
	font-size: 17px;
	font-weight: 600;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.boa-btb-sheet__close-icon {
	display: none;
	width: 22px;
	height: 22px;
}

.boa-btb-sheet .boa-btb-sheet__list {
	margin: 0;
	padding: 0;
	overflow: hidden;
	list-style: none;
	background: #ffffff;
	border-radius: 12px;
}

.boa-btb-sheet .boa-btb-sheet__list li,
.boa-btb-sheet .boa-btb-sheet__sublist {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}

.boa-btb-sheet .boa-btb-sheet__list li::before {
	content: none;
}

/* Separators start after the icon, as in iOS lists. */
.boa-btb-sheet .boa-btb-sheet__list > li + li::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	left: 56px;
	border-top: 1px solid rgba(60, 60, 67, 0.16);
}

.boa-btb-sheet .boa-btb-sheet__link {
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 50px;
	margin: 0;
	padding: 8px 14px;
	color: #1c1c1e;
	background: none;
	font-size: 17px;
	font-weight: 400;
	line-height: 1.3;
	text-decoration: none;
	text-transform: none;
}

.boa-btb-sheet .boa-btb-sheet__link:hover {
	color: #1c1c1e;
	background: #f7f7f9;
	text-decoration: none;
}

.boa-btb-sheet .boa-btb-sheet__link:active {
	background: #e5e5ea;
}

.boa-btb-sheet .boa-btb-sheet__link:focus-visible,
.boa-btb-sheet .boa-btb-sheet__close:focus-visible {
	outline: 2px solid var(--boa-btb-tint);
	outline-offset: -2px;
}

.boa-btb-sheet .boa-btb-sheet__link .boa-btb__icon {
	color: var(--boa-btb-tint);
}

.boa-btb-sheet .boa-btb-sheet__link .boa-btb-icon {
	width: 24px;
	height: 24px;
}

.boa-btb-sheet .boa-btb-sheet__link .boa-btb__label {
	flex: 1;
	min-width: 0;
	overflow-wrap: anywhere;
}

.boa-btb-sheet .boa-btb-sheet__link.is-current {
	font-weight: 600;
}

.boa-btb-sheet .boa-btb-sheet__link.is-current .boa-btb__label {
	color: var(--boa-btb-tint);
}

.boa-btb-sheet__chevron {
	flex: none;
	width: 18px;
	height: 18px;
	color: #aeaeb2;
}

.boa-btb-sheet .boa-btb-sheet__link--child {
	min-height: 44px;
	padding-left: 56px;
	color: #3a3a3c;
	font-size: 15px;
}

/* ---------- "More" sheet: Android (Material 3 bottom sheet) ---------- */

html.boa-btb-android .boa-btb-sheet__panel {
	padding: 0 0 calc(16px + env(safe-area-inset-bottom, 0px));
	color: #1d1b20;
	background: var(--boa-btb-md-sheet, #f7f2fa);
	border-radius: 28px 28px 0 0;
	box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
}

html.boa-btb-android .boa-btb-sheet__handle {
	width: 32px;
	height: 4px;
	margin: 16px auto 8px;
	background: rgba(73, 69, 79, 0.4);
	border-radius: 2px;
}

html.boa-btb-android .boa-btb-sheet__header {
	padding: 0 12px 8px 24px;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__title {
	font-size: 22px;
	font-weight: 400;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__close {
	width: 48px;
	height: 48px;
	padding: 0;
	color: #49454f;
	background: none;
	border-radius: 50%;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__close:active {
	background: rgba(29, 27, 32, 0.1);
}

html.boa-btb-android .boa-btb-sheet__close-icon {
	display: block;
}

html.boa-btb-android .boa-btb-sheet__close-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__list {
	padding: 0 12px;
	background: none;
	border-radius: 0;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__list > li + li::before {
	content: none;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link {
	gap: 12px;
	min-height: 56px;
	padding: 0 16px;
	color: #1d1b20;
	border-radius: 28px;
	font-size: 16px;
	letter-spacing: 0.01em;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link:hover {
	background: rgba(29, 27, 32, 0.06);
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link:active {
	background: rgba(29, 27, 32, 0.1);
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link.is-current {
	color: #1d192b;
	background: var(--boa-btb-md-indicator, #e8def8);
	font-weight: 700;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link.is-current .boa-btb__label {
	color: inherit;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link .boa-btb__icon {
	color: #49454f;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link.is-current .boa-btb__icon {
	color: #1d192b;
}

html.boa-btb-android .boa-btb-sheet__chevron {
	display: none;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link--child {
	min-height: 48px;
	padding-left: 56px;
	color: #49454f;
	font-size: 14px;
}

html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link:focus-visible,
html.boa-btb-android .boa-btb-sheet .boa-btb-sheet__close:focus-visible {
	outline-color: #6750a4;
}

/* ---------- Dark mode (only when the settings allow it) ---------- */

@media (prefers-color-scheme: dark) {
	/* A lighter accent keeps the selected label readable on the dark bar. */
	html.boa-btb-dark {
		--boa-btb-tint: var(--boa-btb-accent-dark, #4da3ff);
	}

	html.boa-btb-dark .boa-btb {
		color: #aeaeb2;
		background: rgba(28, 28, 30, 0.9);
		border-top-color: rgba(84, 84, 88, 0.6);
	}

	html.boa-btb-dark .boa-btb .boa-btb__tab:hover {
		color: #e5e5ea;
	}

	html.boa-btb-dark.boa-btb-ios .boa-btb {
		color: #e5e5ea;
		background: rgba(44, 44, 46, 0.92);
		border-color: rgba(255, 255, 255, 0.14);
		box-shadow:
			0 10px 30px rgba(0, 0, 0, 0.4),
			inset 0 1px 0 rgba(255, 255, 255, 0.12);
	}

	html.boa-btb-dark.boa-btb-ios .boa-btb .boa-btb__tab:hover {
		color: #ffffff;
	}

	/* A recessed (darker) bubble: a light one would wash out the coloured label. */
	html.boa-btb-dark.boa-btb-ios .boa-btb .boa-btb__tab.is-current {
		background: rgba(0, 0, 0, 0.28);
	}

	html.boa-btb-dark.boa-btb-android .boa-btb {
		color: #cac4d0;
		background: #211f26;
	}

	html.boa-btb-dark.boa-btb-android .boa-btb .boa-btb__tab:hover,
	html.boa-btb-dark.boa-btb-android .boa-btb .boa-btb__tab.is-current {
		color: #e6e0e9;
	}

	html.boa-btb-dark.boa-btb-android .boa-btb .is-current > .boa-btb__icon {
		color: #e8def8;
		background: var(--boa-btb-md-indicator-dark, #4a4458);
	}

	html.boa-btb-dark .boa-btb-sheet__panel {
		color: #f2f2f7;
		background: #1c1c1e;
	}

	html.boa-btb-dark .boa-btb-sheet .boa-btb-sheet__list {
		background: #2c2c2e;
	}

	html.boa-btb-dark .boa-btb-sheet .boa-btb-sheet__link,
	html.boa-btb-dark .boa-btb-sheet .boa-btb-sheet__link:hover {
		color: #f2f2f7;
	}

	html.boa-btb-dark .boa-btb-sheet .boa-btb-sheet__link:hover {
		background: #3a3a3c;
	}

	html.boa-btb-dark .boa-btb-sheet .boa-btb-sheet__link--child {
		color: #d1d1d6;
	}

	html.boa-btb-dark .boa-btb-sheet .boa-btb-sheet__list > li + li::before {
		border-top-color: rgba(84, 84, 88, 0.6);
	}

	html.boa-btb-dark.boa-btb-android .boa-btb-sheet__panel {
		color: #e6e0e9;
		background: #2b2930;
	}

	html.boa-btb-dark.boa-btb-android .boa-btb-sheet .boa-btb-sheet__list {
		background: none;
	}

	html.boa-btb-dark.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link {
		color: #e6e0e9;
	}

	html.boa-btb-dark.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link:hover {
		background: rgba(230, 224, 233, 0.08);
	}

	html.boa-btb-dark.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link.is-current {
		color: #e8def8;
		background: var(--boa-btb-md-indicator-dark, #4a4458);
	}

	html.boa-btb-dark.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link .boa-btb__icon,
	html.boa-btb-dark.boa-btb-android .boa-btb-sheet .boa-btb-sheet__close {
		color: #cac4d0;
	}

	html.boa-btb-dark.boa-btb-android .boa-btb-sheet .boa-btb-sheet__link.is-current .boa-btb__icon {
		color: #e8def8;
	}
}

/* ---------- Motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
	.boa-btb .boa-btb__tab,
	.boa-btb .boa-btb__icon,
	.boa-btb-sheet__backdrop,
	.boa-btb-sheet__panel {
		transition: none;
	}
}

@media print {
	.boa-btb,
	.boa-btb-sheet {
		display: none !important;
	}

	body.boa-btb-active {
		padding-bottom: 0 !important;
	}
}
