/* =========================================================================================================
   mercadomayorista.net — Hoja de estilos de la revista (3 temas)
   Base + componentes compartidos (toolbar, carrito, paginación) + los tres temas visuales seleccionables:
     · revista    — editorial, serif, fotos grandes (los estilos globales de tarjeta son este tema)
     · comercio   — grilla compacta, sans, precios prominentes (body.tema-comercio)
     · escaparate — mosaico/vitrina oscuro, texto sobre la foto, acento dorado (body.tema-escaparate)
   Claro y oscuro por tokens. Contrato JS idéntico entre temas (.mag-card + data-* + hooks del carrito).
   ========================================================================================================= */

:root {
	--bg:        #f5f6f8;
	--surface:   #ffffff;
	--surface-2: #fbfbfd;
	--ink:       #18202f;
	--ink-soft:  #5b6675;
	--ink-faint: #8a93a2;
	--line:      #e7e9ef;
	--accent:    #1f3a68;
	--accent-ink:#ffffff;
	--price:     #14202f;
	--shadow:    0 1px 2px rgba(20, 30, 50, .04), 0 8px 24px rgba(20, 30, 50, .06);
	--radius:    14px;
	--serif:     Georgia, "Iowan Old Style", "Times New Roman", serif;
	--sans:      system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg:        #0f141c;
		--surface:   #161d28;
		--surface-2: #1a2230;
		--ink:       #eef1f6;
		--ink-soft:  #a7b0be;
		--ink-faint: #7b8494;
		--line:      #26303f;
		--accent:    #7ea6e6;
		--accent-ink:#0f141c;
		--price:     #f2f5fa;
		--shadow:    0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
	}
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* gana sobre display:flex/grid de autor (tarjetas filtradas, FAB, pie del carrito) */

html, body { margin: 0; }

/* Base común a los tres temas. Los tokens de :root son el look "revista"; comercio y escaparate los redefinen
   por `body.tema-*` más abajo. Las clases de tarjeta compartidas (.mag-card, .mag-grid, .mag-name, precios,
   carrito, toolbar, paginación) son globales = revista; los otros temas solo sobrescriben lo que cambia. */
body {
	background: var(--bg);
	color: var(--ink);
	font-family: var(--sans);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.mag-wrap {
	width: 100%;
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 20px;
}

/* ---- Portada -------------------------------------------------------------------------------------------- */
.mag-cover {
	background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
	border-bottom: 1px solid var(--line);
	padding: 56px 0 40px;
}
.mag-kicker {
	margin: 0 0 10px;
	font-size: .74rem;
	letter-spacing: .16em;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--accent);
}
.mag-title {
	margin: 0;
	font-family: var(--serif);
	font-weight: 700;
	font-size: clamp(2rem, 5vw, 3.2rem);
	line-height: 1.08;
	letter-spacing: -.01em;
	text-wrap: balance;
}
.mag-lede {
	margin: 16px 0 0;
	max-width: 62ch;
	font-size: 1.06rem;
	color: var(--ink-soft);
}
.mag-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 22px;
}
.chip {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--surface);
	border: 1px solid var(--line);
	font-size: .82rem;
	color: var(--ink-soft);
}
.chip-count { color: var(--ink); }
.chip-count b { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: .32em; }
.chip-muted { color: var(--ink-faint); }

/* ---- Barra de herramientas ------------------------------------------------------------------------------ */
.mag-toolbar {
	position: sticky;
	top: 0;
	z-index: 10;
	background: color-mix(in srgb, var(--bg) 86%, transparent);
	backdrop-filter: saturate(1.4) blur(10px);
	border-bottom: 1px solid var(--line);
}
.mag-toolbar-in {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	padding-top: 12px;
	padding-bottom: 12px;
}
.mag-search {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
}
.mag-search svg {
	position: absolute;
	left: 14px;
	width: 18px;
	height: 18px;
	fill: var(--ink-faint);
	pointer-events: none;
}
.mag-search input {
	width: 100%;
	padding: 11px 14px 11px 42px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-size: .95rem;
}
.mag-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.mag-fam {
	flex: 0 0 auto;
	padding: 11px 14px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-size: .92rem;
	max-width: 240px;
}
.mag-fam:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Grilla de productos -------------------------------------------------------------------------------- */
.mag-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
	gap: 18px;
	padding: 30px 0 10px;
}
.mag-card {
	display: flex;
	flex-direction: column;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	transition: transform .16s ease, box-shadow .16s ease;
}
.mag-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.mag-photo {
	position: relative;
	aspect-ratio: 4 / 3;
	background: var(--surface-2);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.mag-photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: var(--surface-2); }
.mag-photo-ph {
	position: absolute;
	inset: 0;
	font-family: var(--serif);
	font-size: 2.1rem;
	font-weight: 700;
	color: var(--accent-ink);
	display: flex; align-items: center; justify-content: center;
	background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000 12%));
	opacity: .9;
}
.mag-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; }
.mag-fam-tag {
	margin: 0;
	font-size: .68rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-faint);
	font-weight: 600;
}
.mag-name {
	margin: 2px 0 0;
	font-family: var(--serif);
	font-size: 1.02rem;
	font-weight: 600;
	line-height: 1.25;
	color: var(--ink);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.mag-code { margin: 0; font-size: .78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.mag-prices { margin-top: auto; padding-top: 12px; display: flex; gap: 16px; flex-wrap: wrap; }
.price { display: flex; flex-direction: column; }
.price-label {
	font-size: .68rem;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--ink-faint);
	font-weight: 600;
}
.price-value {
	font-size: 1.16rem;
	font-weight: 700;
	color: var(--price);
	font-variant-numeric: tabular-nums;
}
.price-value .cur { font-weight: 500; color: var(--ink-faint); font-size: .82em; margin-right: .16em; }
.price-b .price-value { font-size: 1rem; color: var(--ink-soft); }
.price-ask { font-size: .98rem; font-weight: 600; color: var(--ink-soft); }

.mag-empty { text-align: center; color: var(--ink-soft); padding: 40px 0 60px; }

/* ---- Pie ------------------------------------------------------------------------------------------------ */
.mag-foot {
	margin-top: 36px;
	padding: 28px 0 40px;
	border-top: 1px solid var(--line);
	background: var(--surface);
	text-align: center;
}
.mag-foot p { margin: 0; }
.mag-foot b { color: var(--accent); }
.mag-foot-sub { margin-top: 4px; font-size: .84rem; color: var(--ink-faint); }

@media (max-width: 520px) {
	.mag-cover { padding: 40px 0 30px; }
	.mag-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
	.mag-fam { max-width: 42vw; }
}

/* ---- Acciones de la tarjeta ----------------------------------------------------------------------------- */
.mag-actions { margin-top: 12px; display: flex; gap: 8px; align-items: stretch; }
.mag-add {
	flex: 1 1 auto;
	border: 0;
	border-radius: 9px;
	background: var(--accent);
	color: var(--accent-ink);
	font: inherit;
	font-size: .86rem;
	font-weight: 600;
	padding: 8px 10px;
	cursor: pointer;
	transition: filter .15s ease, background .15s ease;
}
.mag-add:hover { filter: brightness(1.06); }
.mag-add.is-added { background: #1c9d63; color: #fff; }
.mag-share-p {
	flex: 0 0 auto;
	width: 36px;
	border: 1px solid var(--line);
	border-radius: 9px;
	background: var(--surface);
	color: var(--ink-soft);
	cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
}
.mag-share-p svg { width: 16px; height: 16px; fill: currentColor; }
.mag-share-p:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Botón flotante del carrito ------------------------------------------------------------------------- */
.cart-fab {
	position: fixed;
	right: 20px; bottom: 20px;
	z-index: 30;
	width: 56px; height: 56px;
	border: 0; border-radius: 50%;
	background: var(--accent);
	color: var(--accent-ink);
	cursor: pointer;
	box-shadow: var(--shadow);
	display: flex; align-items: center; justify-content: center;
}
.cart-fab svg { width: 24px; height: 24px; fill: currentColor; }
.cart-fab-count {
	position: absolute; top: -4px; right: -4px;
	min-width: 22px; height: 22px; padding: 0 5px;
	border-radius: 999px;
	background: #e5484d; color: #fff;
	font: 700 .72rem/22px var(--sans);
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* ---- Drawer del carrito --------------------------------------------------------------------------------- */
.cart-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(10, 15, 25, .5); }
.cart-drawer {
	position: fixed; top: 0; right: 0; z-index: 50;
	width: 380px; max-width: 92vw; height: 100%;
	background: var(--surface);
	border-left: 1px solid var(--line);
	box-shadow: -12px 0 40px rgba(10, 15, 25, .25);
	display: flex; flex-direction: column;
	transform: translateX(100%);
	transition: transform .22s ease;
}
.cart-drawer.is-open { transform: translateX(0); }
.cart-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.cart-head h2 { margin: 0; font-family: var(--serif); font-size: 1.2rem; }
.cart-close { border: 0; background: transparent; color: var(--ink-soft); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.cart-body { flex: 1 1 auto; overflow-y: auto; padding: 12px 14px; }
.cart-empty { color: var(--ink-faint); text-align: center; padding: 40px 12px; }

.cart-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-thumb { position: relative; flex: 0 0 auto; width: 46px; height: 46px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.cart-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cart-thumb-ph {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	font-family: var(--serif); font-weight: 700; font-size: 1rem; color: var(--accent-ink);
	background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000 12%));
}
.cart-info { flex: 1 1 auto; min-width: 0; }
.cart-name { font-size: .86rem; line-height: 1.25; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-unit { font-size: .76rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; margin-top: 2px; }
.cart-qty { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; }
.cart-mini { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: 1rem; line-height: 1; cursor: pointer; }
.cart-mini:hover { border-color: var(--accent); color: var(--accent); }
.cart-q { min-width: 22px; text-align: center; font-size: .86rem; font-variant-numeric: tabular-nums; }
.cart-rem { flex: 0 0 auto; margin-left: 4px; width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-faint); font-size: 1.1rem; cursor: pointer; }
.cart-rem:hover { color: #e5484d; }

.cart-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.cart-total { display: flex; align-items: baseline; justify-content: space-between; font-size: 1.05rem; }
.cart-total span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.cart-buttons { display: flex; flex-direction: column; gap: 8px; }
.cart-wa, .cart-share, .cart-clear { border: 0; border-radius: 10px; font: inherit; font-weight: 600; padding: 11px 12px; cursor: pointer; }
.cart-wa { background: #25d366; color: #06280f; }
.cart-wa:hover { filter: brightness(1.05); }
.cart-share { background: var(--accent); color: var(--accent-ink); }
.cart-share:hover { filter: brightness(1.06); }
.cart-clear { background: transparent; color: var(--ink-faint); font-weight: 500; font-size: .84rem; padding: 4px; }
.cart-clear:hover { color: #e5484d; }

/* ---- Paginación "ver más" ------------------------------------------------------------------------------- */
.mag-more { text-align: center; padding: 6px 0 44px; }
.mag-more button {
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--ink);
	font: inherit; font-weight: 600;
	padding: 11px 26px;
	border-radius: 10px;
	cursor: pointer;
	transition: border-color .15s ease, color .15s ease;
}
.mag-more button:hover { border-color: var(--accent); color: var(--accent); }


/* =========================================================================================================
   TEMA COMERCIO — grilla compacta con precios prominentes (sans, denso, acento teal + precio cálido)
   Reusa la tarjeta estándar; solo redefine tokens y ajusta densidad/tipografía/tamaño de precio.
   ========================================================================================================= */
body.tema-comercio { --accent: #0e7490; --price: #c2410c; --radius: 10px; }
@media (prefers-color-scheme: dark) {
	body.tema-comercio { --accent: #38bdf8; --price: #fb923c; }
}

.com-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 22px 0; }
.com-head-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 12px; }
.com-head-txt { min-width: 0; }
.com-title { margin: 0; font-weight: 800; font-size: clamp(1.4rem, 3.4vw, 2rem); letter-spacing: -.01em; }
.com-lede { margin: 6px 0 0; color: var(--ink-soft); font-size: .95rem; max-width: 60ch; }
.com-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.com-badge { display: inline-flex; align-items: center; gap: .4em; padding: 6px 12px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .86rem; }
.com-badge b { font-variant-numeric: tabular-nums; }
.com-note { font-size: .82rem; color: var(--ink-soft); }
.com-note-muted { color: var(--ink-faint); }

body.tema-comercio .mag-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; padding: 20px 0 8px; }
body.tema-comercio .mag-photo { aspect-ratio: 1 / 1; }
body.tema-comercio .mag-photo-ph { font-family: var(--sans); font-size: 1.7rem; }
body.tema-comercio .mag-body { padding: 10px 11px 12px; gap: 3px; }
body.tema-comercio .mag-fam-tag { font-size: .62rem; }
body.tema-comercio .mag-name { font-family: var(--sans); font-size: .9rem; font-weight: 600; -webkit-line-clamp: 2; }
body.tema-comercio .mag-code { font-size: .72rem; }
body.tema-comercio .mag-prices { gap: 10px; padding-top: 8px; }
body.tema-comercio .price-label { font-size: .62rem; }
body.tema-comercio .price-value { font-size: 1.32rem; color: var(--price); }
body.tema-comercio .price-b .price-value { font-size: .92rem; color: var(--ink-soft); }
body.tema-comercio .mag-actions { margin-top: 10px; }
body.tema-comercio .mag-add { font-size: .82rem; padding: 7px 8px; }
body.tema-comercio .cart-head h2 { font-family: var(--sans); }

@media (max-width: 520px) {
	body.tema-comercio .mag-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
}


/* =========================================================================================================
   TEMA ESCAPARATE — mosaico/vitrina de marco oscuro; la foto manda y el texto va superpuesto. Aspecto de un
   solo tono (deliberadamente oscuro en claro y oscuro), acento dorado.
   ========================================================================================================= */
body.tema-escaparate {
	--bg: #0d0e11; --surface: #15171c; --surface-2: #1c1f26;
	--ink: #f4efe4; --ink-soft: #c7c0b1; --ink-faint: #928b7d;
	--line: #2b2e37; --accent: #caa14a; --accent-ink: #171205; --price: #f7f0e0;
	--serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
}

.esc-cover { padding: 54px 0 34px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #0b0c0f, var(--bg)); }
.esc-kicker { margin: 0 0 10px; font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.esc-title { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(2rem, 5.4vw, 3.4rem); line-height: 1.06; letter-spacing: -.01em; text-wrap: balance; color: var(--ink); }
.esc-lede { margin: 14px 0 0; max-width: 60ch; color: var(--ink-soft); font-size: 1.04rem; }
.esc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.esc-chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: .82rem; }
.esc-chip b { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: .32em; }
.esc-chip-muted { color: var(--ink-faint); }

body.tema-escaparate .esc-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 24px 0 8px; }
body.tema-escaparate .mag-card { position: relative; aspect-ratio: 3 / 4; border: 1px solid var(--line); border-radius: 12px; background: #000; }
body.tema-escaparate .mag-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
body.tema-escaparate .mag-photo { position: absolute; inset: 0; aspect-ratio: auto; }
body.tema-escaparate .mag-photo-ph { font-family: var(--serif); font-size: 2.4rem; }

.esc-veil { position: absolute; inset: auto 0 0 0; z-index: 2; padding: 34px 14px 13px; display: flex; flex-direction: column; gap: 2px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .86) 62%); color: #fff; }
.esc-veil .mag-fam-tag { color: var(--accent); font-size: .62rem; letter-spacing: .1em; }
.esc-veil .mag-name { font-family: var(--serif); font-size: 1rem; font-weight: 600; color: #fff; -webkit-line-clamp: 2; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.esc-veil .mag-code { color: rgba(255, 255, 255, .66); font-size: .72rem; }
.esc-veil .mag-prices { margin-top: 6px; padding-top: 0; gap: 10px; }
.esc-veil .price { flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.esc-veil .price-value { color: #fff; font-size: 1.12rem; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.esc-veil .price-b-inline { color: rgba(255, 255, 255, .7); font-size: .9rem; font-weight: 600; }
.esc-veil .price-ask { color: #fff; }

.esc-actions { position: absolute; inset: 10px 10px auto auto; z-index: 3; margin: 0; width: auto; opacity: 0; transform: translateY(-4px); transition: opacity .16s ease, transform .16s ease; }
.mag-card:hover .esc-actions, .mag-card:focus-within .esc-actions { opacity: 1; transform: none; }
@media (hover: none) { .esc-actions { opacity: 1; transform: none; } }
.esc-actions .mag-add { flex: 0 0 auto; background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.esc-actions .mag-share-p { background: rgba(0, 0, 0, .55); color: #fff; border-color: rgba(255, 255, 255, .25); }
.esc-actions .mag-share-p:hover { color: var(--accent); border-color: var(--accent); }

.esc-foot { background: var(--surface); }

@media (max-width: 520px) {
	body.tema-escaparate .esc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
}


/* =========================================================================================================
   MARCA / LOGO — el logo del catálogo (propio o de la empresa) en la portada de cada tema.
   ========================================================================================================= */
.mag-brand { display: block; margin-bottom: 16px; }
.mag-logo { display: block; max-height: 52px; max-width: 240px; width: auto; height: auto; object-fit: contain; }

/* Comercio: el logo va en la fila del encabezado, a la izquierda del texto. */
body.tema-comercio .mag-brand { margin: 0 4px 0 0; flex: 0 0 auto; }
body.tema-comercio .mag-logo { max-height: 46px; max-width: 190px; }

/* Escaparate: placa clara para que cualquier logo (aun oscuro) se lea sobre el marco oscuro. */
body.tema-escaparate .mag-brand { display: inline-block; margin-bottom: 18px; background: #fff; padding: 9px 13px; border-radius: 10px; }
body.tema-escaparate .mag-logo { max-height: 46px; max-width: 200px; }


/* =========================================================================================================
   PALETAS DE COLOR — se combinan con el tema de diseño (body.paleta-*). Solo redefinen el acento, así que
   componen con cualquier tema (el marco/tipografía los pone el tema; el color de marca, la paleta). Van al
   FINAL para ganar por orden de fuente sobre el acento propio de cada tema.
   ========================================================================================================= */
body.paleta-indigo    { --accent: #4f46e5; --accent-ink: #ffffff; }
body.paleta-esmeralda { --accent: #059669; --accent-ink: #ffffff; }
body.paleta-oceano    { --accent: #0284c7; --accent-ink: #ffffff; }
body.paleta-coral     { --accent: #ea580c; --accent-ink: #ffffff; }
body.paleta-vino      { --accent: #be123c; --accent-ink: #ffffff; }
body.paleta-violeta   { --accent: #7c3aed; --accent-ink: #ffffff; }
body.paleta-grafito   { --accent: #475569; --accent-ink: #ffffff; }


/* =========================================================================================================
   FILTROS EN MÓVIL — buscador a lo ancho y los selects (familia/marca) compartiendo la fila.
   ========================================================================================================= */
@media (max-width: 620px) {
	.mag-search { flex: 1 1 100%; }
	.mag-fam { flex: 1 1 0; max-width: none; }
}


/* =========================================================================================================
   BARRA INFERIOR MÓVIL — Buscar (sube a los filtros) · Cargar más · Carrito. Solo en pantallas angostas; en
   móvil el carrito vive aquí (se oculta el FAB). Común a todos los temas.
   ========================================================================================================= */
.mbar { display: none; }
.mbar-btn {
	flex: 1 1 0;
	display: flex; flex-direction: column; align-items: center; gap: 2px;
	position: relative;
	border: 0; background: transparent; color: var(--ink-soft);
	font: inherit; font-size: .72rem; font-weight: 600; padding: 6px 4px; cursor: pointer;
}
.mbar-btn svg { width: 22px; height: 22px; fill: currentColor; }
.mbar-btn:active { color: var(--accent); }
.mbar-count {
	position: absolute; top: 0; right: 24%;
	min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
	background: #e5484d; color: #fff; font-size: .66rem; line-height: 18px; text-align: center;
	font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
	.mbar {
		display: flex;
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
		background: var(--surface); border-top: 1px solid var(--line);
		box-shadow: 0 -6px 20px rgba(0, 0, 0, .12);
		padding: 6px calc(6px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
	}
	.cart-fab { display: none; }               /* en móvil el carrito está en la barra */
	main.mag-wrap { padding-bottom: 78px; }     /* espacio para no tapar el contenido con la barra */
	.mag-foot { padding-bottom: 90px; }
}


/* =========================================================================================================
   TEMA LISTA — un producto por fila (foto a la izquierda, datos a la derecha); se apila en móvil (foto arriba).
   Reutiliza el encabezado compacto (com-*) y el contrato de tarjeta; el acento sale del tema/paleta.
   ========================================================================================================= */
body.tema-lista .lista-grid { display: flex; flex-direction: column; gap: 14px; padding: 22px 0 10px; }
body.tema-lista .lista-card {
	display: flex; flex-direction: row; align-items: stretch;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
	transition: box-shadow .16s ease;
}
body.tema-lista .lista-card:hover { box-shadow: var(--shadow); }
body.tema-lista .lista-photo { flex: 0 0 210px; width: 210px; min-height: 190px; align-self: stretch; }
body.tema-lista .lista-photo .mag-photo-ph { font-size: 2rem; }
body.tema-lista .lista-body { flex: 1 1 auto; min-width: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
body.tema-lista .lista-code { margin: 0; font-size: .76rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
body.tema-lista .lista-name { margin: 0; font-size: 1.18rem; font-weight: 700; line-height: 1.25; color: var(--ink); }
body.tema-lista .lista-prices { display: flex; flex-wrap: wrap; gap: 2px 20px; margin: 2px 0; }
body.tema-lista .lista-price { font-size: 1.04rem; font-variant-numeric: tabular-nums; color: var(--ink); }
body.tema-lista .lista-price .cur { color: var(--ink-faint); font-size: .82em; margin-right: .12em; }
body.tema-lista .lista-price-a { color: var(--accent); font-weight: 700; }
body.tema-lista .lista-price-a b { font-weight: 600; }
body.tema-lista .lista-price-b { color: var(--ink-soft); }
body.tema-lista .lista-price-b b { font-weight: 600; }
body.tema-lista .lista-meta { margin: 0; font-size: .84rem; color: var(--ink-faint); }
body.tema-lista .lista-dot { opacity: .5; }
body.tema-lista .lista-actions { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
body.tema-lista .lista-add { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
body.tema-lista .lista-add svg { width: 16px; height: 16px; fill: currentColor; }
body.tema-lista .lista-btn-foto, body.tema-lista .lista-btn-wa {
	flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
	border: 0; border-radius: 9px; font: inherit; font-size: .86rem; font-weight: 600; padding: 8px 14px; cursor: pointer;
}
body.tema-lista .lista-btn-foto { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
body.tema-lista .lista-btn-foto:hover { border-color: var(--accent); color: var(--accent); }
body.tema-lista .lista-btn-wa { background: #25d366; color: #06280f; }
body.tema-lista .lista-btn-wa svg { width: 16px; height: 16px; fill: currentColor; }
body.tema-lista .lista-btn-wa:hover { filter: brightness(1.05); }

@media (max-width: 640px) {
	body.tema-lista .lista-card { flex-direction: column; }
	body.tema-lista .lista-photo { flex: none; width: 100%; min-height: 0; aspect-ratio: 4 / 3; }
	body.tema-lista .lista-actions .lista-add,
	body.tema-lista .lista-actions .lista-btn-foto,
	body.tema-lista .lista-actions .lista-btn-wa { flex: 1 1 auto; justify-content: center; }
}


/* =========================================================================================================
   FICHA DE PRODUCTO — vista de un solo producto (/c/<token>?p=<item>): galería + datos completos + acciones.
   ========================================================================================================= */
.mag-card[data-detalle] { cursor: pointer; }        /* la tarjeta lleva a la ficha */

.det-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.det-top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.det-back { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none; font-weight: 600; font-size: .92rem; }
.det-back svg { width: 20px; height: 20px; fill: currentColor; }
.det-back:hover { text-decoration: underline; }
.det-logo { max-height: 40px; max-width: 170px; object-fit: contain; }

.det-wrap { padding: 26px 20px 64px; }
.detalle-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; align-items: start; }

.det-main { position: relative; aspect-ratio: 1 / 1; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.det-main .mag-photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.det-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.det-thumb { width: 64px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.det-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.det-thumb.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.det-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.det-tag { font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; color: var(--ink-faint); background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
.det-tag-marca { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.det-name { font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1.18; margin: 0 0 6px; color: var(--ink); display: block; -webkit-line-clamp: unset; overflow: visible; }
.det-code { margin: 0 0 16px; font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.det-prices { display: flex; flex-wrap: wrap; gap: 10px 30px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.det-price { display: flex; flex-direction: column; }
.det-price-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 600; }
.det-price-value { font-size: 1.7rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.det-price-value .cur { font-size: .68em; color: var(--ink-faint); font-weight: 500; margin-right: .12em; }
.det-price-b .det-price-value { font-size: 1.2rem; color: var(--ink-soft); }
.det-price .price-ask { font-size: 1.1rem; font-weight: 600; color: var(--ink-soft); }
.det-iva { margin: 8px 0 0; font-size: .8rem; color: var(--ink-faint); }
.det-carac { margin-top: 20px; }
.det-sub { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 0 0 6px; }
.det-carac-txt { font-size: .96rem; color: var(--ink-soft); line-height: 1.6; }
.det-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.det-add { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: .98rem; padding: 13px 18px; }
.det-add svg { width: 18px; height: 18px; fill: currentColor; }
.det-btn-foto, .det-btn-wa { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 10px; font: inherit; font-weight: 600; padding: 13px 16px; cursor: pointer; }
.det-btn-foto { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.det-btn-foto:hover { border-color: var(--accent); color: var(--accent); }
.det-btn-wa { background: #25d366; color: #06280f; }
.det-btn-wa svg { width: 18px; height: 18px; fill: currentColor; }
.det-btn-wa:hover { filter: brightness(1.05); }

/* En la ficha, la barra inferior móvil solo ofrece Carrito (no hay grilla ni filtros). */
body.vista-detalle #mbar-buscar, body.vista-detalle #mbar-cargar { display: none; }

@media (max-width: 820px) { .detalle-card { grid-template-columns: 1fr; gap: 20px; } }

/* =========================================================================================================
   MAESTROS / ESCLAVOS — presentaciones de un mismo producto (misma info, distinta talla/color/tamaño).
   La grilla muestra una tarjeta por producto con insignia "N presentaciones"; el detalle trae el selector.
   ========================================================================================================= */
/* Insignia sobre la foto (grilla, lista y escaparate). */
.mag-badge-pres {
	position: absolute; top: 8px; right: 8px; z-index: 2;
	background: var(--accent); color: var(--accent-ink);
	font-size: .68rem; font-weight: 700; letter-spacing: .02em;
	padding: 4px 8px; border-radius: 999px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
	pointer-events: none;
}
/* Etiqueta de presentación única (Talla/Color) en la tarjeta cuando el producto no es un grupo. */
.mag-pres { margin: 2px 0 0; font-size: .78rem; color: var(--ink-soft); font-weight: 600; }
.lista-pres { margin: 2px 0 4px; }
/* El "Elegir presentación" es un enlace con pinta de botón (.mag-add): resetea el subrayado y centra. */
.mag-choose { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.mag-choose:hover { text-decoration: none; }
.mag-choose svg { width: 18px; height: 18px; fill: currentColor; }

/* Selector de presentaciones en la ficha. */
.det-pres { margin: 0 0 16px; }
.det-pres-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 600; margin-bottom: 6px; }
.det-pres-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.det-pres-chip {
	border: 1px solid var(--line); background: var(--surface); color: var(--ink);
	font: inherit; font-size: .84rem; font-weight: 600;
	padding: 7px 13px; border-radius: 999px; cursor: pointer;
	transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.det-pres-chip:hover { border-color: var(--accent); color: var(--accent); }
.det-pres-chip.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.det-pres-solo { margin: 0 0 16px; font-size: .9rem; color: var(--ink-soft); }
.det-pres-solo .det-pres-label { display: inline; text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--ink-faint); }

/* =========================================================================================================
   TIPOGRAFÍAS (Fuente) — seleccionables por catálogo, auto-alojadas (subset latin, con acentos y ñ). Cada
   "fuente" es un emparejamiento titular+cuerpo que se combina con tema y paleta. Se implementa redefiniendo
   los tokens --serif (titular) y --sans (cuerpo) en body.fuente-<clave>, de modo que todo el CSS existente
   (que ya usa esos tokens) adopte la tipografía sin conflictos de especificidad. '' (Moderna) = sin clase.
   ========================================================================================================= */
@font-face { font-family: 'Inter';         font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter';         font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces';      font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/fraunces-600.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/spacegrotesk-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins';       font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins';       font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Archivo';       font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/archivo-400.woff2') format('woff2'); }
@font-face { font-family: 'Archivo';       font-style: normal; font-weight: 800; font-display: swap; src: url('fonts/archivo-800.woff2') format('woff2'); }
@font-face { font-family: 'Oswald';        font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/oswald-600.woff2') format('woff2'); }

body.fuente-elegante { --serif: 'Fraunces', Georgia, serif;               --sans: 'Inter', system-ui, sans-serif;  --fhw: 600; }
body.fuente-fuerte   { --serif: 'Space Grotesk', system-ui, sans-serif;   --sans: 'Inter', system-ui, sans-serif;  --fhw: 600; }
body.fuente-amable   { --serif: 'Poppins', system-ui, sans-serif;         --sans: 'Poppins', system-ui, sans-serif; --fhw: 600; }
body.fuente-titular  { --serif: 'Archivo', system-ui, sans-serif;         --sans: 'Archivo', system-ui, sans-serif; --fhw: 800; }
body.fuente-tecnica  { --serif: 'Oswald', system-ui, sans-serif;          --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --fhw: 600; }

/* Titulares que NO usan var(--serif) por sí mismos (comercio hereda --sans; la ficha no fija familia): se les
   asigna la familia del titular y el peso disponible de la fuente elegida, para que el titular luzca en todos los temas. */
body[class*="fuente-"] .com-title,
body[class*="fuente-"] .det-name { font-family: var(--serif); }
body[class*="fuente-"] .mag-title,
body[class*="fuente-"] .com-title,
body[class*="fuente-"] .esc-title,
body[class*="fuente-"] .det-name { font-weight: var(--fhw, 700); }

/* ============================================================================================
   Existencia (mostrar_stock: 1 = disponible/agotado, 2 = cantidad exacta) — tarjetas y ficha
   ============================================================================================ */
.mag-stock-line{ margin:.15rem 0 0; }
.det-stock-line{ margin:.4rem 0 0; }
.mag-stock{ display:inline-block; font-size:.72rem; font-weight:700; border-radius:999px; padding:2px 9px; letter-spacing:.02em; }
.mag-stock-on{ color:#0a7d33; background:rgba(16,163,74,.13); }
.mag-stock-off{ color:#b91c1c; background:rgba(220,38,38,.13); }
