/**
 * LabDiamond — store / archive (Magazin) styling.
 *
 * Loaded on WooCommerce archives (see functions.php). Turns the unstyled block
 * scaffold into a refined catalog: a clean filter sidebar on desktop that
 * becomes an off-canvas drawer on mobile, polished product cards, and a quiet
 * toolbar. WooCommerce's own filter-overlay buttons are suppressed because we
 * provide our own drawer. Design values come from theme.json tokens.
 */

:root {
	--ldd-ease: cubic-bezier(0.16, 0.84, 0.32, 1);
	--ldd-gold: var(--wp--preset--color--accent, #c5a572);
	--ldd-ink: var(--wp--preset--color--contrast, #1a1a1a);
	--ldd-platinum: var(--wp--preset--color--platinum, #e7e3dc);
	--ldd-muted: var(--wp--preset--color--platinum-dark, #9a958c);
	--ldd-shadow: 0 22px 55px -30px rgba(26, 26, 26, 0.5);
}

/* ----------------------------------------------------------------------- *
 *  Header / breadcrumb / title
 * ----------------------------------------------------------------------- */
.ldd-breadcrumb {
	font-family: var(--wp--preset--font-family--body, sans-serif);
	font-size: 0.8rem;
	letter-spacing: 0.02em;
	color: var(--ldd-muted);
}
.ldd-breadcrumb a { color: var(--ldd-muted); text-decoration: none; }
.ldd-breadcrumb a:hover { color: var(--ldd-gold); }

.ldd-shop-title {
	margin: 0;
	line-height: 1.1;
}

/* ----------------------------------------------------------------------- *
 *  Toolbar: results count + sort + filter toggle
 * ----------------------------------------------------------------------- */
.ldd-shop-toolbar {
	border-top: 1px solid var(--ldd-platinum);
	border-bottom: 1px solid var(--ldd-platinum);
	padding-block: 0.85rem;
}
.ldd-results-count {
	margin: 0;
	font-family: var(--wp--preset--font-family--body, sans-serif);
	font-size: 0.9rem;
	color: var(--ldd-muted);
}
.ldd-catalog-sorting select,
.ldd-catalog-sorting .orderby,
select.orderby {
	font-family: var(--wp--preset--font-family--body, sans-serif);
	font-size: 0.88rem;
	color: var(--ldd-ink);
	background: #fff;
	border: 1px solid var(--ldd-platinum);
	border-radius: 3px;
	padding: 0.5rem 2rem 0.5rem 0.85rem;
	cursor: pointer;
	transition: border-color 0.3s var(--ldd-ease);
}
.ldd-catalog-sorting select:hover,
select.orderby:hover { border-color: var(--ldd-gold); }

/* Our own filter toggle (mobile only). */
.ldd-filter-toggle {
	display: none;
	align-items: center;
	gap: 0.5rem;
	font-family: var(--wp--preset--font-family--body, sans-serif);
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--ldd-ink);
	background: #fff;
	border: 1px solid var(--ldd-platinum);
	border-radius: 3px;
	padding: 0.5rem 1rem;
	cursor: pointer;
	transition: border-color 0.3s var(--ldd-ease), background-color 0.3s var(--ldd-ease);
}
.ldd-filter-toggle:hover { border-color: var(--ldd-gold); }
.ldd-filter-toggle__icon { color: var(--ldd-gold); font-size: 0.95rem; line-height: 1; }

/* Suppress WooCommerce's built-in filter overlay buttons — we use our drawer. */
.wc-block-product-filters__open-overlay,
.wc-block-product-filters__close-overlay,
.wc-block-product-filters__open-overlay-label {
	display: none !important;
}

/* ----------------------------------------------------------------------- *
 *  Layout: sidebar + results
 * ----------------------------------------------------------------------- */
.ldd-shop-layout {
	display: flex;
	align-items: flex-start;
	gap: clamp(1.5rem, 3vw, 3rem);
}
.ldd-filter-drawer {
	flex: 0 0 248px;
	min-width: 0;
	position: sticky;
	top: 1.5rem;
}
.ldd-filter-drawer__close { display: none; }
.ldd-shop-results { flex: 1 1 auto; min-width: 0; }

/* ----------------------------------------------------------------------- *
 *  Filters
 * ----------------------------------------------------------------------- */
.ldd-filters-title {
	margin: 0 0 0.5rem;
	padding-bottom: 0.85rem;
	border-bottom: 1px solid var(--ldd-platinum);
	font-weight: 500;
}
.ldd-product-filters { display: flex; flex-direction: column; gap: 0; }
/* Strip WooCommerce's border/box on the filter group blocks + their direct
   wrappers, so the only separators are the uniform hairlines we add below.
   NOTE: do NOT use a broad [class*="product-filter-"] selector here — it also
   matches the chip items and would strip their pill border/background. */
.ldd-product-filters > *,
.ldd-product-filters [class*="checkbox-list"],
.ldd-product-filters [class*="filter-attribute"] > *,
.ldd-product-filters [class*="filter-price"] > *,
.ldd-product-filters [class*="filter-active"] > * {
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	max-height: none !important;
}
.ldd-product-filters [class*="checkbox-list"] {
	overflow: visible !important;
	width: 100% !important;
	padding: 0 !important;
}
/* Uniform, evenly-spaced sections with a single hairline separator between each
   filter group (first visible group has none). */
.ldd-product-filters > * { margin: 0 !important; padding: 0 !important; }
.ldd-product-filters > * + * {
	margin-top: 1.6rem !important;
	padding-top: 1.6rem !important;
	border-top: 1px solid var(--ldd-platinum) !important;
}
/* WooCommerce groups chip options in a <fieldset>, which carries the browser's
   default 2px groove border — reset it so groups read as clean open lists. */
.ldd-product-filters fieldset {
	border: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	min-width: 0;
}
.ldd-product-filters fieldset > legend { padding: 0; float: none; }

.ldd-product-filters h3 {
	margin: 0 0 0.85rem;
	font-family: var(--wp--preset--font-family--body, sans-serif);
	font-size: 0.72rem !important;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	color: var(--ldd-ink);
}

/* Attribute filters render as chips (pills) — cleaner + more premium than
   WooCommerce's checkbox rows, and free of their cascade-layer layout quirks. */
.wc-block-product-filter-chips__items {
	display: flex !important;
	flex-wrap: wrap;
	gap: 0.45rem;
	margin: 0;
	padding: 0;
}
.wc-block-product-filter-chips__item {
	display: inline-flex !important;
	align-items: center;
	font-family: var(--wp--preset--font-family--body, sans-serif);
	font-size: 0.82rem;
	line-height: 1;
	color: var(--ldd-ink);
	background: #fff !important;
	border: 1px solid var(--ldd-platinum) !important;
	border-radius: 999px !important;
	padding: 0.45rem 0.85rem !important;
	cursor: pointer;
	transition: background-color 0.25s var(--ldd-ease), color 0.25s var(--ldd-ease), border-color 0.25s var(--ldd-ease);
}
.wc-block-product-filter-chips__item:hover {
	border-color: var(--ldd-gold) !important;
	color: var(--ldd-gold);
}
.wc-block-product-filter-chips__item[aria-checked="true"] {
	background: var(--ldd-gold) !important;
	border-color: var(--ldd-gold) !important;
	color: var(--ldd-ink);
	font-weight: 500;
}
.wc-block-product-filter-chips__item:focus-visible {
	outline: 2px solid var(--ldd-gold);
	outline-offset: 2px;
}
.wc-block-product-filter-chips__label { line-height: 1; }
.wc-block-product-filter-checkbox-list__count,
.wc-block-components-filter-element-label .count {
	color: var(--ldd-muted);
	font-size: 0.82rem;
}
.wc-block-product-filter-checkbox-list__show-more {
	color: var(--ldd-gold);
	font-size: 0.82rem;
	background: none;
	border: 0;
	padding: 0.25rem 0;
	cursor: pointer;
}

/* Price slider — inputs stacked below the track (inlineInput:false) so the
   track always has full width. Gold fill + thumbs, tidy number inputs. */
.wc-block-product-filter-price-slider { accent-color: var(--ldd-gold); }
.wc-block-product-filter-price-slider__range { width: 100% !important; }
.wc-block-product-filter-price-slider__range-bar { background: var(--ldd-gold) !important; }
.wc-block-product-filter-price-slider__content { gap: 0.6rem; }
.wc-block-product-filter-price-slider__text { gap: 0.6rem; margin-top: 0.6rem; }
.wc-block-product-filter-price-slider__text input,
.wc-block-product-filter-price input {
	font-family: var(--wp--preset--font-family--body, sans-serif);
	font-size: 0.82rem;
	color: var(--ldd-ink);
	border: 1px solid var(--ldd-platinum);
	border-radius: 3px;
	padding: 0.35rem 0.5rem;
	background: #fff;
	max-width: 100%;
}

/* Active filters chips */
.ldd-filter-active .wc-block-product-filter-active__item,
.wc-block-product-filter-active__item {
	background: var(--wp--preset--color--base, #faf9f7);
	border: 1px solid var(--ldd-platinum);
	border-radius: 999px;
	padding: 0.2rem 0.7rem;
	font-size: 0.8rem;
}

/* Clear / reset button */
.ldd-filter-clear .wp-block-button__link,
.ldd-reset-button .wp-block-button__link {
	font-size: 0.82rem;
	border-color: var(--ldd-ink);
	color: var(--ldd-ink);
	padding: 0.5rem 1.1rem;
}
.ldd-filter-clear .wp-block-button__link:hover {
	background: var(--ldd-ink);
	color: #fff;
}

/* ----------------------------------------------------------------------- *
 *  Product grid + cards
 * ----------------------------------------------------------------------- */
/* WooCommerce caps the product-collection at 768px by default — let it fill. */
.ldd-shop-results .wp-block-woocommerce-product-collection {
	max-width: none !important;
	width: 100%;
}
.ldd-product-grid {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(1.25rem, 2.5vw, 2rem);
	list-style: none;
	margin: 0;
	padding: 0;
}
/* WooCommerce's flex layout pins each <li> to a fixed width; in our grid the
   cell defines the width, so force the item to fill it. */
.ldd-product-grid > li {
	margin: 0;
	width: 100% !important;
	max-width: none !important;
	min-width: 0;
	flex: initial;
}

.ldd-product-card {
	height: 100%;
	align-items: stretch;
	text-align: center;
	padding: 1rem 1rem 1.4rem;
	border: 1px solid var(--ldd-platinum);
	border-radius: 8px;
	background: #fff;
	transition: transform 0.5s var(--ldd-ease), box-shadow 0.5s var(--ldd-ease), border-color 0.5s var(--ldd-ease);
}
.ldd-product-card:hover {
	transform: translateY(-8px);
	box-shadow: var(--ldd-shadow);
	border-color: var(--ldd-gold);
}
.ldd-product-card .wc-block-components-product-image,
.ldd-product-card .wp-block-woocommerce-product-image {
	display: block;
	width: 100%;
	margin: 0 0 1.1rem;
	border-radius: 6px;
	overflow: clip;
	background: var(--wp--preset--color--base, #faf9f7);
	aspect-ratio: 1 / 1;
}
.ldd-product-card .wc-block-components-product-image a,
.ldd-product-card .wp-block-woocommerce-product-image a { display: block; width: 100%; height: 100%; }
.ldd-product-card img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	transition: transform 0.7s var(--ldd-ease);
}
.ldd-product-card:hover img { transform: scale(1.05); }

.ldd-product-card .wp-block-post-title {
	font-size: 1.05rem;
	line-height: 1.35;
	margin: 0 0 0.5rem;
	min-height: 2.7em;
	display: -webkit-box !important;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.ldd-product-card .wp-block-post-title a {
	color: var(--ldd-ink);
	text-decoration: none;
	transition: color 0.3s var(--ldd-ease);
}
.ldd-product-card .wp-block-post-title a:hover { color: var(--ldd-gold); }

.ldd-product-card .wc-block-components-product-price,
.ldd-product-card .price {
	display: block;
	font-family: var(--wp--preset--font-family--body, sans-serif);
	color: var(--ldd-ink);
	margin: 0 0 1rem;
}
.ldd-product-card .wc-block-components-product-price__regular,
.ldd-product-card del { color: var(--ldd-muted); text-decoration: line-through; margin-right: 0.4rem; }
.ldd-product-card .wc-block-components-product-price__value.is-discounted,
.ldd-product-card ins { color: var(--ldd-gold); text-decoration: none; font-weight: 500; }

.ldd-product-card .wp-block-woocommerce-product-button .wp-block-button__link,
.ldd-product-card .wc-block-components-product-button a,
.ldd-product-card .add_to_cart_button {
	display: inline-block;
	width: 100%;
	background: var(--ldd-ink);
	color: #fff;
	border: 1px solid var(--ldd-ink);
	border-radius: 3px;
	padding: 0.7rem 1rem;
	font-family: var(--wp--preset--font-family--body, sans-serif);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	transition: background-color 0.3s var(--ldd-ease), color 0.3s var(--ldd-ease), border-color 0.3s var(--ldd-ease);
}
.ldd-product-card .wp-block-woocommerce-product-button .wp-block-button__link:hover,
.ldd-product-card .add_to_cart_button:hover {
	background: var(--ldd-gold);
	border-color: var(--ldd-gold);
	color: var(--ldd-ink);
}
.ldd-product-card .wc-block-components-product-button .added_to_cart { display: none; }

/* ----------------------------------------------------------------------- *
 *  Pagination
 * ----------------------------------------------------------------------- */
.ldd-pagination {
	margin-top: clamp(2rem, 4vw, 3.5rem);
	gap: 0.4rem;
	font-family: var(--wp--preset--font-family--body, sans-serif);
}
.ldd-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 0.5rem;
	border: 1px solid var(--ldd-platinum);
	border-radius: 3px;
	color: var(--ldd-ink);
	text-decoration: none;
	transition: all 0.3s var(--ldd-ease);
}
.ldd-pagination .page-numbers:hover { border-color: var(--ldd-gold); color: var(--ldd-gold); }
.ldd-pagination .page-numbers.current { background: var(--ldd-ink); color: #fff; border-color: var(--ldd-ink); }

/* ----------------------------------------------------------------------- *
 *  Hover lift on product cards respects reduced motion via the transition
 *  only; transforms are harmless. Mobile drawer below.
 * ----------------------------------------------------------------------- */
@media (max-width: 991px) {
	.ldd-shop-toolbar { flex-wrap: wrap; row-gap: 0.75rem; }
	.ldd-catalog-sorting select, select.orderby { max-width: 100%; }
	.ldd-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ldd-filter-toggle { display: inline-flex; }

	.ldd-shop-layout { display: block; }
	.ldd-filter-drawer {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: min(86vw, 340px);
		max-width: 340px;
		background: #fff;
		z-index: 1000;
		padding: 1.5rem 1.4rem 2.5rem;
		overflow-y: auto;
		transform: translateX(-100%);
		transition: transform 0.45s var(--ldd-ease);
		box-shadow: 0 0 60px rgba(0, 0, 0, 0.25);
	}
	.ldd-filter-drawer.is-open { transform: none; }
	.ldd-filter-drawer__close {
		display: block;
		position: absolute;
		top: 0.9rem;
		right: 1rem;
		width: 34px;
		height: 34px;
		font-size: 1.4rem;
		line-height: 1;
		background: none;
		border: 0;
		color: var(--ldd-ink);
		cursor: pointer;
	}
	.ldd-shop-backdrop {
		position: fixed;
		inset: 0;
		background: rgba(20, 20, 20, 0.5);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.4s var(--ldd-ease), visibility 0.4s var(--ldd-ease);
		z-index: 999;
	}
	.ldd-shop-backdrop.is-open { opacity: 1; visibility: visible; }
	body.ldd-drawer-open { overflow: hidden; }
}

@media (max-width: 560px) {
	.ldd-product-grid { grid-template-columns: 1fr; }
	.ldd-shop-toolbar { gap: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
	.ldd-product-card,
	.ldd-product-card img,
	.ldd-filter-drawer { transition: none; }
}
