/**
 * Shop / Archive Page Styles
 *
 * Covers the layout, sidebar filters, toolbar, product grid, and pagination
 * for the custom woocommerce/archive-product.php template.
 *
 * Product card styles are duplicated here from the best-sellers block because
 * block stylesheets are only enqueued when the block appears in post content —
 * they are not available on the PHP-rendered archive template.
 *
 * @package Wayfinder
 */

/* ----------------------------------------------------------------
   Page wrapper — extra breathing room above/below
   ---------------------------------------------------------------- */
.shop-layout {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: var(--space-xl, 64px);
	padding-block: var(--space-section, 72px);
	align-items: start;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.shop-sidebar {
	position: sticky;
	top: 100px; /* clear the sticky header */
}

/* ----------------------------------------------------------------
   Filter block (category list or price form)
   ---------------------------------------------------------------- */
.shop-filter {
	margin-bottom: var(--space-xl, 64px);
}

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

.shop-filter__heading {
	margin: 0 0 var(--space-md, 16px);
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 11px;
	font-weight: var(--font-weight-bold, 700);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--color-dark-text, #313031);
	opacity: 0.5;
}

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

.shop-filter__list li {
	margin: 0;
	padding: 0;
}

.shop-filter__link {
	display: block;
	padding: 8px 12px;
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 14px;
	font-weight: var(--font-weight-regular, 400);
	color: var(--color-dark-text, #313031);
	text-decoration: none;
	border-radius: 4px;
	transition: background 150ms ease, color 150ms ease;
}

.shop-filter__link:hover {
	background: rgba(0, 0, 0, 0.04);
}

.shop-filter__link.is-active {
	background: var(--color-orange, #FF7A3D);
	color: #fff;
	font-weight: 600;
}

/* ----------------------------------------------------------------
   Price filter form
   ---------------------------------------------------------------- */
.shop-filter--price {
	border: none;
	padding: 0;
}

.shop-filter__price-row {
	display: flex;
	align-items: flex-end;
	gap: var(--space-sm, 8px);
	margin-bottom: var(--space-md, 16px);
}

.shop-filter__price-label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
	min-width: 0;
}

.shop-filter__price-label span {
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 11px;
	font-weight: var(--font-weight-bold, 700);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--color-dark-text, #313031);
	opacity: 0.5;
}

.shop-filter__price-input {
	width: 100%;
	height: 38px;
	padding: 0 10px;
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 14px;
	color: var(--color-dark-text, #313031);
	background-color: #fff;
	border: 1px solid #d9d9d9;
	border-radius: 4px;
	box-sizing: border-box;
	-moz-appearance: textfield;
	transition: border-color var(--transition-fast, 150ms ease),
	            box-shadow var(--transition-fast, 150ms ease);
}

.shop-filter__price-input::-webkit-inner-spin-button,
.shop-filter__price-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.shop-filter__price-input:focus {
	border-color: var(--color-navy, #2B3157);
	box-shadow: 0 0 0 2px rgba(43, 49, 87, 0.15);
	outline: none;
}

.shop-filter__price-sep {
	padding-bottom: 8px;
	font-size: 14px;
	color: var(--color-dark-text, #313031);
	opacity: 0.4;
	flex-shrink: 0;
}

.shop-filter__price-actions {
	display: flex;
	align-items: center;
	gap: var(--space-md, 16px);
}

.shop-filter__apply {
	height: 38px;
	padding: 0 var(--space-md, 16px);
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 13px;
	font-weight: var(--font-weight-bold, 700);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--color-white, #ffffff);
	background-color: var(--color-navy, #2B3157);
	border: none;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color var(--transition-fast, 150ms ease);
}

.shop-filter__apply:hover {
	background-color: var(--color-orange, #FF7A3D);
}

.shop-filter__clear {
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 13px;
	color: var(--color-dark-text, #313031);
	opacity: 0.5;
	text-decoration: underline;
	transition: opacity var(--transition-fast, 150ms ease);
}

.shop-filter__clear:hover {
	opacity: 0.8;
}

/* ================================================================
   MAIN AREA
   ================================================================ */

/* ----------------------------------------------------------------
   Toolbar: count left, sort right
   ---------------------------------------------------------------- */
.shop-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md, 16px);
	margin-bottom: var(--space-lg, 32px);
	padding-bottom: var(--space-md, 16px);
	border-bottom: 1px solid #e8e8e8;
}

.shop-count {
	margin: 0;
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 14px;
	color: var(--color-dark-text, #313031);
	opacity: 0.65;
}

.shop-count strong {
	font-weight: var(--font-weight-bold, 700);
	opacity: 1;
}

/* Sort form */
.shop-sort {
	display: flex;
	align-items: center;
	gap: 8px;
}

.shop-sort__label {
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 13px;
	font-weight: var(--font-weight-bold, 700);
	color: var(--color-dark-text, #313031);
	white-space: nowrap;
}

.shop-sort__select {
	height: 36px;
	padding: 0 28px 0 10px;
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 13px;
	color: var(--color-dark-text, #313031);
	background-color: #fff;
	border: 1px solid #d9d9d9;
	border-radius: 4px;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23313031' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 10px 6px;
	transition: border-color var(--transition-fast, 150ms ease);
}

.shop-sort__select:focus {
	border-color: var(--color-navy, #2B3157);
	box-shadow: 0 0 0 2px rgba(43, 49, 87, 0.15);
	outline: none;
}

/* ----------------------------------------------------------------
   Product grid — 3 columns
   ---------------------------------------------------------------- */
.shop-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-lg, 32px);
	margin: 0;
	padding: 0;
}

/* ================================================================
   PRODUCT CARD
   (Duplicated from plugins/wayfinder-blocks/blocks/best-sellers/style.css
   — block CSS is not loaded on the PHP archive template)
   ================================================================ */
.product-card {
	border-radius: 8px;
	overflow: hidden;
}

.product-card__link {
	display: block;
	text-decoration: none;
	color: inherit;
}

/* Image wrapper — square container, clips both primary and hover images */
.product-card__image-wrapper {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background-color: var(--color-card-bg, #F7F7F7);
	border-radius: 8px 8px 0 0;
	padding: var(--space-sm, 8px);
}

.shop-grid .product-card__image-wrapper {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

/* Primary product image */
.product-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform var(--transition-base, 300ms ease), opacity 300ms ease;
	z-index: 1;
}

.product-card:hover .product-card__image {
	transform: scale(1.04);
	opacity: 0;
}

/* Lifestyle hover image */
.product-card__lifestyle-image {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	object-position: bottom;
	transform: translateY(100%);
	transition: transform 300ms ease;
	z-index: 2;
}

.product-card:hover .product-card__lifestyle-image {
	transform: translateY(0);
}

/* NEW badge — teal, top-right corner */
.product-card__image-wrapper .wayfinder-new-badge {
	z-index: 3;
}

.wayfinder-new-badge {
	position: absolute;
	top: var(--space-sm, 8px);
	right: var(--space-sm, 8px);
	z-index: 2;
	min-width: 46px;
	height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 6px;
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 11px;
	font-weight: var(--font-weight-bold, 700);
	letter-spacing: 0.04em;
	color: var(--color-white, #ffffff);
	background-color: var(--color-teal, #1BC7BA);
	border-radius: 50%;
	line-height: 1;
	text-transform: uppercase;
	pointer-events: none;
}

/* Card text info */
.product-card__info {
	padding: var(--space-md, 16px);
	margin-top: var(--space-sm, 8px);
}

.product-card__name {
	margin: 0 0 var(--space-xs, 4px);
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: var(--font-size-product-name, 24px);
	font-weight: var(--font-weight-bold, 700);
	color: var(--color-dark-text, #313031);
	line-height: 1.2;
}

.product-card__price {
	margin: 0 0 var(--space-xs, 4px);
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: var(--font-size-price, 22px);
	font-weight: var(--font-weight-regular, 400);
	color: var(--color-dark-text, #313031);
}

/* WooCommerce sale price */
.product-card__price del {
	opacity: 0.5;
	margin-right: var(--space-xs, 4px);
}

.product-card__price ins {
	text-decoration: none;
	color: var(--color-orange, #FF7A3D);
}

.product-card__variants {
	margin: 0;
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: var(--font-size-label, 18px);
	font-style: italic;
	font-weight: var(--font-weight-regular, 400);
	color: var(--color-dark-text, #313031);
	opacity: 0.65;
}

/* ================================================================
   PAGINATION
   WooCommerce outputs .woocommerce-pagination > .page-numbers
   ================================================================ */
.shop-pagination {
	margin-top: var(--space-xl, 64px);
}

.shop-pagination .woocommerce-pagination {
	display: flex;
	justify-content: center;
}

.shop-pagination ul.page-numbers {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

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

.shop-pagination .page-numbers {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 6px;
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 14px;
	font-weight: var(--font-weight-bold, 700);
	color: var(--color-navy, #2B3157);
	background-color: transparent;
	border: 2px solid transparent;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
	transition: border-color var(--transition-fast, 150ms ease),
	            background-color var(--transition-fast, 150ms ease),
	            color var(--transition-fast, 150ms ease);
}

.shop-pagination .page-numbers:hover {
	border-color: var(--color-navy, #2B3157);
}

.shop-pagination .page-numbers.current {
	background-color: var(--color-navy, #2B3157);
	border-color: var(--color-navy, #2B3157);
	color: var(--color-white, #ffffff);
}

.shop-pagination .page-numbers.dots {
	border-color: transparent;
	cursor: default;
	opacity: 0.4;
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.shop-empty {
	padding: var(--space-xl, 64px) 0;
	text-align: center;
}

.shop-empty p {
	margin-bottom: var(--space-md, 16px);
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 18px;
	color: var(--color-dark-text, #313031);
	opacity: 0.55;
}

.shop-empty__reset {
	display: inline-block;
	padding: 12px var(--space-lg, 32px);
	font-family: var(--font-body, 'Roboto', sans-serif);
	font-size: 14px;
	font-weight: var(--font-weight-bold, 700);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--color-white, #ffffff);
	background-color: var(--color-navy, #2B3157);
	border-radius: 4px;
	transition: background-color var(--transition-fast, 150ms ease);
}

.shop-empty__reset:hover {
	background-color: var(--color-orange, #FF7A3D);
}

/* ================================================================
   FILTER DRAWER (mobile slide-in)
   ================================================================ */

/* Desktop / tablet defaults — drawer is transparent to layout */
.shop-filter-trigger {
	display: none;
}

.shop-drawer {
	display: contents; /* disappears from layout; .shop-sidebar participates in grid directly */
}

.shop-drawer__backdrop,
.shop-drawer__close {
	display: none;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Tablet: 2-column sidebar collapses, 2-column grid */
@media (max-width: 1023px) {
	.shop-layout {
		grid-template-columns: 1fr;
		gap: var(--space-lg, 32px);
	}

	.shop-sidebar {
		position: static;
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: var(--space-lg, 32px);
	}

	.shop-filter {
		margin-bottom: 0;
	}

	.shop-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Mobile: full-width, 1-column + slide-in drawer */
@media (max-width: 767px) {
	.shop-layout {
		padding-block: var(--space-xl, 64px);
		grid-template-columns: 1fr; /* drawer is out of flow; only .shop-main remains */
	}

	.shop-grid {
		grid-template-columns: 1fr;
		gap: var(--space-md, 16px);
	}

	.shop-toolbar {
		flex-direction: column;
		align-items: flex-start;
	}

	/* ---- Filter trigger button ---- */
	.shop-filter-trigger {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 10px 16px;
		background: var(--color-navy, #2B3157);
		color: #fff;
		border: 0;
		border-radius: 4px;
		font-family: var(--font-body, 'Roboto', sans-serif);
		font-size: 14px;
		font-weight: 600;
		cursor: pointer;
		margin-bottom: 16px;
		transition: background 150ms ease;
	}

	.shop-filter-trigger:hover {
		background: var(--color-orange, #FF7A3D);
	}

	/* ---- Drawer shell — fixed overlay ---- */
	.shop-drawer {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 9000;
		pointer-events: none;
		visibility: hidden;
	}

	.shop-drawer.is-open {
		pointer-events: auto;
		visibility: visible;
	}

	/* ---- Backdrop ---- */
	.shop-drawer__backdrop {
		display: block;
		position: absolute;
		inset: 0;
		background: rgba(0, 0, 0, 0.5);
		opacity: 0;
		transition: opacity 200ms ease;
	}

	.shop-drawer.is-open .shop-drawer__backdrop {
		opacity: 1;
	}

	/* ---- Sidebar panel ---- */
	.shop-drawer .shop-sidebar {
		position: absolute;
		top: 0;
		left: 0;
		bottom: 0;
		width: 80%;
		max-width: 360px;
		background: #fff;
		padding: 60px 20px 20px;
		overflow-y: auto;
		display: block; /* override tablet grid layout */
		transform: translateX(-100%);
		transition: transform 250ms ease;
		box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
	}

	.shop-drawer.is-open .shop-sidebar {
		transform: translateX(0);
	}

	/* ---- Close button ---- */
	.shop-drawer__close {
		display: flex;
		position: absolute;
		top: 12px;
		right: 12px;
		width: 36px;
		height: 36px;
		align-items: center;
		justify-content: center;
		border: 0;
		background: rgba(0, 0, 0, 0.06);
		color: #333;
		font-size: 24px;
		line-height: 1;
		border-radius: 50%;
		cursor: pointer;
		transition: background 150ms ease;
	}

	.shop-drawer__close:hover {
		background: rgba(0, 0, 0, 0.12);
	}

	/* ---- Body scroll lock ---- */
	body.shop-drawer-open {
		overflow: hidden;
	}
}
