/*
 * Bourbon Merchant single-product presentation.
 * WooCommerce owns product data, gallery, variations and cart interactions.
 */

.bm-product-main.bm-main {
	padding-block: 0;
	background: var(--wp--preset--color--ivory);
	color: var(--wp--preset--color--charcoal);
}

.bm-product-main > * {
	margin-block: 0;
}

.bm-product-hero {
	padding-block: clamp(18px, 2.4vw, 28px) clamp(40px, 5vw, 64px);
}

.bm-product-hero .wc-block-breadcrumbs,
.bm-product-hero .woocommerce-breadcrumb {
	margin: 0 0 clamp(16px, 2vw, 24px);
	color: var(--wp--preset--color--taupe);
	font-size: 12px;
	letter-spacing: 0.06em;
}

.bm-product-hero .woocommerce-breadcrumb a {
	color: var(--wp--preset--color--taupe);
	text-decoration: none;
}

.bm-product-hero .woocommerce-breadcrumb a:hover {
	color: var(--wp--preset--color--amber);
}

.bm-product-hero__grid {
	align-items: flex-start !important;
	gap: clamp(28px, 4vw, 64px);
}

.bm-product-gallery-column,
.bm-product-summary {
	min-width: 0;
}

/* Native WooCommerce product gallery. WooCommerce caps the block at 512px; let it fill its column. */
.woocommerce .bm-product-gallery.wp-block-woocommerce-product-image-gallery {
	max-width: none;
}

.bm-product-gallery .woocommerce-product-gallery {
	width: 100% !important;
	margin: 0;
	transition: none !important;
}

.bm-product-gallery .woocommerce-product-gallery__wrapper {
	margin: 0;
}

.bm-product-gallery .flex-viewport,
.bm-product-gallery .woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
	border: 1px solid var(--wp--preset--color--stone);
	background: #fff;
}

.bm-product-gallery .woocommerce-product-gallery__image {
	background: #fff;
}

/* Square white frame, image contained: packshots and lifestyle photos both fit without cropping. */
.bm-product-gallery .woocommerce-product-gallery__image a {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: clamp(16px, 2.4vw, 32px);
}

.bm-product-gallery .woocommerce-product-gallery__image img {
	display: block;
	width: 100%;
	height: 100% !important;
	object-fit: contain;
}

.bm-product-gallery .woocommerce-product-gallery__trigger {
	top: 14px !important;
	right: 14px !important;
	width: 44px !important;
	height: 44px !important;
	border: 1px solid var(--wp--preset--color--stone);
	border-radius: 0 !important;
	background: var(--wp--preset--color--ivory) !important;
}

.bm-product-gallery .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(64px, 76px));
	gap: 10px;
	margin: 12px 0 0 !important;
	padding: 0;
	list-style: none;
}

.bm-product-gallery .flex-control-thumbs li {
	float: none !important;
	width: auto !important;
	margin: 0 !important;
}

.bm-product-gallery .flex-control-thumbs img {
	box-sizing: border-box;
	width: 100%;
	aspect-ratio: 4 / 5;
	padding: 6px;
	border: 1px solid var(--wp--preset--color--stone);
	background: #fff;
	object-fit: contain;
	cursor: pointer;
}

.bm-product-gallery .flex-control-thumbs img.flex-active,
.bm-product-gallery .flex-control-thumbs img:hover,
.bm-product-gallery .flex-control-thumbs img:focus-visible {
	border-color: var(--wp--preset--color--charcoal);
}

/* Summary. */
.bm-product-summary > * {
	margin-block: 0;
}

.bm-product-brand {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.22em;
	line-height: 1.4;
	text-transform: uppercase;
	color: var(--wp--preset--color--amber-deep);
}

.bm-product-brand a {
	color: inherit;
	text-decoration: none;
}

.bm-product-brand a:hover {
	color: var(--wp--preset--color--charcoal);
}

.bm-product-title {
	margin-top: 10px !important;
	font-family: var(--wp--preset--font-family--cormorant-garamond);
	font-size: var(--bm-fs-h2);
	font-weight: 500;
	letter-spacing: -0.01em;
	line-height: 1.1;
	text-wrap: balance;
}

.bm-product-short-description {
	margin-top: 16px !important;
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--bm-fs-text);
	line-height: 1.7;
}

.bm-product-short-description > :first-child {
	margin-top: 0;
}

.bm-product-short-description > :last-child {
	margin-bottom: 0;
}

.bm-product-commerce-meta {
	gap: 12px 24px;
	margin-top: 22px !important;
	padding-block: 16px;
	border-top: 1px solid var(--wp--preset--color--stone);
	border-bottom: 1px solid var(--wp--preset--color--stone);
}

.bm-product-price,
.bm-product-price .wc-block-components-product-price {
	margin: 0 !important;
	font-size: clamp(20px, 1.6vw, 24px);
	font-weight: 700;
	letter-spacing: -0.01em;
}

.bm-product-price del {
	color: var(--wp--preset--color--taupe);
	font-weight: 400;
}

.bm-product-stock {
	margin: 0 !important;
	font-size: 13px;
	font-weight: 700;
}

.bm-product-purchase {
	margin-top: 24px !important;
}

.bm-product-purchase form,
.bm-product-purchase .variations_form,
.bm-product-purchase .cart {
	margin: 0;
}

.bm-product-purchase .variations {
	width: 100%;
	margin: 0 0 18px;
	border-collapse: collapse;
}

/* Stack each attribute label above a full-width selector instead of a two-cell table row. */
.bm-product-purchase .variations,
.bm-product-purchase .variations tbody,
.bm-product-purchase .variations tr,
.bm-product-purchase .variations th,
.bm-product-purchase .variations td {
	display: block;
	width: 100%;
}

.bm-product-main .bm-product-purchase .variations th,
.bm-product-main .bm-product-purchase .variations td {
	padding: 0;
	text-align: left;
	line-height: 1.4;
}

.bm-product-purchase .variations th {
	margin-bottom: 10px;
}

.bm-product-purchase .variations tr + tr {
	margin-top: 14px;
}

/* WooCommerce lays the variations form out as a three-column grid; a block keeps every row full width. */
.bm-product-main .bm-product-purchase form.variations_form {
	display: block;
}

.bm-product-main .bm-product-purchase .single_variation:empty {
	margin: 0;
}

/* The "Clear" link is hidden with inline visibility until an option is chosen; do not reserve its space. */
.bm-product-main .bm-product-purchase .reset_variations[style*="hidden"] {
	display: none;
}

.bm-product-main .bm-product-purchase .variations select {
	margin: 0;
}

.bm-product-main .bm-product-purchase table.variations {
	margin-bottom: 20px;
}

.bm-product-main .bm-product-purchase .single_variation_wrap {
	margin-top: 0;
}

.bm-product-purchase .variations label {
	display: block;
	margin: 0;
	line-height: 1.4;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.bm-product-purchase select {
	width: 100%;
	min-height: 48px;
	padding: 8px 36px 8px 12px;
	border: 1px solid var(--wp--preset--color--charcoal);
	border-radius: 0;
	background: transparent;
	color: var(--wp--preset--color--charcoal);
	font: 600 14px/1.3 var(--wp--preset--font-family--manrope);
}

.bm-product-purchase .reset_variations {
	display: inline-block;
	margin-top: 8px;
	color: var(--wp--preset--color--amber-deep);
	font-size: 12px;
}

.bm-product-purchase .single_variation_wrap {
	margin-top: 12px;
}

.bm-product-purchase .woocommerce-variation-price {
	margin-bottom: 14px;
	font-weight: 700;
}

.bm-product-purchase .woocommerce-variation-description {
	margin-bottom: 14px;
}

.bm-product-purchase .single_variation_wrap .woocommerce-variation-availability p {
	margin: 0 0 12px;
}

/* Simple products: quantity and a full-width Add to cart on one row. */
.bm-product-purchase form.cart:not(.variations_form),
.bm-product-purchase .woocommerce-variation-add-to-cart {
	display: flex;
	align-items: stretch;
	gap: 10px;
}

/* WooCommerce's clearfix pseudo-elements would otherwise become empty flex items. */
.bm-product-main .bm-product-purchase form.cart:not(.variations_form)::before,
.bm-product-main .bm-product-purchase form.cart:not(.variations_form)::after,
.bm-product-main .bm-product-purchase .woocommerce-variation-add-to-cart::before,
.bm-product-main .bm-product-purchase .woocommerce-variation-add-to-cart::after {
	display: none;
}

.bm-product-purchase form.cart:not(.variations_form) > .single_add_to_cart_button,
.bm-product-purchase .woocommerce-variation-add-to-cart > .single_add_to_cart_button {
	flex: 1 1 auto;
	min-width: 0;
}

.bm-product-purchase .single_add_to_cart_button,
.bm-product-purchase .wp-block-button__link,
.bm-product-purchase button[type="submit"] {
	min-height: 48px;
	margin: 0;
	padding: 10px 20px;
	border: 1px solid var(--wp--preset--color--charcoal);
	border-radius: 0;
	background: var(--wp--preset--color--charcoal);
	color: var(--wp--preset--color--ivory);
	font: 700 12px/1.2 var(--wp--preset--font-family--manrope);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	cursor: pointer;
}

.bm-product-purchase .single_add_to_cart_button:hover,
.bm-product-purchase button[type="submit"]:hover {
	border-color: var(--wp--preset--color--amber);
	background: var(--wp--preset--color--amber);
}

.bm-product-purchase button:disabled,
.bm-product-purchase .disabled {
	border-color: var(--wp--preset--color--stone);
	background: var(--wp--preset--color--stone);
	color: var(--wp--preset--color--ink-muted);
	cursor: not-allowed;
}

.bm-product-purchase .quantity,
.bm-product-purchase .wc-block-components-quantity-selector {
	flex: 0 0 auto;
	width: 116px;
	min-height: 48px;
	margin: 0 !important;
	border: 1px solid var(--wp--preset--color--charcoal);
	border-radius: 0;
}

.bm-product-purchase .wc-block-components-quantity-selector::after {
	border: 0;
}

.bm-product-purchase .wc-block-components-quantity-selector__button {
	min-width: 36px;
	color: var(--wp--preset--color--charcoal);
	font-size: 16px;
	opacity: 1;
}

.bm-product-main .bm-product-purchase .quantity input.qty,
.bm-product-main .bm-product-purchase .wc-block-components-quantity-selector input {
	box-sizing: border-box;
	flex: 1 1 0;
	width: 0;
	min-width: 0;
	height: 46px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	font-weight: 700;
}

.bm-product-purchase .stock.out-of-stock {
	padding: 16px;
	border: 1px solid var(--wp--preset--color--amber-deep);
	color: var(--wp--preset--color--amber-deep);
	font-weight: 700;
}

.bm-product-purchase-info {
	margin-top: 20px !important;
}

.bm-product-purchase-info__list {
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--wp--preset--color--ink-muted);
	font-size: 13px;
	line-height: 1.55;
}

.bm-product-purchase-info__list li {
	position: relative;
	margin-top: 9px;
	padding-left: 22px;
}

.bm-product-purchase-info__list li::before {
	position: absolute;
	left: 0;
	content: "—";
	color: var(--wp--preset--color--amber-deep);
}

.bm-product-policy-links {
	margin: 14px 0 0;
	font-size: 12px;
	line-height: 1.7;
}

.bm-product-policy-links a {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.bm-product-details-link {
	margin-top: 22px !important;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.bm-product-details-link a {
	display: inline-flex;
	gap: 10px;
	color: inherit;
	text-decoration: none;
}

/* Product description and attributes. */
.bm-product-details {
	padding-block: clamp(40px, 5vw, 72px);
	border-top: 1px solid var(--wp--preset--color--stone);
}

.bm-product-details__grid {
	gap: clamp(36px, 5vw, 80px);
}

.bm-product-section-title {
	margin: 0;
	font-family: var(--wp--preset--font-family--cormorant-garamond);
	font-size: var(--bm-fs-h2);
	font-weight: 500;
	line-height: 1.1;
}

.bm-product-description {
	margin-top: 20px !important;
}

.bm-product-description > :first-child,
.bm-product-description .woocommerce-product-details__short-description > :first-child {
	margin-top: 0;
}

.bm-product-description :where(p, li) {
	font-size: var(--bm-fs-text);
	line-height: 1.75;
}

.bm-product-description h2 {
	margin: 32px 0 10px;
	font-size: var(--bm-fs-card);
	line-height: 1.25;
}

.bm-product-description h3 {
	margin: 26px 0 10px;
	color: var(--wp--preset--color--amber-deep);
	font-family: var(--wp--preset--font-family--manrope);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.bm-product-description a {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.bm-product-specifications {
	margin-top: 20px !important;
}

.bm-product-specifications table,
.bm-product-specifications .wc-block-product-specifications__table {
	width: 100%;
	margin: 0;
	border-top: 1px solid var(--wp--preset--color--charcoal);
	border-collapse: collapse;
}

.bm-product-specifications tr {
	border-bottom: 1px solid var(--wp--preset--color--stone);
}

.bm-product-specifications th,
.bm-product-specifications td {
	padding: 12px 0;
	border: 0;
	text-align: left;
	vertical-align: baseline;
}

.bm-product-specifications th {
	width: 42%;
	padding-right: 16px;
	color: var(--wp--preset--color--taupe);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.13em;
	text-transform: uppercase;
}

.bm-product-specifications td {
	font-size: var(--bm-fs-text);
	font-weight: 600;
}

/* WooCommerce wraps each value in a paragraph; its margin pushed values below their labels. */
.bm-product-specifications td p {
	margin: 0;
}

/* If WooCommerce has no visible attributes, omit the empty specifications column. */
.bm-product-details__specs:not(:has(table, .wc-block-product-specifications__table)) {
	display: none;
}

.bm-product-details__grid:not(:has(.bm-product-details__specs table, .bm-product-details__specs .wc-block-product-specifications__table)) .bm-product-details__overview {
	flex-basis: 100%;
}

/* Related products reuse the established card structure. */
.bm-product-related {
	padding-block: clamp(40px, 5vw, 72px);
}

.bm-product-related__header {
	gap: 20px;
	margin-bottom: clamp(20px, 2.4vw, 32px) !important;
}

.bm-product-related__title {
	max-width: 760px;
	margin: 0;
	font-family: var(--wp--preset--font-family--cormorant-garamond);
	font-size: var(--bm-fs-h2);
	font-weight: 500;
	line-height: 1.1;
}

.bm-product-related__grid.wc-block-product-template {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	gap: clamp(16px, 1.6vw, 24px) !important;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bm-product-related__grid > .wc-block-product {
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
}

.bm-product-related-card {
	border: 1px solid var(--wp--preset--color--stone);
}

.bm-product-related-card .bm-product-card__media,
.bm-product-related-card .bm-product-card__media a {
	background: #fff;
}

.bm-product-related-card .bm-product-card__media img {
	box-sizing: border-box;
	width: 100%;
	height: auto !important;
	aspect-ratio: 4 / 5 !important;
	padding: 14px;
	object-fit: contain !important;
}

.bm-product-related-card .bm-product-card__body {
	padding: 14px 14px 0;
	border-top: 1px solid var(--wp--preset--color--stone);
}

.bm-product-related-card .bm-product-card__title {
	font-size: 17px;
}

.bm-product-related-card .bm-product-card__title a {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.bm-product-related-card .bm-product-card__footer.wp-block-group {
	gap: 10px;
	padding: 10px 14px 14px;
}

.bm-product-related-card .bm-product-card__button .wp-block-button__link.wc-block-components-product-button__button {
	min-height: 40px;
	padding: 8px 10px;
	font-size: 11px;
}

.bm-product-main :where(a, button, input, select):focus-visible {
	outline: 2px solid var(--wp--preset--color--amber);
	outline-offset: 3px;
}

@media (max-width: 1099px) {
	.bm-product-related__grid.wc-block-product-template {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 781px) {
	.bm-product-hero__grid,
	.bm-product-details__grid {
		flex-direction: column;
	}

	.bm-product-hero__grid > .wp-block-column,
	.bm-product-details__grid > .wp-block-column {
		flex-basis: auto !important;
		width: 100%;
	}

	/* Keep the price and Add to cart close to the first screen on tablets. */
	.bm-product-hero__grid > .bm-product-gallery-column {
		max-width: 560px;
	}

	.bm-product-title {
		font-size: clamp(26px, 7vw, 32px);
	}
}

@media (max-width: 599px) {
	.bm-product-hero {
		padding-block: 16px 40px;
	}

	.bm-product-hero__grid {
		gap: 24px;
	}

	.bm-product-purchase .single_add_to_cart_button,
	.bm-product-purchase button[type="submit"] {
		letter-spacing: 0.11em;
	}

	.bm-product-details__grid {
		gap: 36px;
	}

	.bm-product-related__grid.wc-block-product-template {
		gap: 12px !important;
	}

	.bm-product-related-card .bm-product-card__body {
		padding: 10px 10px 0;
	}

	.bm-product-related-card .bm-product-card__footer.wp-block-group {
		padding: 8px 10px 10px;
	}

	.bm-product-related-card .bm-product-card__title {
		font-size: 15px;
	}

	.bm-product-related-card .bm-product-card__button .wp-block-button__link.wc-block-components-product-button__button {
		padding-inline: 6px;
		font-size: 10px;
		letter-spacing: 0.06em;
	}
}

@media (max-width: 339px) {
	.bm-product-related__grid.wc-block-product-template {
		grid-template-columns: 1fr !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bm-product-main *,
	.bm-product-main *::before,
	.bm-product-main *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}
