/*
 * Sistema visual de las muestras: color fuerte del rubro en bloques grandes,
 * tipografía grande, tarjetas de doble bisel y movimiento con curvas marcadas.
 * Pensado para abrirse desde WhatsApp en el celular.
 */
:root {
  --acento: #2554c7;
  --acento-suave: color-mix(in oklab, var(--acento) 10%, white);
  --acento-medio: color-mix(in oklab, var(--acento) 22%, white);
  --acento-claro: color-mix(in oklab, var(--acento) 55%, white);
  --acento-oscuro: color-mix(in oklab, var(--acento) 70%, black);
  --acento-noche: color-mix(in oklab, var(--acento) 35%, #0b0b0d);
  --fondo: color-mix(in oklab, var(--acento) 5%, #f3f2ee);
  --panel: #ffffff;
  --tinta: #141416;
  --tinta-2: #46464d;
  --tinta-3: #6a6a72;
  --hilo: rgb(20 20 22 / 0.07);
  --ok: #15803d;
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --sombra-flotante: 0 30px 60px -28px color-mix(in oklab, var(--acento) 45%, rgb(0 0 0 / 0.5)), 0 2px 6px rgb(0 0 0 / 0.04);
  --sombra-suave: 0 18px 40px -24px rgb(20 20 22 / 0.28);
}

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

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font: 16px/1.55 var(--sans);
  color: var(--tinta);
  background: var(--fondo);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* Grano de papel: fijo y sin eventos, para no costar repintados al hacer scroll. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1.02; letter-spacing: -0.035em; text-wrap: balance; font-weight: 750; }
p { margin: 0; }
::selection { background: var(--acento-medio); }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; border-radius: 10px; }

button, a, [role='button'] { touch-action: manipulation; }
button, [role='button'], .pill { user-select: none; -webkit-user-select: none; }

input, textarea, select {
  width: 100%;
  font: 16px/1.4 var(--sans);
  color: var(--tinta);
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--fondo);
  box-shadow: inset 0 0 0 1px var(--hilo);
  caret-color: var(--acento);
  transition: box-shadow 160ms var(--ease-out), background 160ms var(--ease-out);
}
input:focus, textarea:focus, select:focus { outline: none; background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--acento), 0 0 0 4px var(--acento-medio); }
input::placeholder { color: var(--tinta-3); }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.i-chica { width: 16px; height: 16px; stroke-width: 1.6; }

.contenedor { width: min(640px, 100%); margin: 0 auto; padding: 0 18px; }

/* Doble bisel: bandeja exterior + núcleo interior con radios concéntricos. */
.bisel { padding: 6px; border-radius: 30px; background: rgb(255 255 255 / 0.55); box-shadow: inset 0 0 0 1px var(--hilo), var(--sombra-suave); }
.bisel > .nucleo { border-radius: 24px; background: var(--panel); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.9), 0 1px 2px rgb(20 20 22 / 0.05); }
.bisel.flotante { box-shadow: inset 0 0 0 1px var(--hilo), var(--sombra-flotante); }

/* Botón píldora con la flecha en su propio círculo. */
.boton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  padding: 6px 8px 6px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--tinta);
  color: #fff;
  font: 600 16px/1 var(--sans);
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background 200ms var(--ease-out), opacity 200ms;
}
.boton .orbita { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: rgb(255 255 255 / 0.14); transition: transform 280ms var(--ease-out); }
.boton:active { transform: scale(0.97); }
.boton[disabled] { opacity: 0.35; cursor: not-allowed; }
.boton.acento { background: var(--acento); }
.boton.claro { background: var(--panel); color: var(--tinta); }
.boton.claro .orbita { background: var(--acento-suave); color: var(--acento-oscuro); }
.boton.sin-orbita { padding: 0 24px; }
.boton.ancho { width: 100%; justify-content: space-between; }
@media (hover: hover) and (pointer: fine) {
  .boton:hover .orbita { transform: translate(2px, -1px) scale(1.06); }
  .boton.acento:hover { background: var(--acento-oscuro); }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--hilo);
  color: var(--tinta-2);
  font: 600 14px var(--sans);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 200ms var(--ease-out), color 200ms var(--ease-out), transform 140ms var(--ease-out);
}
.pill:active { transform: scale(0.96); }
.pill[aria-pressed='true'] { background: var(--tinta); color: #fff; box-shadow: none; }

.estado-vivo { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; background: rgb(255 255 255 / 0.16); font-size: 13px; font-weight: 600; }
.estado-vivo::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #86efac; box-shadow: 0 0 0 4px rgb(134 239 172 / 0.25); }

.tenue { color: var(--tinta-3); }
.precio { font-weight: 700; letter-spacing: -0.02em; }

/* Aviso de muestra */
.aviso-muestra {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 18px 8px;
  background: #0b0b0d;
  color: #d9d9d4;
  font-size: 12.5px;
  text-align: center;
}
.aviso-muestra b { color: #fff; font-weight: 600; }
.aviso-muestra { align-items: center; gap: 10px; }
.aviso-muestra .volver { display: inline-flex; align-items: center; gap: 2px; flex: none; padding: 5px 10px 5px 6px; border-radius: 999px; background: rgb(255 255 255 / 0.12); color: #fff; font-weight: 600; text-decoration: none; }

/* Cierre con contacto del vendedor */
.pie-muestra { padding: 72px 18px calc(56px + env(safe-area-inset-bottom, 0px)); }
.pie-muestra .nucleo { padding: 34px 24px; display: grid; gap: 14px; justify-items: center; text-align: center; color: var(--tinta-2); }
.pie-muestra h2 { font-size: clamp(28px, 7vw, 40px); color: var(--tinta); }

/* Chat tipo WhatsApp para mostrar lo que llega */
.chat-vista { background: #ece5dd; border-radius: 22px; padding: 16px; display: grid; gap: 8px; }
.burbuja {
  justify-self: start;
  max-width: 86%;
  padding: 9px 12px 6px;
  border-radius: 4px 16px 16px 16px;
  background: #fff;
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.07);
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.burbuja.propia { justify-self: end; background: #d9fdd3; border-radius: 16px 4px 16px 16px; }
.burbuja time { display: block; text-align: right; font-size: 11px; color: #697179; margin-top: 2px; }

/* Hoja inferior */
.velo { position: fixed; inset: 0; z-index: 40; background: rgb(10 10 12 / 0.4); opacity: 0; transition: opacity 260ms var(--ease-out); }
.velo.abierta { opacity: 1; }
.hoja {
  position: fixed;
  z-index: 41;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border-radius: 30px 30px 0 0;
  padding: 12px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 420ms var(--ease-drawer);
}
.hoja.abierta { transform: none; }
.hoja::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: #dcdcd6; margin: 0 auto 16px; }
.hoja-contenido { width: min(600px, 100%); margin: 0 auto; display: grid; gap: 16px; }

/* Isla flotante inferior (carrito, pedido) */
.isla {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: min(560px, calc(100% - 28px));
  transform: translate(-50%, 140%);
  transition: transform 460ms var(--ease-drawer);
}
.isla.visible { transform: translate(-50%, 0); }
.isla .boton { width: 100%; justify-content: space-between; box-shadow: 0 22px 44px -18px rgb(0 0 0 / 0.55); }

.cantidad { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--fondo); }
.cantidad button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--panel);
  color: var(--tinta);
  cursor: pointer;
  transition: transform 120ms var(--ease-out);
}
.cantidad button:active { transform: scale(0.9); }
.cantidad button.mas { background: var(--acento); color: #fff; }
.cantidad output { min-width: 24px; text-align: center; font-weight: 700; }

/* Apariciones: escalonadas al entrar en pantalla (ver revelar() en comun.js). */
.revelar { opacity: 0; transform: translateY(28px); filter: blur(6px); transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out), filter 800ms var(--ease-out); transition-delay: calc(var(--orden, 0) * 70ms); }
.revelar.visto { opacity: 1; transform: none; filter: none; }
.aparecer { animation: aparecer 420ms var(--ease-out) both; }
@keyframes aparecer { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .revelar { transform: none; filter: none; transition: opacity 300ms ease; }
  .aparecer { animation: desvanecer 200ms ease both; }
  .hoja, .isla { transition-duration: 1ms; }
}
@keyframes desvanecer { from { opacity: 0; } }
