/* ==========================================================================
   Shared components — filled in progressively as each page is built.
   ========================================================================== */

.apex-page-header {
	background: var(--color-bg-alt);
	border-bottom: 1px solid var(--color-border);
	padding-block: var(--space-8);
	margin-bottom: var(--space-8);
	text-align: center;
	/* Same reasoning as .woocommerce-breadcrumb: this is a full-width band
	   with its own background and bottom rule, so it has to break out of
	   Storefront's .col-full or the rule stops short of both edges. The
	   inner .apex-container still centres the heading. */
	width: 100vw;
	margin-inline: calc(50% - 50vw);
}
.apex-page-header h1 { margin: 0; }

/* ---------------- Floating WhatsApp button ---------------- */
.apex-whatsapp-fab {
	position: fixed;
	right: 20px;
	bottom: 20px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #25D366;
	color: var(--color-white);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(0,0,0,.25);
	z-index: 500;
	transition: transform .15s ease;
}
.apex-whatsapp-fab:hover { transform: scale(1.08); color: var(--color-white); }
.apex-whatsapp-fab svg { width: 30px; height: 30px; }

/* ---------------- FAQ / Help Centre ---------------- */
.apex-faq { max-width: 860px; padding-block: var(--space-12); }
.apex-faq__group { margin-bottom: var(--space-10); }
.apex-faq__group-title {
	font-size: 1.15rem;
	color: var(--color-navy);
	border-bottom: 2px solid var(--color-border);
	padding-bottom: var(--space-3);
	margin-bottom: var(--space-4);
}
.apex-faq__item {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-3);
	background: var(--color-bg-alt);
	overflow: hidden;
}
.apex-faq__question {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	background: none;
	border: 0;
	padding: 1.1em 1.4em;
	text-align: left;
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--color-navy);
}
.apex-faq__question .apex-icon svg { width: 18px; height: 18px; transition: transform .2s ease; color: var(--color-text-muted); flex-shrink: 0; }
.apex-faq__item.is-open .apex-faq__question .apex-icon svg { transform: rotate(180deg); color: var(--color-red); }
.apex-faq__answer {
	max-height: 0;
	overflow: hidden;
	transition: max-height .25s ease;
}
.apex-faq__answer p { padding: 0 1.4em 1.2em; margin: 0; color: var(--color-text-muted); font-size: 0.9rem; line-height: 1.65; }

.apex-faq__cta {
	position: relative;
	overflow: hidden;
	text-align: center;
	background: var(--color-navy);
	background-image: radial-gradient(circle at 50% -40%, var(--color-navy-light), transparent 70%);
	border-radius: var(--radius-lg);
	/* Generous, deliberate breathing room — this panel closes the page, so it
	   should feel like a section rather than a tight box. */
	padding: clamp(2.5rem, 1.6rem + 3vw, 4rem) clamp(1.5rem, 0.6rem + 3vw, 3.5rem);
	margin-top: var(--space-12);
	margin-bottom: var(--space-4);
}
.apex-faq__cta h3 {
	color: var(--color-white);
	font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem);
	margin-bottom: var(--space-3);
}
.apex-faq__cta p {
	color: rgba(255,255,255,.8);
	max-width: 44ch;
	margin: 0 auto var(--space-8);
}
.apex-faq__cta .apex-btn { margin: var(--space-2) var(--space-2) 0; }
.apex-faq__cta .apex-btn--outline { border-color: rgba(255,255,255,.5); color: var(--color-white); }
.apex-faq__cta .apex-btn--outline:hover { background: rgba(255,255,255,.12); color: var(--color-white); }

/* ---------------- Product card ---------------- */
ul.products {
	display: grid !important;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--space-6);
	margin: 0 !important;
	padding: 0 !important;
}
ul.products::before, ul.products::after { display: none !important; }

ul.products li.product {
	display: flex !important;
	flex-direction: column;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 0 var(--space-4) var(--space-4);
	overflow: hidden;
	transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
	list-style: none;
	width: auto !important;
	margin: 0 !important;
	float: none !important;
	height: 100%;
}
ul.products li.product:hover {
	box-shadow: var(--shadow-card-hover);
	transform: translateY(-2px);
	border-color: var(--color-navy);
}
/* Title/rating/price grow to fill space so every card's Add to Cart
   button lines up on the same baseline regardless of title length. */
ul.products li.product a.woocommerce-LoopProduct-link {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
}
ul.products li.product .apex-card__title { flex: 0 0 auto; }
ul.products li.product .star-rating,
ul.products li.product .price { flex: 0 0 auto; }
ul.products li.product .apex-card__cart { margin-top: auto; padding-top: var(--space-2); }

.apex-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	background: var(--color-bg);
	overflow: hidden;
	/* Bleeds to the card's outer edge on top/left/right — li.product carries
	   the padding everywhere else — so the photo reads as full-bleed the way
	   Victorian Plumbing's cards do, rather than sitting in an inset box. */
	margin: 0 calc(-1 * var(--space-4)) var(--space-3);
}
.apex-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
ul.products li.product:hover .apex-card__media img { transform: scale(1.04); }

.apex-card__media .onsale {
	position: absolute;
	top: 10px; left: 10px;
	background: var(--color-red);
	color: var(--color-white);
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	padding: 4px 10px;
	border-radius: var(--radius-pill);
	min-height: 0;
	line-height: 1.4;
	z-index: 2;
}

/* Honest label for a product still using a stand-in image. Better than
   presenting a generated graphic as if it were product photography. */
.apex-photo-pending {
	position: absolute;
	left: 10px;
	bottom: 10px;
	z-index: 2;
	background: rgba(1, 32, 79, .82);
	color: var(--color-white);
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	padding: 4px 9px;
	border-radius: var(--radius-pill);
	backdrop-filter: blur(2px);
}
.apex-photo-pending--pdp {
	left: auto;
	right: var(--space-4);
	bottom: var(--space-4);
	font-size: 0.72rem;
	padding: 6px 12px;
}

.apex-card__quick-view {
	position: absolute;
	top: var(--space-3);
	right: var(--space-3);
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-white);
	color: var(--color-navy);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(1,32,79,.18);
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity .18s ease, transform .18s ease, background .15s ease, color .15s ease;
}
.apex-card__quick-view .apex-icon svg { width: 18px; height: 18px; }
.apex-card__media:hover .apex-card__quick-view,
.apex-card__quick-view:focus {
	opacity: 1;
	transform: translateY(0);
}
.apex-card__quick-view:hover { background: var(--color-navy); color: var(--color-white); }

.apex-card__eyebrow {
	display: block;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--color-red);
	margin-bottom: 4px;
}

.apex-card__title,
.woocommerce ul.products li.product .apex-card__title {
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--color-navy);
	line-height: 1.35;
	margin-bottom: var(--space-2);
	/* Clamp to 2 lines so every card in a row reserves the same title
	   height — otherwise price/button position drifts card to card. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.7em;
}

/* Reserve rating space whether or not a product actually has ≥10 reviews,
   so price doesn't jump up/down between cards in the same row. */
.apex-card__rating-slot { display: block; min-height: 20px; margin-bottom: var(--space-2); }
.woocommerce ul.products li.product .star-rating { font-size: 0.8rem; margin: 0; }

.woocommerce ul.products li.product .price {
	display: block;
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--color-navy);
	margin-bottom: var(--space-3);
}
.woocommerce ul.products li.product .price del { color: var(--color-text-muted); font-weight: 400; opacity: .7; }
.woocommerce ul.products li.product .price ins { text-decoration: none; color: var(--color-red); }

.apex-card__cart { display: block; }
.woocommerce ul.products li.product .apex-card__cart a.button,
.woocommerce ul.products li.product .apex-card__cart a.add_to_cart_button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	background: var(--color-red);
	color: var(--color-white);
	border-radius: var(--radius-sm);
	font-weight: 600;
	font-size: 0.85rem;
	padding: 0.65em 1em;
}
.woocommerce ul.products li.product .apex-card__cart a.button:hover { background: var(--color-red-dark); }
.woocommerce ul.products li.product .apex-card__cart a.added_to_cart { display: block; text-align: center; font-size: 0.8rem; margin-top: 6px; }

/* ---------------- Quick View modal ---------------- */
.apex-modal-overlay {
	position: fixed; inset: 0;
	background: rgba(1,21,54,.6);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-4);
	opacity: 0; visibility: hidden;
	transition: opacity .2s ease, visibility .2s;
	/* Must exceed Storefront's #masthead (position:relative;z-index:999) since
	   this modal is appended via wp_footer, outside any stacking context that
	   would otherwise let a lower z-index still win locally. */
	z-index: 1200;
}
.apex-modal-overlay.is-open { opacity: 1; visibility: visible; }

.apex-modal {
	position: relative;
	background: var(--color-white);
	border-radius: var(--radius-md);
	max-width: 720px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	padding: var(--space-8);
}
.apex-modal__close {
	position: absolute;
	top: var(--space-3);
	right: var(--space-3);
	background: var(--color-bg);
	border: 0;
	border-radius: 50%;
	width: 36px; height: 36px;
	display: flex; align-items: center; justify-content: center;
	color: var(--color-navy);
}

.apex-quick-view { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.apex-quick-view__media img { border-radius: var(--radius-sm); width: 100%; }
.apex-quick-view__info h2 { font-size: 1.3rem; margin-bottom: var(--space-2); }
.apex-quick-view__info .price { font-size: 1.3rem; font-weight: 700; color: var(--color-navy); margin-bottom: var(--space-3); }
.apex-quick-view__desc { font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: var(--space-4); }
.apex-quick-view__info .apex-btn { margin-right: var(--space-2); margin-bottom: var(--space-2); }

/* ==========================================================================
   Homepage
   ========================================================================== */

.apex-btn--on-dark.apex-btn--outline { border-color: rgba(255,255,255,.5); color: var(--color-white); }
.apex-btn--on-dark.apex-btn--outline:hover { background: rgba(255,255,255,.12); color: var(--color-white); border-color: var(--color-white); }

.apex-section-heading {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: var(--space-6);
	gap: var(--space-4);
}
.apex-section-heading h2 { margin: 0; }
.apex-section-heading__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
	font-size: 0.9rem;
	white-space: nowrap;
}
.apex-section-heading__link .apex-icon svg { width: 16px; height: 16px; }
.apex-section-heading--center { justify-content: center; text-align: center; }
.apex-section-heading--tight { margin-bottom: var(--space-4); }

/* ---- Deals carousel (full-bleed, edge-to-edge) ----
   Plain background-image slides, at the client's explicit request: no
   headline, description or button on the slide itself — the whole slide IS
   the link, straight to /offers/. Images come from the Customizer (Homepage
   Deals Carousel), so this only needs to lay the pictures out and drive the
   crossfade; apex-hero-slider.js does the same rotation/swipe logic as
   before, just against <a> slides instead of <div> ones. */
.apex-hero {
	position: relative;
	overflow: hidden;
	min-height: 420px;
	/* Break out of Storefront's .col-full content constraint to go full-bleed. */
	width: 100vw;
	margin-inline: calc(50% - 50vw);
}
.apex-hero__slides { position: relative; min-height: 420px; }

.apex-hero__slide {
	position: absolute;
	inset: 0;
	display: block;
	background-color: var(--color-navy);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	opacity: 0;
	visibility: hidden;
	transition: opacity .6s ease;
}
/* Stays `position: absolute` even when active — this slide is an empty
   <a> with only a background-image, no text content to give it height, so
   `inset: 0` (which only positions an absolutely/fixed element) is what
   supplies its size. The old markup switched the active slide to `relative`
   safely because its text content gave it real height on its own; here that
   would collapse the element to 0px and hide the image entirely. */
.apex-hero__slide.is-active { opacity: 1; visibility: visible; }

/* A slide is a full-bleed link with no visible label of its own — give
   keyboard/AT users the same "View current offers" the aria-label already
   provides, without adding anything visually. */
.apex-hero__slide:focus-visible {
	outline: 3px solid var(--color-white);
	outline-offset: -3px;
}

.apex-hero__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px; height: 48px;
	padding: 0;
	margin: 0;
	flex-shrink: 0;
	border-radius: 50%;
	background: rgba(255,255,255,.15);
	border: 1px solid rgba(255,255,255,.3);
	color: var(--color-white);
	font-size: 1.75rem;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 5;
	transition: background .15s ease;
}
.apex-hero__arrow:hover { background: rgba(255,255,255,.28); }
.apex-hero__arrow--prev { left: var(--space-6); }
.apex-hero__arrow--next { right: var(--space-6); }

.apex-hero__dots {
	position: absolute;
	bottom: var(--space-6);
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 10px;
	z-index: 5;
}
.apex-hero__dot {
	width: 10px; height: 10px;
	border-radius: 50%;
	background: rgba(255,255,255,.4);
	border: 0;
	padding: 0;
	transition: background .15s ease, transform .15s ease;
}
.apex-hero__dot.is-active { background: var(--color-white); transform: scale(1.3); }

/* ---- Category grid ----
   Full-bleed photo tiles with the heading and a "View Products" link
   overlaid on a dark gradient, rather than a photo-plus-caption card —
   modelled on the "Shop by Style" tiles the client pointed to as the
   look they preferred over the old icon-tile design. */
.apex-category-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--space-6);
}
.apex-category-card {
	position: relative;
	display: block;
	aspect-ratio: 4 / 5;
	border-radius: var(--radius-md);
	overflow: hidden;
	isolation: isolate;
	box-shadow: var(--shadow-card);
	transition: box-shadow .2s ease, transform .2s ease;
}
.apex-category-card:hover,
.apex-category-card:focus-visible {
	box-shadow: var(--shadow-card-hover);
	transform: translateY(-4px);
}
.apex-category-card__media {
	position: absolute;
	inset: 0;
	z-index: 0;
}
.apex-category-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .4s ease;
}
.apex-category-card:hover .apex-category-card__media img,
.apex-category-card:focus-visible .apex-category-card__media img { transform: scale(1.06); }
.apex-category-card::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(11, 20, 38, .92) 0%, rgba(11, 20, 38, .45) 38%, rgba(11, 20, 38, 0) 65%);
	pointer-events: none;
}
.apex-category-card__label {
	position: absolute;
	z-index: 2;
	left: 0;
	right: 0;
	bottom: 0;
	padding: var(--space-5);
}
.apex-category-card__title { display: block; font-weight: 700; font-size: 1.25rem; color: var(--color-white); margin-bottom: 6px; }
.apex-category-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--color-white);
	border-bottom: 1px solid rgba(255, 255, 255, .55);
	padding-bottom: 2px;
	transition: gap .15s ease;
}
.apex-category-card:hover .apex-category-card__cta,
.apex-category-card:focus-visible .apex-category-card__cta { gap: 10px; }
.apex-category-card__cta svg { width: 14px; height: 14px; }

/* ---- Homepage blog / guides grid ---- */
.apex-blog-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-6);
}
.apex-blog-card {
	display: flex;
	flex-direction: column;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	overflow: hidden;
	transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.apex-blog-card:hover,
.apex-blog-card:focus-visible {
	box-shadow: var(--shadow-card-hover);
	transform: translateY(-4px);
	border-color: var(--color-navy);
}
.apex-blog-card__media { display: block; aspect-ratio: 16 / 10; overflow: hidden; }
.apex-blog-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.apex-blog-card:hover .apex-blog-card__media img { transform: scale(1.05); }
.apex-blog-card__body { display: flex; flex-direction: column; flex: 1 1 auto; padding: var(--space-5); }
.apex-blog-card__title { display: block; font-weight: 700; font-size: 1.1rem; color: var(--color-navy); line-height: 1.35; margin-bottom: var(--space-2); }
.apex-blog-card__excerpt { display: block; font-size: 0.9rem; color: var(--color-text-muted); line-height: 1.5; margin-bottom: var(--space-3); }
.apex-blog-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: auto;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--color-red);
	transition: gap .15s ease;
}
.apex-blog-card:hover .apex-blog-card__cta { gap: 10px; }
.apex-blog-card__cta svg { width: 14px; height: 14px; }

/* Full-bleed helper: breaks a section out of Storefront's .col-full
   content constraint so its background reaches the true viewport edge,
   while an inner .apex-container still centers the actual content. */
.apex-full-bleed {
	width: 100vw;
	margin-inline: calc(50% - 50vw);
}

/* ---- Offers banner ---- */
.apex-section--offers { background: var(--color-bg-alt); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.apex-offers-banner {
	background: linear-gradient(120deg, var(--color-red) 0%, var(--color-red-dark) 100%);
	border-radius: var(--radius-md);
	padding: var(--space-8);
	margin-bottom: var(--space-8);
	color: var(--color-white);
}
.apex-offers-banner__eyebrow { display: block; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 0.8rem; margin-bottom: var(--space-2); opacity: .9; }
.apex-offers-banner h2 { color: var(--color-white); max-width: 30ch; margin-bottom: var(--space-4); }
.apex-offers-banner .apex-btn--primary { background: var(--color-white); color: var(--color-red); }
.apex-offers-banner .apex-btn--primary:hover { background: var(--color-bg); }

/* ---- Why Apex ---- */
.apex-why { background: var(--color-bg-alt); }
.apex-why-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--space-6);
}
.apex-why-card { text-align: center; padding: var(--space-4); }
.apex-why-card__icon {
	width: 64px; height: 64px;
	border-radius: 50%;
	background: var(--color-bg);
	color: var(--color-red);
	display: flex; align-items: center; justify-content: center;
	margin: 0 auto var(--space-4);
}
.apex-why-card__icon svg { width: 30px; height: 30px; }
.apex-why-card h3 { font-size: 1rem; margin-bottom: var(--space-2); }
.apex-why-card p { font-size: 0.875rem; color: var(--color-text-muted); margin: 0; }

/* ---- CTA ---- */
.apex-cta { background: var(--color-navy); color: var(--color-white); }
.apex-cta__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-6);
	padding-block: var(--space-12);
	flex-wrap: wrap;
}
.apex-cta h2 { color: var(--color-white); margin-bottom: var(--space-2); }
.apex-cta p { color: rgba(255,255,255,.75); margin: 0; }
.apex-cta__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ==========================================================================
   Shop / category page — filter sidebar layout
   ========================================================================== */

.apex-shop-layout {
	display: grid;
	grid-template-columns: 260px 1fr;
	gap: var(--space-8);
	align-items: start;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--space-4);
	padding-bottom: var(--space-12);
}
@media (min-width: 768px) { .apex-shop-layout { padding-inline: var(--space-8); } }

/* With a 260px sidebar eating into the width, 4 columns made cards far
   too narrow/tall for their content — 3 columns fits the remaining
   space properly. */
.apex-shop-main ul.products { grid-template-columns: repeat(3, 1fr); }

/* ---- Grid / List view toggle ---- */
.apex-view-toggle { display: flex; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }
.apex-view-toggle__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 38px;
	background: var(--color-bg-alt);
	color: var(--color-text-muted);
	border: 0;
	border-right: 1px solid var(--color-border);
}
.apex-view-toggle__btn:last-child { border-right: 0; }
.apex-view-toggle__btn svg { width: 17px; height: 17px; }
.apex-view-toggle__btn.is-active { background: var(--color-navy); color: var(--color-white); }
.apex-view-toggle__btn:hover:not(.is-active) { background: var(--color-bg); color: var(--color-navy); }

/* List view: single column, horizontal card */
.apex-shop-main ul.products.apex-view-list {
	grid-template-columns: 1fr !important;
	gap: var(--space-4) !important;
}
ul.products.apex-view-list li.product {
	flex-direction: row;
	align-items: center;
	gap: var(--space-6);
	padding: var(--space-4);
}
ul.products.apex-view-list li.product a.woocommerce-LoopProduct-link {
	display: grid;
	grid-template-columns: 160px 1fr;
	grid-template-rows: repeat(4, auto);
	column-gap: var(--space-6);
	align-items: start;
	flex: 1 1 auto;
}
ul.products.apex-view-list .apex-card__media {
	grid-column: 1;
	grid-row: 1 / span 4;
	width: 160px;
	align-self: center;
	margin-bottom: 0;
}
ul.products.apex-view-list .apex-card__title { -webkit-line-clamp: 2; min-height: 0; font-size: 1.05rem; margin-top: var(--space-2); }
ul.products.apex-view-list .apex-card__cart { margin-top: 0; flex: 0 0 auto; width: 180px; }
ul.products.apex-view-list .price { font-size: 1.1rem; }

.apex-shop-sidebar {
	position: sticky;
	top: calc(var(--header-height, 0px) + var(--space-4));
	/* A long filter list must not push the sticky panel taller than the
	   viewport, or the bottom groups become unreachable while it is stuck. */
	max-height: calc(100vh - var(--header-height, 0px) - var(--space-8));
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	padding: var(--space-5);
	box-shadow: var(--shadow-card);
	scrollbar-width: thin;
}
.apex-shop-sidebar__header { display: none; }

.apex-shop-sidebar__title-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	font-weight: 700;
	color: var(--color-navy);
	font-size: 0.95rem;
	padding-bottom: var(--space-4);
	border-bottom: 2px solid var(--color-border);
}
.apex-shop-sidebar__title-label { display: inline-flex; align-items: center; gap: 8px; }
.apex-shop-sidebar__title-row svg { width: 18px; height: 18px; color: var(--color-red); flex-shrink: 0; }
.apex-shop-sidebar__clear {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--color-red);
	white-space: nowrap;
}
.apex-shop-sidebar__clear:hover { color: var(--color-red-dark); text-decoration: underline; }

/* Drawer footer — only meaningful once the sidebar is a mobile overlay. */
.apex-shop-sidebar__actions { display: none; }

.apex-filter-overlay { display: none; }

.apex-filter-mobile-toggle {
	display: none;
	align-items: center;
	gap: 8px;
	grid-column: 1 / -1;
	background: var(--color-navy);
	color: var(--color-white);
	border: 0;
	border-radius: var(--radius-pill);
	padding: 0.8em 1.4em;
	font-weight: 600;
	width: max-content;
	box-shadow: var(--shadow-card);
}

.apex-filter-block { border-top: 1px solid var(--color-border); }
.apex-filter-block:first-of-type { border-top: 0; }

/* --- Group header doubles as the collapse toggle --- */
.apex-filter-block__title { margin: 0; }
.apex-filter-block__title--plain {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: .08em;
	font-weight: 700;
	color: var(--color-text-muted);
	padding-block: var(--space-4) var(--space-2);
}
.apex-filter-block__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	background: none;
	border: 0;
	padding: var(--space-4) 0;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--color-navy);
	text-align: left;
}
.apex-filter-block__toggle:hover { color: var(--color-red); }
/* Plus / minus toggle. One SVG holds both strokes; the vertical one is
   hidden while the group is open, turning "+" into "-". */
.apex-filter-block__icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	color: var(--color-text-muted);
}
.apex-filter-block__icon-v {
	transform-origin: center;
	transition: opacity .18s ease, transform .18s ease;
}
.apex-filter-block__toggle[aria-expanded="true"] .apex-filter-block__icon-v {
	opacity: 0;
	transform: scaleY(0);
}
.apex-filter-block__toggle:hover .apex-filter-block__icon { color: var(--color-red); }

.apex-filter-block__body { padding-bottom: var(--space-5); }
.apex-filter-block__body[hidden] { display: none; }

.apex-filter-block ul { display: flex; flex-direction: column; gap: 1px; list-style: none; margin: 0; padding: 0; }

/* WooCommerce's layered nav emits `<li><a>Term</a> <span class="count">(3)</span></li>`
   -- the count is a SIBLING of the link, not inside it. The link was
   `display:flex` (so, block-level), which pushed the count onto its own line
   underneath every option. Making the `li` the flex row puts them back on one
   line and lets the count sit hard right. */
.apex-filter-block li {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	border-radius: var(--radius-sm);
	padding-right: var(--space-2);
	transition: background-color .12s ease;
}
.apex-filter-block li:hover { background: var(--color-bg); }

.apex-filter-block li a {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.875rem;
	color: var(--color-text);
	padding: 8px 4px 8px 6px;
	transition: color .12s ease;
}
/* Fake checkbox -- layered nav renders plain links, not real inputs, so a
   pseudo-element supplies the affordance shoppers expect from a filter. */
.apex-filter-block li a::before {
	content: '';
	flex-shrink: 0;
	width: 17px;
	height: 17px;
	border: 1.5px solid var(--color-border);
	border-radius: 5px;
	background: var(--color-white);
	transition: background-color .12s ease, border-color .12s ease;
}
.apex-filter-block li:hover a::before { border-color: var(--color-navy-light); }
.apex-filter-block li.chosen a::before {
	background-color: var(--color-red);
	border-color: var(--color-red);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
	background-size: 11px;
	background-repeat: no-repeat;
	background-position: center;
}
.apex-filter-block li a:hover { color: var(--color-navy); }
.apex-filter-block li.chosen a { color: var(--color-navy); font-weight: 600; }

/* A term that currently matches no products (see Apex_Widget_Layered_Nav in
   category-filters.php) renders as a <span>, not an <a> — visible so the
   shopper knows the option exists, but not clickable and visually muted so
   it doesn't look like a live filter that happens to return nothing. */
.apex-filter-block li.apex-filter-term--empty-item { cursor: default; }
.apex-filter-block li.apex-filter-term--empty-item:hover { background: none; }
.apex-filter-block .apex-filter-term--empty {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.875rem;
	color: var(--color-text-muted);
	padding: 8px 4px 8px 6px;
}
.apex-filter-block .apex-filter-term--empty::before {
	content: '';
	flex-shrink: 0;
	width: 17px;
	height: 17px;
	border: 1.5px dashed var(--color-border);
	border-radius: 5px;
	background: var(--color-bg);
}
.apex-filter-block--swatches .apex-filter-term--empty::before { display: none; }
.apex-filter-block--swatches li.apex-filter-term--empty-item .apex-filter-swatch { opacity: .4; }

.apex-filter-block .count {
	flex-shrink: 0;
	color: var(--color-text-muted);
	font-size: 0.72rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	padding: 1px 7px;
	border-radius: var(--radius-pill);
}
.apex-filter-block li:hover .count { background: var(--color-white); }
.apex-filter-block li.chosen .count { background: var(--color-navy); border-color: var(--color-navy); color: var(--color-white); }

/* --- Colour swatches ---
   The dot is injected by main.js, which maps each colour term name to a real
   colour. Terms it does not recognise keep the standard checkbox instead. */
.apex-filter-block--swatches li a::before { display: none; }
.apex-filter-swatch {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 1.5px solid rgba(1, 32, 79, .18);
	box-shadow: inset 0 0 0 2px var(--color-white);
	transition: transform .12s ease, box-shadow .12s ease;
}
.apex-filter-block--swatches li:hover .apex-filter-swatch { transform: scale(1.12); }
.apex-filter-block--swatches li.chosen .apex-filter-swatch {
	border-color: var(--color-red);
	border-width: 2px;
	box-shadow: inset 0 0 0 2px var(--color-white), 0 0 0 2px rgba(210, 49, 32, .2);
}
/* Terms with no swatch mapping fall back to the checkbox. */
.apex-filter-block--swatches li a.has-no-swatch::before { display: block; }

/* --- Price slider (WooCommerce core widget markup) --- */
.apex-filter-block .price_slider { margin-bottom: var(--space-5); }
.apex-filter-block .price_slider_amount {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
	font-size: 0.8rem;
	color: var(--color-text-muted);
}
.apex-filter-block .price_slider_amount .price_label {
	order: 1;
	flex: 1 1 100%;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 0.55em 0.8em;
	text-align: center;
	font-weight: 600;
	color: var(--color-navy);
}
.apex-filter-block .price_slider_amount .button {
	order: 2;
	background: var(--color-navy);
	color: var(--color-white);
	border: 0;
	border-radius: var(--radius-sm);
	padding: 0.55em 1.3em;
	font-size: 0.8rem;
	font-weight: 600;
	width: 100%;
}
.apex-filter-block .price_slider_amount .button:hover { background: var(--color-red); }
.apex-filter-block .ui-slider {
	position: relative;
	height: 5px;
	background: var(--color-border);
	border-radius: var(--radius-pill);
	margin: var(--space-5) 9px var(--space-4);
}
.apex-filter-block .ui-slider-range { position: absolute; height: 100%; background: var(--color-red); border-radius: var(--radius-pill); }
.apex-filter-block .ui-slider-handle {
	position: absolute;
	top: 50%;
	width: 18px;
	height: 18px;
	background: var(--color-white);
	border: 3px solid var(--color-red);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	cursor: grab;
	outline: none;
	box-shadow: 0 2px 6px rgba(1, 32, 79, .2);
	transition: transform .12s ease;
}
.apex-filter-block .ui-slider-handle:hover { transform: translate(-50%, -50%) scale(1.15); }
.apex-filter-block .ui-slider-handle:active { cursor: grabbing; }

/* --- Rating filter --- */
.apex-filter-block .wc-layered-nav-rating a { gap: var(--space-2); }
.apex-filter-block .wc-layered-nav-rating .star-rating { font-size: 0.8rem; }

/* --- Active filter pills --- */
.apex-filter-block--active { border-top: 0; padding-bottom: var(--space-4); }
.apex-filter-block--active ul { flex-direction: row; flex-wrap: wrap; gap: var(--space-2); }
.apex-filter-block--active li { padding: 0; background: none; }
.apex-filter-block--active li:hover { background: none; }
/* WooCommerce marks every active filter `<li class="chosen">` -- the SAME
   class the checkbox styling above keys off. `.apex-filter-block li.chosen a`
   is specificity 0,2,2 and beat a plain `.apex-filter-block--active li a`
   (0,1,2) on both `color` and the `::before`, so the pills rendered with dark
   navy text and a red filled checkbox instead of white text and a remove
   cross. Matching `.chosen` here puts these rules back on top. */
.apex-filter-block--active li.chosen a {
	background: var(--color-navy);
	color: var(--color-white);
	border-radius: var(--radius-pill);
	padding: 5px 10px 5px 12px;
	font-size: 0.78rem;
	font-weight: 600;
	gap: 6px;
}
/* Reuse the checkbox pseudo-element as the pill's remove affordance. */
.apex-filter-block--active li.chosen a::before {
	content: "×";
	width: auto;
	height: auto;
	border: 0;
	border-radius: 0;
	background: none;
	background-image: none;
	order: 2;
	font-size: 1.05rem;
	line-height: 1;
	color: rgba(255, 255, 255, .75);
}
.apex-filter-block--active li.chosen a:hover { background: var(--color-red); color: var(--color-white); }
.apex-filter-block--active li.chosen a:hover::before { color: var(--color-white); }
.apex-filter-block--active .reset a { background: transparent; color: var(--color-red); font-weight: 700; padding-left: 0; }
.apex-filter-block--active .reset a::before { content: none; }
