/* Moto Storie – invito «Installa l'app» (PWA)
 * Una scheda piccola e chiara che scende dall'alto, solo su telefoni e tablet:
 * sul computer non ha senso (e il testo parla di telefono), quindi non compare.
 */

#ms-install[hidden] { display: none !important; }

#ms-install {
	--msi-bg: #ffffff;
	--msi-text: #1a1a1a;
	--msi-muted: #5f6368;
	--msi-red: #cd192d;
	--msi-red-dark: #a91325;
	--msi-border: rgba(0, 0, 0, .08);

	position: fixed;
	z-index: 99990;
	top: calc(env(safe-area-inset-top, 0px) + 12px);
	left: 50%;
	transform: translateX(-50%);
	width: min(440px, calc(100vw - 24px));
	box-sizing: border-box;

	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 10px 12px 12px;

	background: var(--msi-bg);
	color: var(--msi-text);
	border: 1px solid var(--msi-border);
	border-radius: 16px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .08);
	font: 400 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

	animation: msi-in .35s cubic-bezier(.2, .8, .2, 1) both;
}

/* con la barra di WordPress (amministratori collegati) la scheda scende sotto */
body.admin-bar #ms-install { top: calc(env(safe-area-inset-top, 0px) + 46px + 10px); }
@media (min-width: 783px) {
	body.admin-bar #ms-install { top: calc(32px + 12px); }
}

.ms-install-icon {
	flex: none;
	width: 44px;
	height: 44px;
	border-radius: 11px;
	box-shadow: 0 0 0 1px var(--msi-border);
	object-fit: cover;
}

.ms-install-body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.ms-install-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--msi-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#ms-install-text {
	font-size: 13px;
	color: var(--msi-muted);
}

#ms-install-ok {
	flex: none;
	appearance: none;
	border: 0;
	margin: 0;
	padding: 9px 16px;
	border-radius: 999px;
	background: var(--msi-red);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .15s ease;
}
#ms-install-ok:hover { background: var(--msi-red-dark); }
#ms-install-ok[hidden] { display: none; }

#ms-install-no {
	flex: none;
	appearance: none;
	border: 0;
	margin: 0;
	width: 32px;
	height: 32px;
	padding: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--msi-muted);
	font: 400 22px/32px Arial, sans-serif;
	text-align: center;
	cursor: pointer;
	transition: background-color .15s ease;
}
#ms-install-no:hover { background: rgba(0, 0, 0, .06); color: var(--msi-text); }

#ms-install-ok:focus-visible,
#ms-install-no:focus-visible {
	outline: 3px solid rgba(205, 25, 45, .35);
	outline-offset: 2px;
}

/* tema scuro del telefono */
@media (prefers-color-scheme: dark) {
	#ms-install {
		--msi-bg: #1f2023;
		--msi-text: #f2f2f2;
		--msi-muted: #b5b8bd;
		--msi-border: rgba(255, 255, 255, .1);
		box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
	}
	#ms-install-no:hover { background: rgba(255, 255, 255, .08); }
}

/* computer (mouse): niente invito */
@media (hover: hover) and (pointer: fine) {
	#ms-install { display: none !important; }
}

@keyframes msi-in {
	from { opacity: 0; transform: translate(-50%, -14px); }
	to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
	#ms-install { animation: none; }
}
