/*
 * OBD Dynamics App — front-end install prompt.
 *
 * Scoped entirely under .oba-install so it cannot leak into the theme, and
 * driven by --oba-* custom properties that the plugin prints inline from the
 * site's own brand colour. It deliberately does NOT read the theme's variables:
 * half the themes in this estate do not declare them, and a missing --brand
 * used to leave the install button's label the same colour as its background.
 *
 * The card is a light surface by default and follows the device to dark, so it
 * sits well on both a white page and a dark one.
 */

.oba-install {
	--oba-radius: 18px;
	--oba-surface: #ffffff;
	--oba-ink: #14161a;
	--oba-muted: rgba(20, 22, 26, .62);
	--oba-line: rgba(20, 22, 26, .12);
	--oba-shadow: 0 2px 6px rgba(12, 14, 18, .06), 0 18px 44px -12px rgba(12, 14, 18, .34);

	position: fixed;
	left: 50%;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 99990;

	display: flex;
	align-items: center;
	gap: 14px;

	width: calc(100% - 24px);
	max-width: 440px;
	padding: 14px;

	border: 1px solid var(--oba-line);
	border-radius: var(--oba-radius);
	background: var(--oba-surface);
	color: var(--oba-ink);
	box-shadow: var(--oba-shadow);

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	text-align: left;

	opacity: 0;
	transform: translate(-50%, 14px) scale(.98);
	transition: opacity .26s ease, transform .32s cubic-bezier(.22, .61, .36, 1);
}

.oba-install.is-open {
	opacity: 1;
	transform: translate(-50%, 0) scale(1);
}

/* The icon is the app icon, so it gets the same rounding a home screen gives
   it, plus a hairline to keep a pale brand from dissolving into the card. */
.oba-install__icon {
	flex: 0 0 auto;
	width: 54px;
	height: 54px;
	border-radius: 14px;
	display: block;
	background: var(--oba-brand, #14161a);
	box-shadow: 0 1px 3px rgba(12, 14, 18, .18), inset 0 0 0 1px rgba(0, 0, 0, .06);
}

.oba-install__text {
	flex: 1 1 auto;
	min-width: 0;
}

.oba-install__title {
	margin: 0;
	font-weight: 650;
	font-size: 15.5px;
	letter-spacing: -.01em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.oba-install__body {
	margin: 3px 0 0;
	font-size: 13px;
	line-height: 1.35;
	color: var(--oba-muted);
}

.oba-install__actions {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 4px;
}

.oba-install__button,
.oba-install__dismiss {
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	font-family: inherit;
	white-space: nowrap;
	border-radius: 999px;
	border: 0;
}

/* The one place the brand colour is used at full strength. */
.oba-install__button {
	min-height: 40px;
	padding: 0 18px;
	font-weight: 650;
	font-size: 14px;
	letter-spacing: -.005em;
	background: var(--oba-brand, #14161a);
	color: var(--oba-on-brand, #ffffff);
	box-shadow: 0 1px 2px rgba(12, 14, 18, .16);
	transition: filter .16s ease, transform .16s ease;
}

.oba-install__button:hover {
	filter: brightness(1.06);
}

.oba-install__button:active {
	transform: translateY(1px);
	filter: brightness(.96);
}

.oba-install__dismiss {
	background: transparent;
	color: var(--oba-muted);
	font-size: 12.5px;
	min-height: 26px;
	padding: 0 8px;
}

.oba-install__dismiss:hover,
.oba-install__dismiss:focus-visible {
	color: var(--oba-ink);
}

.oba-install__button:focus-visible,
.oba-install__dismiss:focus-visible {
	outline: 2px solid var(--oba-brand, #14161a);
	outline-offset: 2px;
}

/* iOS gets a hint rather than a button, so the actions column is just the
   dismiss and the card can give the copy the full width. */
.oba-install--hint .oba-install__body {
	font-size: 13.5px;
}

@media (max-width: 460px) {
	.oba-install {
		gap: 12px;
		padding: 12px;
	}

	.oba-install__icon {
		width: 46px;
		height: 46px;
		border-radius: 12px;
	}

	.oba-install__title {
		font-size: 15px;
	}

	.oba-install__button {
		min-height: 38px;
		padding: 0 14px;
	}
}

@media (prefers-color-scheme: dark) {
	.oba-install {
		--oba-surface: #1b1e23;
		--oba-ink: #f4f5f7;
		--oba-muted: rgba(244, 245, 247, .64);
		--oba-line: rgba(255, 255, 255, .14);
		--oba-shadow: 0 2px 6px rgba(0, 0, 0, .34), 0 18px 44px -12px rgba(0, 0, 0, .7);
	}

	.oba-install__icon {
		box-shadow: 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.oba-install {
		transition: none;
		transform: translate(-50%, 0);
	}
}

/* The prompt is irrelevant once the app is running from the home screen. */
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
	.oba-install {
		display: none !important;
	}
}

@media print {
	.oba-install {
		display: none !important;
	}
}
