/*
 * Site Core app mode (PWA) — home-screen install card.
 *
 * Shown on the WooCommerce order-received page only. The card is rendered
 * hidden by includes/pwa.php and revealed by assets/js/bc-pwa-install.js.
 */

/*
 * Mobile install bar.
 *
 * Fixed above the bottom navigation (and, on product pages, above the sticky
 * buy bar). Hidden by default; the install script reveals it on mobile only.
 *
 * Brand values arrive inline from includes/pwa.php and every one has a neutral
 * fallback, so the card looks finished even in a theme that does not define the
 * Site Core custom properties.
 */
.bc-pwa-install-bar {
	position: fixed;
	right: 0.75rem;
	bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
	left: 0.75rem;
	z-index: 96;
	display: none;
	flex-wrap: wrap;
	gap: 0.85rem;
	align-items: center;
	max-width: 30rem;
	padding: 0.9rem;
	margin-inline: auto;
	color: var(--bc-install-ink, var(--bc-color-ink, #111827));
	background: var(--bc-install-surface, var(--bc-color-surface, #ffffff));
	border: 1px solid var(--bc-install-line, var(--bc-color-line, rgba(17, 24, 39, 0.12)));
	border-radius: 20px;
	box-shadow: 0 18px 40px rgba(17, 24, 39, 0.16), 0 2px 8px rgba(17, 24, 39, 0.06);
}

.bc-pwa-install-bar,
.bc-pwa-install-bar * {
	box-sizing: border-box;
}

.bc-pwa-install-bar[hidden] {
	display: none !important;
}

@media (max-width: 899px) {
	.bc-pwa-install-bar {
		bottom: calc(var(--bc-bottom-nav-height, 4rem) + env(safe-area-inset-bottom, 0px) + 0.6rem);
	}

	/* Keep both purchase controls and the navigation fully tappable. */
	body.single-product .bc-pwa-install-bar {
		bottom: calc(var(--bc-bottom-nav-height, 4rem) + var(--bc-sticky-buy-height, 4.1rem) + env(safe-area-inset-bottom, 0px) + 0.6rem);
	}
}

/*
 * When a floating WhatsApp button is present (the bottom bar has no WhatsApp
 * item), lift the card above it too, so neither control covers the other.
 */
@supports selector(:has(*)) {
	@media (max-width: 899px) {
		body:not(.single-product):has(.bc-whatsapp-chat:not(.bc-whatsapp-chat--bottom-nav)) .bc-pwa-install-bar {
			bottom: calc(var(--bc-bottom-nav-height, 4rem) + var(--bc-whatsapp-chat-size, 3.5rem) + 1.25rem + env(safe-area-inset-bottom, 0px) + 0.6rem);
		}
	}
}

@media (max-width: 767px), (pointer: coarse) {
	.bc-pwa-install-bar:not([hidden]) {
		display: flex;
		animation: bc-install-bar-in 250ms ease-out both;
	}
}

@keyframes bc-install-bar-in {
	from {
		opacity: 0;
		transform: translateY(1.25rem);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.bc-pwa-install-bar__icon {
	flex: 0 0 auto;
	width: 3.5rem;
	height: 3.5rem;
	border-radius: 1rem;
	object-fit: cover;
	box-shadow: 0 6px 16px rgba(17, 24, 39, 0.16);
}

.bc-pwa-install-bar__icon--letter {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--bc-install-primary, var(--bc-color-primary, #1f2937));
	color: var(--bc-install-on-primary, #ffffff);
	font-family: var(--bc-font-display, inherit);
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
	text-transform: uppercase;
}

.bc-pwa-install-bar__body {
	flex: 1 1 auto;
	min-width: 8rem;
}

.bc-pwa-install-bar__title {
	margin: 0;
	color: inherit;
	font-family: var(--bc-font-display, inherit);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.25;
}

.bc-pwa-install-bar__text {
	display: -webkit-box;
	margin: 0.2rem 0 0;
	overflow: hidden;
	color: var(--bc-install-muted, rgba(17, 24, 39, 0.68));
	font-size: 0.8125rem;
	line-height: 1.4;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.bc-pwa-install-bar__steps {
	padding-left: 1.1rem;
	margin: 0.45rem 0 0;
	color: var(--bc-install-ink, var(--bc-color-ink, #111827));
	font-size: 0.78rem;
	line-height: 1.4;
}

.bc-pwa-install-bar__steps li + li {
	margin-top: 0.15rem;
}

.bc-pwa-install-bar__actions {
	flex: 0 0 auto;
	display: flex;
	gap: 0.3rem;
	align-items: center;
	margin-inline-start: auto;
}

.bc-pwa-install-bar .bc-pwa-install-bar__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	padding: 0 1.1rem;
	gap: 0;
	color: var(--bc-install-on-primary, #ffffff);
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.01em;
	white-space: nowrap;
	background: var(--bc-install-primary, var(--bc-color-primary, #1f2937));
	border: 0;
	border-radius: 999px;
	box-shadow: 0 6px 16px rgba(17, 24, 39, 0.18);
	cursor: pointer;
	transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.bc-pwa-install-bar .bc-pwa-install-bar__button:hover {
	filter: brightness(0.94);
}

.bc-pwa-install-bar .bc-pwa-install-bar__button:active {
	box-shadow: 0 3px 10px rgba(17, 24, 39, 0.2);
	transform: translateY(1px);
}

.bc-pwa-install-bar .bc-pwa-install-bar__button:focus-visible {
	outline: 2px solid var(--bc-install-ink, var(--bc-color-ink, #111827));
	outline-offset: 2px;
}

.bc-pwa-install-bar .bc-pwa-install-bar__button:disabled {
	opacity: 0.65;
	cursor: default;
}

.bc-pwa-install-bar__dismiss {
	display: inline-grid;
	flex: 0 0 auto;
	width: 2rem;
	height: 2rem;
	padding: 0;
	color: var(--bc-install-muted, rgba(17, 24, 39, 0.68));
	font-size: 1rem;
	line-height: 1;
	background: transparent;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	place-items: center;
	transition: color 150ms ease, background-color 150ms ease;
}

.bc-pwa-install-bar__dismiss:hover {
	color: var(--bc-install-ink, var(--bc-color-ink, #111827));
	background: var(--bc-install-line, rgba(17, 24, 39, 0.12));
}

.bc-pwa-install-bar__dismiss:focus-visible {
	outline: 2px solid var(--bc-install-ink, var(--bc-color-ink, #111827));
	outline-offset: 2px;
}

@media (max-width: 360px) {
	.bc-pwa-install-bar:not([hidden]) {
		display: grid;
		grid-template-columns: 3.5rem minmax(0, 1fr);
		row-gap: 0.7rem;
		padding: 0.8rem;
	}

	.bc-pwa-install-bar__body {
		grid-column: 2;
	}

	.bc-pwa-install-bar__actions {
		grid-column: 1 / -1;
		width: 100%;
		margin-inline-start: 0;
		justify-content: stretch;
	}

	.bc-pwa-install-bar .bc-pwa-install-bar__button {
		flex: 1 1 auto;
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bc-pwa-install-bar {
		animation: none !important;
	}

	.bc-pwa-install-bar .bc-pwa-install-bar__button,
	.bc-pwa-install-bar__dismiss {
		transition: none;
	}

	.bc-pwa-install-bar .bc-pwa-install-bar__button:active {
		transform: none;
	}
}

.bc-pwa-install {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
	margin-top: 1.5rem;
	padding: 1.25rem;
	background: var(--bc-color-surface, #ffffff);
	border: 1px solid var(--bc-color-line, rgba(17, 24, 39, 0.12));
	border-radius: var(--bc-radius-lg, 20px);
	box-shadow: var(--bc-shadow-soft, 0 12px 32px rgba(17, 24, 39, 0.12));
}

.bc-pwa-install[hidden],
.bc-pwa-install [hidden] {
	display: none !important;
}

.bc-pwa-install__icon {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	border-radius: 0.85rem;
	background: var(--bc-color-primary, #1f2937);
	color: var(--bc-color-white, #ffffff);
	font-family: var(--bc-font-display, inherit);
	font-size: 0.62rem;
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: 0.01em;
}

.bc-pwa-install__icon span {
	display: block;
}

.bc-pwa-install__body {
	flex: 1 1 auto;
	min-width: 0;
}

.bc-pwa-install__title {
	margin: 0 0 0.35rem;
	font-family: var(--bc-font-display, inherit);
	font-size: 1.15rem;
	font-weight: 600;
	line-height: 1.2;
	color: var(--bc-color-ink, #111827);
}

.bc-pwa-install__text {
	margin: 0;
	color: var(--bc-color-text, #111827);
	font-size: 0.92rem;
}

.bc-pwa-install__steps {
	display: grid;
	gap: 0.5rem;
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
}

.bc-pwa-install__steps li {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.92rem;
}

.bc-pwa-install__step-icon svg {
	display: block;
	width: 1.25rem;
	height: 1.25rem;
	color: var(--bc-color-primary, #1f2937);
}

.bc-pwa-install__actions {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.5rem;
}

.bc-pwa-install .bc-pwa-install__button {
	min-height: 2.75rem;
	padding: 0 1.1rem;
	color: #ffffff;
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	background: var(--bc-color-primary, #1f2937);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
}

.bc-pwa-install .bc-pwa-install__button:hover {
	filter: brightness(0.94);
}

.bc-pwa-install .bc-pwa-install__button:focus-visible {
	outline: 2px solid var(--bc-color-ink, #111827);
	outline-offset: 2px;
}

.bc-pwa-install__dismiss {
	padding: 0.25rem;
	border: 0;
	background: none;
	color: var(--bc-color-ink-muted, #6b7280);
	font-size: 0.78rem;
	text-decoration: underline;
	cursor: pointer;
}

@media (max-width: 600px) {
	.bc-pwa-install {
		flex-wrap: wrap;
	}

	.bc-pwa-install__actions {
		width: 100%;
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
	}
}

/*
 * Header / footer image logo.
 *
 * Explicit width/height attributes are printed with the image. These rules fix
 * the rendered height before paint, so the logo never shifts the header or
 * footer (CLS = 0).
 */

.bc-wordmark--image {
	display: inline-flex;
}

.bc-wordmark--image picture {
	display: block;
}

.bc-wordmark--image img {
	display: block;
	width: auto;
	height: 44px;
}

.bc-wordmark--footer.bc-wordmark--image {
	align-items: center;
}

.bc-wordmark--footer.bc-wordmark--image img {
	height: 56px;
}

@media (max-width: 767px) {
	.bc-wordmark--image img {
		height: 36px;
	}

	.bc-wordmark--footer.bc-wordmark--image img {
		height: 44px;
	}

	.bc-wordmark--image:not(.bc-wordmark--footer) .bc-wordmark__tagline {
		display: none;
	}
}

/*
 * Installed-app splash screen.
 *
 * Hidden by default. The head boot script adds `bc-is-standalone` only in an
 * installed app, which reveals it. A normal browser tab never sees it and never
 * requests the logo.
 */

.bc-splash {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	padding: 2rem;
	background: var(--bc-splash-bg, #1f2937);
	color: #ffffff;
	text-align: center;
}

.bc-is-standalone .bc-splash {
	display: flex;
}

.bc-splash::before {
	content: "";
	position: absolute;
	inset: 0;
	opacity: 0.07;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cpath d='M20 120C20 65 55 25 120 15c2 55-33 95-100 105Z' fill='%23ffffff'/%3E%3Cpath d='M28 112C50 84 72 62 100 42' stroke='%231f2937' stroke-width='3' fill='none'/%3E%3C/svg%3E") 0 0 / 140px 140px;
	pointer-events: none;
}

.bc-splash > * {
	position: relative;
}

.bc-splash__logo {
	display: block;
	width: 70vw;
	max-width: 280px;
	margin: 0;
}

.bc-splash__logo img {
	display: block;
	width: 100%;
	height: auto;
}

.bc-splash__wordmark {
	font-family: var(--bc-font-display, Georgia, serif);
	font-size: clamp(2rem, 8vw, 3rem);
	font-weight: 700;
	letter-spacing: -0.07em;
	color: #ffffff;
}

.bc-splash__wordmark span {
	color: #f3f4f6;
}

.bc-splash__tagline {
	margin: 0;
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #ffffff;
}

.bc-splash__bar {
	width: min(70vw, 280px);
	height: 4px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.25);
	overflow: hidden;
}

.bc-splash__bar span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: var(--bc-splash-bar, #111827);
	transition: width 0.2s ease;
}

.bc-splash__loading {
	margin: 0;
	font-size: 0.78rem;
	color: rgba(255, 255, 255, 0.85);
}

.bc-splash--hide {
	opacity: 0;
	transition: opacity 0.2s ease;
}

@keyframes bc-splash-out {
	to {
		opacity: 0;
		visibility: hidden;
	}
}

.bc-is-standalone .bc-splash:not(.bc-splash--live) {
	animation: bc-splash-out 0.3s 2s forwards;
}

@media (prefers-reduced-motion: reduce) {
	.bc-splash__bar span {
		transition: none;
	}
}
