/**
 * Peet's PDP — gallery fade + desktop layout restore.
 * Frozen theme CSS is missing .pv-gallery width / thumb strip rules,
 * so desktop blows up to full-bleed stacked thumbs and pushes buy stack down.
 */

/* —— Gallery fade (mobile + desktop) ——
 * Flickity locks .flickity-viewport to a tall inline height while the real
 * image is shorter → huge white gap under the cover. Collapse to selected img.
 */
html.sf-peets-pdp #photos.pv-gallery__items,
html.sf-peets-pdp #photos .flickity-viewport {
	overflow: hidden !important;
	touch-action: pan-y;
	position: relative !important;
	max-width: 100%;
	height: auto !important;
	min-height: 0 !important;
}

html.sf-peets-pdp #photos .flickity-slider {
	transform: none !important;
	left: 0 !important;
	width: 100% !important;
	height: auto !important;
	position: relative !important;
	inset: auto !important;
}

html.sf-peets-pdp #photos .pv-gallery__item {
	position: absolute !important;
	left: 0 !important;
	top: 0 !important;
	width: 100% !important;
	height: auto !important;
	min-height: 0 !important;
	opacity: 0 !important;
	visibility: hidden !important;
	z-index: 0;
	pointer-events: none !important;
	transition: opacity 0.2s ease;
}

/* Selected slide in flow so #photos height == image */
html.sf-peets-pdp #photos .pv-gallery__item.is-selected {
	position: relative !important;
	left: auto !important;
	top: auto !important;
	opacity: 1 !important;
	visibility: visible !important;
	z-index: 1;
	pointer-events: auto !important;
}

/* Kill theme padding-bottom aspect box — size to the real image */
html.sf-peets-pdp #photos .ir--product,
html.sf-peets-pdp #photos .ir--product-gallery,
html.sf-peets-fix #photos .ir--product,
html.sf-peets-fix #photos .ir--product-gallery {
	height: auto !important;
	padding-bottom: 0 !important;
	width: 100% !important;
	position: relative !important;
	overflow: hidden !important;
}

html.sf-peets-pdp #photos .ir img,
html.sf-peets-fix #photos .ir img {
	position: static !important;
	inset: auto !important;
	display: block !important;
	width: 100% !important;
	height: auto !important;
	max-width: 100% !important;
	margin: 0 !important;
	-o-object-fit: contain;
	object-fit: contain;
}

/* 3+ qty: explicit − / value / + (native number spinners missing on mobile) */
html.sf-peets-pdp .sf-peets-pdp-stepper {
	display: flex !important;
	align-items: center;
	justify-content: center;
	gap: 0;
	margin: 8px auto 0;
	max-width: 100%;
	width: fit-content;
	border: 1px solid #222;
	background: #fff;
	border-radius: 2px;
	overflow: hidden;
	position: relative;
	z-index: 3;
}
html.sf-peets-pdp .sf-peets-pdp-stepper__btn {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: #f5f4ef;
	color: #222;
	font: 700 1.1rem/1 system-ui, sans-serif;
	min-width: 2.25rem;
	min-height: 2.25rem;
	padding: 0;
	cursor: pointer;
	touch-action: manipulation;
	user-select: none;
	-webkit-user-select: none;
}
html.sf-peets-pdp .sf-peets-pdp-stepper__btn:active {
	background: #e8e6df;
}
html.sf-peets-pdp .sf-peets-pdp-more {
	display: block;
	width: 2.6em;
	min-width: 2.6em;
	margin: 0;
	padding: 0.35em 0.15em;
	border: 0;
	border-left: 1px solid #ddd;
	border-right: 1px solid #ddd;
	border-radius: 0;
	background: #fff;
	color: inherit;
	font: 600 0.95rem/1.2 system-ui, sans-serif;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}
html.sf-peets-pdp .sf-peets-pdp-more::-webkit-outer-spin-button,
html.sf-peets-pdp .sf-peets-pdp-more::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

html.sf-peets-pdp .js-buy-stack-qty-more-trigger:not(.is-selected) .sf-peets-pdp-more,
html.sf-peets-pdp .js-buy-stack-qty-more-trigger:not(.is-selected) .sf-peets-pdp-stepper {
	display: none !important;
}

/* Selected 3+ chip: room for stepper under the big "3" */
html.sf-peets-pdp .js-buy-stack-qty-more-trigger.is-selected {
	padding-bottom: 0.5rem !important;
	overflow: visible !important;
}

/* —— Desktop: two-column PDP + thumb strip —— */
@media only screen and (min-width: 1025px) {
	html.sf-peets-fix .pv-essentials__container,
	html.sf-peets-pdp .pv-essentials__container {
		display: -webkit-box !important;
		display: -ms-flexbox !important;
		display: flex !important;
		-webkit-box-orient: horizontal !important;
		-webkit-box-direction: normal !important;
		-ms-flex-direction: row !important;
		flex-direction: row !important;
		-ms-flex-wrap: nowrap !important;
		flex-wrap: nowrap !important;
		-webkit-box-align: start !important;
		-ms-flex-align: start !important;
		align-items: flex-start !important;
	}

	html.sf-peets-fix .pv-gallery.pv-gallery--product,
	html.sf-peets-pdp .pv-gallery.pv-gallery--product {
		-webkit-box-flex: 0 !important;
		-ms-flex: 0 0 50% !important;
		flex: 0 0 50% !important;
		width: 50% !important;
		max-width: 50% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		padding: 0 1.25rem 0 0;
	}

	html.sf-peets-fix .pv-essential.pv-essential--product,
	html.sf-peets-pdp .pv-essential.pv-essential--product {
		-webkit-box-flex: 0 !important;
		-ms-flex: 0 0 50% !important;
		flex: 0 0 50% !important;
		width: 50% !important;
		max-width: 36.25rem !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		margin: 0 !important;
		padding: 1.5rem 2.5rem 5rem !important;
	}

	/* Breadcrumbs: horizontal, no bullets */
	html.sf-peets-fix .pv-breadcrumbs,
	html.sf-peets-pdp .pv-breadcrumbs {
		margin: 0 0 0.75rem;
	}

	html.sf-peets-fix .pv-breadcrumbs__text,
	html.sf-peets-pdp .pv-breadcrumbs__text {
		display: -webkit-box !important;
		display: -ms-flexbox !important;
		display: flex !important;
		-ms-flex-wrap: wrap !important;
		flex-wrap: wrap !important;
		-webkit-box-align: center !important;
		-ms-flex-align: center !important;
		align-items: center !important;
		gap: 0.35rem;
		list-style: none !important;
		margin: 0 !important;
		padding: 0 !important;
		font-size: 0.875rem;
		line-height: 1.4;
	}

	html.sf-peets-fix .pv-breadcrumbs__text > li,
	html.sf-peets-pdp .pv-breadcrumbs__text > li {
		list-style: none !important;
		display: inline !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	/* Thumb strip — small squares, not full-bleed product shots */
	html.sf-peets-fix .pv-gallery__nav.desktop-only,
	html.sf-peets-pdp .pv-gallery__nav.desktop-only {
		display: -webkit-box !important;
		display: -ms-flexbox !important;
		display: flex !important;
		-ms-flex-wrap: wrap !important;
		flex-wrap: wrap !important;
		gap: 0.5rem;
		list-style: none !important;
		margin: 0.875rem 0 0 !important;
		padding: 0 !important;
		width: 100% !important;
		max-width: 100% !important;
		height: auto !important;
		max-height: none !important;
	}

	html.sf-peets-fix .pv-gallery__nav-list,
	html.sf-peets-pdp .pv-gallery__nav-list {
		list-style: none !important;
		display: block !important;
		width: 4.75rem !important;
		height: 4.75rem !important;
		max-width: 4.75rem !important;
		margin: 0 !important;
		padding: 0 !important;
		overflow: hidden !important;
		-webkit-box-flex: 0 !important;
		-ms-flex: 0 0 4.75rem !important;
		flex: 0 0 4.75rem !important;
	}

	html.sf-peets-fix .pv-gallery__nav-item,
	html.sf-peets-pdp .pv-gallery__nav-item {
		display: block !important;
		width: 100% !important;
		height: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		border: 1px solid transparent;
		background: transparent;
		cursor: pointer;
		overflow: hidden;
	}

	html.sf-peets-fix .pv-gallery__nav-item.is-selected,
	html.sf-peets-pdp .pv-gallery__nav-item.is-selected,
	html.sf-peets-fix .pv-gallery__nav-item[aria-current="true"],
	html.sf-peets-pdp .pv-gallery__nav-item[aria-current="true"] {
		border-color: #1a1a1a;
	}

	/* Fixed square thumbs — don't rely on padding-bottom (theme overrides .ir height) */
	html.sf-peets-fix .pv-gallery__nav .ir,
	html.sf-peets-pdp .pv-gallery__nav .ir,
	html.sf-peets-fix .pv-gallery__nav .ir--product,
	html.sf-peets-pdp .pv-gallery__nav .ir--product {
		height: 100% !important;
		padding-bottom: 0 !important;
		width: 100% !important;
		overflow: hidden !important;
		position: relative !important;
	}

	html.sf-peets-fix .pv-gallery__nav .ir img,
	html.sf-peets-pdp .pv-gallery__nav .ir img,
	html.sf-peets-fix .pv-gallery__nav-image,
	html.sf-peets-pdp .pv-gallery__nav-image {
		position: absolute !important;
		inset: 0 !important;
		width: 100% !important;
		height: 100% !important;
		max-width: none !important;
		margin: 0 !important;
		-o-object-fit: cover;
		object-fit: cover;
	}
}
