/**
 * Evradin Hide — mobile app feel (bottom nav, sheets, tap feedback, PWA spacing).
 * Undo: remove enqueue in includes/evradin-mobile-app-feel.php
 */

:root {
	--ev-bottom-nav-h: calc(3.75rem + env(safe-area-inset-bottom, 0px));
	--ev-brand-ink: #1a1512;
	--ev-border-warm: #e8e1d9;
}

@media (max-width: 781px) {
	body.ev-has-bottom-nav {
		padding-bottom: var(--ev-bottom-nav-h);
	}

	body.ev-has-bottom-nav .ev-site-footer,
	body.ev-has-bottom-nav .wp-site-blocks > footer {
		margin-bottom: 0;
	}

	body.ev-has-bottom-nav .ev-whatsapp-float {
		bottom: calc(var(--ev-bottom-nav-h) + 0.75rem);
	}

	/* Woo mini-cart drawer above bottom nav + safe area */
	.wc-block-mini-cart__drawer,
	.wc-block-components-drawer {
		z-index: 140 !important;
	}

	.wc-block-mini-cart__template-part,
	.wc-block-mini-cart__footer {
		padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0));
	}

	body:not(.ev-has-bottom-nav) .ev-whatsapp-float {
		bottom: max(1rem, env(safe-area-inset-bottom, 0px));
	}
}

/* Tap feedback */
@media (hover: none) {
	.ev-bottom-nav__item:active,
	.ev-product-card:active,
	.ev-category-card:active,
	.button:active,
	.wp-block-button__link:active,
	.wc-block-components-button:active {
		transform: scale(0.97);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ev-bottom-nav__item:active,
	.ev-product-card:active,
	.ev-category-card:active {
		transform: none;
	}
}

/* Bottom navigation */
.ev-bottom-nav {
	display: none;
}

@media (max-width: 781px) {
	.ev-bottom-nav {
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 120;
		height: var(--ev-bottom-nav-h);
		padding-bottom: env(safe-area-inset-bottom, 0);
		background: #fff;
		border-top: 1px solid var(--ev-border-warm);
		box-shadow: 0 -4px 16px rgb(26 21 18 / 6%);
	}

	.ev-bottom-nav__item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 0.15rem;
		min-height: 44px;
		padding: 0.35rem 0.15rem;
		border: 0;
		background: transparent;
		color: var(--ev-brand-ink);
		text-decoration: none;
		font: inherit;
		cursor: pointer;
		transition: transform 0.12s ease;
	}

	.ev-bottom-nav__item.is-active {
		font-weight: 600;
	}

	.ev-bottom-nav__icon-wrap {
		position: relative;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 1.5rem;
		min-height: 1.5rem;
	}

	.ev-bottom-nav__icon {
		font-size: 1.125rem;
		line-height: 1;
	}

	.ev-bottom-nav__badge {
		position: absolute;
		top: -0.35rem;
		right: -0.55rem;
		min-width: 1.125rem;
		height: 1.125rem;
		padding: 0 0.25rem;
		border-radius: 999px;
		background: var(--ev-brand-ink);
		color: #fff;
		font-size: 0.625rem;
		font-weight: 600;
		line-height: 1.125rem;
		text-align: center;
	}

	.ev-bottom-nav__badge[hidden] {
		display: none !important;
	}

	.ev-bottom-nav__item:focus-visible {
		outline: 2px solid var(--ev-brand-ink);
		outline-offset: 2px;
	}

	.ev-bottom-nav__label {
		font-size: 0.625rem;
		letter-spacing: 0.02em;
	}
}

/* Search bottom sheet */
.ev-app-search-sheet[hidden] {
	display: none !important;
}

.ev-app-search-sheet {
	position: fixed;
	inset: 0;
	z-index: 130;
}

.ev-app-search-sheet__backdrop {
	position: absolute;
	inset: 0;
	background: rgb(26 21 18 / 45%);
}

.ev-app-search-sheet__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0));
	background: #fff;
	border-radius: 1rem 1rem 0 0;
}

.ev-app-search-sheet__form {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.ev-app-search-sheet__form input[type="search"] {
	flex: 1;
	min-height: 44px;
	padding: 0 0.75rem;
	border: 1px solid var(--ev-border-warm);
}

.ev-app-search-sheet__submit,
.ev-app-search-sheet__close {
	min-height: 44px;
	padding: 0 1rem;
	border: 0;
	background: var(--ev-brand-ink);
	color: #fff;
	cursor: pointer;
}

.ev-app-search-sheet__close {
	margin-top: 0.75rem;
	width: 100%;
	background: transparent;
	color: var(--ev-brand-ink);
	border: 1px solid var(--ev-border-warm);
}

/* WhatsApp floating action (official green + logo) */
.ev-whatsapp-float {
	position: fixed;
	right: max(1rem, env(safe-area-inset-right, 0px));
	bottom: 1rem;
	z-index: 110;
	width: 3.25rem;
	height: 3.25rem;
	min-width: 44px;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	background: #25d366;
	color: #fff;
	text-decoration: none;
	box-shadow: 0 4px 14px rgb(37 211 102 / 35%);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ev-whatsapp-float:hover,
.ev-whatsapp-float:focus-visible {
	color: #fff;
	box-shadow: 0 6px 18px rgb(37 211 102 / 45%);
	outline: 2px solid #1a1512;
	outline-offset: 2px;
}

.ev-whatsapp-float__icon {
	width: 1.75rem;
	height: 1.75rem;
	display: block;
}

@media (hover: none) {
	.ev-whatsapp-float:active {
		transform: scale(0.97);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ev-whatsapp-float {
		transition: none;
	}

	.ev-whatsapp-float:active {
		transform: none;
	}
}

/* Category pills (horizontal scroll) */
.ev-shop-pills-wrap {
	max-width: 100%;
	overflow: hidden;
}

.ev-category-pills {
	display: flex;
	gap: 0.5rem;
	max-width: 100%;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	padding: 0.25rem 0 0.75rem;
	margin: 0 0 0.5rem;
	list-style: none;
	scrollbar-width: none;
}

.ev-category-pills::-webkit-scrollbar {
	display: none;
}

.ev-category-pills__item {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

.ev-category-pills__link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 0.95rem;
	border: 1px solid color-mix(in srgb, var(--ev-brand-ink, #1a1512) 32%, transparent);
	border-radius: 999px;
	color: var(--ev-brand-ink);
	text-decoration: none;
	font-size: 0.8125rem;
	font-weight: 500;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.ev-category-pills__link.is-active,
.ev-category-pills__link[aria-current="page"] {
	background: var(--ev-brand-ink, #1a1512);
	border-color: var(--ev-brand-ink, #1a1512);
	color: #fff;
}

/* Product row carousel — primary rules in storefront.css (.ev-home-grid--one-row-four) */
@media (max-width: 781px) {
	.ev-home-grid.ev-product-row-scroll {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		gap: 0.75rem;
		padding-bottom: 0.35rem;
		-webkit-overflow-scrolling: touch;
	}

	.ev-home-grid.ev-product-row-scroll > li {
		flex: 0 0 47%;
		max-width: 47%;
		scroll-snap-align: start;
	}
}

/* Sticky add-to-cart bar (mobile PDP) */
@media (max-width: 781px) {
	body.single-product {
		padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0));
	}

	.single-product .ev-pdp-sticky-bar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 115;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.75rem;
		padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0));
		background: #fff;
		border-top: 1px solid var(--ev-border-warm);
		box-shadow: 0 -4px 16px rgb(26 21 18 / 8%);
	}

	body.ev-has-bottom-nav.single-product .ev-pdp-sticky-bar {
		bottom: var(--ev-bottom-nav-h);
	}

	body.ev-has-bottom-nav.single-product {
		padding-bottom: calc(var(--ev-bottom-nav-h) + 4.5rem);
	}

	.single-product .ev-pdp-sticky-bar .price {
		margin: 0;
		font-weight: 600;
		font-size: 1rem;
	}

	.single-product .ev-pdp-sticky-bar .button,
	.single-product .ev-pdp-sticky-bar .single_add_to_cart_button {
		flex: 1;
		min-height: 44px;
		margin: 0;
		text-align: center;
	}

	.single-product .ev-pdp-sticky-bar .button.disabled,
	.single-product .ev-pdp-sticky-bar .button:disabled {
		opacity: 0.55;
	}

	/* Main gallery: horizontal swipe between images */
	.single-product .woocommerce-product-gallery .flex-viewport,
	.single-product .woocommerce-product-gallery__wrapper {
		touch-action: pan-y pinch-zoom;
	}

	.single-product .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs {
		scroll-snap-type: x mandatory;
	}
}

/* Homepage contrast + readability */
.ev-trust__lede,
.ev-trust__title,
.ev-brand-story__lede,
.ev-craftsmanship__lede,
.ev-site-footer a,
.ev-site-footer p {
	color: #3a332d;
}

.ev-trust__lede,
.ev-brand-story__lede,
.ev-craftsmanship__lede {
	font-size: max(0.875rem, 14px);
	line-height: 1.5;
}

.ev-product-card__leadtime {
	font-size: 0.8125rem;
	color: #3a332d;
	opacity: 0.9;
}

/* Newsletter polish */
.ev-newsletter__form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: stretch;
}

.ev-newsletter__form input[type="email"] {
	flex: 1;
	min-width: 12rem;
	min-height: 44px;
}

.ev-newsletter__form button,
.ev-newsletter__form .wp-block-button__link {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	background: var(--ev-brand-ink) !important;
	color: #fff !important;
}

.ev-newsletter__privacy {
	margin: 0.5rem 0 0;
	font-size: 0.8125rem;
	color: #3a332d;
}

.ev-shipping-band + .ev-newsletter,
.ev-journal-home + .ev-newsletter {
	margin-top: clamp(2rem, 4vw, 3rem);
}

.ev-shop-pills-wrap {
	margin: 0 0 1rem;
}

/* Footer: compact nav on mobile; legal links stay tappable */
@media (max-width: 781px) {
	.ev-site-footer__nav a {
		display: inline-flex;
		align-items: center;
		min-height: auto;
		padding-block: 0.125rem;
		line-height: 1.45;
	}

	.ev-site-footer__legal a {
		display: inline-flex;
		align-items: center;
		min-height: 2.75rem;
	}
}

/* PWA install hint (Android Chrome beforeinstallprompt) */
.ev-pwa-install {
	position: fixed;
	left: 0.75rem;
	right: 0.75rem;
	bottom: calc(var(--ev-bottom-nav-h, 0px) + 0.75rem);
	z-index: 150;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	background: #fff;
	border: 1px solid var(--ev-border-warm);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(26, 21, 18, 0.12);
}

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

.ev-pwa-install__text {
	flex: 1 1 12rem;
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: #3a332d;
}

.ev-pwa-install__actions {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.ev-pwa-install__btn {
	min-height: 40px;
	padding: 0 0.85rem;
	border: none;
	border-radius: 4px;
	background: var(--ev-brand-ink);
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
}

.ev-pwa-install__dismiss {
	min-width: 40px;
	min-height: 40px;
	border: none;
	background: transparent;
	color: #3a332d;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
}

@media (min-width: 782px) {
	.ev-pwa-install {
		left: auto;
		right: 1rem;
		max-width: 22rem;
		bottom: 1rem;
	}
}
