/* ==========================================================================
   SHOES HUB — PRODUCT ARCHIVES
   --------------------------------------------------------------------------
   Shop, category, brand and tag archives. Loaded on product archives only;
   the product card itself stays in product-loop.css.

   Mobile-first: the filter form is inline (and fully usable without JS).
   With JS it becomes a drawer below 1024px; from 1024px it is always the
   left sidebar, exactly like the reference.
   ========================================================================== */

/* ---------- Page shell -------------------------------------------------- */

.shop-archive {
	/* Same gutter as the header: the archive content starts and ends exactly
	   where the header content does. */
	--archive-gutter: var(--gutter);
	padding-block: var(--space-4) var(--space-8);
}

/* Full-bleed, but the inset matches the header's --gutter (16/24/32) so the
   archive edges line up with the logo and header actions at every width. */
.shop-archive__container {
	display: block;
	max-width: none;
	padding-inline: var(--archive-gutter);
}

.shop-archive__content {
	min-width: 0;
}

/* ---------- Breadcrumb -------------------------------------------------- */

.shop-breadcrumb {
	margin-bottom: var(--space-4);
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	line-height: var(--leading-snug);
}

.shop-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.shop-breadcrumb li {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}

.shop-breadcrumb li + li::before {
	content: "/";
	color: var(--color-border-strong);
}

.shop-breadcrumb a {
	color: inherit;
}

.shop-breadcrumb a:hover {
	color: var(--color-accent-text);
}

.shop-breadcrumb [aria-current="page"] {
	color: var(--color-text);
}

/* ---------- Title row --------------------------------------------------- */

.shop-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-4);
	margin-bottom: var(--space-4);
}

.shop-head__title {
	margin: 0;
	color: var(--color-heading);
	font-size: clamp(1.75rem, 6vw, 2.75rem);
	font-weight: var(--font-weight-extrabold);
	line-height: 1.05;
	letter-spacing: var(--tracking-tight);
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.shop-head__intro {
	max-width: 70ch;
	margin: 0 0 var(--space-5);
	color: var(--color-text-muted);
	font-size: var(--text-sm);
	line-height: var(--leading-normal);
}

.shop-head__intro > :first-child {
	margin-top: 0;
}

.shop-head__intro > :last-child {
	margin-bottom: 0;
}

/* Sort lives in the title row from 1024px; below that it sits in the bar.
   Without JS the mobile bar never appears, so keep the title-row sort too. */
.shop-head__sort {
	display: block;
	flex: none;
}

.archive-ready .shop-head__sort {
	display: none;
}

/* ---------- Mobile / tablet control bar --------------------------------- */

.shop-mobile-bar {
	display: none;
}

.archive-ready .shop-mobile-bar {
	position: sticky;
	top: calc(var(--header-h) + env(safe-area-inset-top));
	z-index: 50;
	display: grid;
	grid-template-columns: 1fr 1fr;
	align-items: stretch;
	margin: 0 calc(var(--archive-gutter) * -1) var(--space-4);
	padding-inline: var(--archive-gutter);
	border-block: 1px solid var(--color-border);
	background: var(--color-bg);
}

.shop-mobile-bar__button,
.shop-mobile-bar .shop-sort__trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	width: 100%;
	min-height: var(--tap);
	padding-inline: var(--space-3);
	color: var(--color-text);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-semibold);
	line-height: 1;
}

.shop-mobile-bar__button .icon {
	width: 18px;
	height: 18px;
}

.shop-mobile-bar__filters {
	justify-content: center;
	text-transform: uppercase;
}

/* Mobile bar: text only, centred in each half. */
.shop-mobile-bar__filters .icon,
.shop-mobile-bar .shop-sort__trigger .icon {
	display: none;
}

.shop-mobile-bar__sort {
	display: flex;
	justify-content: center;
	border-left: 1px solid var(--color-border);
}

.shop-mobile-bar .shop-sort {
	width: 100%;
}

.shop-mobile-bar .shop-sort__trigger {
	justify-content: center;
}

/* ---------- Sidebar / filter form --------------------------------------- */

.shop-filters {
	min-width: 0;
	/* Squared scrollbar with no arrow buttons, matching the filter boxes.
	   Firefox uses the thin native bar; WebKit/Blink get the custom one. */
	scrollbar-width: thin;
	scrollbar-color: var(--color-border-strong) transparent;
}

.shop-filters::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

.shop-filters::-webkit-scrollbar-button {
	display: none;
	width: 0;
	height: 0;
}

.shop-filters::-webkit-scrollbar-track {
	background: transparent;
}

.shop-filters::-webkit-scrollbar-thumb {
	border-radius: 2px;
	background: var(--color-border-strong);
}

.shop-filters::-webkit-scrollbar-thumb:hover {
	background: var(--color-text-subtle);
}

.shop-filters__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	margin-bottom: var(--space-2);
}

.shop-filters__heading {
	margin: 0;
	font-size: var(--text-lg);
	font-weight: var(--font-weight-bold);
	letter-spacing: var(--tracking-tight);
	text-transform: uppercase;
}

.shop-filters__close {
	display: none;
	place-items: center;
	width: var(--tap);
	height: var(--tap);
	margin-right: calc(var(--space-2) * -1);
	border: 0;
	border-radius: var(--radius-pill);
	background: transparent;
	color: var(--color-text);
	cursor: pointer;
}

.archive-ready .shop-filters__close {
	display: grid;
}

.shop-filters__close:hover {
	background: var(--color-bg-soft);
}

.shop-filter {
	min-width: 0;
	margin: 0;
	padding: var(--space-3) 0;
	border: 0;
}

.shop-filter__title {
	margin: 0 0 var(--space-1);
	padding: 0;
	color: var(--color-text);
	font-size: var(--text-xs);
	font-weight: var(--font-weight-bold);
	line-height: var(--leading-snug);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
}

.shop-filter__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.shop-filter__option {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	min-height: 34px;
	padding-block: 0;
	color: var(--color-text);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-medium);
	line-height: var(--leading-snug);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
}

.shop-filter__option:hover span {
	color: var(--color-accent-text);
}

.shop-filter__option span {
	min-width: 0;
	overflow-wrap: anywhere;
}

/* Native boxes and radios are replaced by one square control. Checked is the
   brand yellow block, no tick mark. Price "radios" use the same square so
   every filter row reads the same. */
.shop-filter__option input[type="checkbox"],
.shop-filter__option input[type="radio"] {
	-webkit-appearance: none;
	appearance: none;
	flex: none;
	width: 18px;
	height: 18px;
	margin: 0;
	border: 1px solid var(--color-border-strong);
	border-radius: 2px;
	background: var(--color-surface);
	cursor: pointer;
	transition: background-color var(--dur) var(--ease),
		border-color var(--dur) var(--ease);
}

.shop-filter__option input[type="checkbox"]:hover,
.shop-filter__option input[type="radio"]:hover {
	border-color: var(--color-text);
}

.shop-filter__option input[type="checkbox"]:checked,
.shop-filter__option input[type="radio"]:checked {
	border-color: var(--color-primary-hover);
	background: var(--color-primary);
}

.shop-filter__option input:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
}

.shop-filter__more {
	margin-top: var(--space-1);
}

.shop-filter__more summary {
	display: flex;
	align-items: center;
	min-height: 34px;
	color: var(--color-accent-text);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-semibold);
	line-height: 1;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
	list-style: none;
}

.shop-filter__more summary::-webkit-details-marker {
	display: none;
}

.shop-filter__more summary:hover {
	color: var(--color-accent-text-hover);
}

.shop-filter__more[open] summary {
	margin-bottom: var(--space-1);
}

.shop-filters__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding-top: var(--space-3);
	border-top: 0;
}

.shop-filters__clear {
	display: inline-flex;
	align-items: center;
	min-height: var(--tap);
	color: var(--color-accent-text);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-semibold);
}

.shop-filters__clear:hover {
	color: var(--color-accent-text-hover);
}

.shop-filters__apply {
	flex: 1 1 auto;
}

.shop-filters__apply-mobile {
	display: inline;
}

.shop-filters__apply-desktop {
	display: none;
}

/* ---------- Sort dropdown ----------------------------------------------- */

.shop-sort {
	position: relative;
}

.shop-sort__trigger {
	display: inline-flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--space-2);
	min-height: var(--tap);
	color: var(--color-text);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-semibold);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
	list-style: none;
}

.shop-sort__trigger::-webkit-details-marker {
	display: none;
}

.shop-sort__trigger .icon {
	width: 16px;
	height: 16px;
	transition: transform var(--dur) var(--ease);
}

.shop-sort[open] .shop-sort__trigger .icon {
	transform: rotate(180deg);
}

.shop-sort__menu {
	position: absolute;
	top: calc(100% + var(--space-2));
	right: 0;
	z-index: 30;
	width: min(90vw, 260px);
	margin: 0;
	padding: var(--space-2) 0;
	border: 0;
	border-radius: 2px;
	background: var(--color-surface);
	box-shadow: var(--shadow-2);
	list-style: none;
}

.shop-sort__menu a {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	min-height: 34px;
	padding-inline: var(--space-4);
	border-radius: 0;
	color: var(--color-text);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-medium);
	line-height: var(--leading-snug);
	letter-spacing: 0.02em;
	text-align: left;
	text-transform: uppercase;
}

.shop-sort__menu a:hover {
	background: transparent;
	color: var(--color-accent-text);
}

.shop-sort__menu a[aria-current="true"] {
	background: transparent;
	color: var(--color-accent-text);
	font-weight: var(--font-weight-semibold);
}

/* ---------- Active filter pills ----------------------------------------- */

.shop-active {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
	margin-bottom: var(--space-4);
}

.shop-active__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.shop-pill {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	min-height: 38px;
	padding: 0 var(--space-4);
	border: 1px solid var(--color-text);
	border-radius: 2px;
	background: var(--color-text);
	color: var(--color-on-secondary);
	font-size: var(--text-xs);
	font-weight: var(--font-weight-semibold);
	line-height: 1;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.shop-pill:hover {
	border-color: var(--color-secondary);
	background: var(--color-secondary);
	color: var(--color-on-secondary);
}

.shop-pill .icon {
	width: 12px;
	height: 12px;
	color: currentColor;
	opacity: 0.75;
}

.shop-active__clear {
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	color: var(--color-accent-text);
	font-size: var(--text-xs);
	font-weight: var(--font-weight-semibold);
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.shop-active__clear:hover {
	color: var(--color-accent-text-hover);
}

/* ---------- Product grid spacing ---------------------------------------- */

.shop-archive ul.products {
	gap: var(--space-6) var(--space-3);
	margin-bottom: 0;
}

/* ---------- Pagination --------------------------------------------------- */

.shop-pagination {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-4);
	margin-top: var(--space-7);
	padding-top: var(--space-5);
	border-top: 1px solid var(--color-border);
}

.shop-pagination .woocommerce-pagination {
	margin: 0;
}

.shop-pagination .woocommerce-pagination ul.page-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.shop-pagination .woocommerce-pagination ul.page-numbers li {
	margin: 0;
}

.shop-pagination .woocommerce-pagination li .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: var(--tap);
	min-height: var(--tap);
	padding: 0 var(--space-2);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-xs);
	background: var(--color-surface);
	color: var(--color-text);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-semibold);
	line-height: 1;
}

.shop-pagination .woocommerce-pagination a.page-numbers:hover {
	border-color: var(--color-border);
	background: var(--color-surface);
	color: var(--color-accent-text);
}

.shop-pagination .woocommerce-pagination li .page-numbers.current {
	border-color: var(--color-secondary);
	background: var(--color-secondary);
	color: var(--color-on-secondary);
}

.shop-pagination .woocommerce-pagination li .page-numbers.dots {
	border-color: transparent;
	background: transparent;
	font-weight: var(--font-weight-normal);
}

.shop-pagination .woocommerce-pagination li .prev.page-numbers,
.shop-pagination .woocommerce-pagination li .next.page-numbers {
	padding-inline: var(--space-3);
}

/* ---------- Empty state -------------------------------------------------- */

.shop-empty {
	padding: var(--space-8) var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-bg-mist);
	text-align: center;
}

.shop-empty__title {
	margin: 0 0 var(--space-2);
	font-size: var(--text-xl);
}

.shop-empty__text {
	max-width: 46ch;
	margin: 0 auto var(--space-5);
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}

.shop-empty__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
}

/* ---------- Mobile drawer (JS only) ------------------------------------- */

.shop-filters__overlay {
	display: none;
}

@media (max-width: 1023px) {
	.archive-ready .shop-filters__overlay {
		position: fixed;
		inset: 0;
		z-index: calc(var(--z-drawer) - 1);
		display: block;
		border: 0;
		background: var(--color-overlay);
	}

	.archive-ready .shop-filters__overlay[hidden] {
		display: none;
	}

	.archive-ready .shop-filters {
		position: fixed;
		inset: 0 auto 0 0;
		z-index: var(--z-drawer);
		display: flex;
		flex-direction: column;
		width: min(90vw, 380px);
		max-width: 100%;
		padding: 0 var(--space-4) env(safe-area-inset-bottom);
		/* Vertical scroll only: stop the drawer drifting sideways while a
		   finger moves and stop the page behind from being dragged. */
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		touch-action: pan-y;
		background: var(--color-surface);
		box-shadow: var(--shadow-2);
		transform: translateX(-100%);
		visibility: hidden;
		transition: transform var(--dur) var(--ease), visibility var(--dur) var(--ease);
	}

	.archive-ready .shop-filters.is-open {
		transform: none;
		visibility: visible;
	}

	.archive-ready .shop-filters__head {
		position: sticky;
		top: 0;
		z-index: 1;
		margin: 0 calc(var(--space-4) * -1);
		padding: var(--space-2) var(--space-4);
		border-bottom: 1px solid var(--color-border);
		background: var(--color-surface);
	}

	.archive-ready .shop-filters__form {
		display: flex;
		flex: 1;
		min-width: 0;
		flex-direction: column;
	}

	.archive-ready .shop-filters__footer {
		position: sticky;
		bottom: 0;
		margin-top: auto;
		padding-block: var(--space-3);
		background: var(--color-surface);
	}

	.archive-ready .shop-filters__apply {
		flex: 1 1 100%;
	}

	/* The filter form is inline without JS, so let it breathe above the grid. */
	.shop-filters:not(.shop-filters--filtered) .shop-filters__clear {
		display: none;
	}

	/* Drawer open: stop the page behind from scrolling. */
	body.is-filters-open {
		overflow: hidden;
	}
}

/* ---------- Desktop layout ---------------------------------------------- */

@media (min-width: 1024px) {
	.shop-archive__layout {
		display: grid;
		grid-template-columns: 220px minmax(0, 1fr);
		gap: var(--space-7);
		align-items: start;
	}

	.shop-head {
		margin-bottom: var(--space-5);
	}

	.shop-head__sort {
		display: block;
	}

	.archive-ready .shop-head__sort {
		display: block;
	}

	.shop-mobile-bar,
	.archive-ready .shop-mobile-bar {
		display: none;
	}

	.shop-filters {
		position: sticky;
		top: calc(var(--header-h-desktop) + var(--space-4));
		/* Keep a clear strip below the panel: the sidebar starts below the
		   title, so a full 100dvh cap would push the last brands and the
		   scrollbar bottom under the viewport. */
		max-height: calc(100vh - var(--header-h-desktop) - var(--space-8));
		max-height: calc(100dvh - var(--header-h-desktop) - var(--space-8));
		padding-right: var(--space-2);
		overflow-y: auto;
	}

	.shop-filters__head {
		display: none;
	}

	.shop-filters__form {
		border-top: 0;
	}

	.shop-filter {
		padding-block: var(--space-3);
	}

	.shop-filters__footer {
		padding-bottom: var(--space-3);
	}

	.shop-filters__apply-mobile {
		display: none;
	}

	.shop-filters__apply-desktop {
		display: inline;
	}

	/* With JS the page applies filters on change, so the button is noise.
	   Keep it visible without JS and whenever Clear all needs company. */
	.archive-ready .shop-filters .shop-filters__apply {
		display: none;
	}

	.archive-ready .shop-filters:not(.shop-filters--filtered) .shop-filters__footer {
		display: none;
	}

	.shop-archive ul.products {
		gap: var(--space-7) var(--space-4);
	}

	.shop-pagination {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
}
