/* Digital Hub — shop/category sidebar (category tree + price filter).
   Structure/sizing from donor's real #filters offcanvas: 296px sidebar,
   sticky, category buttons with count badges. */

/* Storefront's stock CSS reserves ~26% of #primary's width for a real
   #secondary widget-area sidebar (`.right-sidebar .content-area{width:
   73.913%}`) based purely on the body class — it doesn't know
   digitalhub_remove_sidebar() (functions.php) already unhooks the real
   sidebar output. .dh-shop-layout supplies its own sidebar in-content, so
   that reserved 26% was just dead whitespace on the right edge of every
   shop/category page, and it also squeezed ul.products into a narrower
   column than intended (found 2026-08-04: cards rendering at 149px wide
   instead of the ~250-270px every other product-card carousel on the
   site uses). `.archive` covers both /shop/ and /product-category/ pages —
   not scoped tighter to tax-product_cat alone so search results (also
   `.archive`) get the same fix. */
body.archive.right-sidebar .content-area {
	width: 100%;
	float: none;
	margin-right: 0;
}

.dh-shop-layout {
	display: flex;
	align-items: flex-start;
	gap: 1.5rem;
}

.dh-shop-main {
	flex: 1 1 auto;
	min-width: 0;
}

.dh-shop-sidebar {
	flex: 0 0 296px;
	width: 296px;
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	position: sticky;
	top: 1rem;
}

.dh-shop-sidebar-block {
	background-color: var(--color-surface);
	border-radius: 16px;
	padding: 1rem;
}

.dh-shop-sidebar-block h3 {
	font-size: 16px;
	font-weight: 700;
	margin: 0 0 0.75rem;
	color: var(--color-text);
}

.dh-category-list {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.dh-category-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.5rem 0.5rem;
	border-radius: 8px;
	color: var(--color-text);
	font-size: 14px;
	font-weight: 500;
}

.dh-category-btn:hover {
	background-color: var(--color-bg);
	color: var(--color-text);
}

.dh-category-btn--back {
	color: var(--color-text-secondary);
	justify-content: flex-start;
}

.dh-category-btn--active {
	background-color: var(--color-bg);
	font-weight: 700;
}

.dh-category-count {
	color: var(--color-text-secondary);
	font-size: 13px;
}

.dh-price-filter {
	display: flex;
	gap: 0.5rem;
}

.dh-price-field {
	position: relative;
	flex: 1 1 0;
	display: flex;
	align-items: center;
	background-color: var(--color-bg);
	border-radius: 8px;
	padding: 0.4rem 0.5rem 0.4rem 2.6rem;
	gap: 0.3rem;
}

.dh-price-field svg {
	position: absolute;
	left: 0.6rem;
	color: var(--color-text-secondary);
}

.dh-price-field-label {
	font-size: 12px;
	color: var(--color-text-secondary);
	white-space: nowrap;
}

.dh-price-field input {
	width: 100%;
	border: none;
	background: transparent;
	font-family: var(--font-family);
	font-size: 14px;
	color: var(--color-text);
}

.dh-price-field input:focus {
	outline: none;
}

/* Mobile "Фильтры" trigger + offcanvas sidebar (CP42) — donor's real
   #filters panel is `offcanvas-top` on mobile (see 02_category.html),
   triggered by a filter-icon button next to the sort dropdown. Desktop
   keeps the existing static sticky sidebar unchanged. */
.dh-filters-toggle {
	display: none;
}

.dh-shop-sidebar-backdrop {
	display: none;
}

@media (max-width: 991px) {
	.dh-filters-toggle {
		display: inline-flex;
		align-items: center;
		gap: 0.4rem;
		background-color: var(--color-surface);
		border: 1px solid #e2e4e8;
		border-radius: 8px;
		padding: 0.6rem 1rem;
		font-weight: 500;
		font-size: 14px;
		color: var(--color-text);
		margin-bottom: 1rem;
	}

	.dh-shop-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		/* .site-header is z-index:999 (see header.css) — must clear that or
		   the site header draws over the top of this panel. */
		z-index: 1001;
		width: auto;
		max-height: 85vh;
		overflow-y: auto;
		background-color: var(--color-bg);
		border-radius: 0 0 16px 16px;
		padding: 1rem;
		transform: translateY(-100%);
		transition: transform 0.25s ease;
	}

	.dh-shop-sidebar.is-open {
		transform: translateY(0);
	}

	.dh-shop-sidebar-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 1000;
		background-color: rgba(11, 13, 18, 0.5);
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.25s ease;
	}

	.dh-shop-sidebar-backdrop.is-open {
		opacity: 1;
		pointer-events: auto;
	}
}

.dh-shop-sidebar-header {
	display: none;
}

.dh-shop-sidebar-apply {
	display: none;
}

@media (max-width: 991px) {
	.dh-shop-sidebar-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 0.5rem;
	}

	.dh-shop-sidebar-header h2 {
		font-size: 18px;
		font-weight: 700;
		margin: 0;
		color: var(--color-text);
	}

	.dh-shop-sidebar-close {
		border: none;
		background: none;
		color: var(--color-text-secondary);
		font-size: 14px;
	}

	.dh-shop-sidebar-apply {
		display: block;
		width: 100%;
		background-color: var(--color-brand);
		color: #ffffff;
		border: none;
		border-radius: 8px;
		font-weight: 600;
		padding: 0.75rem;
		margin-top: 0.5rem;
	}

	.dh-shop-sidebar-apply:hover {
		background-color: var(--color-brand-hover);
	}
}

/* Shop/category title — donor's real h2.headline-md-bold has no count next
   to it (checked directly against 02_category.html's DOM, not memory — a
   past guess here was wrong). Count lives only in the toolbar, see
   .dh-result-count below. */
.woocommerce-products-header__title.page-title {
	font-size: 28px;
	letter-spacing: 0.28px;
	font-weight: 700;
}

/* Toolbar — donor's real #total_count/sort row (see digitalhub_result_count()
   in functions.php), measured directly off 02_category.html's computed
   styles (getBoundingClientRect/getComputedStyle), not eyeballed:
   - whole row: light gray panel, `.block.round-8.block-tertiary` —
     padding:8px 16px, border-radius:8px, gap:4px. Donor's own token here is
     var(--primary-100)/#f3f4f6 (== our --color-bg) but donor nests this
     inside one big WHITE content card (sidebar+grid all inside a single
     white wrapper), so gray-on-white reads as a visible panel there. Our
     shop area has no such white wrapper (sits directly on the page's own
     --color-bg) — same token here would be invisible, so this uses
     --color-surface (white) instead, matching how every other card on this
     site (sidebar, product cards) already floats on the gray page bg.
   - count text: 16px/400, color var(--text-secondary) (#6c737f — our
     --color-text-secondary matches exactly); the number itself is 16px/600
     in var(--text-primary) #384250 (donor's `--primary-700` — a distinct
     token we don't otherwise carry, not our usual --color-text #0b0d12).
   - sort control: plain text+icon, NO border/background/box — donor's
     `.custom-link.custom-link--primary` (secondary gray, 16px/500, 20px
     icon, 6px gap). We keep a `<select>` (real native control, not a
     div+dropdown-menu), so border/background are stripped instead of
     boxed — closest achievable match without rebuilding it as a custom
     widget.
   Storefront's own .storefront-sorting wrapper stacks these as plain
   block/float children in hook-priority order (ordering fires before result
   count) — flex+order fixes the visual order to match donor without
   fighting hook priorities Storefront may re-register. */
.storefront-sorting {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	background-color: var(--color-surface);
	border-radius: 8px;
	padding: 8px 16px;
}

.storefront-sorting .woocommerce-result-count {
	order: 1;
}

.storefront-sorting .woocommerce-ordering {
	order: 2;
}

.storefront-sorting .woocommerce-pagination {
	order: 3;
	margin-left: auto;
}

.woocommerce-result-count.dh-result-count {
	font-size: 16px;
	font-weight: 400;
	color: var(--color-text-secondary);
	margin: 0;
}

.dh-result-count-num {
	font-weight: 600;
	color: #384250;
}

.woocommerce-ordering {
	margin: 0;
}

/* CP47: custom sort dropdown (see digitalhub_catalog_ordering() in
   functions.php) replacing the native <select> — donor's real control here
   (`.custom-link.custom-link--primary` + `.dropdown-menu`) has no visible
   border/box, just icon+text in secondary gray, with a menu that pops open
   on click. Menu panel styling matches this site's existing card language
   (shadow, radius, hover row) since donor's exact `.block-shadow` values
   weren't worth chasing pixel-for-pixel for a floating menu that's only
   ever seen open for a second. */
.dh-sort-dropdown {
	position: relative;
}

.dh-sort-toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	border: none;
	background: transparent;
	padding: 0;
	font-size: 16px;
	font-weight: 500;
	color: var(--color-text-secondary);
	cursor: pointer;
}

.dh-sort-toggle:hover {
	color: var(--color-text);
}

.dh-sort-toggle svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	transition: transform 0.15s ease;
}

.dh-sort-dropdown.is-open .dh-sort-toggle svg {
	transform: rotate(180deg);
}

.dh-sort-menu {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 20;
	min-width: 220px;
	margin: 0;
	padding: 0.4rem;
	list-style: none;
	background-color: var(--color-surface);
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(11, 13, 18, 0.16);
}

.dh-sort-dropdown.is-open .dh-sort-menu {
	display: block;
}

.dh-sort-menu a {
	display: block;
	padding: 0.5rem 0.75rem;
	border-radius: 8px;
	font-size: 14px;
	color: var(--color-text);
	text-decoration: none !important;
	white-space: nowrap;
}

.dh-sort-menu a:hover {
	background-color: var(--color-bg);
}

.dh-sort-menu a.is-active {
	color: var(--color-brand);
	font-weight: 600;
}
