/**
 * Shop archive: grid, cards, filter bar.
 *
 * Loaded only on WooCommerce surfaces — see inc/enqueue.php.
 */

/* -------------------------------------------------------------------------
 * 1. Archive masthead
 * ---------------------------------------------------------------------- */

/* Woo's products header is left behind once its title is suppressed. */
.woocommerce-products-header:empty {
	display: none;
}

/**
 * Full-bleed ink band.
 *
 * The band has to escape a constrained container it is rendered several levels
 * inside, so it cannot use WordPress's alignfull. The margin/padding pair below
 * is the standard breakout: pull out to the viewport edges, then push the
 * content back to the same 1180px measure as everything else.
 */
.lib-archive-band {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--bone);
	margin-inline: calc(50% - 50vw);
	margin-bottom: var(--wp--preset--spacing--40);
	padding-block: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	padding-inline: max(clamp(1.25rem, 5vw, 4rem), calc(50vw - 590px));
	--lib-dim: var(--wp--preset--color--concrete);
}

.lib-archive-band__inner {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.lib-archive-band__eyebrow {
	margin: 0;
}

.lib-archive-band__title {
	color: var(--wp--preset--color--bone);
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(2.4rem, 6.5vw, 4.5rem);
	font-weight: 400;
	letter-spacing: var(--wp--custom--tracking--display);
	line-height: 0.9;
	margin: 0;
	text-transform: uppercase;
}

.lib-archive-band .lib-swash {
	margin-block: 0.15rem 0.5rem;
}

.lib-archive-band__intro {
	color: var(--wp--preset--color--bone);
	max-width: 52ch;
	opacity: 0.82;
}

.lib-archive-band__intro p {
	margin: 0;
}

.lib-archive-band__count {
	color: var(--lib-dim);
	margin: 0.35rem 0 0;
}

/* Breadcrumbs sit on ink here, so they take the band's own colours. */
.lib-archive-band .lib-crumbs,
.lib-archive-band .lib-crumbs a {
	color: var(--wp--preset--color--concrete);
}

.lib-archive-band .lib-crumbs a:hover {
	color: var(--wp--preset--color--bone);
}

.lib-archive-band .lib-crumbs {
	margin-bottom: var(--wp--preset--spacing--20);
}

.lib-crumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lib-crumbs li + li::before {
	content: "/";
	color: var(--wp--preset--color--concrete);
	margin-right: 0.4rem;
}

.lib-crumbs,
.lib-crumbs a {
	color: var(--wp--preset--color--ash);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.lib-crumbs a {
	text-decoration: none;
}

.lib-crumbs a:hover {
	color: var(--wp--preset--color--signal-deep);
	text-decoration: underline;
}

/* -------------------------------------------------------------------------
 * 2. Filter bar
 * ---------------------------------------------------------------------- */

.lib-filters {
	border-block: 1px solid var(--wp--preset--color--rule);
	margin-bottom: var(--wp--preset--spacing--40);
	padding-block: var(--wp--preset--spacing--20);
}

.lib-filters__inner {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
}

/* Disclosure toggle: mobile only. */
.lib-filters__toggle {
	align-items: center;
	cursor: pointer;
	display: flex;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 600;
	gap: 0.5rem;
	letter-spacing: var(--wp--custom--tracking--label);
	list-style: none;
	padding: 0.35rem 0;
	text-transform: uppercase;
}

.lib-filters__toggle::-webkit-details-marker {
	display: none;
}

/* A chevron that turns with the disclosure state. */
.lib-filters__toggle::after {
	border-bottom: 2px solid currentColor;
	border-right: 2px solid currentColor;
	content: "";
	height: 0.45rem;
	transform: rotate(45deg);
	transform-origin: center;
	transition: transform var(--wp--custom--transition--swift);
	width: 0.45rem;
}

.lib-filters__panel[open] > .lib-filters__toggle::after {
	transform: rotate(-135deg);
}

.lib-filters__badge {
	background: var(--wp--preset--color--signal);
	color: var(--wp--preset--color--bone);
	font-size: 0.65rem;
	line-height: 1;
	padding: 0.25em 0.45em;
}

.lib-filters__panel[open] > .lib-filters__inner {
	padding-top: var(--wp--preset--spacing--20);
}

@media (min-width: 900px) {
	/* No disclosure on desktop — there is room for the bar itself. */
	.lib-filters__toggle {
		display: none;
	}

	.lib-filters__panel[open] > .lib-filters__inner {
		padding-top: 0;
	}
}

.lib-filters__group {
	border: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0;
	min-width: 0;
	padding: 0;
}

.lib-filters__group legend {
	padding: 0;
}

.lib-filters__options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.lib-chip {
	align-items: center;
	border: 1px solid var(--wp--preset--color--rule);
	cursor: pointer;
	display: inline-flex;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	gap: 0.4rem;
	letter-spacing: 0.06em;
	line-height: 1;
	padding: 0.5rem 0.7rem;
	text-transform: uppercase;
	transition: border-color var(--wp--custom--transition--swift), background-color var(--wp--custom--transition--swift);
	-webkit-user-select: none;
	user-select: none;
}

.lib-chip:hover {
	border-color: var(--wp--preset--color--ink);
}

/* The native control stays in the accessibility tree, visually replaced. */
.lib-chip input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
}

.lib-chip:has(input:checked) {
	background: var(--wp--preset--color--ink);
	border-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--bone);
}

.lib-chip:has(input:focus-visible) {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--signal-deep);
	outline-offset: var(--wp--custom--focus--offset);
}

.lib-chip__dot {
	background: var(--lib-chip-hex, transparent);
	box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.25);
	display: block;
	height: 0.85rem;
	width: 0.85rem;
}

.lib-filters__sort {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-left: auto;
}

.lib-filters__sort select {
	background: var(--wp--preset--color--paper);
	border: 1px solid var(--wp--preset--color--rule);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	letter-spacing: 0.06em;
	padding: 0.5rem 0.7rem;
	text-transform: uppercase;
}

.lib-filters__actions {
	align-items: flex-end;
	display: flex;
	gap: 0.5rem;
}

/* With JS on, filters apply immediately and the button has nothing to do. */
.lib-js .lib-filters__actions button[type="submit"] {
	display: none;
}

/* -------------------------------------------------------------------------
 * 3. Buttons
 * ---------------------------------------------------------------------- */

.lib-btn {
	border: 0;
	cursor: pointer;
	display: inline-block;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--label);
	line-height: 1;
	padding: 0.9rem 1.4rem;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color var(--wp--custom--transition--swift), color var(--wp--custom--transition--swift);
}

.lib-btn--solid {
	background: var(--wp--preset--color--signal-deep);
	color: var(--wp--preset--color--bone);
}

.lib-btn--solid:hover,
.lib-btn--solid:focus {
	background: var(--wp--preset--color--signal-ink);
	color: var(--wp--preset--color--bone);
}

.lib-btn--ghost {
	background: transparent;
	box-shadow: inset 0 0 0 2px var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ink);
}

.lib-btn--ghost:hover,
.lib-btn--ghost:focus {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--bone);
}

/* -------------------------------------------------------------------------
 * 4. Grid and card
 * ---------------------------------------------------------------------- */

.lib-grid {
	display: grid;
	gap: var(--wp--preset--spacing--30) var(--wp--preset--spacing--20);
	grid-template-columns: repeat(2, minmax(0, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

@media (min-width: 900px) {
	.lib-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: var(--wp--preset--spacing--40) var(--wp--preset--spacing--30);
	}
}

.lib-card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0;
	min-width: 0;
}

.lib-card__link {
	color: inherit;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	text-decoration: none;
}

/**
 * The garment sits on a flat bone field at a fixed 4:5 ratio, so the grid never
 * shifts as images load and every design is compared at the same scale.
 */
.lib-card__media {
	aspect-ratio: 4 / 5;
	background: var(--wp--preset--color--bone-deep);
	overflow: hidden;
	position: relative;
}

.lib-card__img {
	display: block;
	height: 100%;
	object-fit: cover;
	transition: opacity var(--wp--custom--transition--base);
	width: 100%;
}

.lib-card__img.is-swapping {
	opacity: 0.35;
}

.lib-card__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-s);
	font-weight: 400;
	letter-spacing: 0;
	line-height: 1;
	margin: 0;
	text-transform: uppercase;
}

.lib-card__link:hover .lib-card__title {
	color: var(--wp--preset--color--signal-deep);
}

.lib-card__price {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.04em;
	margin: 0;
}

.lib-card__price del {
	color: var(--lib-dim);
	margin-right: 0.4rem;
}

.lib-card__price ins {
	color: var(--wp--preset--color--signal);
	text-decoration: none;
}

.lib-card__colours {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: 0.15rem;
}

/**
 * The tap target is 24px square — the WCAG 2.2 minimum — while the swatch it
 * draws stays 18px. Painting the colour on a pseudo-element rather than the
 * button lets the target grow without the dot growing with it.
 */
.lib-dot {
	background: none;
	border: 0;
	cursor: pointer;
	display: block;
	height: 1.5rem;
	padding: 0;
	position: relative;
	width: 1.5rem;
}

.lib-dot::before {
	background: var(--lib-dot-hex, transparent);
	box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.28);
	content: "";
	inset: 3px;
	position: absolute;
	transition: box-shadow var(--wp--custom--transition--swift);
}

.lib-dot:hover::before {
	box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.28), 0 0 0 2px var(--wp--preset--color--ink);
}

.lib-dot.is-active::before {
	box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.28), 0 0 0 2px var(--wp--preset--color--signal-deep);
}

.lib-card__more {
	margin-left: 0.15rem;
}

.lib-card__cta {
	margin-top: auto;
	align-self: start;
}

/* -------------------------------------------------------------------------
 * 5. Empty state and pagination
 * ---------------------------------------------------------------------- */

.lib-empty {
	border: 1px solid var(--wp--preset--color--rule);
	padding: var(--wp--preset--spacing--40);
	text-align: center;
}

.lib-empty__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-m);
	margin: 0 0 0.5rem;
	text-transform: uppercase;
}

.woocommerce-pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	justify-content: center;
	list-style: none;
	margin: var(--wp--preset--spacing--50) 0 0;
	padding: 0;
}

.woocommerce-pagination a,
.woocommerce-pagination span {
	border: 1px solid var(--wp--preset--color--rule);
	display: block;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	min-width: 2.5rem;
	padding: 0.6rem 0.5rem;
	text-align: center;
	text-decoration: none;
}

.woocommerce-pagination .current {
	background: var(--wp--preset--color--ink);
	border-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--bone);
}

/* Results dim while a filtered set is being fetched. */
#lib-results.is-loading {
	opacity: 0.4;
	pointer-events: none;
	transition: opacity var(--wp--custom--transition--base);
}


/* -------------------------------------------------------------------------
 * 6. Notices
 *
 * WooCommerce 11 prints its block-style notice banner even inside classic
 * templates — coupon prompt, "added to your cart", checkout errors. Out of the
 * box they are rounded, blue-tinted and icon-led, the one thing on these pages
 * that looked like a different site.
 * ---------------------------------------------------------------------- */

.lib-shop .wc-block-components-notice-banner {
	align-items: center;
	background: var(--wp--preset--color--paper);
	border: 0;
	border-left: var(--wp--custom--rule--structural) solid var(--wp--preset--color--ink);
	border-radius: 0;
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	gap: 0.75rem;
	margin: 0 0 var(--wp--preset--spacing--20);
	padding: 0.85rem 1rem;
}

.lib-shop .wc-block-components-notice-banner > svg {
	display: none;
}

.lib-shop .wc-block-components-notice-banner.is-success {
	border-left-color: var(--wp--preset--color--acid);
}

.lib-shop .wc-block-components-notice-banner.is-error {
	border-left-color: var(--wp--preset--color--signal-deep);
}

.lib-shop .wc-block-components-notice-banner a {
	color: var(--wp--preset--color--signal-deep);
	font-weight: 600;
}

.lib-shop .wc-block-components-notice-banner .button {
	background: none;
	border: 0;
	color: var(--wp--preset--color--signal-deep);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	letter-spacing: 0.08em;
	padding: 0;
	text-decoration: underline;
	text-transform: uppercase;
}

/* -------------------------------------------------------------------------
 * 7. Search: matching pages under the product results
 * ---------------------------------------------------------------------- */

.lib-search-pages {
	border-top: 1px solid var(--wp--preset--color--rule);
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--30);
}

.lib-search-pages h2 {
	margin: 0 0 var(--wp--preset--spacing--20);
}

.lib-search-pages ul {
	display: grid;
	gap: var(--wp--preset--spacing--20);
	list-style: none;
	margin: 0;
	padding: 0;
}

@media (min-width: 700px) {
	.lib-search-pages ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.lib-search-pages li {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	margin: 0;
}

.lib-search-pages a {
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-s);
	line-height: 1;
	text-decoration: none;
	text-transform: uppercase;
}

.lib-search-pages a:hover {
	color: var(--wp--preset--color--signal-deep);
}

.lib-search-pages span {
	color: var(--lib-dim);
	font-size: var(--wp--preset--font-size--small);
}

/* -------------------------------------------------------------------------
 * 8. Account forms
 *
 * WooCommerce rounds its account inputs to 4px and draws the login form in a
 * rounded, bordered box — the only rounded corners left on the site. Square
 * edges are a brand rule.
 * ---------------------------------------------------------------------- */

.woocommerce form.login,
.woocommerce form.register,
.woocommerce form.lost_reset_password,
.woocommerce form.woocommerce-EditAccountForm {
	background: var(--wp--preset--color--paper);
	border: 0 !important;
	border-radius: 0 !important;
	border-top: var(--wp--custom--rule--brand) solid var(--wp--preset--color--signal) !important;
	padding: var(--wp--preset--spacing--30) !important;
}

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.woocommerce .woocommerce-form-login input.input-text {
	background: var(--wp--preset--color--paper);
	border: 1px solid var(--wp--preset--color--rule);
	border-radius: 0 !important;
	font-family: var(--wp--preset--font-family--body);
	padding: 0.8rem 0.9rem;
}

.woocommerce form .form-row input.input-text:focus {
	border-color: var(--wp--preset--color--ink);
}

.woocommerce .woocommerce-form-login__submit,
.woocommerce .woocommerce-Button {
	border-radius: 0 !important;
	font-family: var(--wp--preset--font-family--mono) !important;
	font-size: var(--wp--preset--font-size--label) !important;
	font-weight: 600 !important;
	letter-spacing: var(--wp--custom--tracking--label);
	padding: 0.95rem 1.5rem !important;
	text-transform: uppercase;
}

.woocommerce-account .woocommerce h2 {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-s);
	font-weight: 400;
	text-transform: uppercase;
}
