/**
 * Rachel Mizrahi — single product page.
 *
 * Layout + components for the single-product sketch: two-column grid (image on
 * the inline-start / visual right in RTL, sticky on desktop; summary on the
 * other side), a single full-width add-to-cart CTA (quantity UI hidden), a
 * description/details accordion, and a related-products grid that reuses the
 * borderless catalog card.
 *
 * Everything is scoped to body.single-product so nothing leaks onto the
 * catalog, cart, checkout or content pages. Loaded AFTER brand.css (which owns
 * the shared tokens + base WooCommerce colours in section e), so same-
 * specificity rules here win; !important is used only where Astra inlines
 * Customizer values (widths / floats on the product columns).
 *
 * Colours + fonts come from brand.css :root tokens (--rm-*). Light neutral
 * palette only — no dark backgrounds. RTL-safe via logical properties.
 *
 * CONTENTS
 *   1. Two-column layout (grid, sticky image, thin frame)
 *   2. Summary column (title, price, short description)
 *   3. Add-to-cart row (single full-width CTA, quantity hidden)
 *   4. Accordion (description / ingredients / usage / shipping)
 *   5. Related products grid
 *   6. Responsive (stacks) + reduced motion
 */

/* ==========================================================================
   1. Two-column layout
   ========================================================================== */

body.single-product div.product {
	position: relative; /* Anchor for the absolute sale flash (brand.css). */
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
	column-gap: clamp(2rem, 5vw, 4.5rem);
	row-gap: clamp(2.5rem, 5vw, 4rem);
	align-items: start;
}

/* Image column: inline-start (visual right in RTL). Static — a sticky image
   inside this grid would keep floating over the full-width related-products
   row below and collide with it, so it scrolls with the column. */
body.single-product div.product > .images,
body.single-product div.product > .woocommerce-product-gallery {
	grid-column: 1;
	grid-row: 1;
	width: auto !important; /* Override Astra/WC float width. */
	float: none !important;
	margin: 0 !important;
	align-self: start;
}

/* Thin light frame around the whole gallery. */
body.single-product div.product .woocommerce-product-gallery {
	background: var(--rm-white);
	border: 1px solid var(--rm-border-soft);
	border-radius: var(--rm-radius);
	padding: clamp(10px, 1.5vw, 18px);
}

body.single-product div.product .woocommerce-product-gallery__wrapper {
	margin: 0;
}

/* Summary column: the other side. */
body.single-product div.product > .summary {
	grid-column: 2;
	grid-row: 1;
	width: auto !important;
	float: none !important;
	margin: 0 !important;
}

/* Tabs / upsells / related span both columns, full width below. */
body.single-product div.product > .related,
body.single-product div.product > .up-sells,
body.single-product div.product > .woocommerce-tabs {
	grid-column: 1 / -1;
	width: auto !important;
	float: none !important;
}

/* ==========================================================================
   2. Summary column typography (reinforces brand.css section e)
   ========================================================================== */

/* Breadcrumb (Astra prints it at priority 2 inside the summary): small taupe. */
body.single-product div.product .summary > .woocommerce-breadcrumb {
	color: var(--rm-taupe);
	font-size: 0.78rem;
	letter-spacing: 0.06em;
	margin: 0 0 1rem;
}

body.single-product div.product .summary > .woocommerce-breadcrumb a {
	color: var(--rm-taupe);
}

body.single-product div.product .product_title {
	margin-top: 0;
}

/* Price sits large + taupe (brand.css handles colour/serif); a touch more
   air below it so the single CTA row breathes. */
body.single-product div.product .summary p.price,
body.single-product div.product .summary span.price {
	margin: 0.2em 0 1.6em;
	display: block;
}

body.single-product div.product .woocommerce-product-details__short-description {
	margin-top: 1.6rem;
	padding-top: 1.6rem;
	border-top: 1px solid var(--rm-border-soft);
}

/* ==========================================================================
   3. Add-to-cart row (single full-width CTA, quantity hidden)
   ========================================================================== */

body.single-product div.product form.cart {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 14px;
	margin-bottom: 0;
}

/* Variable-product internals stay full width above the button row. */
body.single-product div.product form.cart table.variations,
body.single-product div.product form.cart .single_variation_wrap {
	flex: 1 1 100%;
	margin: 0;
}

body.single-product div.product .woocommerce-variation-add-to-cart {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 14px;
}

/* No plus/minus, no visible qty box — the buy row is one calm espresso CTA.
   The input stays in the DOM (display:none) so WooCommerce still posts
   quantity=1; cart quantities are edited in the cart drawer / cart page. */
body.single-product div.product form.cart .quantity,
body.single-product div.product .woocommerce-variation-add-to-cart .quantity {
	display: none;
}

/* Prominent espresso button owns the full row (colour from brand.css). */
body.single-product div.product form.cart .single_add_to_cart_button,
body.single-product div.product .woocommerce-variation-add-to-cart .single_add_to_cart_button {
	flex: 1 1 100%;
	min-width: 0;
}

/* ==========================================================================
   4. Accordion
   ========================================================================== */

.rm-accordion {
	margin-top: 2.4rem;
	border-top: 1px solid var(--rm-border-soft);
}

.rm-accordion__item {
	border-bottom: 1px solid var(--rm-border-soft);
}

.rm-accordion__heading {
	margin: 0;
	font-family: var(--rm-font-body);
}

/* Trigger is a plain <button type="button"> — the brand button style targets
   button[type="submit"], not this, so it stays a flat text row. */
.rm-accordion__trigger {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	background: transparent;
	border: none;
	border-radius: 0;
	padding: 22px 2px;
	cursor: pointer;
	text-align: start;
	font-family: var(--rm-font-serif);
	font-size: 1.1rem;
	font-weight: 500;
	color: var(--rm-espresso);
	letter-spacing: 0.02em;
	transition: color 0.2s var(--rm-ease);
}

.rm-accordion__trigger:hover .rm-accordion__title {
	color: var(--rm-taupe);
}

.rm-accordion__title {
	transition: color 0.2s var(--rm-ease);
}

/* Plus / minus cue built from two 1px bars; the vertical bar collapses when open. */
.rm-accordion__icon {
	position: relative;
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
}

.rm-accordion__icon::before,
.rm-accordion__icon::after {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 50%;
	width: 16px;
	height: 1.5px;
	background: var(--rm-taupe);
	transform: translateY(-50%);
	transition: transform 0.3s var(--rm-ease), opacity 0.3s var(--rm-ease);
}

.rm-accordion__icon::after {
	transform: translateY(-50%) rotate(90deg); /* Vertical bar => "+" */
}

.rm-accordion__item.is-open .rm-accordion__icon::after {
	transform: translateY(-50%) rotate(90deg) scaleX(0); /* Collapse to "−" */
	opacity: 0;
}

/* Panel: open by default (no-JS / progressive enhancement). Once JS adds
   .is-enhanced the panels collapse and only the open item expands, using a
   grid-template-rows animation (0fr -> 1fr) with visibility for a11y. */
.rm-accordion__panel {
	display: grid;
	grid-template-rows: 1fr;
}

.rm-accordion__panel-inner {
	overflow: hidden;
	min-height: 0;
	padding-block-end: 24px;
	color: var(--rm-body);
	font-size: 1rem;
	line-height: 1.8;
}

.rm-accordion__panel-inner > :first-child {
	margin-top: 0;
}

.rm-accordion.is-enhanced .rm-accordion__panel {
	grid-template-rows: 0fr;
	visibility: hidden;
	transition: grid-template-rows 0.35s var(--rm-ease), visibility 0.35s var(--rm-ease);
}

.rm-accordion.is-enhanced .rm-accordion__item.is-open .rm-accordion__panel {
	grid-template-rows: 1fr;
	visibility: visible;
}

.rm-accordion__copy {
	color: var(--rm-body);
}

/* ==========================================================================
   5. Related products (reuse the borderless catalog card from brand.css d)
   ========================================================================== */

body.single-product .related.products ul.products,
body.single-product .up-sells ul.products {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	column-gap: clamp(1.5rem, 3vw, 2.5rem);
	row-gap: clamp(2rem, 4vw, 3rem);
	margin: 0;
}

body.single-product .related.products ul.products li.product,
body.single-product .up-sells ul.products li.product {
	width: auto !important; /* Drop WC's percentage width + float. */
	margin: 0 !important;
	float: none !important;
	clear: none !important;
}

/* ==========================================================================
   6. Responsive + reduced motion
   ========================================================================== */

@media (max-width: 921px) {
	body.single-product div.product {
		grid-template-columns: 1fr;
	}

	body.single-product div.product > .images,
	body.single-product div.product > .woocommerce-product-gallery,
	body.single-product div.product > .summary {
		grid-column: 1;
		grid-row: auto;
	}

	/* No sticky image once the columns stack. */
	body.single-product div.product > .images,
	body.single-product div.product > .woocommerce-product-gallery {
		position: static;
		top: auto;
	}

	body.single-product .related.products ul.products,
	body.single-product .up-sells ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 544px) {
	body.single-product .related.products ul.products,
	body.single-product .up-sells ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: 1rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rm-accordion.is-enhanced .rm-accordion__panel,
	.rm-accordion__icon::before,
	.rm-accordion__icon::after,
	.rm-accordion__trigger,
	.rm-accordion__title {
		transition-duration: 0.01ms !important;
	}
}

/* ==========================================================================
   Related products — match the site-wide card design line.
   The catalog chip rules live in woo-catalog.css (which does NOT load on the
   single-product page), so replicate the round +/view chip pair + centred,
   larger title/price here, scoped to .related.products.
   ========================================================================== */
body.single-product .related.products ul.products li.product {
	position: relative;
	text-align: center;
}

body.single-product .related.products li.product .astra-shop-summary-wrap {
	text-align: center;
}

body.single-product .related.products li.product .woocommerce-loop-product__title {
	text-align: center;
	font-size: clamp(1.15rem, 1.9vw, 1.25rem);
}

body.single-product .related.products li.product .price,
body.single-product .related.products li.product .price .amount {
	text-align: center;
	font-size: 1.05rem;
}

body.single-product .related.products li.product .ast-woo-product-category {
	display: block;
	text-align: center;
}

/* Round +/view chip pair over the image (mirrors woo-catalog.css section 5). */
body.single-product .related.products li.product .astra-shop-summary-wrap .button,
body.single-product .related.products li.product .astra-shop-summary-wrap .button.ajax_add_to_cart,
body.single-product .related.products li.product .rm-loop-view {
	position: absolute;
	z-index: 4;
	inset-block-start: 14px;
	inset-block-end: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(66, 43, 28, 0.08);
	border-radius: 50%;
	background-color: var(--rm-white, #fff) !important;
	color: var(--rm-espresso, #422B1C) !important;
	line-height: 1;
	text-decoration: none !important;
	box-shadow: var(--rm-shadow-soft, 0 10px 24px -14px rgba(66, 43, 28, 0.5));
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s var(--rm-ease, ease), transform 0.3s var(--rm-ease, ease), background-color 0.3s var(--rm-ease, ease), color 0.3s var(--rm-ease, ease);
}

body.single-product .related.products li.product .astra-shop-summary-wrap .button {
	inset-inline-end: calc(50% + 6px);
	inset-inline-start: auto;
	font-size: 0;
}

body.single-product .related.products li.product .rm-loop-view {
	inset-inline-start: calc(50% + 6px);
	inset-inline-end: auto;
}

body.single-product .related.products li.product .rm-loop-view__icon {
	width: 20px;
	height: 20px;
}

body.single-product .related.products li.product .astra-shop-summary-wrap .button::before {
	content: "+";
	font-family: var(--rm-font-body, sans-serif);
	font-size: 1.6rem;
	font-weight: 300;
	line-height: 1;
}

body.single-product .related.products li.product:hover .astra-shop-summary-wrap .button,
body.single-product .related.products li.product:hover .rm-loop-view,
body.single-product .related.products li.product:focus-within .astra-shop-summary-wrap .button,
body.single-product .related.products li.product:focus-within .rm-loop-view {
	opacity: 1;
	transform: translateY(0);
}

body.single-product .related.products li.product .astra-shop-summary-wrap .button:hover,
body.single-product .related.products li.product .astra-shop-summary-wrap .button:focus-visible,
body.single-product .related.products li.product .rm-loop-view:hover,
body.single-product .related.products li.product .rm-loop-view:focus-visible {
	background-color: var(--rm-espresso, #422B1C) !important;
	color: var(--rm-cream, #EFEAE5) !important;
	transform: translateY(0) scale(1.05);
}

@media (hover: none) {
	body.single-product .related.products li.product .astra-shop-summary-wrap .button,
	body.single-product .related.products li.product .rm-loop-view {
		opacity: 1;
		transform: none;
	}
}

/* ==========================================================================
   Accordion trigger — kill the stray blue hover/active (Astra's default button
   accent colour leaked onto the plain <button>). Keep it quiet + on-brand.
   ========================================================================== */
body.single-product .rm-accordion__trigger,
body.single-product .rm-accordion__trigger:hover,
body.single-product .rm-accordion__trigger:focus,
body.single-product .rm-accordion__trigger:active,
body.single-product .rm-accordion__heading:hover .rm-accordion__trigger {
	background: transparent !important;
	color: var(--rm-espresso, #422B1C) !important;
	box-shadow: none !important;
}

body.single-product .rm-accordion__trigger:hover {
	color: var(--rm-taupe, #725C4E) !important;
}

body.single-product .rm-accordion__trigger:focus-visible {
	outline: 2px solid var(--rm-taupe, #725C4E);
	outline-offset: 2px;
}

/* ---- Bilingual product name on the single product page -------------------- */
.rm-name-he,
.rm-name-en {
	display: block;
}

.rm-name-en {
	margin-block-start: 6px;
	font-size: 0.5em;
	font-weight: 400;
	letter-spacing: 0.08em;
	line-height: 1.35;
	color: var(--rm-taupe, #725C4E);
}

/*
 * Untranslated Hebrew copy inside the English site.
 *
 * rm_lang_catalogue_copy() wraps product descriptions in lang="he" dir="rtl" so
 * screen readers switch voice (WCAG 2.0 SC 3.1.2). The dir flip also aligns the
 * block to the right while the page around it runs LTR — correct for Hebrew, but
 * it needs to read as a deliberate quoted passage rather than a layout accident,
 * hence the rule and the inset.
 */
.rm-lang-en .rm-he-copy {
	border-inline-start: 2px solid var(--rm-border-soft, rgba(114, 92, 78, .25));
	padding-inline-start: 1rem;
	text-align: start;
}

.rm-lang-en .rm-he-copy > *:last-child {
	margin-block-end: 0;
}
