/* ==========================================================================
   AquaBrum child theme — catalogue, single product, search, 404
   --------------------------------------------------------------------------
   Every rule is scoped to a body class that only WooCommerce / search / 404
   pages carry, so the homepage, the trust pages, /produits/ and the blog
   keep the styling they were verified with.

   Design tokens follow the site's own language: teal #0b8194, ink #43415E,
   paper #F7F8FC, hairline #E2E6F0, 16px radius, Inter for headings.
   ========================================================================== */

body.woocommerce,
body.search,
body.error404,
body.single-product {
	--aqb-ink: #43415e;
	--aqb-muted: #5c5c5c;
	--aqb-line: #e2e6f0;
	--aqb-paper: #f7f8fc;
	--aqb-surface: #ffffff;
	--aqb-teal: #0b8194;
	--aqb-deep: #073b46;
	--aqb-wa: #0f7d3c;
	--aqb-radius: 16px;
	--aqb-shell: 1160px;
	--aqb-gutter: 24px;
}

/* --------------------------------------------------------------------------
   1. Container discipline
   Kadence renders these templates edge-to-edge on this install, which is why
   body copy started 16px from the viewport edge. Everything now sits in the
   same 1160px shell the rebuilt pages use.
   -------------------------------------------------------------------------- */

body.woocommerce #primary > .content-container,
body.search #primary > .content-container,
body.error404 #primary > .content-container,
body.single-product #primary > .content-container {
	max-width: var(--aqb-shell);
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--aqb-gutter);
	padding-right: var(--aqb-gutter);
	box-sizing: border-box;
}

body.woocommerce .woocommerce-breadcrumb,
body.single-product .woocommerce-breadcrumb {
	max-width: var(--aqb-shell);
	margin: 0 auto;
	padding: 20px var(--aqb-gutter) 0;
	font-size: 0.8125rem;
	line-height: 1.5;
	color: #7a7a8c;
}

body.woocommerce .woocommerce-breadcrumb a,
body.single-product .woocommerce-breadcrumb a {
	color: var(--aqb-muted);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.15s ease, color 0.15s ease;
}

body.woocommerce .woocommerce-breadcrumb a:hover,
body.single-product .woocommerce-breadcrumb a:hover {
	color: var(--aqb-teal);
	border-bottom-color: currentColor;
}

/* --------------------------------------------------------------------------
   2. Category archive hero
   Deliberately minimal. The banner is a Kadence hero with its own background
   image, overlay and vertical rhythm; changing its display model squashes the
   photo into a strip. So the only thing touched here is the horizontal
   alignment of the title, which is pulled into the same 1160px shell as the
   copy and grid beneath it. Colour, height and overlay are left to the theme.
   -------------------------------------------------------------------------- */

body.woocommerce .entry-hero.product-archive-hero-section .hero-container {
	max-width: var(--aqb-shell);
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--aqb-gutter);
	padding-right: var(--aqb-gutter);
	box-sizing: border-box;
}

/* The parent theme ships the overlay div but paints nothing in it, so the
   title sits straight on the photo. Which part of the photo lands behind it
   depends on the viewport crop, so contrast is a lottery. A light veil keeps
   the image visible while making the dark title safe at every width. */

body.woocommerce .entry-hero.product-archive-hero-section .hero-section-overlay {
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.54) 100%);
}

body.woocommerce .entry-hero.product-archive-hero-section .page-title.archive-title {
	color: #1a202c;
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin: 0;
}

/* --------------------------------------------------------------------------
   3. Category description
   The category blurb is 8 lines of unbroken text. Constrained to a readable
   measure and given room; on phones it is clamped behind a "Lire la suite"
   control so a visitor reaches the products on the first screen.
   -------------------------------------------------------------------------- */

body.woocommerce .term-description {
	max-width: 68ch !important;
	margin: 32px 0 8px !important;
	color: var(--aqb-muted);
	font-size: 1.0625rem;
	line-height: 1.7;
	position: relative;
}

body.woocommerce .term-description p {
	margin: 0 0 0.9em;
}

body.woocommerce .term-description p:last-child {
	margin-bottom: 0;
}

body.woocommerce .term-description strong {
	color: var(--aqb-ink);
	font-weight: 700;
}

@media (max-width: 767px) {
	body.woocommerce .term-description {
		font-size: 0.9375rem;
		line-height: 1.65;
		margin-top: 22px !important;
	}

	body.woocommerce .term-description.aqb-clamped {
		max-height: 8.25em;
		overflow: hidden;
	}

	body.woocommerce .term-description.aqb-clamped::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		height: 3em;
		background: linear-gradient(180deg, rgba(247, 248, 252, 0), var(--aqb-paper));
		pointer-events: none;
	}
}

.aqb-more {
	display: inline-block;
	margin: 4px 0 0;
	padding: 0;
	background: none;
	border: 0;
	border-bottom: 1px solid currentColor;
	color: var(--aqb-teal);
	font: 700 0.875rem/1.4 "Inter", system-ui, -apple-system, sans-serif;
	cursor: pointer;
}

.aqb-more:hover {
	color: var(--aqb-deep);
}

/* --------------------------------------------------------------------------
   4. Toolbar — result count, sorting, view toggle
   -------------------------------------------------------------------------- */

body.woocommerce .kadence-shop-top-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin: 20px 0 26px;
	padding: 14px 0;
	border-top: 1px solid var(--aqb-line);
	border-bottom: 1px solid var(--aqb-line);
}

body.woocommerce .woocommerce-result-count {
	margin: 0;
	color: var(--aqb-muted);
	font-size: 0.9375rem;
}

body.woocommerce .woocommerce-ordering {
	margin: 0;
}

body.woocommerce .woocommerce-ordering select {
	appearance: none;
	-webkit-appearance: none;
	min-width: 190px;
	padding: 9px 34px 9px 14px;
	border: 1px solid var(--aqb-line);
	border-radius: 10px;
	background-color: var(--aqb-surface);
	color: var(--aqb-ink);
	font-size: 0.9375rem;
	line-height: 1.2;
	cursor: pointer;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%235C5C5C' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 13px center;
}

body.woocommerce .woocommerce-ordering select:focus-visible {
	outline: 2px solid var(--aqb-teal);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   5. Product cards
   Kadence already provides the grid (grid-lg-col-4); these rules only give
   the cards a surface, a consistent image box and a clamped title so every
   card in a row is the same height.
   -------------------------------------------------------------------------- */

body.woocommerce ul.products.product-archive {
	gap: 24px;
	margin: 0 0 56px;
	padding: 0;
	list-style: none;
}

body.woocommerce ul.products.product-archive li.product {
	margin: 0;
	padding: 0;
	float: none;
	width: auto;
	display: flex;
	flex-direction: column;
	background: var(--aqb-surface);
	border: 1px solid var(--aqb-line);
	border-radius: var(--aqb-radius);
	overflow: hidden;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

body.woocommerce ul.products.product-archive li.product:hover {
	transform: translateY(-2px);
	border-color: #cbd3e6;
	box-shadow: 0 14px 30px rgba(67, 65, 94, 0.1);
}

body.woocommerce ul.products.product-archive li.product .woocommerce-loop-image-link {
	display: block;
	background: var(--aqb-paper);
	padding: 14px;
}

body.woocommerce ul.products.product-archive li.product img {
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	margin: 0;
	border-radius: 10px;
	display: block;
}

body.woocommerce ul.products.product-archive li.product .product-details {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1 1 auto;
	padding: 16px 18px 18px;
}

body.woocommerce ul.products.product-archive .woocommerce-loop-product__title {
	margin: 0;
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: -0.01em;
	color: var(--aqb-ink);
}

body.woocommerce ul.products.product-archive .woocommerce-loop-product__title a {
	color: inherit;
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

body.woocommerce ul.products.product-archive .woocommerce-loop-product__title a:hover {
	color: var(--aqb-teal);
}

body.woocommerce ul.products.product-archive .price {
	margin: 0;
	color: var(--aqb-teal);
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: 1.0625rem;
	font-weight: 800;
	line-height: 1.2;
}

body.woocommerce ul.products.product-archive .price del {
	color: #9a9aab;
	font-weight: 500;
}

body.woocommerce ul.products.product-archive .product-excerpt {
	margin: 0;
	color: var(--aqb-muted);
	font-size: 0.875rem;
	line-height: 1.6;
}

body.woocommerce ul.products.product-archive .product-excerpt p {
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

body.woocommerce ul.products.product-archive .product-excerpt h1,
body.woocommerce ul.products.product-archive .product-excerpt h2,
body.woocommerce ul.products.product-archive .product-excerpt h3,
body.woocommerce ul.products.product-archive .product-excerpt h4,
body.woocommerce ul.products.product-archive .product-excerpt h5,
body.woocommerce ul.products.product-archive .product-excerpt h6 {
	display: none;
}

/* The Kadence loop ships "action on hover": .product-action-wrap is
   absolutely positioned at bottom:-12.8px with opacity:0, revealed only on
   :hover. Two consequences on this catalogue, both bad:
     1. touch devices never hover, so the WhatsApp CTA was invisible and
        unreachable on every phone — the site's only conversion path;
     2. even on hover the button hung 12.8px below the card and was clipped
        by the card's own overflow:hidden.
   Putting it back in flow makes it a permanent, tappable part of the card.
   !important is used because the theme sets these inline in a
   higher-specificity rule we do not control. */

body.woocommerce ul.products.product-archive .product-action-wrap {
	position: static !important;
	opacity: 1 !important;
	visibility: visible !important;
	transform: none !important;
	bottom: auto !important;
	left: auto !important;
	right: auto !important;
	width: 100% !important;
	margin-top: auto !important;
	padding-top: 10px;
}

body.woocommerce ul.products.product-archive .product-action-wrap a,
body.woocommerce ul.products.product-archive .product-action-wrap #sendbtn {
	display: block;
	padding: 11px 16px;
	border-radius: 999px;
	background: var(--aqb-wa);
	color: #ffffff;
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

body.woocommerce ul.products.product-archive .product-action-wrap a:hover,
body.woocommerce ul.products.product-archive .product-action-wrap #sendbtn:hover {
	background: #0b6130;
	color: #ffffff;
}

/* --------------------------------------------------------------------------
   6. Currency symbol direction
   WooCommerce prints the Arabic dirham symbol *first* in the DOM with
   dir="auto", so a price reads "د.م. 1.749,00". The order is in the markup,
   not the direction, so `direction: ltr` alone cannot fix it. Reversing the
   flex axis puts the amount first and the symbol last — "1.749,00 د.م." —
   which is how a Moroccan price is read.
   -------------------------------------------------------------------------- */

.price bdi,
.woocommerce-Price-amount bdi {
	display: inline-flex;
	flex-direction: row-reverse;
	align-items: baseline;
	direction: ltr;
	gap: 0.2em;
	line-height: 1.5;
	white-space: nowrap;
}

.woocommerce-Price-currencySymbol {
	direction: ltr;
	unicode-bidi: isolate;
	display: inline-block;
	padding-block: 0.08em;
}

/* --------------------------------------------------------------------------
   7. Single product
   Layout stays as the theme built it (two columns); this constrains the
   shell, calms the headline, and gives the price and the short description
   a hierarchy.
   -------------------------------------------------------------------------- */

body.single-product div.product {
	max-width: var(--aqb-shell);
	margin-left: auto;
	margin-right: auto;
}

body.single-product div.product .product_title {
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: clamp(1.6rem, 2.8vw, 2.25rem);
	line-height: 1.18;
	letter-spacing: -0.02em;
	margin: 0 0 14px;
}

body.single-product div.product .summary .price {
	display: block;
	margin: 0 0 20px;
	color: var(--aqb-teal);
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: 1.75rem;
	font-weight: 800;
	line-height: 1.15;
}

body.single-product div.product .summary .price small,
body.single-product div.product .summary .price .woocommerce-price-suffix {
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--aqb-muted);
}

body.single-product div.product .woocommerce-product-details__short-description {
	color: var(--aqb-muted);
	font-size: 1rem;
	line-height: 1.7;
	margin: 0 0 22px;
}

body.single-product div.product .woocommerce-product-details__short-description p {
	margin: 0 0 0.9em;
}

body.single-product div.product .woocommerce-product-details__short-description p:last-child {
	margin-bottom: 0;
}

body.single-product div.product .summary .button,
body.single-product div.product .summary .single_add_to_cart_button {
	border-radius: 999px;
	padding: 13px 26px;
	background: var(--aqb-wa);
	color: #ffffff;
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-weight: 700;
	font-size: 0.9375rem;
	border: 0;
}

body.single-product div.product .summary .button:hover,
body.single-product div.product .summary .single_add_to_cart_button:hover {
	background: #0b6130;
	color: #ffffff;
}

body.single-product div.product .woocommerce-tabs {
	margin-top: 40px;
}

/* --------------------------------------------------------------------------
   8. Search results
   The grid mixes blog posts (small bold titles) with products (huge titles)
   at very different sizes. Normalise both to one card rhythm.
   -------------------------------------------------------------------------- */

body.search .site-main {
	margin-bottom: 56px;
}

body.search .site-main > h1,
body.search .site-main .page-title {
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: clamp(1.5rem, 3vw, 2.125rem);
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--aqb-ink);
	margin: 28px 0 24px;
}

body.search .site-main .woocommerce-loop-product__title,
body.search .site-main .entry-title,
body.search .site-main .entry-title a {
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: -0.01em;
	color: var(--aqb-ink);
	text-decoration: none;
}

body.search .site-main article,
body.search .site-main .entry {
	background: var(--aqb-surface);
	border: 1px solid var(--aqb-line);
	border-radius: var(--aqb-radius);
	overflow: hidden;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

body.search .site-main article:hover,
body.search .site-main .entry:hover {
	transform: translateY(-2px);
	border-color: #cbd3e6;
	box-shadow: 0 14px 30px rgba(67, 65, 94, 0.1);
}

/* Kadence wraps post thumbnails in a fixed-ratio box (.kadence-thumbnail-ratio-*)
   and absolutely positions the image inside it, so the ratio is left to the
   wrapper — only the crop is enforced here. */
body.search .site-main .post-thumbnail img,
body.search .site-main .entry-image img {
	width: 100%;
	object-fit: cover;
	display: block;
}

/* --------------------------------------------------------------------------
   9. 404
   -------------------------------------------------------------------------- */

body.error404 .aqb-404 {
	max-width: var(--aqb-shell);
	margin: 0 auto;
	padding: 56px var(--aqb-gutter) 72px;
	box-sizing: border-box;
}

body.error404 .aqb-404-code {
	margin: 0 0 8px;
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--aqb-teal);
}

body.error404 .aqb-404-title {
	margin: 0 0 14px;
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: clamp(1.6rem, 3.4vw, 2.5rem);
	line-height: 1.15;
	letter-spacing: -0.02em;
	color: var(--aqb-ink);
}

body.error404 .aqb-404-sub {
	max-width: 56ch;
	margin: 0 0 28px;
	color: var(--aqb-muted);
	font-size: 1.0625rem;
	line-height: 1.7;
}

body.error404 .aqb-404-search {
	display: flex;
	gap: 10px;
	max-width: 520px;
	margin: 0 0 40px;
}

body.error404 .aqb-404-search input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	padding: 13px 16px;
	border: 1px solid var(--aqb-line);
	border-radius: 12px;
	background: var(--aqb-surface);
	color: var(--aqb-ink);
	font-size: 1rem;
}

body.error404 .aqb-404-search input[type="search"]:focus-visible {
	outline: 2px solid var(--aqb-teal);
	outline-offset: 1px;
}

body.error404 .aqb-404-search button {
	flex: 0 0 auto;
	padding: 13px 24px;
	border: 0;
	border-radius: 12px;
	background: var(--aqb-teal);
	color: #ffffff;
	font-family: "Inter", system-ui, -apple-system, sans-serif;
	font-size: 0.9375rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

body.error404 .aqb-404-search button:hover {
	background: var(--aqb-deep);
}

body.error404 .aqb-404-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

body.error404 .aqb-404-grid a {
	display: block;
	padding: 16px 18px;
	background: var(--aqb-surface);
	border: 1px solid var(--aqb-line);
	border-radius: 14px;
	color: var(--aqb-ink);
	font-weight: 600;
	font-size: 0.9375rem;
	text-decoration: none;
	transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

body.error404 .aqb-404-grid a:hover {
	border-color: var(--aqb-teal);
	color: var(--aqb-teal);
	transform: translateY(-1px);
}

body.error404 .aqb-404-grid span {
	display: block;
	margin-top: 4px;
	color: var(--aqb-muted);
	font-weight: 400;
	font-size: 0.8125rem;
}

@media (max-width: 560px) {
	body.error404 .aqb-404-search {
		flex-wrap: wrap;
	}

	body.error404 .aqb-404-search button {
		width: 100%;
	}
}

/* --------------------------------------------------------------------------
   10. Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	body.woocommerce .entry-hero.product-archive-hero-section {
		min-height: 190px;
	}

	body.woocommerce .kadence-shop-top-row {
		gap: 10px;
	}

	body.woocommerce .woocommerce-ordering select {
		min-width: 0;
		width: 100%;
	}

	/* Two columns on phones. This category alone lists 50 products; one
	   column meant roughly 26,000px of scrolling before the pagination. */
	body.woocommerce ul.products.product-archive {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	body.woocommerce ul.products.product-archive li.product .product-details {
		gap: 6px;
		padding: 10px 12px 12px;
	}

	body.woocommerce ul.products.product-archive .woocommerce-loop-product__title {
		font-size: 0.875rem;
	}

	body.woocommerce ul.products.product-archive .price {
		font-size: 0.9375rem;
	}

	body.woocommerce ul.products.product-archive .product-action-wrap a,
	body.woocommerce ul.products.product-archive .product-action-wrap #sendbtn {
		width: 100%;
		box-sizing: border-box;
		padding: 9px 8px;
		border-radius: 10px;
		font-size: 0.75rem;
	}
}

/* --------------------------------------------------------------------------
   11. Reduced motion and focus
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	body.woocommerce ul.products.product-archive li.product,
	body.search .site-main article,
	body.search .site-main .entry,
	body.error404 .aqb-404-grid a {
		transition: none;
	}

	body.woocommerce ul.products.product-archive li.product:hover,
	body.search .site-main article:hover,
	body.search .site-main .entry:hover,
	body.error404 .aqb-404-grid a:hover {
		transform: none;
	}
}

body.woocommerce ul.products.product-archive li.product a:focus-visible,
body.error404 .aqb-404-grid a:focus-visible {
	outline: 2px solid var(--aqb-teal);
	outline-offset: 3px;
	border-radius: 6px;
}
