/**
 * Mobile bottom navigation (template-parts/global/bottom-nav.php): an
 * app-style tab bar fixed to the bottom of phone screens (below 48rem).
 * Frosted-glass bar; the current tab gets a highlight pill behind its icon;
 * WhatsApp is a raised, glowing highlight-colored button in the centre.
 * The page reserves the bar's height (body.has-bottom-nav) so nothing hides
 * behind it, and the car page's floating enquiry bar sits just above it.
 */

:root {
	--nscb-bottom-nav-h: 4.25rem;
}

.bottom-nav {
	display: none;
}

@media (max-width: 47.99rem) {
	body.has-bottom-nav {
		padding-bottom: calc(var(--nscb-bottom-nav-h) + env(safe-area-inset-bottom));
	}

	/* Car pages: the floating enquiry bar rides above the tab bar, clear of the
	   raised centre button (it rises 1.75rem above the bar). */
	.has-bottom-nav .car-sticky {
		bottom: calc(var(--nscb-bottom-nav-h) + env(safe-area-inset-bottom) + 1.75rem + var(--nscb-space-2));
	}

	.bottom-nav {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: var(--nscb-z-header);
		display: block;
		padding: 0 max(var(--nscb-space-2), env(safe-area-inset-right)) env(safe-area-inset-bottom) max(var(--nscb-space-2), env(safe-area-inset-left));
		border-top: 1px solid var(--nscb-edge);
		background-color: var(--nscb-color-bg);
		background-color: color-mix(in srgb, var(--nscb-color-bg) 82%, transparent);
		box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, 0.7);
		-webkit-backdrop-filter: blur(18px) saturate(160%);
		backdrop-filter: blur(18px) saturate(160%);
	}

	/* A hairline of light along the top edge, like the site's lit panels. */
	.bottom-nav::before {
		position: absolute;
		top: -1px;
		left: 12%;
		right: 12%;
		height: 1px;
		background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--nscb-color-highlight) 45%, transparent), transparent);
		content: "";
	}

	.bottom-nav__list {
		display: grid;
		grid-auto-columns: minmax(0, 1fr);
		grid-auto-flow: column;
		align-items: end;
		height: var(--nscb-bottom-nav-h);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.bottom-nav__item {
		display: flex;
		justify-content: center;
	}

	.bottom-nav__link {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 0.25rem;
		width: 100%;
		min-height: var(--nscb-bottom-nav-h);
		padding: 0.375rem 0 0.5rem;
		color: var(--nscb-color-text-secondary);
		text-decoration: none;
		-webkit-tap-highlight-color: transparent;
		transition: color var(--nscb-duration-fast) var(--nscb-ease-standard);
	}

	.bottom-nav__link:focus-visible {
		outline-offset: -4px;
		border-radius: var(--nscb-radius-lg);
	}

	/* Icon in a pill that lights up for the current page. */
	.bottom-nav__icon {
		display: grid;
		place-items: center;
		width: 3.5rem;
		height: 2rem;
		border-radius: var(--nscb-radius-pill);
		transition: background-color var(--nscb-duration-base) var(--nscb-ease-standard), transform var(--nscb-duration-fast) var(--nscb-ease-standard);
	}

	.bottom-nav__icon .nscb-icon {
		width: 1.375rem;
		height: 1.375rem;
	}

	.bottom-nav__label {
		font-size: 0.6875rem;
		font-weight: 600;
		letter-spacing: 0.01em;
		line-height: 1;
	}

	.bottom-nav__link[aria-current="page"] {
		color: var(--nscb-color-text);
	}

	.bottom-nav__link[aria-current="page"] .bottom-nav__icon {
		background-color: color-mix(in srgb, var(--nscb-color-highlight) 18%, transparent);
		box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nscb-color-highlight) 28%, transparent);
		color: var(--nscb-color-highlight);
	}

	/* Press feedback, like a native tab. */
	.bottom-nav__link:active .bottom-nav__icon {
		transform: scale(0.9);
	}

	/* ---------- Centre WhatsApp button ---------- */

	.bottom-nav__link--whatsapp {
		color: var(--nscb-color-text);
	}

	.bottom-nav__item--center .bottom-nav__icon {
		position: relative;
		width: 3.5rem;
		height: 3.5rem;
		margin-top: -1.75rem;
		border-radius: 50%;
		background: linear-gradient(180deg, color-mix(in srgb, var(--nscb-color-highlight) 55%, #FFFFFF) 0%, var(--nscb-color-highlight) 45%, color-mix(in srgb, var(--nscb-color-highlight) 70%, #5A3300) 100%);
		box-shadow:
			0 0 0 0.3125rem var(--nscb-color-bg),
			inset 0 1px 0 color-mix(in srgb, #FFFFFF 55%, transparent),
			inset 0 -3px 6px color-mix(in srgb, #3D2200 35%, transparent),
			0 10px 22px -6px color-mix(in srgb, var(--nscb-color-highlight) 60%, transparent);
		color: var(--nscb-color-highlight-text);
	}

	.bottom-nav__item--center .bottom-nav__icon .nscb-icon {
		width: 1.625rem;
		height: 1.625rem;
	}

	/* A slow ring pulsing out of the button to draw the eye. */
	.bottom-nav__item--center .bottom-nav__icon::after {
		position: absolute;
		inset: 0;
		border-radius: 50%;
		box-shadow: 0 0 0 0 color-mix(in srgb, var(--nscb-color-highlight) 55%, transparent);
		content: "";
		animation: nscb-bottom-nav-pulse 2.6s var(--nscb-ease-out) infinite;
		pointer-events: none;
	}

	.bottom-nav__link--whatsapp:active .bottom-nav__icon {
		transform: scale(0.92);
	}
}

@keyframes nscb-bottom-nav-pulse {
	0% {
		box-shadow: 0 0 0 0 color-mix(in srgb, var(--nscb-color-highlight) 50%, transparent);
	}

	70%,
	100% {
		box-shadow: 0 0 0 0.875rem color-mix(in srgb, var(--nscb-color-highlight) 0%, transparent);
	}
}

@media (prefers-reduced-motion: reduce) {
	.bottom-nav__item--center .bottom-nav__icon::after {
		animation: none;
	}
}
