/**
 * Rachel Mizrahi — WooCommerce CATALOG / archive styles.
 *
 * Loaded after brand.css (which defines the --rm-* design tokens) and pairs
 * with inc/woo-catalog.php. Everything is scoped under `body.rm-catalog`
 * (added by rm_catalog_body_class() on the shop page + product taxonomy
 * archives only) so the borderless-card / grid overrides never leak onto the
 * single-product related loop, cart cross-sells, or content pages.
 *
 * Palette: LIGHT beige / white neutral. Page grounds are --rm-paper /
 * --rm-cream; espresso is reserved for the title, sale badge and buttons —
 * NEVER as a large background band. var() fallbacks mirror brand.css tokens
 * as insurance in case load order ever changes.
 *
 * The site runs RTL (Hebrew); direction-sensitive rules use logical
 * properties (margin-inline-*, inset-inline-*) so they hold under LTR too.
 * All motion is transform/opacity based and disabled under reduced-motion.
 *
 * CONTENTS
 *   1. Container reset
 *   2. Light category / shop header (edge-to-edge cream band)
 *   3. Result-count + ordering toolbar
 *   4. Product grid
 *   5. Product cards (borderless, hover-zoom image, quick add-to-cart)
 *   6. Sale badge
 *   7. Pagination
 *   8. Reduced motion
 */

/* ==========================================================================
   1. Container reset — let the header band bleed to the viewport edge
   ========================================================================== */

body.rm-catalog.woocommerce #primary,
body.rm-catalog.woocommerce-page #primary {
	margin-top: 0;
	padding-top: 0;
}

/* ==========================================================================
   2. Light category / shop header
   ========================================================================== */

.rm-catalog-head {
	position: relative;
	width: 100vw;
	margin-inline: calc(50% - 50vw);   /* full-bleed out of the container */
	margin-block: 0 clamp(28px, 4vw, 44px);
	padding-block: clamp(20px, 2.8vw, 34px);
	display: flex;
	align-items: center;
	justify-content: center;
	/* LIGHT band — warm cream, no dark hero. */
	background: linear-gradient(135deg, var(--rm-cream, #EFEAE5) 0%, var(--rm-paper, #F7F3EF) 100%);
	border-block-end: 1px solid var(--rm-border-soft, rgba(66, 43, 28, 0.08));
	overflow: hidden;
}

.rm-catalog-head__inner {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: 1200px;
	margin-inline: auto;
	padding-inline: clamp(20px, 4vw, 48px);
	text-align: center;
}

/* Breadcrumb line above the title — small, taupe. */
.rm-catalog-head__crumbs {
	color: var(--rm-taupe, #725C4E);
	font-family: var(--rm-font-body, sans-serif);
	font-size: 0.78rem;
	font-weight: 400;
	letter-spacing: 0.14em;
	margin-block-end: 14px;
}

.rm-catalog-head__crumbs a {
	color: var(--rm-taupe, #725C4E);
	text-decoration: none;
	transition: color 0.2s ease;
}

.rm-catalog-head__crumbs a:hover {
	color: var(--rm-espresso, #422B1C);
}

.rm-catalog-head__crumb-sep {
	display: inline-block;
	margin-inline: 10px;
	opacity: 0.5;
}

/* Large serif title in espresso (brand.css paints h1 espresso; we restate it
   with the band's own scale). */
.rm-catalog-head__title {
	font-family: var(--rm-font-serif, Georgia, serif) !important;
	color: var(--rm-espresso, #422B1C) !important;
	font-size: clamp(1.25rem, 2.2vw, 1.7rem);
	font-weight: 400;
	line-height: 1.15;
	margin: 0 0 8px;
}

.rm-catalog-head__count {
	color: var(--rm-taupe, #725C4E);
	font-family: var(--rm-font-body, sans-serif);
	font-size: 0.85rem;
	font-weight: 500;
	letter-spacing: 0.16em;
	margin: 0;
}

.rm-catalog-head__desc {
	max-width: 560px;
	margin-block-start: 16px;
	color: var(--rm-body, #4A4038);
	font-size: 0.95rem;
	line-height: 1.8;
}

.rm-catalog-head__desc p {
	margin: 0;
}

/* ==========================================================================
   3. Result-count + ordering toolbar — one thin-ruled line
   ========================================================================== */

.rm-catalog-toolbar {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
	margin-block-end: clamp(28px, 4vw, 44px);
	padding-block-end: 14px;
	border-block-end: 1px solid var(--rm-border-soft, rgba(66, 43, 28, 0.08));
}

/* Neutralise WooCommerce's default float layout inside the flex row. */
.rm-catalog-toolbar .woocommerce-result-count,
.rm-catalog-toolbar .woocommerce-ordering {
	float: none !important;
	margin: 0 !important;
}

.rm-catalog-toolbar .woocommerce-result-count {
	color: var(--rm-charcoal, #5A5A58);
	font-size: 0.8rem;
	letter-spacing: 0.1em;
}

/* Restyled ordering <select>: quiet underline field, taupe on hover/focus. */
.rm-catalog-toolbar .woocommerce-ordering select,
.rm-catalog-toolbar select.orderby {
	background-color: transparent;
	border: none !important;
	border-block-end: 1px solid transparent !important;
	border-radius: 0;
	color: var(--rm-espresso, #422B1C);
	font-family: var(--rm-font-body, sans-serif);
	font-size: 0.82rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	padding: 4px 2px;
	cursor: pointer;
	box-shadow: none;
	transition: border-color 0.2s ease;
}

.rm-catalog-toolbar .woocommerce-ordering select:hover,
.rm-catalog-toolbar .woocommerce-ordering select:focus,
.rm-catalog-toolbar select.orderby:hover,
.rm-catalog-toolbar select.orderby:focus {
	border-block-end-color: var(--rm-taupe, #725C4E) !important;
	outline: none;
}

/* ==========================================================================
   4. Product grid — CSS grid overrides Astra's floated columns
   ========================================================================== */

.rm-catalog ul.products {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	column-gap: clamp(20px, 3vw, 40px);
	row-gap: clamp(40px, 5vw, 64px);
	margin: 0 0 clamp(40px, 5vw, 56px);
	padding: 0;
	list-style: none;
}

/* Kill Astra's clearfix pseudo-elements that would create phantom grid cells. */
.rm-catalog ul.products::before,
.rm-catalog ul.products::after {
	display: none !important;
}

.rm-catalog ul.products li.product {
	width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
	clear: none !important;
	display: flex;
	flex-direction: column;
	position: relative; /* Positioning context for the floating chip pair. */
}

@media (max-width: 921px) {
	.rm-catalog ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: clamp(14px, 3vw, 24px);
		row-gap: clamp(32px, 6vw, 48px);
	}
}

/* ==========================================================================
   5. Product cards — borderless, edge-to-edge image, hover zoom
   ========================================================================== */

/* Media well: overflow-hidden so the image can scale on hover without spill. */
.rm-catalog ul.products li.product .astra-shop-thumbnail-wrap {
	position: relative;
	overflow: hidden;
	border-radius: var(--rm-radius, 2px);
	background: var(--rm-cream-warm, #E7DFDD);
	margin-block-end: 18px;
}

.rm-catalog ul.products li.product .astra-shop-thumbnail-wrap img {
	display: block;
	width: 100%;
	margin: 0;
	transition: transform 0.8s var(--rm-ease, ease);
}

.rm-catalog ul.products li.product:hover .astra-shop-thumbnail-wrap img,
.rm-catalog ul.products li.product:focus-within .astra-shop-thumbnail-wrap img {
	transform: scale(1.05);
}

/* Summary column: category eyebrow, serif title, taupe price. CENTRED so the
   name + price read as a balanced pair under the image, matching the home
   featured grid. */
.rm-catalog ul.products li.product .astra-shop-summary-wrap {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	padding-inline: 2px;
	text-align: center;
}

.rm-catalog ul.products li.product .ast-woo-product-category {
	order: -1;
	font-family: var(--rm-font-body, sans-serif);
	font-size: 0.7rem;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--rm-charcoal, #5A5A58);
	margin-block-end: 6px;
	text-align: center;
}

.rm-catalog ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--rm-font-serif, Georgia, serif);
	color: var(--rm-espresso, #422B1C);
	font-size: clamp(1.15rem, 1.9vw, 1.25rem);
	font-weight: 500;
	line-height: 1.35;
	padding: 0;
	margin-block-start: 4px;
}

.rm-catalog ul.products li.product .price {
	color: var(--rm-taupe, #725C4E);
	font-family: var(--rm-font-body, sans-serif);
	font-size: 1.05rem;
	margin-block-start: 8px;
	margin-block-end: 0;
}

/* Struck-through original price on sale items: quieter still. */
.rm-catalog ul.products li.product .price del {
	color: var(--rm-charcoal, #5A5A58);
	opacity: 0.7;
	font-size: 0.9em;
}

.rm-catalog ul.products li.product .price ins {
	text-decoration: none;
	font-weight: 600;
}

/* --------------------------------------------------------------------------
   Round "+" (add-to-cart) + "view product" chip pair — identical to the home
   featured grid so the whole site shares one design line. The visible Woo
   add-to-cart button becomes a round "+" chip; the ungated woo-catalog.php hook
   prints a round eye "view product" link (.rm-loop-view) beside it. The pair is
   a centred cluster near the top of the card (reliably over the product image),
   revealed together on hover / focus, always visible on touch. The "+" is the
   REAL loop link so cart.js's AJAX still fires; we only restyle it.

   The chips are NOT descendants of .astra-shop-thumbnail-wrap (Astra closes it
   before these links print), so they anchor to li.product.
   -------------------------------------------------------------------------- */
.rm-catalog ul.products li.product .astra-shop-summary-wrap .button,
.rm-catalog ul.products li.product .astra-shop-summary-wrap .button.ajax_add_to_cart,
.rm-catalog ul.products li.product .rm-loop-view {
	position: absolute;
	z-index: 4;
	inset-block-start: 14px; /* Cluster over the top of the product image. */
	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);
}

/* "+" (add) sits just inline-start of the card centre. */
.rm-catalog ul.products li.product .astra-shop-summary-wrap .button {
	inset-inline-end: calc(50% + 6px);
	inset-inline-start: auto;
	font-size: 0; /* Hide the "add to cart" label; the glyph is the ::before. */
}

/* "view" (open product) sits just inline-end of the card centre. */
.rm-catalog ul.products li.product .rm-loop-view {
	inset-inline-start: calc(50% + 6px);
	inset-inline-end: auto;
}

.rm-catalog ul.products li.product .rm-loop-view__icon {
	width: 20px;
	height: 20px;
}

/* The "+" glyph — kept as content so the underlying link text is preserved for
   AJAX / a11y (we only zero its font-size above). */
.rm-catalog ul.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;
}

/* Reveal the pair together on card hover / keyboard focus within the card. */
.rm-catalog ul.products li.product:hover .astra-shop-summary-wrap .button,
.rm-catalog ul.products li.product:hover .rm-loop-view,
.rm-catalog ul.products li.product:focus-within .astra-shop-summary-wrap .button,
.rm-catalog ul.products li.product:focus-within .rm-loop-view {
	opacity: 1;
	transform: translateY(0);
}

.rm-catalog ul.products li.product .astra-shop-summary-wrap .button:hover,
.rm-catalog ul.products li.product .astra-shop-summary-wrap .button:focus-visible,
.rm-catalog ul.products li.product .rm-loop-view:hover,
.rm-catalog ul.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);
}

/* Loading + added states keep the round chip readable (cart.js owns behaviour). */
.rm-catalog ul.products li.product .astra-shop-summary-wrap .button.loading,
.rm-catalog ul.products li.product .astra-shop-summary-wrap .button.added {
	opacity: 1;
	transform: translateY(0);
}

/* The "added" state prints a following AJAX "view cart" link — show it as a
   quiet underlined text link below the card, not a round chip. */
.rm-catalog ul.products li.product a.added_to_cart {
	position: relative;
	z-index: 4;
	display: inline-block;
	margin-block-start: 10px;
	font-family: var(--rm-font-body, sans-serif);
	font-size: 0.82rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	color: var(--rm-taupe, #725C4E) !important;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Touch devices (no hover): the chip pair is always visible + tappable. */
@media (hover: none) {
	.rm-catalog ul.products li.product .astra-shop-summary-wrap .button,
	.rm-catalog ul.products li.product .rm-loop-view {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ==========================================================================
   6. Sale badge — espresso "מבצע" chip (text set in woo-catalog.php)
   ========================================================================== */

.rm-catalog ul.products li.product .onsale {
	position: absolute;
	top: 12px;
	inset-inline-start: 12px;
	inset-inline-end: auto;
	left: auto;   /* neutralise WooCommerce's physical defaults */
	right: auto;
	margin: 0;
	background: var(--rm-espresso, #422B1C) !important;
	color: var(--rm-paper, #F7F3EF) !important;
	border-radius: var(--rm-radius, 2px);
	font-family: var(--rm-font-body, sans-serif);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	line-height: 1;
	min-height: 0;
	min-width: 0;
	padding: 8px 14px;
	z-index: 3;
}

/* ==========================================================================
   7. Pagination — minimal numbers, taupe active underline
   ========================================================================== */

.rm-catalog nav.woocommerce-pagination {
	margin-block-start: clamp(32px, 4vw, 48px);
	text-align: center;
}

.rm-catalog nav.woocommerce-pagination ul,
.rm-catalog nav.woocommerce-pagination ul li {
	border: none !important;
	background: transparent !important;
	margin: 0;
}

.rm-catalog nav.woocommerce-pagination ul li a,
.rm-catalog nav.woocommerce-pagination ul li span {
	background: transparent !important;
	border: none;
	border-block-end: 1px solid transparent;
	border-radius: 0;
	color: var(--rm-taupe, #725C4E) !important;
	font-family: var(--rm-font-body, sans-serif);
	font-size: 0.95rem;
	letter-spacing: 0.06em;
	padding: 8px 12px;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.rm-catalog nav.woocommerce-pagination ul li a:hover,
.rm-catalog nav.woocommerce-pagination ul li a:focus {
	color: var(--rm-espresso, #422B1C) !important;
	border-block-end-color: var(--rm-border-mid, rgba(66, 43, 28, 0.16));
}

.rm-catalog nav.woocommerce-pagination ul li span.current {
	color: var(--rm-espresso, #422B1C) !important;
	border-block-end-color: var(--rm-taupe, #725C4E);
	font-weight: 600;
}

/* ==========================================================================
   8. Reduced motion — kill transforms / transitions, keep buttons visible
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.rm-catalog ul.products li.product .astra-shop-thumbnail-wrap img,
	.rm-catalog ul.products li.product .astra-shop-summary-wrap .button,
	.rm-catalog ul.products li.product .rm-loop-view {
		transition: none !important;
	}

	.rm-catalog ul.products li.product:hover .astra-shop-thumbnail-wrap img,
	.rm-catalog ul.products li.product:focus-within .astra-shop-thumbnail-wrap img {
		transform: none !important;
	}

	/* Never leave the chip pair hidden when animation is off — reveal on
	   hover/focus still applies, but the base transform is neutralised. */
	.rm-catalog ul.products li.product .astra-shop-summary-wrap .button,
	.rm-catalog ul.products li.product .rm-loop-view {
		transform: none !important;
	}
}

/* ==========================================================================
   רקע צילום אמיתי לרצועת כותרת החנות (inc/woo-catalog.php)
   ========================================================================== */
.rm-catalog-head--photo {
	position: relative;
	isolation: isolate;
}

.rm-catalog-head__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.rm-catalog-head__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 38%;
	display: block;
}

/* שכבת קרם מבהירה — הכותרת האספרסו נשארת קריאה לחלוטין. */
.rm-catalog-head__veil {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background:
		radial-gradient(62% 76% at 50% 50%, rgba(247, 243, 239, 0.86) 0%, rgba(247, 243, 239, 0.72) 60%, rgba(239, 234, 229, 0.68) 100%),
		linear-gradient(180deg, rgba(247, 243, 239, 0.55) 0%, rgba(231, 223, 221, 0.6) 100%);
}

.rm-catalog-head--photo .rm-catalog-head__inner {
	z-index: 2;
}

/* ---- Bilingual product name (Hebrew heading + English under it) -----------
   Client request: the product reads in Hebrew with the English name exactly as
   printed on the bottle beneath it. Rendered by rm_child_bilingual_product_title()
   in functions.php; when a product has no Hebrew name only one line prints.
   -------------------------------------------------------------------------- */
.rm-name-he,
.rm-name-en {
	display: block;
}

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