/**
 * Shop / Product Archive Styles.
 *
 * Loaded on: is_woocommerce(), is_cart(), is_checkout() pages.
 * See inc/enqueue.php for loading conditions.
 *
 * Depends on:
 *   style.css   — brand tokens (--color-*, --radius-*, --font-*, etc.)
 *   main.css    — layout primitives (.container, .section, etc.)
 *
 * Does NOT duplicate homepage.css product card styles.
 * Instead, product card visual rules are repeated here so the shop
 * works independently without loading the homepage stylesheet.
 */

/* =============================================================================
   PRODUCT CARD — GRID CONTEXT
   Card visuals live in assets/css/product-card.css (the global product card).
   Only grid placement is defined here; do NOT restyle card internals.
   ============================================================================= */

/* =============================================================================
   SHOP ARCHIVE — PAGE STRUCTURE
   ============================================================================= */

.shop-archive {
	/* Top spacing lives inside .shop-archive__header so the full-width
	   banner touches the header above without a gap. */
	padding-block: 0 72px;
	background: var(--color-background);
}

/* =============================================================================
   BREADCRUMB
   ============================================================================= */

.shop-breadcrumb {
	margin-bottom: 20px;
}

.shop-breadcrumb__list {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.shop-breadcrumb__item {
	font-size: 0.8125rem;
	color: var(--color-text-muted);
}

.shop-breadcrumb__link {
	color: var(--color-text-muted);
	text-decoration: none;
	transition: color var(--transition-fast);
}

.shop-breadcrumb__link:hover,
.shop-breadcrumb__link:focus-visible {
	color: var(--color-primary);
}

.shop-breadcrumb__item--sep {
	color: var(--color-border);
	user-select: none;
}

.shop-breadcrumb__item--current {
	color: var(--color-text);
	font-weight: 600;
}

/* =============================================================================
   SHOP HEADER — full-width banner, content kept in .container
   ============================================================================= */

.shop-archive__header {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	width: 100%;
	margin: 0 0 32px;
	/* Top padding moved here from .shop-archive so the banner
	   starts flush below the site header. */
	padding-block: 40px;
	background: var(--color-surface);
}

/* Optional full-bleed background layer (image / gradient).
   Sits behind the inner container. Shared by shop + category headers. */
.shop-archive__bg,
.cat-archive__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
}

.shop-archive__bg img,
.cat-archive__bg img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* No dark overlay — banner images show in their real colors and
   header text keeps its original colors. */
.shop-archive__scrim {
	display: none;
}

/* Inner container: keeps breadcrumb + title + intro at container width. */
.shop-archive__header-inner {
	position: relative;
	z-index: 1;
}

.shop-archive__title {
	font-family: var(--font-display);
	font-size: clamp(1.75rem, 4vw, 2.75rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;
	color: var(--color-text);
	margin: 0 0 10px;
	text-align: left;
}

.shop-archive__intro {
	margin: 0;
	font-size: clamp(0.9375rem, 1.5vw, 1.0625rem);
	color: var(--color-text-muted);
	line-height: 1.6;
	max-width: 520px;
}

/* =============================================================================
   SHOP TOOLBAR
   ============================================================================= */

.shop-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	padding: 14px 20px;
	background: var(--color-surface);
	border-radius: var(--radius-md);
	margin-bottom: 32px;
}

.shop-toolbar__left {
	display: flex;
	align-items: center;
	gap: 16px;
}

.shop-toolbar__right {
	display: flex;
	align-items: center;
	gap: 12px;
}

/* WooCommerce result count */
.shop-result-count .woocommerce-result-count {
	margin: 0;
	font-size: 0.875rem;
	color: var(--color-text-muted);
	font-weight: 500;
}

/* Compact "N Products" count: mobile only (desktop keeps full text). */
.shop-result-count--compact {
	display: none;
	margin: 0;
	font-size: 0.8125rem;
	font-weight: 700;
	color: var(--color-text-muted);
	white-space: nowrap;
}

/* WooCommerce ordering dropdown */
.shop-toolbar .woocommerce-ordering {
	margin: 0;
}

.shop-toolbar .woocommerce-ordering select {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 8px 32px 8px 12px;
	font-size: 0.875rem;
	font-family: var(--font-body);
	color: var(--color-text);
	background: var(--color-white);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	min-width: 180px;
	transition: border-color var(--transition-fast);
}

.shop-toolbar .woocommerce-ordering select:focus {
	outline: none;
	border-color: var(--color-primary);
}

/* =============================================================================
   PRODUCT GRID
   ============================================================================= */

/* Override WooCommerce's default ul.products list styles */
.shop-products-grid ul.products {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 24px;
	width: 100%;
}

/* Each WooCommerce product loop item (li.shop-products-grid__item) */
.shop-products-grid ul.products li.shop-products-grid__item {
	margin: 0;
	padding: 0;
	float: none; /* override WC float layout */
	width: 100%; /* fill the grid cell */
}

/* WooCommerce sometimes wraps with .woocommerce .products */
.shop-products-grid .woocommerce,
.shop-products-grid .woocommerce-page {
	width: 100%;
}

/* =============================================================================
   WOOCOMMERCE NOTICES (inside shop)
   ============================================================================= */

.shop-archive .woocommerce-notices-wrapper {
	margin-bottom: 20px;
}

.shop-archive .woocommerce-info,
.shop-archive .woocommerce-message,
.shop-archive .woocommerce-error {
	border-radius: var(--radius-md);
	font-size: 0.9375rem;
	padding: 14px 20px;
}

/* =============================================================================
   PAGINATION
   ============================================================================= */

.shop-pagination {
	margin-top: 56px;
}

.shop-pagination .woocommerce-pagination,
.shop-pagination .woocommerce-pagination ul {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}

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

.shop-pagination .woocommerce-pagination ul li a,
.shop-pagination .woocommerce-pagination ul li span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border-radius: var(--radius-sm);
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: none;
	transition:
		background var(--transition-fast),
		color var(--transition-fast);
}

.shop-pagination .woocommerce-pagination ul li a {
	background: var(--color-surface);
	color: var(--color-text);
	border: 1px solid var(--color-border);
}

.shop-pagination .woocommerce-pagination ul li a:hover,
.shop-pagination .woocommerce-pagination ul li a:focus-visible {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: #ffffff;
}

.shop-pagination .woocommerce-pagination ul li span.current {
	background: var(--color-primary);
	color: #ffffff;
	border: 1px solid var(--color-primary);
}

/* =============================================================================
   EMPTY STATE
   ============================================================================= */

.shop-empty {
	text-align: center;
	padding: 80px 20px;
}

.shop-empty .woocommerce-info {
	margin-bottom: 24px;
}

.shop-empty__cta {
	margin: 0;
}

.shop-empty__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 52px;
	padding: 12px 32px;
	border-radius: var(--radius-pill);
	background: var(--color-primary);
	color: var(--color-white);
	font-weight: 700;
	text-decoration: none;
	font-size: 1rem;
	transition:
		background-color var(--transition-fast),
		transform var(--transition-fast);
}

.shop-empty__link:hover {
	background: var(--color-primary-dark);
	transform: translateY(-1px);
}

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

/* =============================================================================
   CATEGORY HERO — full-width banner wrapper, content kept in .container
   Top padding moved here from .shop-archive so the banner starts flush
   below the site header (same pattern as .shop-archive__header).
   ============================================================================= */

.cat-archive__header {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	width: 100%;
	margin: 0 0 32px;
	padding-block: 60px;
	background: var(--color-surface);
}

.cat-archive__header-inner {
	position: relative;
	z-index: 1;
}

/* Full-width header banner (per-category uploads). Positioning base is
   shared with .shop-archive__bg above. No dark overlay — images show in
   their real colors and header text keeps its original black/accent
   colors. */
.cat-archive__bg-picture {
	display: block;
	width: 100%;
	height: 100%;
}

.cat-archive__scrim {
	display: none;
}

/* When the hero lives inside the full-width banner wrapper,
   its own outer margins collapse — spacing comes from the wrapper. */
.cat-archive__header .cat-hero {
	margin: 0;
}

.cat-hero {
	margin: 4px 0 32px;
}

.cat-hero--split {
	display: grid;
	grid-template-columns: 1.5fr 1fr;
	gap: 40px;
	align-items: center;
}

.cat-hero .shop-breadcrumb {
	margin-bottom: 20px;
}

/* ---------- Breadcrumb banner (optional term banners) ---------- */

.cat-crumb-banner {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	min-height: 150px;
	margin-bottom: 20px;
	padding: 22px 24px;
	border-radius: 16px;
	background: var(--color-text);
}

.cat-crumb-banner__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.cat-crumb-banner__bg img,
.cat-crumb-banner__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cat-crumb-banner__scrim {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(
		100deg,
		rgba(10, 10, 12, 0.62) 0%,
		rgba(10, 10, 12, 0.35) 55%,
		rgba(10, 10, 12, 0.12) 100%
	);
	pointer-events: none;
}

.cat-crumb-banner .shop-breadcrumb {
	position: relative;
	z-index: 2;
	margin: 0;
}

.cat-crumb-banner .shop-breadcrumb__link {
	color: rgba(255, 255, 255, 0.85);
}

.cat-crumb-banner .shop-breadcrumb__link:hover {
	color: #ffffff;
}

.cat-crumb-banner .shop-breadcrumb__item--sep {
	color: rgba(255, 255, 255, 0.55);
}

.cat-crumb-banner .shop-breadcrumb__item--current {
	color: #ffffff;
}

/* Compact single-line trail: Home/Shop never truncate, only the current
   category ellipsizes. Scoped to the hero so Shop/archives are untouched. */
.cat-hero .shop-breadcrumb__list {
	flex-wrap: nowrap;
	overflow: hidden;
	font-size: 0.75rem;
	line-height: 1.4;
}

.cat-hero .shop-breadcrumb__item {
	flex: none;
}

.cat-hero .shop-breadcrumb__item--current {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cat-hero__eyebrow {
	margin: 0 0 8px;
	font-family: var(--font-body);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--color-primary);
}

.cat-hero__title {
	margin: 0 0 12px;
	font-family: var(--font-display);
	font-size: clamp(2rem, 4vw, 2.75rem);
	font-weight: 700;
	line-height: 1.12;
	color: var(--color-text);
}

.cat-hero__description {
	max-width: 60ch;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--color-text);
}

.cat-hero__description p {
	margin: 0 0 0.75em;
}

.cat-hero__description p:last-child {
	margin-bottom: 0;
}

.cat-hero__count {
	margin: 12px 0 0;
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--color-text-muted);
}

.cat-hero__media {
	min-width: 0;
	display: flex;
	justify-content: flex-end;
}

/* Square thumbnail accent — never a banner. Source assets are 200×200,
   presented in a bounded 1:1 box. */
.cat-hero__image {
	display: block;
	width: min(100%, 320px);
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 16px;
	background: var(--color-surface);
}

/* =============================================================================
   SIBLING CATEGORY NAVIGATION
   Compact horizontal strip; scrolls on small screens.
   ============================================================================= */

.cat-nav {
	margin: 0 0 28px;
}

.cat-nav__label {
	margin: 0 0 12px;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.cat-nav__list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cat-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 165px;
	max-width: 220px;
	min-height: 48px;
	padding: 6px 16px 6px 6px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-pill);
	background: var(--color-white);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	transition:
		border-color var(--transition-fast),
		color var(--transition-fast);
}

.cat-nav__name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cat-nav__link:hover {
	border-color: var(--color-primary);
	color: var(--color-primary);
}

.cat-nav__link:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

.cat-nav__thumb {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--color-surface);
	flex: none;
}

/* =============================================================================
   RESPONSIVE — TABLET (≤ 1024px)
   ============================================================================= */

@media (max-width: 64em) {
	.shop-products-grid ul.products {
		grid-template-columns: repeat(3, 1fr);
		gap: 20px;
	}
}

/* =============================================================================
   RESPONSIVE — MOBILE (≤ 640px)
   ============================================================================= */

@media (max-width: 47.99em) {
	.shop-archive {
		padding-block: 0 56px;
	}

	.shop-archive__header,
	.cat-archive__header {
		padding-block: 24px;
		margin-bottom: 24px;
	}

	.shop-archive__title {
		font-size: clamp(1.5rem, 6vw, 2rem);
	}

	/* Mobile toolbar: ONE compact row — count left, actions right.
	   Shared with Shop (same component, same behavior). */
	.shop-toolbar {
		padding: 10px 16px;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		gap: 8px;
	}

	.shop-toolbar__left {
		flex: 1 1 auto;
		min-width: 0;
		width: auto;
		gap: 8px;
	}

	.shop-toolbar__right {
		flex: none;
		width: auto;
	}

	.shop-result-count {
		min-width: 0;
		overflow: hidden;
	}

	.shop-result-count--full {
		display: none;
	}

	.shop-result-count--compact {
		display: block;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.shop-toolbar .woocommerce-ordering select {
		width: auto;
		min-width: 0;
		max-width: 132px;
		font-size: 0.75rem;
		padding: 8px 24px 8px 10px;
		background-position: right 8px center;
	}

	.shop-filter-trigger {
		width: 40px;
		height: 40px;
		flex: none;
	}

	.shop-filter-trigger svg {
		width: 20px;
		height: 20px;
	}

	.shop-products-grid ul.products {
		grid-template-columns: repeat(2, 1fr);
		gap: 14px;
	}

	/* Card responsive sizing lives in product-card.css. */

	/* Category hero stacks compactly: content, then a small centered
	   thumbnail accent (never full-width). */
	.cat-hero {
		margin-bottom: 24px;
	}

	/* Inside the full-width banner wrapper the hero must not add
	   its own outer margin — spacing comes from the wrapper. */
	.cat-archive__header .cat-hero {
		margin: 0;
	}

	.cat-hero--split {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
	}

	.cat-hero .shop-breadcrumb {
		margin-bottom: 16px;
	}

	.cat-crumb-banner {
		min-height: 110px;
		margin-bottom: 16px;
		padding: 14px 16px;
		border-radius: 14px;
	}

	.cat-hero__eyebrow {
		font-size: 0.6875rem;
		line-height: 1;
		margin-bottom: 8px;
	}

	.cat-hero__title {
		font-size: 2rem;
		line-height: 1.05;
		margin-bottom: 10px;
	}

	.cat-hero__count {
		font-size: 0.8125rem;
		line-height: 1.2;
		margin: 0 0 18px;
	}

	.cat-hero__media {
		justify-content: center;
	}

	.cat-hero__image {
		width: 140px;
		height: 140px;
		flex: none;
	}

	.cat-nav {
		margin-bottom: 32px;
	}

	/* Sibling strip scrolls horizontally within the container gutters —
	   no bleed tricks, so the first pill is always fully visible. */
	.cat-nav__list {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		padding-bottom: 4px;
	}

	.cat-nav__list::-webkit-scrollbar {
		display: none;
	}

	.cat-nav__link {
		flex: none;
	}

	.shop-pagination {
		margin-top: 40px;
	}
}

/* =============================================================================
   RESPONSIVE — VERY SMALL (≤ 360px)
   ============================================================================= */

@media (max-width: 22.5em) {
	.shop-products-grid ul.products {
		grid-template-columns: 1fr;
	}
}

/* =============================================================================
   FILTER TRIGGER BUTTON
   ============================================================================= */

.shop-filter-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--color-text);
	cursor: pointer;
	transition:
		color var(--transition-fast),
		background-color var(--transition-fast),
		transform var(--transition-fast);
}

.shop-filter-trigger svg {
	width: 22px;
	height: 22px;
}

.shop-filter-trigger:hover {
	color: var(--color-primary);
	background: var(--color-surface);
}

.shop-filter-trigger:active {
	transform: scale(0.93);
}

.shop-filter-trigger:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

/* =============================================================================
   SIDEBAR DRAWER (RETRACTABLE)
   ============================================================================= */

.shop-sidebar-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	pointer-events: none;
	visibility: hidden;
}

.shop-sidebar-drawer[aria-hidden="false"] {
	pointer-events: auto;
	visibility: visible;
}

.shop-sidebar-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.shop-sidebar-drawer[aria-hidden="false"] .shop-sidebar-drawer__overlay {
	opacity: 1;
}

.shop-sidebar-drawer__inner {
	position: relative;
	width: 100%;
	max-width: 360px;
	background: var(--color-surface);
	height: 100%;
	display: flex;
	flex-direction: column;
	transform: translateX(-100%);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

.shop-sidebar-drawer[aria-hidden="false"] .shop-sidebar-drawer__inner {
	transform: translateX(0);
}

.shop-sidebar-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid var(--color-border);
}

.shop-sidebar-drawer__title {
	font-family: var(--font-heading);
	font-size: 1.25rem;
	margin: 0;
}

.shop-sidebar-drawer__close {
	background: transparent;
	border: none;
	padding: 8px;
	margin: -8px;
	cursor: pointer;
	color: var(--color-text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color var(--transition-fast);
}

.shop-sidebar-drawer__close:hover {
	color: var(--color-accent-red);
}

.shop-sidebar-drawer__content {
	padding: 24px;
	overflow-y: auto;
	flex: 1;
}

/* Basic WooCommerce Widget Styling in Drawer */
.shop-sidebar-drawer__content .widget {
	margin-bottom: 32px;
}

.shop-sidebar-drawer__content .widget-title {
	font-size: 1.125rem;
	margin-bottom: 16px;
	font-family: var(--font-heading);
}

.shop-sidebar-drawer__empty {
	color: var(--color-text-muted);
	font-size: 0.875rem;
	font-style: italic;
}
