/**
 * Zenth Toolkit — Merch Grid
 *
 * Catálogo editorial CR Merch (widget Zenth Merch Grid): toolbar de filtros
 * por subcategoría + select de orden, contador y grid de cards de producto
 * Woo con flags (Nuevo / Limitado / Agotado). Lenguaje visual streetwear:
 * esquinas RECTAS + acento bone. El filtrado/orden vive en merch-grid.js.
 * Standalone: usa var(--cr-*, fallback) para funcionar sin el theme.
 *
 * ─────────────────────────────────────────────────────────────────────────
 * ÍNDICE
 *   §1  Wrapper          → .zenth-merch (tokens locales + box)
 *   §2  Toolbar          → .zenth-merch__toolbar (filtros + orden)
 *   §3  Contador + empty → .zenth-merch__count / __empty
 *   §4  Grid             → .zenth-merch__grid (cols por var)
 *   §5  Card             → .zenth-merch__product (media + flags + textos)
 *   §6  Responsive       → @media de tamaño + accesibilidad
 * ─────────────────────────────────────────────────────────────────────────
 * BREAKPOINTS (mobile-first: la base usa --zm-cols-mobile)
 *   Tablet        → min-width: 768px    (cols tablet)
 *   Desktop       → min-width: 1025px   (cols desktop)
 *   + 900 max-width para la toolbar apilada (excepción de composición)
 *   + 1 media de accesibilidad (prefers-reduced-motion) al final de §6.
 * ─────────────────────────────────────────────────────────────────────────
 */


/* ═══════════════════════════════════════════════════════════════════════
   §1 · WRAPPER — .zenth-merch (tokens locales + box)
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-merch {
	/* Columnas reales llegan inline desde el widget */
	--zm-cols-desktop: 4;
	--zm-cols-tablet: 2;
	--zm-cols-mobile: 2;
	--zm-gap: 16px;
	--zm-border: rgba(255, 255, 255, 0.1);
	--zm-border-hover: rgba(255, 255, 255, 0.25);
	--zm-muted: rgba(255, 255, 255, 0.6);
	--zm-faint: rgba(255, 255, 255, 0.35);
	--zm-bone: #e8e2d8;
	--zm-ease: cubic-bezier(0.16, 1, 0.3, 1);

	box-sizing: border-box;
	width: 100%;
	max-width: var(--cr-container-max, 1440px);
	margin-inline: auto;
	padding-inline: var(--cr-container-pad, 32px);
}

.zenth-merch *,
.zenth-merch *::before,
.zenth-merch *::after {
	box-sizing: border-box;
}


/* ═══════════════════════════════════════════════════════════════════════
   §2 · TOOLBAR — filtros + orden
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-merch__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
	padding: 18px 0;
	border-top: 1px solid var(--zm-border);
	border-bottom: 1px solid var(--zm-border);
	margin-bottom: 28px;
}

.zenth-merch__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.zenth-merch__filter {
	margin: 0;
	padding: 9px 18px;
	background: transparent;
	border: 1px solid var(--zm-border);
	border-radius: 0;
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--zm-muted);
	cursor: pointer;
	transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
	white-space: nowrap;
	line-height: 1;
	-webkit-appearance: none;
	appearance: none;
}

.zenth-merch__filter:hover,
.zenth-merch__filter:focus-visible {
	border-color: var(--zm-border-hover);
	color: var(--cr-color-white, #fff);
	background: transparent;
}

.zenth-merch__filter.is-active {
	background: var(--cr-color-white, #fff);
	border-color: var(--cr-color-white, #fff);
	color: var(--cr-color-black, #000);
}

.zenth-merch__filter-count {
	display: inline-block;
	margin-left: 6px;
	opacity: 0.5;
}

.zenth-merch__sort {
	display: flex;
	align-items: center;
	gap: 12px;
}

.zenth-merch__sort-label {
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--zm-faint);
}

.zenth-merch__sort-select {
	padding: 9px 38px 9px 16px;
	background: var(--cr-color-black, #000) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c00000' d='M6 8L0 0h12z'/%3E%3C/svg%3E") no-repeat right 14px center;
	border: 1px solid var(--zm-border);
	border-radius: 0;
	color: var(--cr-color-white, #fff);
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 200ms ease;
}

.zenth-merch__sort-select:hover {
	border-color: var(--zm-border-hover);
}

.zenth-merch__sort-select:focus {
	outline: none;
	border-color: var(--cr-color-primary, #c00000);
}


/* ═══════════════════════════════════════════════════════════════════════
   §3 · CONTADOR + EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-merch__count {
	margin: 0 0 28px;
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--zm-faint);
}

.zenth-merch__count strong {
	color: var(--cr-color-white, #fff);
	font-weight: 800;
}

.zenth-merch__empty {
	margin: 0;
	padding: 64px 24px;
	text-align: center;
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--zm-faint);
}


/* ═══════════════════════════════════════════════════════════════════════
   §4 · GRID
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-merch__grid {
	display: grid;
	grid-template-columns: repeat(var(--zm-cols-mobile), minmax(0, 1fr));
	gap: var(--zm-gap);
}

.zenth-merch__product.is-hidden {
	display: none !important;
}


/* ═══════════════════════════════════════════════════════════════════════
   §5 · CARD — .zenth-merch__product
   ═══════════════════════════════════════════════════════════════════════ */

.zenth-merch__product {
	position: relative;
}

.zenth-merch__link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.zenth-merch__link:focus-visible {
	outline: 3px solid var(--cr-color-primary, #c00000);
	outline-offset: 3px;
}

/* Media 4/5, esquinas RECTAS */
.zenth-merch__media {
	position: relative;
	display: block;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	background: linear-gradient(135deg, #151515 0%, var(--cr-color-black, #000) 100%);
	border: 1px solid var(--zm-border);
	margin-bottom: 16px;
	transition: border-color 400ms var(--zm-ease);
}

.zenth-merch__product:hover .zenth-merch__media {
	border-color: var(--zm-border-hover);
}

.zenth-merch__img {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block;
	transition: transform 400ms var(--zm-ease);
}

.zenth-merch__product:hover .zenth-merch__img {
	transform: scale(1.04);
}

.zenth-merch__placeholder {
	position: absolute;
	inset: 0;
	background:
		repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0px, rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 12px),
		linear-gradient(135deg, #151515 0%, var(--cr-color-black, #000) 100%);
}

/* Flags (arriba izquierda) */
.zenth-merch__flag {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 2;
	padding: 6px 12px;
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.5625rem;
	font-weight: 800;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	line-height: 1;
}

.zenth-merch__flag--new {
	background: var(--cr-color-white, #fff);
	color: var(--cr-color-black, #000);
}

.zenth-merch__flag--limited {
	background: var(--cr-color-primary, #c00000);
	color: var(--cr-color-white, #fff);
}

.zenth-merch__flag--soldout {
	background: var(--cr-color-black, #000);
	color: var(--zm-faint);
	border: 1px solid var(--zm-border);
}

/* Drop tag (arriba derecha) */
.zenth-merch__drop-tag {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	padding: 5px 10px;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(10px);
	border: 1px solid var(--zm-border);
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.5rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--zm-muted);
	line-height: 1;
}

/* Overlay sold out */
.zenth-merch__soldout-overlay {
	position: absolute;
	inset: 0;
	z-index: 2;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
}

.zenth-merch__soldout-overlay span {
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 1rem;
	font-weight: 900;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: var(--cr-color-white, #fff);
	border: 2px solid var(--cr-color-white, #fff);
	padding: 10px 20px;
	transform: rotate(-8deg);
}

/* Nombre + footer */
.zenth-merch__name {
	margin: 0 0 6px;
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.9375rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	text-transform: uppercase;
	color: var(--cr-color-white, #fff);
	line-height: 1.25;
}

.zenth-merch__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.zenth-merch__price {
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--zm-bone);
}

.zenth-merch__price.is-soldout {
	color: var(--zm-faint);
}

/* El price_html de Woo puede traer del/ins (ofertas) */
.zenth-merch__price del {
	opacity: 0.5;
	margin-right: 6px;
}

.zenth-merch__price ins {
	text-decoration: none;
}

.zenth-merch__sizes {
	font-family: var(--cr-font-body, system-ui, sans-serif);
	font-size: 0.6875rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--zm-faint);
	white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════════════
   §6 · RESPONSIVE — tamaño + accesibilidad
   ───────────────────────────────────────────────────────────────────────
   Mobile-first: la base usa --zm-cols-mobile; tablet/desktop suben por
   min-width (768 → 1025, de menor a mayor). La toolbar apilada usa un
   max-width 900 puntual (composición, no columnas).
   ═══════════════════════════════════════════════════════════════════════ */

/* ─────────────────── TOOLBAR APILADA · max-width: 900px ───────────────── */
@media (max-width: 900px) {

	/* §2 · Toolbar en columna: filtros arriba, orden abajo a lo ancho */
	.zenth-merch__toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.zenth-merch__sort {
		justify-content: space-between;
	}
}

/* ───────────────────────── TABLET · min-width: 768px ──────────────────── */
@media (min-width: 768px) {

	/* §4 · Columnas tablet */
	.zenth-merch__grid {
		grid-template-columns: repeat(var(--zm-cols-tablet), minmax(0, 1fr));
	}
}

/* ──────────────────────── DESKTOP · min-width: 1025px ─────────────────── */
@media (min-width: 1025px) {

	/* §4 · Columnas desktop */
	.zenth-merch__grid {
		grid-template-columns: repeat(var(--zm-cols-desktop), minmax(0, 1fr));
	}
}

/* ─────────────────── ACCESIBILIDAD · prefers-reduced-motion ───────────── */
@media (prefers-reduced-motion: reduce) {

	.zenth-merch__media,
	.zenth-merch__img,
	.zenth-merch__filter,
	.zenth-merch__sort-select {
		transition: none;
	}

	.zenth-merch__product:hover .zenth-merch__img {
		transform: none;
	}
}
