/* Juguetería LIVE · estilos. Identidad aprobada: Poppins, negro, panel, verde y blanco. */

@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/poppins-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/poppins-latin-800-normal.woff2') format('woff2'); }

:root {
  --negro: #0B0F12;
  --panel: #172126;
  --panel-2: #1F2D34;
  --borde: #5E7885; /* 3,51:1 sobre el panel (medido con contraste.mjs) */
  --texto-suave: #B7C4CB;
  --verde: #75FF45;
  --blanco: #F7F9FC;
  --error-sobre-oscuro: #FF9C93;

  /* Superficie clara del formulario (mockup 3) */
  --claro-fondo: #F7F9FC;
  --claro-panel: #FFFFFF;
  --claro-texto: #0B0F12;
  --claro-suave: #44545C;
  --claro-borde: #5F717A;
  --claro-error: #B3261E;
  --claro-aviso: #E8F1F6;

  --foco: var(--blanco);
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --e1: 4px; --e2: 8px; --e3: 12px; --e4: 16px; --e5: 24px;
  --tipografia: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --alto-barra: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: calc(var(--alto-barra) + var(--e4)); }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--negro);
  color: var(--blanco);
  font-family: var(--tipografia);
  font-size: 1rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
body.con-barra { padding-bottom: calc(var(--alto-barra) + var(--e5) + env(safe-area-inset-bottom, 0px)); }

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }

.saltar {
  position: absolute; left: var(--e2); top: -64px; z-index: 50;
  padding: var(--e2) var(--e4); border-radius: var(--r-s);
  background: var(--verde); color: var(--negro); font-weight: 700; text-decoration: none;
}
.saltar:focus { top: var(--e2); }

/* ---------- Cabecera ---------- */
.cabecera { padding: var(--e3) var(--e4) var(--e2); background: var(--negro); }
.cabecera__fila { display: flex; align-items: center; gap: var(--e3); }
.cabecera__logo { width: 80px; height: auto; object-fit: contain; flex: none; }
.cabecera__titulo { font-size: 1.375rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }
.cabecera__titulo span { color: var(--verde); }

/* Carrusel de promociones: deslizamiento nativo con scroll-snap, sin autoplay ni librerías. La proporción se reserva por
   CSS para que la página no salte mientras carga el banner (arte completo 1824×798 en todas las pantallas). En el celular
   ocupa todo el ancho de la pantalla, sin el margen lateral, para que los textos del arte se lean más grandes. */
.promos { margin: var(--e3) calc(-1 * var(--e4)) 0; }
.promos__pista {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  border-radius: var(--r-l); scrollbar-width: none;
}
.promos__pista::-webkit-scrollbar { display: none; }
.promos__pista:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; }
.promos__item { flex: 0 0 100%; min-width: 0; scroll-snap-align: center; scroll-snap-stop: always; }
.promos__item a { display: block; border-radius: var(--r-l); }
.promos__img { display: block; width: 100%; height: auto; aspect-ratio: 1824 / 798; border-radius: var(--r-l); background: var(--panel); }
.promos__puntos { display: flex; justify-content: center; gap: var(--e1); margin-top: var(--e1); }
.promos__punto {
  display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; background: none; cursor: pointer; border-radius: 50%;
}
.promos__punto::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--borde); }
.promos__punto[aria-current='true']::before { background: var(--verde); }
@media (pointer: coarse) { .promos__punto { width: 36px; height: 36px; } }
@media (min-width: 672px) { .promos { max-width: 640px; margin-inline: auto; } }
@media (min-width: 900px) { .promos { max-width: 880px; } }

.franja-pruebas {
  margin: var(--e2) 0 0; padding: 6px var(--e3); border: 1px dashed var(--verde); border-radius: var(--r-s);
  color: var(--verde); font-size: 0.75rem; font-weight: 600; text-align: center;
}

/* ---------- Catálogo ---------- */
.catalogo { padding: var(--e2) var(--e4) var(--e5); outline: none; }
.catalogo__titulo { font-size: 1.125rem; font-weight: 700; margin-bottom: var(--e2); }

.filtros {
  display: flex; gap: var(--e2); margin: 0 calc(var(--e4) * -1) var(--e3); padding: 2px var(--e4);
  overflow-x: auto; scrollbar-width: none;
}
.filtros::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 32px; padding: 4px var(--e3); border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 2px solid var(--borde); color: var(--blanco);
  font-size: 0.8125rem; font-weight: 600;
  transition: transform 0.15s ease;
}
@media (pointer: coarse) { .chip { min-height: 36px; } }
.chip:hover { border-color: var(--verde); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed='true'] { background: var(--verde); border-color: var(--verde); color: var(--negro); }

.rejilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e3); }
@media (min-width: 640px) {
  .catalogo { max-width: 1100px; margin-inline: auto; padding-inline: var(--e5); }
  .rejilla { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--e4); }
}

.tarjeta {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--r-m);
}
.tarjeta__foto { width: 100%; aspect-ratio: 5 / 4; object-fit: cover; background: var(--panel-2); }
.tarjeta__cuerpo { display: flex; flex-direction: column; gap: var(--e2); flex: 1; padding: var(--e2) var(--e2) var(--e3); min-width: 0; }
.tarjeta__nombre { font-size: 0.875rem; font-weight: 700; line-height: 1.25; }
.tarjeta__precio { font-size: 1.125rem; font-weight: 800; color: var(--verde); line-height: 1.1; }
.tarjeta__ejemplo { font-size: 0.75rem; color: var(--texto-suave); }
.tarjeta__acciones { display: grid; gap: 6px; margin-top: auto; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2);
  min-height: 40px; padding: 8px var(--e3); border-radius: var(--r-s); cursor: pointer;
  border: 2px solid transparent; font-size: 0.8125rem; font-weight: 700; line-height: 1.2; text-align: center;
  text-decoration: none; transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--primario { background: var(--verde); color: var(--negro); border-color: var(--verde); }
.btn--primario:hover { opacity: 0.9; }
.btn--secundario { background: transparent; color: var(--blanco); border-color: var(--verde); }
.btn--secundario:hover { background: var(--panel-2); }
.btn--grande { width: 100%; min-height: 52px; font-size: 1rem; }
.btn__icono { flex: none; width: 18px; height: 18px; }
/* Agotado: legible (no un verde desvanecido) y claramente distinto de «Pedir ahora». */
.btn--agotado, .btn--agotado[disabled] { opacity: 1; background: var(--panel-2); color: var(--texto-suave); border-color: var(--borde); }
.btn--whatsapp { background: var(--verde); color: var(--negro); border-color: var(--verde); }
.btn--enlace { background: none; color: var(--verde); border: 0; padding-inline: 0; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; }

@media (pointer: coarse) { .btn, .chip { min-height: 44px; } }

/* ---------- Estados ---------- */
.estado { min-height: 0; }
.estado:not(:empty) { margin-bottom: var(--e3); }
.aviso { padding: var(--e3); border-radius: var(--r-s); font-size: 0.875rem; }
.aviso--error { background: var(--panel); border: 2px solid var(--error-sobre-oscuro); color: var(--blanco); }
.aviso--info { background: var(--claro-aviso); border: 1px solid var(--claro-borde); color: var(--claro-texto); }
.vacio { padding: var(--e5) var(--e4); text-align: center; background: var(--panel); border-radius: var(--r-m); color: var(--texto-suave); }
.estado .btn { margin-top: var(--e2); }

.esqueleto { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--r-m); aspect-ratio: 3 / 4; animation: pulso 1.4s ease-in-out infinite alternate; }
@keyframes pulso { from { opacity: 0.45; } to { opacity: 1; } }

/* ---------- Barra fija ---------- */
.barra {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: var(--e3);
  padding: var(--e2) var(--e4) calc(var(--e2) + env(safe-area-inset-bottom, 0px));
  background: var(--panel); border-top: 2px solid var(--verde);
}
.barra__resumen { font-size: 0.875rem; font-weight: 600; min-width: 0; }
.barra__resumen b { color: var(--verde); font-weight: 800; }
.barra .btn { flex: none; min-width: 120px; }

/* ---------- Ventanas (hoja inferior en móvil) ---------- */
.ventana {
  position: fixed; inset: auto 0 0 0; margin: 0; padding: 0;
  width: 100%; max-width: none; max-height: 92dvh;
  border: 0; border-radius: var(--r-l) var(--r-l) 0 0;
  background: var(--panel); color: var(--blanco);
  overflow: hidden;
}
.ventana[open] { display: flex; flex-direction: column; animation: subir 0.22s ease-out; }
.ventana::backdrop { background: rgba(0, 0, 0, 0.72); animation: aparecer 0.22s ease-out; }
@keyframes subir { from { transform: translateY(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 640px) {
  .ventana { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: 90dvh; border-radius: var(--r-l); }
  .ventana[open] { animation: centrar 0.22s ease-out; }
  @keyframes centrar { from { transform: translate(-50%, -48%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
}

.ventana__cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--e3); padding: var(--e4) var(--e4) var(--e2); }
.ventana__titulo { font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.ventana__precio { font-size: 1.25rem; font-weight: 800; color: var(--verde); }
.ventana__cuerpo { flex: 1; min-height: 0; overflow-y: auto; padding: var(--e2) var(--e4) var(--e4); overscroll-behavior: contain; }
.ventana__pie { padding: var(--e3) var(--e4) calc(var(--e4) + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--borde); }

.cerrar {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: transparent; border: 2px solid currentColor; color: inherit;
}
.cerrar:hover { background: var(--panel-2); }
@media (pointer: coarse) { .cerrar { width: 44px; height: 44px; } }

.acc__foto { width: 100%; max-height: 200px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-m); background: var(--panel-2); }
.galeria { display: flex; gap: var(--e2); margin-top: var(--e2); overflow-x: auto; padding-bottom: 2px; }
.galeria[hidden] { display: none; }
.galeria__mini {
  flex: none; width: 56px; height: 44px; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--panel-2); border: 2px solid var(--borde); border-radius: var(--r-s);
}
.galeria__mini[aria-pressed='true'] { border-color: var(--verde); }
.galeria__mini img { width: 100%; height: 100%; object-fit: cover; }
.acc__descripcion { margin-top: var(--e3); font-size: 0.875rem; color: var(--texto-suave); }
.acc__subtitulo { margin: var(--e4) 0 var(--e2); font-size: 1rem; font-weight: 700; }
.acc__lista { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--e2); }
.acc__item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--e2); background: var(--panel-2); border-radius: var(--r-s); text-align: center; font-size: 0.75rem; line-height: 1.25; }
.acc__item img { width: 100%; max-width: 88px; aspect-ratio: 1; border-radius: var(--r-s); }
.acc__cant { font-weight: 700; color: var(--verde); }
.acc__vacio { grid-column: 1 / -1; color: var(--texto-suave); font-size: 0.875rem; }
.nota { margin-top: var(--e3); font-size: 0.75rem; color: var(--texto-suave); }
.nota--centro { text-align: center; }

/* ---------- Formulario (superficie clara, como el mockup) ---------- */
.ventana--clara { background: var(--claro-fondo); color: var(--claro-texto); --foco: var(--claro-texto); }
.ventana--clara .cerrar:hover { background: #E3EAEE; }
.ventana--clara .nota { color: var(--claro-suave); }
.ventana--clara .btn--primario,
.ventana--clara .btn--whatsapp { border-color: var(--claro-texto); }
.ventana--clara .btn--secundario { color: var(--claro-texto); border-color: var(--claro-texto); }
.ventana--clara .btn--secundario:hover { background: #E3EAEE; }
.ventana--clara .btn--enlace { color: var(--claro-texto); border: 0; font-weight: 700; }

.form__subtitulo { font-size: 1rem; font-weight: 700; margin: var(--e3) 0 var(--e2); }
.items { display: grid; gap: var(--e2); }
.item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--e2) var(--e3); align-items: center; padding: var(--e2); background: var(--claro-panel); border: 1px solid var(--claro-borde); border-radius: var(--r-m); }
.item__foto { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--panel); }
.item__nombre { font-size: 0.875rem; font-weight: 700; line-height: 1.25; }
.item__precio { font-size: 0.8125rem; color: var(--claro-suave); }
.item__mando { display: flex; align-items: center; gap: var(--e1); }
.paso {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-s); cursor: pointer;
  background: var(--claro-panel); border: 2px solid var(--claro-texto); font-size: 1.125rem; font-weight: 700; line-height: 1;
}
.paso:hover { background: #E3EAEE; }
.paso[disabled] { opacity: 0.4; cursor: not-allowed; }
.item__cant { min-width: 28px; text-align: center; font-weight: 700; }
.item__quitar { grid-column: 1 / -1; justify-self: end; min-height: 32px; padding: 0 var(--e2); background: none; border: 0; color: var(--claro-error); font-size: 0.75rem; font-weight: 600; text-decoration: underline; cursor: pointer; }
@media (pointer: coarse) { .paso { width: 44px; height: 44px; } .item__quitar { min-height: 40px; } }

.selector { margin-top: var(--e2); }
.selector__fila { display: flex; gap: var(--e2); }
.selector__fila .campo { flex: 1; min-width: 0; }

.grupo { margin-bottom: var(--e3); }
.etiqueta { display: block; margin-bottom: 4px; font-size: 0.875rem; font-weight: 600; }
.campo {
  width: 100%; min-height: 44px; padding: 8px var(--e3); border-radius: var(--r-s);
  background: var(--claro-panel); color: var(--claro-texto); border: 2px solid var(--claro-borde); font-size: 1rem;
}
.campo::placeholder { color: var(--claro-suave); opacity: 1; }
.campo[aria-invalid='true'] { border-color: var(--claro-error); }
.ayuda { margin-top: 4px; font-size: 0.75rem; color: var(--claro-suave); }
.error { margin-top: 4px; font-size: 0.8125rem; font-weight: 600; color: var(--claro-error); }
.error--general { margin: var(--e3) 0; padding: var(--e2) var(--e3); border: 2px solid var(--claro-error); border-radius: var(--r-s); background: var(--claro-panel); }

.total { margin: var(--e3) 0; font-size: 1.125rem; font-weight: 800; display: flex; justify-content: space-between; gap: var(--e3); }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Solicitud guardada ---------- */
.pie-comercial { max-width: 1200px; margin: var(--e3) auto; padding: var(--e3); color: var(--texto-suave); font-size: 0.75rem; text-align: center; }
.exito { display: flex; flex-direction: column; gap: var(--e3); padding-top: var(--e4); }
.exito__titulo { font-size: 1.375rem; font-weight: 800; outline: none; }
.exito__codigo { font-size: 1rem; }
.exito__paso { padding: var(--e3); background: var(--claro-aviso); border: 1px solid var(--claro-borde); border-radius: var(--r-s); }
.exito .btn { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .esqueleto { opacity: 0.8; }
}
