/* ECARTBAY mobile / app polish. Layered on top of the theme's own
   mobile-first CSS - fixes only, no re-layout. */

:root {
	--nmm-nav-h: 58px;
	--nmm-safe: env(safe-area-inset-bottom, 0px);
}

/* ---------- 1. Nothing may scroll sideways ---------- */

html, body { max-width: 100%; }

img, video, iframe, canvas, svg { max-width: 100%; height: auto; }

@media (max-width: 759px) {
	.eb-searchwrap { min-width: 0; }
	.eb-pdp-buy table.variations select { min-width: 0; width: 100%; }
	.eb-pdp-bars { min-width: 0; }

	/* Wide content scrolls inside itself rather than pushing the page. */
	.woocommerce table.shop_table,
	.woocommerce-page table.shop_table,
	.eb-pdp-buy table.variations {
		display: block;
		width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* A price row set to nowrap can paint outside a narrow product card and
   drag the page sideways with it. Let it wrap on small screens. */
@media (max-width: 759px) {
	.eb-price-row {
		flex-wrap: wrap;
		white-space: normal;
	}

	.woocommerce-loop-product__title,
	.eb-cardtitle,
	.eb-lab-main {
		overflow-wrap: anywhere;
	}

	/* A long spec value must wrap rather than widen the row. */
	.eb-specrow > * { min-width: 0; overflow-wrap: anywhere; }
}

/* Last-resort guard. `clip` rather than `hidden`: hidden on html/body
   silently kills position:sticky, which the header and tab bar rely on. */
@supports (overflow-x: clip) {
	html, body { overflow-x: clip; }
}

/* ---------- 2. Native-feeling touch behaviour ---------- */

@media (max-width: 759px) {
	body {
		-webkit-tap-highlight-color: transparent;
		-webkit-text-size-adjust: 100%;
		overscroll-behavior-y: contain;
	}

	a, button, .eb-util, .eb-btn-accent, [role="button"] {
		-webkit-touch-callout: none;
	}

	/* iOS zooms the page when a focused input is under 16px. */
	input[type="text"],
	input[type="search"],
	input[type="email"],
	input[type="tel"],
	input[type="number"],
	input[type="password"],
	select,
	textarea,
	.eb-field,
	.eb-searchfield {
		font-size: 16px;
	}

	/* Comfortable thumb targets. */
	.eb-util { width: 44px; height: 44px; }
	.eb-bottomnav a { min-height: var(--nmm-nav-h); }
	.woocommerce a.button,
	.woocommerce button.button,
	.eb-btn-accent { min-height: 46px; }
}

/* ---------- 3. Bottom nav: fixed, safe-area aware, with a cart badge ---------- */

@media (max-width: 759px) {
	.eb-bottomnav {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		padding-bottom: var(--nmm-safe);
		box-shadow: 0 -1px 12px rgba(37, 35, 34, 0.08);
	}

	/* Icon over label, the way a native tab bar reads. */
	.eb-bottomnav a {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 4px;
		padding: 8px 4px;
		position: relative;
		color: var(--ash, #6E686B);
		text-decoration: none;
	}

	.eb-bottomnav svg {
		width: 22px;
		height: 22px;
		flex: none;
		display: block;
	}

	.eb-bottomnav .eb-micro {
		font-size: 10.5px;
		line-height: 1;
		letter-spacing: 0.04em;
		color: inherit !important;
	}

	.eb-bottomnav a:active { background: var(--surface-charcoal, #F7F5F6); }

	.eb-bottomnav a[aria-current="page"],
	.eb-bottomnav a.is-current { color: var(--gold-text, #026E8C); }
	.eb-bottomnav a.is-current .eb-micro { color: inherit !important; }

	/* Content must clear the fixed bar. */
	body { padding-bottom: calc(var(--nmm-nav-h) + var(--nmm-safe)); }

	/* Anchored to the tab's centre rather than to the label's static position,
	   so the badge lands consistently whatever the label's width. */
	.nmm-badge {
		position: absolute;
		top: 5px;
		left: 50%;
		transform: translateX(5px);
		min-width: 16px;
		height: 17px;
		padding: 0 4px;
		background: var(--gold, #0389AE);
		color: #fff;
		font-size: 10.5px;
		line-height: 17px;
		text-align: center;
		font-variant-numeric: tabular-nums;
	}

	.nmm-badge[hidden] { display: none; }
}

@media (min-width: 760px) {
	.nmm-badge { display: none; }
}

/* ---------- 4. Sticky buy bar (product pages, mobile) ---------- */

.nmm-buybar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: calc(var(--nmm-nav-h) + var(--nmm-safe));
	z-index: 70;
	display: none;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	background: #fff;
	border-top: 1px solid var(--line, #E6E1E4);
	box-shadow: 0 -6px 20px rgba(37, 35, 34, 0.10);
	transform: translateY(105%);
	transition: transform .22s cubic-bezier(.32, .72, 0, 1);
}

.nmm-buybar.is-on { transform: translateY(0); }

@media (max-width: 759px) {
	.nmm-buybar.is-live { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
	.nmm-buybar { transition-duration: .01ms; }
}

.nmm-buybar-thumb {
	flex: none;
	width: 42px;
	height: 42px;
	background: var(--surface-iron, #F1EEF0);
}

.nmm-buybar-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.nmm-buybar-info { min-width: 0; flex: 1; }

.nmm-buybar-name {
	display: block;
	font-size: 12.5px;
	line-height: 1.25;
	color: var(--ash, #6E686B);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nmm-buybar-price {
	display: block;
	font-weight: 600;
	font-size: 15px;
	color: var(--ink, #252322);
	font-variant-numeric: tabular-nums;
}

.nmm-buybar-price del { font-weight: 400; font-size: 12.5px; color: var(--slate, #9C9599); margin-right: 5px; }
.nmm-buybar-price ins { text-decoration: none; }

.nmm-buybar-btn {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 0 22px;
	background: var(--gold, #0389AE);
	border: 1px solid var(--gold, #0389AE);
	border-radius: 0;
	color: #fff;
	font-family: 'Saira', sans-serif;
	font-size: 13px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
}

.nmm-buybar-btn:hover,
.nmm-buybar-btn:active { background: var(--gold-dark, #02607A); border-color: var(--gold-dark, #02607A); color: #fff; }
.nmm-buybar-btn[disabled] { opacity: .55; }

/* ---------- 5. Cart drawer sits above the nav and clears the home bar ---------- */

@media (max-width: 759px) {
	.nmcd-foot { padding-bottom: calc(20px + var(--nmm-safe)); }
	.nmcd { z-index: 99999; }
	.nmcd-scrim { z-index: 99998; }
}

/* ---------- 6. Search suggestions clear the keyboard area ---------- */

@media (max-width: 759px) {
	.nmas-box { max-height: 52vh; }
}

/* ---------- 7. Header stays reachable while scrolling ---------- */

@media (max-width: 759px) {
	.eb-header {
		position: sticky;
		top: 0;
		z-index: 50;
	}
}
