/*
 * Cross-device layout hardening.
 * Loaded after every theme stylesheet so Android, iOS, tablets and desktop
 * share the same width-driven responsive behaviour.
 */

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

@supports not (overflow: clip) {
	html,
	body {
		overflow-x: hidden;
	}
}

body,
.zshop-main,
.zshop-site-header,
.zshop-site-footer,
.zshop-container,
.woocommerce,
.woocommerce-page,
.woocommerce div.product,
.woocommerce div.product .summary,
.woocommerce div.product .woocommerce-product-gallery {
	min-inline-size: 0;
}

img,
picture,
video,
iframe,
svg,
table,
input,
select,
textarea,
button {
	max-inline-size: 100%;
}

.zshop-section-heading__copy,
.zshop-category-card__copy,
.zshop-product-card__body,
.zshop-product-card__title,
.zshop-product-card__price,
.woocommerce div.product .summary,
.woocommerce div.product .product_title,
.woocommerce-product-details__short-description {
	min-width: 0;
	overflow-wrap: anywhere;
}

/* Tablets and narrow notebooks: avoid a cramped two-column product page. */
@media (max-width: 900px) {
	.woocommerce div.product {
		grid-template-columns: minmax(0, 1fr);
	}

	.woocommerce div.product .woocommerce-product-gallery,
	.woocommerce div.product .summary {
		width: 100% !important;
	}
}

@media (max-width: 767px) {
	:root {
		--zshop-mobile-nav-height: 74px;
	}

	html {
		scroll-padding-bottom: calc(var(--zshop-mobile-nav-height) + 20px + env(safe-area-inset-bottom));
	}

	body {
		padding-bottom: calc(var(--zshop-mobile-nav-height) + 18px + env(safe-area-inset-bottom));
		font-size: clamp(13px, 3.55vw, 14px);
	}

	.zshop-container {
		width: min(calc(100% - 24px), var(--zshop-container));
		max-width: 100%;
	}

	.zshop-section {
		padding-block: 25px;
	}

	.zshop-section-heading {
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: end;
		gap: 9px;
		margin-bottom: 15px;
	}

	.zshop-section-heading h2 {
		max-width: 100%;
		font-size: clamp(21px, 6.2vw, 27px);
		line-height: 1.48;
		letter-spacing: -0.025em;
	}

	.zshop-section-heading p {
		max-width: 100%;
		font-size: clamp(10px, 2.9vw, 12px);
		line-height: 1.75;
	}

	.zshop-section-link {
		max-width: none;
		min-height: 38px;
		padding: 7px 10px;
		font-size: 10px;
		white-space: nowrap;
	}

	/* Keep the hero proportional on short and tall Android screens. */
	.zshop-hero {
		height: clamp(320px, 96vw, 420px);
		min-height: 0;
		max-height: min(70svh, 420px);
	}

	.zshop-hero-slide {
		padding: 22px 18px 66px;
	}

	.zshop-hero-slide h1 {
		max-width: 15ch;
		font-size: clamp(25px, 7.8vw, 34px);
	}

	.zshop-hero-side {
		grid-template-columns: minmax(0, 1.45fr) minmax(104px, 0.8fr);
	}

	.zshop-promo-card--primary,
	.zshop-promo-card--sale {
		min-width: 0;
		min-height: 158px;
	}

	/* Category cards are compact and useful instead of one oversized row. */
	.zshop-category-grid,
	.zshop-category-grid--listing {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.zshop-category-card {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr);
		min-width: 0;
		min-height: 0;
		border-radius: 18px;
	}

	.zshop-category-card__image {
		width: 100%;
		min-height: 0;
		aspect-ratio: 1.3 / 1;
	}

	.zshop-category-card__copy {
		justify-content: flex-start;
		padding: 12px 11px 13px;
	}

	.zshop-category-card__copy strong {
		display: -webkit-box !important;
		min-height: 42px;
		overflow: hidden;
		font-size: clamp(13px, 3.8vw, 15px);
		line-height: 1.55;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}

	.zshop-category-card__copy small {
		display: block;
		margin: 3px 0 8px;
		font-size: 9px;
		line-height: 1.55;
	}

	.zshop-category-card__copy > span {
		margin-top: auto;
		font-size: 9.5px;
	}

	/* All phone widths, including common 320/360 Android viewports, remain two-column. */
	.zshop-product-grid,
	.zshop-product-rail,
	.woocommerce ul.products,
	.zshop-account-wishlist__grid {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-flow: row;
		grid-auto-columns: auto;
		align-items: stretch;
		gap: 9px;
		width: 100%;
		max-width: 100%;
		padding: 0;
		margin: 0;
		overflow: visible;
		scroll-snap-type: none;
	}

	.zshop-deals-section {
		padding-inline: 0;
	}

	.zshop-deals-panel {
		width: min(calc(100% - 24px), var(--zshop-container));
		padding: 20px 12px 17px;
		border-radius: 22px;
	}

	.zshop-deals-panel .zshop-product-rail {
		margin: 0;
		padding: 0;
	}

	.zshop-product-card,
	.woocommerce ul.products li.product.zshop-product-card {
		min-width: 0 !important;
		max-width: 100%;
		border-radius: 17px;
	}

	.zshop-product-card__media {
		aspect-ratio: 1 / 0.92;
		padding: 7px;
	}

	.zshop-product-card__media > a {
		border-radius: 11px;
	}

	.zshop-product-card__image,
	.woocommerce ul.products li.product.zshop-product-card img.zshop-product-card__image {
		transform: scale(0.96);
	}

	.zshop-favorite {
		inset-block-start: 11px;
		inset-inline-start: 11px;
		width: 31px;
		height: 31px;
		border-radius: 10px;
	}

	.zshop-favorite .zshop-icon {
		width: 16px;
		height: 16px;
	}

	.zshop-product-card__discount,
	.zshop-product-card__stock {
		inset-block-start: 11px;
		inset-inline-end: 11px;
		min-width: 31px;
		height: 25px;
		padding-inline: 6px;
		font-size: 8.5px;
	}

	.zshop-product-card__body {
		padding: 9px 9px 10px;
	}

	.zshop-product-card__meta {
		min-height: 16px;
		font-size: 8.5px;
	}

	.zshop-product-card__title,
	.woocommerce ul.products li.product.zshop-product-card .woocommerce-loop-product__title {
		display: -webkit-box;
		min-height: 38px;
		margin-top: 2px;
		overflow: hidden;
		font-size: clamp(10.8px, 3.15vw, 12px);
		line-height: 1.7;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}

	.zshop-product-card__category {
		min-height: 15px;
		overflow: hidden;
		font-size: 8.5px;
		line-height: 1.5;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.zshop-product-card__footer {
		padding-top: 6px;
	}

	.zshop-product-card__price,
	.woocommerce ul.products li.product.zshop-product-card .price {
		min-height: 35px;
		margin-bottom: 6px;
		font-size: clamp(12px, 3.6vw, 14px);
		line-height: 1.5;
	}

	.zshop-product-card__price del {
		font-size: 8px;
	}

	.zshop-product-card__cta,
	.woocommerce ul.products li.product.zshop-product-card a.button.zshop-product-card__cta {
		min-height: 40px;
		padding: 8px 5px;
		border-radius: 11px;
		font-size: clamp(9.5px, 2.8vw, 10.8px);
		line-height: 1.45;
		white-space: normal;
	}

	.zshop-product-card__cta .zshop-icon {
		display: none;
	}

	/* Single-product layout: no oversized title, fixed-width controls or overflow. */
	.single-product .zshop-shop-main {
		padding-top: 16px;
	}

	.woocommerce div.product {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		gap: 12px;
		width: 100%;
		max-width: 100%;
	}

	.woocommerce div.product .woocommerce-product-gallery {
		padding: 10px;
		margin: 0 !important;
		border-radius: 20px;
	}

	.woocommerce div.product .woocommerce-product-gallery__image {
		border-radius: 15px;
	}

	.woocommerce div.product .woocommerce-product-gallery__image > a {
		aspect-ratio: 1 / 0.88;
		max-height: min(72svh, 350px);
	}

	.woocommerce div.product .summary {
		padding: 17px 14px;
		margin: 0 !important;
		border-radius: 20px;
	}

	.woocommerce div.product .product_title {
		font-size: clamp(21px, 6.5vw, 28px);
		line-height: 1.52;
		letter-spacing: -0.025em;
	}

	.woocommerce div.product .summary > .price {
		padding: 13px 0;
		margin: 10px 0;
		font-size: clamp(21px, 6vw, 25px);
	}

	.woocommerce div.product .woocommerce-product-details__short-description {
		font-size: clamp(11.5px, 3.25vw, 13px);
		line-height: 1.95;
	}

	.woocommerce div.product form.cart,
	.woocommerce div.product form.variations_form.cart .woocommerce-variation-add-to-cart {
		grid-template-columns: minmax(0, 1fr) 110px;
		gap: 8px;
		width: 100%;
	}

	.woocommerce div.product form.cart > .quantity,
	.woocommerce div.product form.variations_form.cart .woocommerce-variation-add-to-cart > .quantity,
	.woocommerce .quantity {
		width: 110px;
		max-width: 100%;
		grid-template-columns: 32px minmax(38px, 1fr) 32px;
	}

	.woocommerce .quantity .qty,
	.zshop-quantity-button {
		height: 48px;
	}

	.zshop-quantity-button {
		width: 32px;
	}

	.woocommerce div.product form.cart .button {
		min-width: 0;
		min-height: 50px;
		padding-inline: 9px;
		font-size: 11.5px;
		white-space: normal;
	}

	.zshop-pdp-facts,
	.zshop-pdp-trust {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 7px;
	}

	.zshop-pdp-facts > div,
	.zshop-pdp-trust > span {
		min-width: 0;
		min-height: 48px;
		padding: 8px;
	}

	.woocommerce div.product .woocommerce-tabs {
		padding: 16px 12px;
		border-radius: 20px;
	}

	.woocommerce div.product .woocommerce-tabs ul.tabs {
		gap: 6px;
		padding-bottom: 3px;
	}

	.woocommerce div.product .woocommerce-tabs ul.tabs li a {
		padding: 8px 13px;
		font-size: 10px;
	}

	/* Fixed controls stay clear of content and Android browser UI. */
	.zshop-mobile-nav {
		inset-inline: 0;
		width: 100%;
		max-width: 100vw;
		height: calc(var(--zshop-mobile-nav-height) + env(safe-area-inset-bottom));
		min-height: var(--zshop-mobile-nav-height);
		padding: 6px 5px;
		padding-bottom: calc(6px + env(safe-area-inset-bottom));
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.zshop-mobile-nav > a {
		gap: 2px;
		padding-inline: 2px;
		border-radius: 14px;
		font-size: clamp(8.3px, 2.5vw, 9.5px);
		line-height: 1.35;
		white-space: nowrap;
	}

	.zshop-mobile-nav .zshop-icon {
		width: 23px;
		height: 23px;
	}

	.zshop-back-to-top,
	.zshop-floating-chat {
		inset-block-end: calc(var(--zshop-mobile-nav-height) + 10px + env(safe-area-inset-bottom));
		width: 40px;
		height: 40px;
		min-height: 40px;
		border-radius: 13px;
	}

	.zshop-back-to-top {
		inset-inline-end: 10px;
	}

	.zshop-floating-chat {
		inset-inline-start: 10px;
		grid-template-columns: 34px;
		padding: 2px;
	}

	.zshop-floating-chat > .zshop-icon,
	.zshop-floating-chat__icon {
		width: 34px;
		height: 34px;
		padding: 8px;
	}

	.woocommerce-cart .zshop-floating-chat,
	.woocommerce-checkout .zshop-floating-chat,
	.woocommerce-account .zshop-floating-chat {
		display: none;
	}
}

/* Very narrow phones: preserve two product columns, stack headings only. */
@media (max-width: 380px) {
	.zshop-container {
		width: min(calc(100% - 18px), var(--zshop-container));
	}

	.zshop-section-heading {
		grid-template-columns: minmax(0, 1fr);
		align-items: start;
	}

	.zshop-section-link {
		justify-self: start;
	}

	.zshop-product-grid,
	.zshop-product-rail,
	.woocommerce ul.products,
	.zshop-account-wishlist__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 7px;
	}

	.zshop-deals-panel {
		width: calc(100% - 18px);
		padding-inline: 9px;
	}

	.zshop-product-card__body {
		padding-inline: 7px;
	}

	.zshop-product-card__title,
	.woocommerce ul.products li.product.zshop-product-card .woocommerce-loop-product__title {
		font-size: 10.6px;
	}

	.zshop-product-card__price,
	.woocommerce ul.products li.product.zshop-product-card .price {
		font-size: 12px;
	}

	.zshop-product-card__cta,
	.woocommerce ul.products li.product.zshop-product-card a.button.zshop-product-card__cta {
		font-size: 9.4px;
	}

	.zshop-mobile-nav .zshop-icon {
		width: 21px;
		height: 21px;
	}

	.woocommerce div.product form.cart,
	.woocommerce div.product form.variations_form.cart .woocommerce-variation-add-to-cart {
		grid-template-columns: minmax(0, 1fr) 102px;
	}

	.woocommerce div.product form.cart > .quantity,
	.woocommerce div.product form.variations_form.cart .woocommerce-variation-add-to-cart > .quantity,
	.woocommerce .quantity {
		width: 102px;
		grid-template-columns: 30px minmax(36px, 1fr) 30px;
	}

	.zshop-quantity-button {
		width: 30px;
	}
}

/* Only exceptionally narrow legacy viewports switch categories to one column. */
@media (max-width: 330px) {
	.zshop-category-grid,
	.zshop-category-grid--listing {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Phone landscape and short browser windows. */
@media (max-height: 500px) and (orientation: landscape) {
	.zshop-hero {
		height: 300px;
		max-height: none;
	}

	.zshop-back-to-top,
	.zshop-floating-chat {
		display: none;
	}
}

/* 13.4.3 — stories immediately below the home hero on every viewport. */
.zshop-hero-primary {
	display: grid;
	min-width: 0;
	align-content: start;
	gap: 14px;
}

.zshop-hero-primary.has-stories .zshop-hero {
	height: clamp(400px, 34vw, 470px);
}

.zshop-hero-stories {
	min-width: 0;
	padding: 12px 14px 10px;
	background: var(--zshop-paper);
	border: 1px solid rgba(7, 63, 49, 0.1);
	border-radius: 22px;
	box-shadow: var(--zshop-shadow-xs);
}

.zshop-hero-stories .zshop-stories {
	gap: clamp(11px, 1.25vw, 18px);
	padding: 2px;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-inline: contain;
	scroll-padding-inline: 2px;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.zshop-hero-stories .zshop-stories::-webkit-scrollbar {
	display: none;
}

.zshop-hero-stories .zshop-story {
	flex: 0 0 76px;
	gap: 6px;
}

.zshop-hero-stories .zshop-story__ring {
	width: 66px;
	height: 66px;
	padding: 3px;
}

.zshop-hero-stories .zshop-story strong {
	width: 100%;
	font-size: 10px;
	line-height: 1.45;
	-webkit-line-clamp: 1;
}

@media (max-width: 1180px) {
	.zshop-hero-primary.has-stories .zshop-hero {
		height: 440px;
	}
}

@media (max-width: 960px) {
	.zshop-hero-primary.has-stories .zshop-hero {
		height: 410px;
	}
}

@media (max-width: 767px) {
	.zshop-hero-section {
		padding-block: 10px 12px;
	}

	.zshop-hero-primary {
		gap: 9px;
	}

	.zshop-hero-primary.has-stories .zshop-hero {
		height: clamp(270px, 78vw, 340px);
		max-height: min(49svh, 340px);
	}

	.zshop-hero-stories {
		padding: 9px 8px 7px;
		border-radius: 18px;
	}

	.zshop-hero-stories .zshop-stories {
		gap: clamp(8px, 2.5vw, 11px);
		margin: 0;
		padding: 1px;
	}

	.zshop-hero-stories .zshop-story {
		flex-basis: clamp(60px, 18vw, 70px);
		gap: 5px;
	}

	.zshop-hero-stories .zshop-story__ring {
		width: clamp(55px, 16vw, 63px);
		height: clamp(55px, 16vw, 63px);
	}

	.zshop-hero-stories .zshop-story strong {
		font-size: clamp(8.5px, 2.55vw, 10px);
		white-space: nowrap;
		text-overflow: ellipsis;
	}
}

@media (max-width: 360px) {
	.zshop-hero-primary.has-stories .zshop-hero {
		height: clamp(250px, 76vw, 285px);
		max-height: 46svh;
	}

	.zshop-hero-stories .zshop-story {
		flex-basis: 58px;
	}

	.zshop-hero-stories .zshop-story__ring {
		width: 53px;
		height: 53px;
	}
}

@media (max-width: 900px) and (orientation: landscape) {
	.zshop-hero-primary.has-stories .zshop-hero {
		height: clamp(180px, 34vw, 260px);
		max-height: 48svh;
	}

	.zshop-hero-stories {
		padding-block: 7px 6px;
	}

	.zshop-hero-stories .zshop-story {
		flex-basis: 58px;
	}

	.zshop-hero-stories .zshop-story__ring {
		width: 52px;
		height: 52px;
	}
}

/* 13.4.4 — stable, non-zooming viewport across touch and desktop devices. */
html {
	width: 100%;
	max-width: 100%;
	overflow-x: clip;
	touch-action: pan-x pan-y;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	width: 100%;
	max-width: 100%;
	overflow-x: clip;
	touch-action: pan-x pan-y;
	overscroll-behavior-x: none;
}

/* Prevent browser focus-zoom on form controls without changing desktop sizing. */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
	input,
	select,
	textarea {
		font-size: max(16px, 1em);
	}
}

/* Keep embedded and replaced content inside the fixed page viewport. */
img,
picture,
video,
canvas,
svg,
iframe,
embed,
object {
	max-width: 100%;
}
