/* =========================================================================
   CLUTCHES — Product page (PDP)
   Editorial layout: stacked image grid + sticky buy box, square controls,
   full-width black add-to-cart.
   ========================================================================= */

/* The MAIN product wrapper only (div id="product-123"). A bare `div.product`
   selector also matches every product CARD in the related rails — which turned
   each card into a two-column grid and piled its text on top of itself.

   MOBILE-FIRST on purpose: the DEFAULT layout is a single column (image, then
   buy box). The desktop two-column grid is applied only from 901px up, so no
   engine/breakpoint quirk can ever leave a phone stuck with desktop columns. */
.single-product div[id^="product-"].product {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sp-5);
	align-items: start;
	padding-block: var(--sp-4) var(--sp-8);
	/* the buy box / gallery must not touch the viewport edges */
	max-inline-size: 1520px; margin-inline: auto;
	padding-inline: clamp(16px, 3vw, 56px);
}
.single-product div[id^="product-"].product > .onsale,
.single-product div[id^="product-"].product > .badge { display: none; } /* we render our own % badge */
/* Grid children must never blow the column out (the carousels' inner rail
   is thousands of px wide — min-width:auto would stretch the whole page). */
.single-product div[id^="product-"].product > * { min-inline-size: 0; max-inline-size: 100%; }
.single-product .product-carousel .rail { max-inline-size: 100%; }

@media (min-width: 901px) {
	.single-product div[id^="product-"].product {
		/* RTL: first track is the RIGHT column (buy box), second the LEFT (gallery) */
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
		gap: clamp(24px, 3vw, 48px);
	}
	/* Explicit placement — stray flash spans must never shift the layout */
	.single-product div[id^="product-"].product > .woocommerce-product-gallery { grid-column: 2; grid-row: 1; }
	.single-product div[id^="product-"].product > .summary { grid-column: 1; grid-row: 1; }
	/* Sections after the summary span the full row, not one grid column */
	.single-product div[id^="product-"].product > .product-carousel,
	.single-product div[id^="product-"].product > section.related,
	.single-product div[id^="product-"].product > section.up-sells { grid-column: 1 / -1; }
}

/* ---- Gallery: big main image + thumbnail strip (JS builds .pdp-thumbs) ----
   Catalog photos are white 1:1 squares — square boxes, capped like the
   reference site so the image never becomes a huge empty canvas. */
.single-product .woocommerce-product-gallery {
	position: static;
	max-inline-size: 680px; margin-inline: auto;
}
.single-product .woocommerce-product-gallery.has-thumbs {
	display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start;
	direction: ltr; /* thumbs physically left of the image, like the reference */
	max-inline-size: 764px;
}
.pdp-thumbs { display: flex; flex-direction: column; gap: 8px; }
.pdp-thumb {
	inline-size: 72px; block-size: 92px; padding: 0; cursor: pointer;
	border: 1px solid var(--c-line); background: #fff; overflow: hidden;
	transition: border-color var(--dur-fast) var(--ease);
}
.pdp-thumb img { inline-size: 100%; block-size: 100%; object-fit: contain; padding: 4px; }
.pdp-thumb.is-active, .pdp-thumb:hover { border-color: var(--c-black); }

.single-product .woocommerce-product-gallery__wrapper {
	display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.single-product .has-thumbs .woocommerce-product-gallery__wrapper { display: block; }
.single-product .woocommerce-product-gallery__image:first-child { grid-column: 1 / -1; }
/* Beat WooCommerce core's columns-N rule (width:25%; inline-block) */
.single-product .woocommerce-product-gallery__image,
.single-product .woocommerce-product-gallery--columns-3 .woocommerce-product-gallery__image:nth-child(n+2),
.single-product .woocommerce-product-gallery--columns-4 .woocommerce-product-gallery__image:nth-child(n+2),
.single-product .woocommerce-product-gallery--columns-5 .woocommerce-product-gallery__image:nth-child(n+2) {
	width: 100% !important; display: block; float: none;
	background: var(--c-bg-soft); overflow: hidden;
}
.single-product .woocommerce-product-gallery__image { background: #fff; border: 1px solid var(--c-line); }
.single-product .woocommerce-product-gallery__image a { display: block; block-size: 100%; }
.single-product .woocommerce-product-gallery__image img {
	inline-size: 100%; block-size: 100%; aspect-ratio: 1 / 1;
	object-fit: contain; display: block;
}

/* ---- Buy box (sticky while images scroll — desktop only) ---- */
@media (min-width: 901px) {
	.single-product .summary {
		position: sticky; inset-block-start: calc(var(--header-h) + 16px);
	}
}

.pdp-brand {
	font-size: var(--fs-xs); letter-spacing: var(--ls-wider);
	text-transform: uppercase; font-weight: var(--fw-bold); color: var(--c-ink);
}
.single-product .product_title {
	font-family: var(--font-ui); font-weight: var(--fw-regular);
	font-size: var(--fs-lg); line-height: 1.3; margin: 6px 0 2px;
	unicode-bidi: isolate; /* Latin model names must not scramble in RTL */
}
.pdp-sku { font-size: var(--fs-xxs); color: var(--c-muted-2); margin-block-start: var(--sp-2); }

/* ---- Colour options (sibling products as photo swatches) ---- */
.pdp-colors { margin-block: var(--sp-3) var(--sp-2); }
.pdp-colors .pdp-color-label { margin-block-start: 0; text-transform: none; letter-spacing: 0; font-weight: var(--fw-regular); color: var(--c-muted); }
.pdp-colors .pdp-color-label b { color: var(--c-ink); font-weight: var(--fw-medium); }
.pdp-color-list { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pdp-color-swatch {
	display: block; inline-size: 56px; block-size: 56px; overflow: hidden;
	border: 1px solid var(--c-line-strong); background: #fff; position: relative;
	transition: border-color var(--dur-fast) var(--ease);
}
.pdp-color-swatch img { inline-size: 100%; block-size: 100%; object-fit: contain; padding: 3px; display: block; }
.pdp-color-swatch:hover, .pdp-color-swatch.is-current { border-color: var(--c-black); box-shadow: inset 0 0 0 1px var(--c-black); }
.pdp-color-swatch.is-out { opacity: .45; }
.pdp-color-swatch.is-out::after { content: ""; position: absolute; inset: 50% -10% auto; block-size: 1px; background: var(--c-sale); transform: rotate(-45deg); }

.single-product .price {
	display: inline-flex; align-items: baseline; gap: var(--sp-3);
	flex-wrap: wrap; max-inline-size: 100%;
	font-size: var(--fs-xl); font-weight: var(--fw-bold); margin-block-end: var(--sp-2);
}
.single-product .price del { color: var(--c-muted-2); font-weight: var(--fw-regular); font-size: var(--fs-md); }
.single-product .price ins { color: var(--c-sale); text-decoration: none; }
.pdp-off-badge {
	display: inline-block; vertical-align: middle;
	background: var(--c-hl); color: var(--c-on-hl);
	font-size: var(--fs-xs); font-weight: var(--fw-bold);
	padding: 3px 8px; margin-inline-start: var(--sp-2);
}

/* ---- Size boxes ---- */
.pdp-color-label, .pdp-size-label {
	font-size: var(--fs-xs); font-weight: var(--fw-bold);
	letter-spacing: .06em; text-transform: uppercase;
	margin-block-start: var(--sp-4); display: block;
}
.pdp-size-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-block: var(--sp-2) var(--sp-4); }
.size-chip {
	min-inline-size: 52px; block-size: 46px; padding: 0 12px;
	display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid var(--c-line-strong); background: #fff; border-radius: 0;
	cursor: pointer; font-size: var(--fs-sm);
	transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.size-chip:hover { border-color: var(--c-black); }
.size-chip.is-selected { background: var(--c-black); color: #fff; border-color: var(--c-black); }
.size-chip.is-out { color: var(--c-muted-2); text-decoration: line-through; cursor: not-allowed; border-style: dashed; background: var(--c-bg-soft); }

/* ---- Simple-product size block (reference style: boxes + chart link) ---- */
.pdp-size-block { margin-block: var(--sp-4) var(--sp-2); }
.pdp-size-head { display: flex; align-items: center; justify-content: space-between; }
.pdp-size-head .pdp-size-label { margin-block-start: 0; }
.pdp-size-guide {
	background: none; border: 0; padding: 0; cursor: pointer;
	font-size: var(--fs-xs); color: var(--c-ink); text-decoration: underline;
	text-underline-offset: 3px;
}
.pdp-size-guide:hover { color: var(--c-black); }
.pdp-size-block .pdp-size-chips {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
	gap: 8px; margin-block: var(--sp-2) 0;
}
.pdp-size-error { color: var(--c-sale); font-size: var(--fs-xs); margin: 6px 0 0; }

/* Size chart table inside the accordion */
.pdp-size-table { inline-size: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.pdp-size-table th, .pdp-size-table td {
	border: 1px solid var(--c-line); padding: 8px 10px; text-align: center;
}
.pdp-size-table th { background: var(--c-bg-soft); font-weight: var(--fw-bold); }
.pdp-size-note { font-size: var(--fs-xs); color: var(--c-muted); margin-block-start: var(--sp-2); }

/* ---- Color swatches ---- */
.pdp-color-swatches { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-block: var(--sp-2) var(--sp-4); }
.color-swatch {
	inline-size: 34px; block-size: 34px; border-radius: 50%;
	border: 1px solid var(--c-line-strong); cursor: pointer; padding: 0;
	position: relative; transition: transform var(--dur-fast) var(--ease);
	box-shadow: inset 0 0 0 2px #fff;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.is-selected { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--c-black); }
.color-swatch.is-out { opacity: .4; cursor: not-allowed; }
.color-swatch.is-out::after { content: ""; position: absolute; inset: 50% 0 auto; block-size: 1px; background: var(--c-sale); transform: rotate(-45deg); }

.single-product .variations { margin-block: var(--sp-2); }
.single-product .variations td.label { font-size: var(--fs-sm); padding-block: var(--sp-2); }

/* ---- Add to cart: full-width YELLOW button (reference style) ---- */
.single-product .quantity { display: none; }
.single-product form.cart { display: block; margin-block: var(--sp-4); }
.single-product .single_add_to_cart_button {
	inline-size: 100%;
	background: var(--c-hl); color: var(--c-on-hl); border: 1px solid var(--c-hl);
	padding: 16px 28px; border-radius: 0;
	font-size: var(--fs-base); font-weight: var(--fw-bold);
	letter-spacing: .04em;
	cursor: pointer; transition: filter var(--dur-fast) var(--ease);
}
.single-product .single_add_to_cart_button:hover { filter: brightness(.93); }

/* New-in badge */
.pdp-new-badge {
	display: inline-block; background: var(--c-black); color: #fff;
	font-size: var(--fs-xxs); font-weight: var(--fw-bold); letter-spacing: .08em;
	padding: 4px 10px; margin-block-end: var(--sp-2);
}

/* Delivery promise chip */
.pdp-promise {
	margin: var(--sp-3) 0 0; display: inline-block;
	background: var(--c-black); color: #fff;
	font-size: var(--fs-xs); font-weight: var(--fw-medium);
	padding: 7px 12px;
}
.pdp-promise mark { background: var(--c-hl); color: var(--c-on-hl); padding: 1px 6px; margin-inline-start: 4px; }

/* Service icon tiles */
.pdp-tiles {
	list-style: none; margin: var(--sp-3) 0 0; padding: 0;
	display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.pdp-tiles li {
	border: 1px solid var(--c-line); padding: 10px 6px;
	display: flex; flex-direction: column; align-items: center; gap: 6px;
	text-align: center;
}
.pdp-tiles .icon { color: var(--c-ink); }
.pdp-tiles span { font-size: var(--fs-xxs); color: var(--c-muted); line-height: 1.2; }

/* ---- Catalog mode: inquiry CTA — yellow, reference style ---- */
.pdp-wa-cta {
	display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
	inline-size: 100%; margin-block: var(--sp-4);
	background: var(--c-hl); color: var(--c-on-hl); border: 1px solid var(--c-hl);
	padding: 16px 28px; font-size: var(--fs-base); font-weight: var(--fw-bold);
	letter-spacing: .02em;
	transition: filter var(--dur-fast) var(--ease);
}
.pdp-wa-cta:hover { filter: brightness(.93); color: var(--c-on-hl); }
.pdp-wa-cta .icon { color: #1da851; }

/* ---- Wishlist: slim outline row ---- */
.pdp-wishlist {
	display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
	margin-block: var(--sp-3); border: 1px solid var(--c-line-strong);
	padding: 10px; cursor: pointer;
	transition: border-color var(--dur-fast) var(--ease);
}
.pdp-wishlist:hover { border-color: var(--c-black); }
.pdp-wishlist .wishlist-heart { position: static; background: transparent; border: 0; inline-size: auto; block-size: auto; }
.pdp-wishlist-label { font-size: var(--fs-xs); font-weight: var(--fw-medium); letter-spacing: .06em; text-transform: uppercase; }

/* ---- Benefits (four rows under add-to-cart, never in tabs) ---- */
.pdp-benefits {
	list-style: none; margin: var(--sp-3) 0 0; padding: var(--sp-3) var(--sp-4);
	border: 1px solid var(--c-line); background: var(--c-bg-soft);
	display: grid; gap: 10px;
}
.pdp-benefits li { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--c-ink); line-height: 1.35; }
.pdp-benefits li b { font-weight: var(--fw-bold); }
.pdp-benefits .icon { color: var(--c-ink); flex: 0 0 auto; }

/* ---- Accordion (PDP) ---- */
.pdp-accordion { margin-block-start: var(--sp-5); }

/* ---- Related / recently viewed ---- */
.single-product .related.products h2,
.single-product section.up-sells h2 {
	font-size: var(--fs-sm); font-weight: var(--fw-bold);
	letter-spacing: .08em; text-transform: uppercase;
	margin-block: var(--sp-7) var(--sp-4);
}
.single-product .related.products ul.products,
.single-product .related.products .products {
	display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gutter); list-style: none; padding: 0;
}

/* ---- Sticky mobile add-to-cart (mobile-first: on by default, off ≥901px) ---- */
.pdp-sticky {
	position: fixed; inset-inline: 0; inset-block-end: 0; z-index: var(--z-float);
	background: #fff; border-block-start: 1px solid var(--c-line);
	display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
	padding: var(--sp-3) var(--gutter); box-shadow: 0 -4px 20px rgba(0,0,0,.08);
	transform: translateY(100%); transition: transform var(--dur) var(--ease);
}
@media (min-width: 901px) { .pdp-sticky { display: none; } }
/* keep the floating stack clear of the sticky bar (mobile default) */
.single-product { --float-base: 84px; }
@media (min-width: 901px) { .single-product { --float-base: 22px; } }
.pdp-sticky.is-show { transform: translateY(0); }
.pdp-sticky-info { display: flex; flex-direction: column; min-inline-size: 0; }
.pdp-sticky-name { font-size: var(--fs-xxs); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdp-sticky-price { font-size: var(--fs-md); font-weight: var(--fw-bold); }
.pdp-sticky-price del { font-size: var(--fs-xs); color: var(--c-muted-2); font-weight: var(--fw-regular); margin-inline-end: 6px; }
.pdp-sticky-price ins { text-decoration: none; color: var(--c-sale); }
/* mobile gallery: the main image is swipeable (pdp.js) */
.single-product .has-thumbs .woocommerce-product-gallery__wrapper { touch-action: pan-y; }
.carousel-eyebrow { color: var(--c-muted); margin-block-end: 2px; }
.pdp-sticky .btn { flex: 0 0 auto; background: var(--c-black); color: #fff; border-radius: 0; text-transform: uppercase; letter-spacing: .06em; font-weight: var(--fw-bold); }
.pdp-sticky-wa { background: #25d366 !important; border-color: #25d366 !important; }

@media (max-width: 640px) {
	/* Keep desktop gallery grid on phones — same proportions as desktop */
	.single-product .woocommerce-product-gallery__wrapper {
		display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
	}
	.single-product .woocommerce-product-gallery__image:first-child { grid-column: 1 / -1; }
	.single-product .woocommerce-product-gallery__image img { aspect-ratio: 1 / 1; }
	.pdp-tiles { grid-template-columns: repeat(2, 1fr); }
	.pdp-tiles li { padding: 8px 6px; gap: 4px; }
	.pdp-tiles span { overflow-wrap: break-word; }
	/* long unbroken product names / SKUs must wrap, never widen the page */
	.single-product .product_title,
	.single-product .pdp-sku,
	.single-product .price { overflow-wrap: anywhere; }
}

/* (mobile is the default layout now — desktop rules live in min-width: 901px) */
@media (max-width: 900px) {
	.single-product .woocommerce-product-gallery__wrapper { grid-template-columns: 1fr 1fr; }

	/* Gallery with thumbnails (2+ images): large main image on top, compact
	   horizontal thumb strip underneath — not a page-length image grid. */
	.single-product .woocommerce-product-gallery.has-thumbs {
		display: flex; flex-direction: column; max-inline-size: none;
	}
	.single-product .has-thumbs .woocommerce-product-gallery__wrapper { order: 1; }
	.single-product .has-thumbs .pdp-thumbs {
		order: 2; flex-direction: row; gap: 8px; padding-block: 8px;
		overflow-x: auto; -webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}
	.single-product .has-thumbs .pdp-thumbs::-webkit-scrollbar { display: none; }
	.single-product .has-thumbs .pdp-thumb {
		inline-size: 68px; block-size: 68px; flex: 0 0 auto;
	}
}
	/* structural spacer: the fixed add-to-cart bar must never sit on top of
	   the last content (prices, accordions, footer links) */
	body.single-product { padding-block-end: calc(76px + env(safe-area-inset-bottom, 0px)); }
	/* breathing room inside gallery boxes so the product never kisses the edges */
	.single-product .woocommerce-product-gallery__image img { padding: 3%; }
}
