/*
 * Amazon 3-column product layout
 * Scoped entirely under body.pdp-layout-amazon — Classic layout untouched.
 */

/* ===== Desktop: 3-column grid ===== */
@media (min-width: 993px) {

	body.pdp-layout-amazon .printley-hero {
		display: grid;
		grid-template-columns: 36fr 39fr minmax(300px, 25fr);
		column-gap: 2.5rem;
		align-items: start;
		max-width: calc(1920px + 5.2325em);
		margin: 0 auto;
	}

	/* Neutralise the Classic (vistaprint) widths inside the hero */
	body.pdp-layout-amazon .printley-hero .woocommerce-product-gallery,
	body.pdp-layout-amazon .printley-hero .images {
		width: auto !important;
		padding-right: 0 !important;
		grid-column: 1;
		grid-row: 1 / span 99; /* span all rows; "-1" fails without explicit grid-template-rows */
		align-self: start;
	}

	/* Promote summary + the add-to-cart form's children to hero grid items */
	body.pdp-layout-amazon .printley-hero .summary {
		width: auto !important;
		padding: 0 !important;
		display: contents;
	}
	body.pdp-layout-amazon .printley-hero form.variations_form,
	body.pdp-layout-amazon .printley-hero form.cart {
		display: contents;
	}

	/* MIDDLE column: all summary children + the variation table */
	body.pdp-layout-amazon .printley-hero .summary > *,
	body.pdp-layout-amazon .printley-hero form.variations_form > .variations {
		grid-column: 2;
		min-width: 0;
	}

	/* RIGHT column: the single grouped buy-box, sticky within the hero */
	body.pdp-layout-amazon .printley-hero .printley-buybox {
		grid-column: 3;
		grid-row: 1 / span 99; /* span all rows; "-1" fails without explicit grid-template-rows */
		align-self: start;
		position: sticky;
		top: 1.5rem;
		display: flex;
		flex-direction: column;
		gap: 1rem;
		background: #fff;
		border: 1px solid #ececec;
		border-radius: 14px;
		padding: 1.5rem;
		box-shadow: 0 4px 22px rgba(0, 0, 0, .07);
	}

	/* Sticky fix: the wrapping .product-details-wrapper has overflow:hidden, which
	   becomes the buy-box's scroll container and kills position:sticky. Make it
	   visible (Amazon layout only) so the buy-box pins within the hero. */
	body.pdp-layout-amazon .product-details-wrapper {
		overflow: visible;
	}

	/* Hide the default variable-product price range (from-price headline + live
	   variation price cover it); keep it for simple products. */
	body.pdp-layout-amazon .product-type-variable .printley-hero .summary > .price {
		display: none;
	}

	/* Hide social sharing in the Amazon hero */
	body.pdp-layout-amazon .printley-hero .product_share,
	body.pdp-layout-amazon .printley-hero .social-share,
	body.pdp-layout-amazon .printley-hero .wd-social-icons {
		display: none;
	}

	/* Product meta (SKU/category) — muted, bottom of middle column */
	body.pdp-layout-amazon .printley-hero .product_meta {
		font-size: .8rem;
		color: #999;
	}
}

/* ===== From-price headline: inline style moved out of the mu-plugin into here =====
   (Applies at all widths under the Amazon layout.) */
body.pdp-layout-amazon .printley-buybox .printley-from-price {
	font-size: 1.15em;
	font-weight: 600;
	margin: 0;
	color: #e6447b;
}

/* ===== Buy-box: compact quantity above a full-width button, left-aligned ===== */
/* Stack the children; DON'T stretch them (the qty stepper is absolutely positioned
   and breaks if the .quantity box is force-widened). */
body.pdp-layout-amazon .printley-buybox .woocommerce-variation-add-to-cart {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: .75rem;
}
/* Reset inherited padding/margins on the variation wrappers. */
body.pdp-layout-amazon .printley-buybox .single_variation_wrap,
body.pdp-layout-amazon .printley-buybox .woocommerce-variation-add-to-cart {
	margin: 0;
	padding: 0;
}
/* Quantity: keep its natural compact size (stepper stays attached), left-aligned. */
body.pdp-layout-amazon .printley-buybox .quantity {
	float: none;
	margin: 0 !important;
	align-self: flex-start;
}
/* Add-to-cart button: full width, left edge flush with the quantity. */
body.pdp-layout-amazon .printley-buybox .single_add_to_cart_button {
	float: none;
	width: 100%;
	min-width: 0;
	margin: 0 !important;
	white-space: nowrap;
	box-sizing: border-box;
	align-self: stretch;
}
/* Simple-product price (moved into the buy-box by JS) shown as a price heading. */
body.pdp-layout-amazon .printley-buybox > .price {
	margin: 0;
	font-size: 1.3rem;
	font-weight: 700;
	color: #111;
}

/* ===== Mobile / tablet (<993px): natural single-column stack ===== */
@media (max-width: 992px) {
	body.pdp-layout-amazon .printley-buybox {
		display: flex;
		flex-direction: column;
		gap: .75rem;
	}
}
