/* =========================================================
   NÜMO · Caja de compra ("Elige tu café") — 25-sep-2026
   Sustituye a las tres tarjetas de precio. Una foto que muestra
   cuántos envases te llevas, los 4 packs (1·3·6·12) como atajos y
   un contador − n + pegado al botón para cualquier cantidad (1–99).
   La comparten las dos plantillas (index.html y mobile/index.html):
   se adapta con container queries al ancho que tenga, no a la
   pantalla. Todo lleva prefijo bb-/bbox para no chocar con el
   carrito, que ya usa .qty.
   Lógica en js/buybox.js; precio en js/pricing.js.
   ========================================================= */

.bbox { container-type: inline-size; }
/* El aviso se oculta con el atributo `hidden`, pero `.bbox__nudge` pone
   display:flex y lo pisaría: la hoja del móvil no trae la regla general
   `[hidden] { display: none !important }`. Sin esto sale una caja vacía. */
.bbox [hidden] { display: none !important; }
.bbox__grid { display: grid; gap: 24px; }
@container (min-width: 720px) {
  .bbox__grid { grid-template-columns: .9fr 1.1fr; gap: 40px; align-items: start; }
  .bbox__stage { position: sticky; top: 96px; min-height: 560px; }
}

/* --- Foto: los envases que te llevas --------------------------------- */
.bbox__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 390px;
  padding: 20px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    radial-gradient(60% 55% at 50% 60%, rgba(197, 112, 77, .20), transparent 70%),
    var(--bg-1);
  overflow: hidden;
}
.bbox__bottles {
  position: relative;
  z-index: 1;
  display: grid;
  justify-content: center;
  align-content: center;
  gap: 10px 8px;
}
/* Sombra de apoyo, enganchada a la BASE de los envases (antes iba fija al
   fondo del recuadro y, como el alto de los envases cambia con la cantidad,
   quedaba flotando por debajo). z-index -1 dentro del contexto de
   .bbox__bottles: por detrás de los envases, por delante del fondo. */
/* Sobre el fondo casi negro una sombra sola no se ve: primero un charco de
   luz cálida en el "suelo" (::before) y encima la sombra de contacto (::after). */
.bbox__bottles::before,
.bbox__bottles::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.bbox__bottles::before {
  left: -22%; right: -22%;
  bottom: -26px;
  height: 56px;
  background: radial-gradient(closest-side, rgba(216, 138, 99, .22), rgba(197, 112, 77, .08) 55%, transparent);
}
.bbox__bottles::after {
  left: -3%; right: -3%;
  bottom: -8px;
  height: 18px;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .95), rgba(0, 0, 0, .5) 55%, transparent);
}
.bbox__bottles img {
  height: var(--h);
  width: auto;
  max-width: none;
  justify-self: center;
  filter: drop-shadow(0 14px 12px rgba(0, 0, 0, .65)) drop-shadow(0 4px 4px rgba(0, 0, 0, .4));
  animation: bb-pop .45s cubic-bezier(.2, .8, .2, 1.2) both;
}
@keyframes bb-pop {
  from { opacity: 0; transform: translateY(14px) scale(.92); }
  to { opacity: 1; transform: none; }
}
/* Altura del envase según cuántos se ven. Con 6 y 12 van en dos filas. */
.bb-s1  { --h: 320px; }
.bb-s3  { --h: 280px; }
.bb-s6  { --h: 170px; }
.bb-s12 { --h: 165px; gap: 8px 4px; }
@container (min-width: 720px) {
  .bb-s1  { --h: 400px; }
  .bb-s3  { --h: 340px; }
  .bb-s6  { --h: 225px; }
  .bb-s12 { --h: 205px; gap: 10px 5px; }
}
/* Más de 12: se ven 12 y una etiqueta con el resto. */
.bbox__more {
  position: absolute;
  right: -14px; top: -10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #1a0e08;
  font-weight: 800;
  font-size: 13px;
}

/* --- Panel ------------------------------------------------------------ */
.bbox__eyebrow {
  margin: 0 0 8px;
  color: var(--accent-hot);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .22em;
}
.bbox__title {
  margin: 0 0 18px;
  font-size: clamp(24px, 3cqi, 32px);
  font-weight: 800;
  line-height: 1.15;
  text-wrap: balance;
}

/* Los 4 packs: el primer número de cada tramo de precio.
   27-sep-2026: menos texto y más jerarquía. Cada tarjeta dice cuántas,
   cuánto y qué ganas (una píldora abajo); el "envío gratis" es una franja al
   pie en vez de otra línea. La elegida se ilumina en cobre con un check, y
   las demás quedan en segundo plano: el ojo va a la elección y al botón. */
.bbox__tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 12px; /* fila holgada: la insignia de abajo no roza la tarjeta de arriba */
  margin: 6px 0 18px;
}
.bb-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--bg-1);
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  overflow: visible;
  transition: border-color .2s, transform .2s, opacity .2s, background .2s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.bb-tile:hover { transform: translateY(-2px); }
.bb-tile:focus-visible { outline: 2px solid var(--accent-hot); outline-offset: 2px; }
.bb-tile.is-on {
  border-color: var(--accent);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(216, 138, 99, .22), transparent 70%),
    #140e0c;
  box-shadow: 0 0 0 1px var(--accent), 0 18px 36px -26px rgba(216, 138, 99, .4);
}
/* Check de la elegida, arriba a la derecha. */
.bb-tile.is-on::after {
  content: "";
  position: absolute;
  top: 10px; right: 10px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%231a0e08' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.bb-tile.is-on .bb-tile__n { color: var(--accent-hot); }
/* Cantidad libre: los packs se apagan y se marca el del tramo en el que cae. */
.bbox__tiles.is-free .bb-tile { opacity: .55; }
.bbox__tiles.is-free .bb-tile.is-tier {
  opacity: 1;
  border-color: var(--accent-glow);
  border-style: dashed;
}
.bb-tile.is-tier .bb-tile__e { color: var(--accent-hot); font-weight: 700; }
.bb-tile__n { display: block; font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.bb-tile__u { display: block; margin: 5px 0 14px; font-size: 10.5px; letter-spacing: .2em; color: var(--ink-mute); }
.bb-tile__p { display: block; font-size: 21px; font-weight: 800; line-height: 1.1; }
.bb-tile__e { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-mute); }
/* Píldora de abajo: el descuento, o "Para probar" en la de 1. Siempre al pie
   (margin-top:auto) para que las de una misma fila queden alineadas. */
.bb-tile__off {
  display: inline-block;
  margin-top: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(127, 191, 142, .13);
  color: #8fd19e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}
.bb-tile__e + .bb-tile__off { margin-top: 12px; }
.bb-tile__off--mute {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink-mute);
  font-weight: 600;
}
/* Franja "envío gratis" al pie (la rellena js/buybox.js según el umbral). */
.bb-tile__ship {
  align-self: stretch;
  margin: 14px -8px -14px;
  padding: 7px 4px;
  border-top: 1px solid rgba(127, 191, 142, .18);
  border-radius: 0 0 15px 15px;
  background: rgba(127, 191, 142, .07);
  color: #8fd19e;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em; /* "SPEDIZIONE GRATUITA" / "KOSTENLOSER VERSAND" caben en 1 línea a 360 px */
  text-transform: uppercase;
}
.bb-tile__ship:empty { display: none; }
@container (min-width: 720px) {
  .bb-tile { padding: 24px 10px 16px; }
  .bb-tile__n { font-size: 46px; }
  .bb-tile__ship { margin: 14px -10px -16px; }
}
.bb-badge {
  position: absolute;
  top: -11px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #1a0e08;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* Aviso "con 1 más…" / "por el mismo precio te llevas 12". */
.bbox__nudge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--accent-glow);
  border-radius: 10px;
  background: rgba(197, 112, 77, .10);
  font-size: 13.5px;
  line-height: 1.4;
}
.bbox__nudge b { color: var(--accent-hot); white-space: nowrap; }
.bbox__nudge button {
  flex: none;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent-hot);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

/* Contador − n + pegado al botón de añadir. */
.bbox__buy { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: stretch; }
.bb-qty {
  display: grid;
  grid-template-columns: 40px 48px 40px;
  align-items: center;
  height: 54px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-card);
}
.bb-qty button {
  height: 46px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bb-qty button:hover { background: rgba(255, 255, 255, .06); }
.bb-qty button:disabled { opacity: .35; cursor: default; background: transparent; }
.bb-qty input {
  width: 100%;
  height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.bb-qty input:focus { outline: none; background: rgba(197, 112, 77, .10); border-radius: 8px; }
.bb-qty button:focus-visible { outline: 2px solid var(--accent-hot); outline-offset: -2px; }
.bbox__cta.btn {
  width: 100%;
  min-height: 54px;
  padding: 12px 10px;
  font-size: 14px;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 14px 28px -18px rgba(216, 138, 99, .5);
}

/* Bajo el botón, centradas: lo que ahorras (o el desglose de una cantidad
   libre) y el envío. Antes había además una ayuda del contador y un
   resumen que repetía la tarjeta elegida. */
.bbox__sum {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.bbox__sum:empty { display: none; }
.bbox__sum em { font-style: normal; color: #8fd19e; font-weight: 700; white-space: nowrap; }
.bbox__sum::first-letter { text-transform: uppercase; }
.bbox__ship {
  margin: 4px 0 0;
  color: var(--ink-mute);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}
.bbox__sum:empty + .bbox__ship { margin-top: 14px; }
.bbox__ship:empty { display: none; }
.bbox__ship.is-free { color: #8fd19e; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .bbox__bottles img { animation: none; }
  .bb-tile { transition: none; }
}
