/*
 * Le Toy Factory — Cajón de cesta: skin visual (global)
 *
 * Cargado en TODAS las páginas porque el cajón se pinta en wp_footer
 * en cada página, no solo en cart/checkout.
 * Layout y comportamiento: el padre. Aquí: dimensiones, glassmorphism,
 * tipografía y foto portrait propios de LTF.
 *
 * Clase bugs del borrador anterior en cesta.css:
 *   .sgf-cart-drawer__panel  → no existe en el DOM → corregido a #sgf-cart-drawer
 *   .sgf-cart-drawer__overlay → no existe en el DOM → corregido a .sgf-cart-overlay
 */

/* ── Panel: 501 px, full height, glassmorphism ─────────────────────────── */

#sgf-cart-drawer {
	width: 501px;
	background: rgba(251, 251, 250, .86);
	backdrop-filter: blur(40px) saturate(1.6);
	border-left: none;
}

@media (max-width: 540px) {
	#sgf-cart-drawer { width: 100vw; }
}

/* ── Scrim ──────────────────────────────────────────────────────────────── */
/* Creado dinámicamente por cart-drawer.js (className = 'sgf-cart-overlay') */

.sgf-cart-overlay {
	background: rgba(20, 18, 18, .12);
	backdrop-filter: blur(20px) saturate(1.2);
}

/* ── Cabecera: h=60, pad 0 24px ─────────────────────────────────────────── */

.sgf-cart-drawer__header {
	height: 60px;
	padding: 0 24px;
	border-bottom: 1px solid var(--sgf-color-line, #dfdfde);
}

/* Tablero .d "Tus toys (1)": 12px uppercase (Fase C sobreescribirá el texto) */
.sgf-cart-drawer__title {
	font-size: var(--sgf-text-xs, 12px);
	font-weight: 400;
	letter-spacing: .02em;
	text-transform: uppercase;
}

/* Tablero .a "Cerrar": 12px uppercase, sin caja */
.sgf-cart-drawer__close {
	width: auto;
	height: auto;
	background: none;
	border: none;
	padding: 0;
	font-size: var(--sgf-text-xs, 12px);
	font-weight: 400;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--sgf-color-ink, #141212);
	cursor: pointer;
}

.sgf-cart-drawer__close svg { display: none; }

/* ── Zona de scroll: pad 24 px a los lados ──────────────────────────────── */

.sgf-cart-drawer__scroll {
	padding-inline: 24px;
}

/* ── Ítem: grid 3 cols (foto | datos | precio+qty), foto portrait 96×120 ── */

.sgf-cart-item {
	display: grid;
	grid-template-columns: 96px 1fr auto;
	column-gap: 16px;
	padding-block: 20px;
	border-top: 1px solid var(--sgf-color-line, #dfdfde);
	border-bottom: 0;
}

.sgf-cart-item + .sgf-cart-item { margin-top: 0; }

/* Foto portrait 4:5 */
.sgf-cart-item__media {
	width: 96px;
	height: 120px;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	background: var(--sgf-color-paper, #f4f2ef);
}

.sgf-cart-item__media img {
	width: 100%;
	height: 100%;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	display: block;
}

.sgf-cart-item__body {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	min-width: 0;
}

.sgf-cart-item__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
}

/* Nombre: 12px uppercase */
.sgf-cart-item__name {
	font-size: var(--sgf-text-xs, 12px);
	font-weight: 400;
	letter-spacing: .02em;
	text-transform: uppercase;
	line-height: 1.3;
	margin: 0;
}

/* Variante: 13px muted sin uppercase */
.sgf-cart-item__meta {
	font-size: 13px;
	text-transform: none;
	letter-spacing: normal;
	color: var(--sgf-color-ink-2, #6b6460);
	margin: 4px 0 0;
}

/* "Quitar": 11px muted uppercase */
.sgf-cart-item__remove {
	flex-shrink: 0;
	font-size: 11px;
	font-weight: 400;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--sgf-color-ink-2, #6b6460);
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	line-height: 1;
}

.sgf-cart-item__remove:hover {
	color: var(--sgf-color-ink, #141212);
}

.sgf-cart-item__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-block-start: 8px;
}

/* Precio 3ª columna */
.sgf-cart-item__price {
	font-size: 14px;
	font-weight: 400;
	font-variant-numeric: tabular-nums;
	color: var(--sgf-color-ink, #141212);
	white-space: nowrap;
	margin: 0;
}

/* ── Stepper de cantidad: inline-flex 32px, box-shadow como borde ────────── */

.sgf-qty {
	display: inline-flex;
	align-items: center;
	height: 32px;
	box-shadow: inset 0 0 0 1px var(--sgf-color-line, #dfdfde);
	border: none;
	border-radius: 0;
	padding: 0;
	font-variant-numeric: tabular-nums;
}

.sgf-qty__btn {
	width: 32px;
	height: 32px;
	display: grid;
	place-items: center;
	border: none;
	background: none;
	cursor: pointer;
	color: var(--sgf-color-ink, #141212);
	font-size: 16px;
	flex-shrink: 0;
}

.sgf-qty__value {
	font-size: 14px;
	font-weight: 400;
	font-variant-numeric: tabular-nums;
	width: 32px;
	text-align: center;
}

/* ── Pie del cajón: pad 20 24 24, border-top sutil ──────────────────────── */

.sgf-cart-drawer__footer {
	padding: 20px 24px 24px;
	border-top: 1px solid rgba(20, 18, 18, .08);
}

/* Subtotal flex: texto a la izquierda, importe a la derecha */
.sgf-cart-drawer__total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0;
	font-size: 14px;
	border: none;
}

.sgf-cart-drawer__total-amount {
	font-weight: 400;
	font-variant-numeric: tabular-nums;
}

/* ── Estado vacío: tablero Cesta-Vacia.dc.html ─────────────────────────── */

.sgf-cart-drawer__empty {
	padding-top: 40px;
	display: flex;
	flex-direction: column;
	flex: 1;
}

/* "Todavía no hay ningún par." — 20 px */
.sgf-cart-drawer__empty-title {
	font-size: 20px;
	line-height: 1.35;
	letter-spacing: -0.01em;
	margin: 0;
	font-weight: 400;
}

/* Subtexto muted — 14 px */
.sgf-cart-drawer__empty-desc {
	font-size: 14px;
	line-height: 1.55;
	color: var(--sgf-color-ink-2, #65605e);
	margin: 10px 0 0;
}

/* CTA al fondo del cajón */
.sgf-cart-drawer__empty-cta {
	margin-top: auto;
	padding: 24px 0;
}

.sgf-cart-drawer__empty-cta .sgf-btn {
	width: 100%;
	box-sizing: border-box;
}

/* ══ Ajuste al tablero Cesta-Lateral (medidas/Cesta-Lateral.json) ════════════
   Hoja de 501 a toda la altura, por encima de la cabecera. Dentro: cabecera
   de 60 · artículos · «Completa el look» en tres · desplegables · pie con
   el subtotal, el botón y «Ver tus toys». */

#sgf-cart-drawer {
	top: 0;
	bottom: 0;
	height: auto;
	max-height: none;
	z-index: calc(var(--sgf-z-nav, 1000) + 2);
	-webkit-backdrop-filter: blur(40px) saturate(1.6);
	display: flex;
	flex-direction: column;
	color: var(--sgf-color-text);
}
.sgf-cart-overlay { z-index: calc(var(--sgf-z-nav, 1000) + 1); -webkit-backdrop-filter: blur(20px) saturate(1.2); }

.sgf-cart-drawer__header { flex: none; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; }
.sgf-cart-drawer__title { margin: 0; line-height: 16px; }
.sgf-cart-drawer__close { line-height: 16px; }
.sgf-cart-drawer__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-block: 0 20px; scrollbar-width: none; }
.sgf-cart-drawer__scroll::-webkit-scrollbar { display: none; }

/* ── Artículo ────────────────────────────────────────────────────────────────
   El padre lo monta en tres renglones (nombre y «Quitar» · línea · precio y
   cantidad). El tablero pone el precio arriba a la derecha y «Quitar» junto
   a la cantidad: mismas piezas, recolocadas en una rejilla. */
#sgf-cart-drawer .sgf-cart-drawer__items { padding: 0; margin: 0; }
#sgf-cart-drawer .sgf-cart-item {
	display: grid;
	grid-template-columns: 96px 96px minmax(0, 1fr) auto;
	grid-template-rows: auto auto 1fr;
	column-gap: 16px;
	row-gap: 0;
	align-items: start;
	margin: 0;
	padding: 20px 0;
	border: 0;
	border-top: 1px solid var(--sgf-color-border);
	border-radius: 0;
	background: none;
}
#sgf-cart-drawer .sgf-cart-item:first-child { border-top: 0; margin-top: 15px; }
#sgf-cart-drawer .sgf-cart-item__media { grid-column: 1; grid-row: 1 / span 3; background: var(--sgf-color-bg-alt); }
#sgf-cart-drawer :is(.sgf-cart-item__body, .sgf-cart-item__head, .sgf-cart-item__foot) { display: contents; }
#sgf-cart-drawer .sgf-cart-item__name { grid-column: 2 / span 2; grid-row: 1; font-size: 12px; line-height: 16px; }
#sgf-cart-drawer .sgf-cart-item__price { grid-column: 4; grid-row: 1; font-size: 14px; line-height: 17px; text-align: right; }
#sgf-cart-drawer .sgf-cart-item__meta { grid-column: 2 / -1; grid-row: 2; margin: 5px 0 0; font-size: 13px; line-height: 17px; color: var(--sgf-color-muted); }
/* «talla 42» → «Talla 42»: la etiqueta del atributo viene en minúscula. */
#sgf-cart-drawer .sgf-cart-item__meta::first-letter { text-transform: uppercase; }
#sgf-cart-drawer .sgf-qty { grid-column: 2; grid-row: 3; margin: 16px 0 0; box-sizing: border-box; width: 96px; height: 32px; }
#sgf-cart-drawer .sgf-qty__btn { width: 32px; height: 32px; font-size: 14px; }
#sgf-cart-drawer .sgf-cart-item__remove {
	grid-column: 3; grid-row: 3; justify-self: start; align-self: start;
	width: auto; height: auto; min-height: 0; margin: 24px 0 0 4px; padding: 0 0 2px;
	font-size: 12px; line-height: 14px; letter-spacing: .02em; text-transform: uppercase; color: var(--sgf-color-muted);
	background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
}

/* ── Completa el look: tres fotos 4:5 ─────────────────────────────────────── */
/* Del tamaño de la foto del artículo (96 × 120), no a todo el ancho: a 146
   eran más grandes que lo que ya está en la cesta y se comían media hoja
   (Sam, 12 nov 2026). El nombre puede ir en dos líneas. */
.ltf-drawer-crossell { margin: 0; border-top: 1px dotted var(--ltf-punteado, #e9e7e6); }
.ltf-drawer-crossell__titulo { margin: 0 0 11px; padding: 16px 0 0; max-width: none; font-size: 12px; line-height: 16px; letter-spacing: .02em; text-transform: uppercase; }
#sgf-cart-drawer .ltf-drawer-crossell__grid { display: grid; grid-template-columns: repeat(3, 96px); gap: 16px; justify-content: start; list-style: none; margin: 0; padding: 0; }
.ltf-drawer-crossell__item { margin: 0; max-width: none; min-width: 0; }
.ltf-drawer-crossell__link { display: block; color: inherit; text-decoration: none; }
.ltf-drawer-crossell__media { display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--sgf-color-bg-alt); }
#sgf-cart-drawer .ltf-drawer-crossell__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ltf-drawer-crossell__cap { display: block; margin-top: 8px; font-size: 12px; line-height: 16px; letter-spacing: .02em; text-transform: uppercase; }
.ltf-drawer-crossell__nombre { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.ltf-drawer-crossell__precio { display: block; margin-top: 2px; color: var(--sgf-color-muted); }

/* ── Desplegables: los del padre, con la piel del acordeón ───────────────── */
#sgf-cart-drawer .sgf-drawer-panels { margin: 29px 0 0; padding: 0; border: 0; border-bottom: 1px dotted var(--ltf-punteado, #e9e7e6); }
#sgf-cart-drawer .sgf-drawer-panel { margin: 0; padding: 0; border: 0; border-top: 1px dotted var(--ltf-punteado, #e9e7e6); }
#sgf-cart-drawer .sgf-drawer-panel__title {
	display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer;
	height: 51px; padding: 0; font-size: 14px; font-weight: 400; line-height: 17px; letter-spacing: 0; text-transform: none;
}
#sgf-cart-drawer .sgf-drawer-panel__title::-webkit-details-marker { display: none; }
#sgf-cart-drawer .sgf-drawer-panel__title::after { content: "+"; background: none; border: 0; width: auto; height: auto; transform: none; }
#sgf-cart-drawer .sgf-drawer-panel[open] .sgf-drawer-panel__title::after { content: "−"; }
#sgf-cart-drawer .sgf-drawer-panel__body { padding: 0 0 18px; font-size: 14px; line-height: 1.5; color: var(--sgf-color-muted); }
#sgf-cart-drawer .sgf-drawer-panel__body p { margin: 0; max-width: none; }

/* ── Pie ──────────────────────────────────────────────────────────────────── */
#sgf-cart-drawer .sgf-cart-drawer__footer { flex: none; padding: 20px 24px 24px; border-top: 1px solid var(--sgf-color-border); background: none; }
#sgf-cart-drawer .sgf-cart-drawer__total { margin: 0; font-size: 14px; line-height: 17px; }
#sgf-cart-drawer .sgf-cart-drawer__total > span:first-child { color: var(--sgf-color-muted); }
#sgf-cart-drawer .sgf-cart-drawer__checkout {
	display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; height: 48px; min-height: 0;
	margin: 16px 0 0; padding: 0; border: 0; border-radius: 0; background: var(--sgf-color-text); color: var(--sgf-color-bg);
	font-size: 12px; font-weight: 400; line-height: 1; letter-spacing: .02em; text-transform: uppercase; text-decoration: none;
	transition: opacity .3s cubic-bezier(.16, 1, .3, 1);
}
#sgf-cart-drawer .sgf-cart-drawer__checkout:hover { opacity: .8; }
#sgf-cart-drawer .sgf-cart-drawer__ver-cesta {
	display: table; margin: 16px auto 0; padding-bottom: 2px; font-size: 12px; line-height: 14px; letter-spacing: .02em; text-transform: uppercase;
	color: inherit; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
}
#sgf-cart-drawer :is(.sgf-cart-drawer__checkout, .sgf-cart-drawer__ver-cesta, .sgf-cart-item__remove, .sgf-drawer-panel__title, .sgf-cart-drawer__close):focus-visible { outline: 2px solid var(--sgf-color-text); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
	#sgf-cart-drawer .sgf-cart-drawer__checkout { transition: none; }
}

/* ── Cesta vacía (tablero Cesta-Vacia) ───────────────────────────────────────
   Título a 20, una línea en gris, dos modelos con su foto 2:3 y, abajo del
   todo, «Ver la colección» con contorno. */
#sgf-cart-drawer .sgf-cart-drawer__scroll:has(.sgf-cart-drawer__empty) { display: flex; flex-direction: column; padding-bottom: 0; }
#sgf-cart-drawer .sgf-cart-drawer__empty { flex: 1; display: flex; flex-direction: column; padding: 40px 0 0; text-align: left; }
#sgf-cart-drawer .sgf-cart-drawer__empty-title { margin: 0; max-width: none; font-size: 20px; line-height: 27px; letter-spacing: -.01em; font-weight: 400; color: var(--sgf-color-text); }
#sgf-cart-drawer .sgf-cart-drawer__empty-desc { margin: 10px 0 0; max-width: none; font-size: 14px; line-height: 22px; color: var(--sgf-color-muted); }
.ltf-cesta-vacia__modelos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 32px; }
.ltf-cesta-vacia__modelo { display: block; color: inherit; text-decoration: none; }
.ltf-cesta-vacia__foto { display: block; aspect-ratio: 2 / 3; overflow: hidden; background: var(--sgf-color-bg-alt); }
#sgf-cart-drawer .ltf-cesta-vacia__foto img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ltf-cesta-vacia__nombre { display: block; margin-top: 7px; font-size: 12px; line-height: 16px; letter-spacing: .02em; text-transform: uppercase; }
#sgf-cart-drawer .sgf-cart-drawer__empty-cta { margin-top: auto; padding: 24px 0; }
#sgf-cart-drawer .sgf-cart-drawer__empty-cta .sgf-btn {
	display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; height: 48px; min-height: 0; padding: 0;
	border: 1px solid var(--sgf-color-text); border-radius: 0; background: none; color: var(--sgf-color-text);
	font-size: 12px; font-weight: 400; line-height: 1; letter-spacing: .02em; text-transform: uppercase; text-decoration: none;
}
#sgf-cart-drawer .sgf-cart-drawer__empty-cta .sgf-btn:hover { background: var(--sgf-color-text); color: var(--sgf-color-bg); }

/* ══ Móvil: la cesta es una hoja a pantalla completa (M-Cesta, 390) ══════════
   16 de margen y foto de 80 × 100. «Completa el look» va como en
   escritorio: tres de 96 caben sin carril. */
@media (max-width: 600px) {
	#sgf-cart-drawer .sgf-cart-drawer__header { padding-inline: 16px; }
	#sgf-cart-drawer .sgf-cart-drawer__scroll { padding-inline: 16px; }
	#sgf-cart-drawer .sgf-cart-drawer__footer { padding: 16px 16px max(28px, env(safe-area-inset-bottom, 28px)); }
	#sgf-cart-drawer .sgf-cart-item { grid-template-columns: 80px 96px minmax(0, 1fr) auto; }
	#sgf-cart-drawer .sgf-cart-item__media { width: 80px; height: 100px; }
}


/* Los dos estados del cajón van siempre en el HTML y el que no toca lleva
   `hidden` (inc/ltf-cesta.php, 16 nov 2026). Las reglas de arriba les dan
   `display` con el id delante, que pesa más que el `hidden` del navegador:
   sin esto se verían la cesta vacía y la llena a la vez. */
#sgf-cart-drawer .ltf-cajon-vacio[hidden],
#sgf-cart-drawer .ltf-cajon-lleno[hidden],
#sgf-cart-drawer .sgf-cart-drawer__footer[hidden] {
	display: none;
}
