/* Sobre Bootstrap 5.3 (solo CSS). Diseño mobile-first. */

:root {
  --tinta: #191919;
  --tinta-suave: #5a5853;
  --fondo: #fcf7f3;
  --superficie: #fff;
  --linea: #e4dfd6;
  --acento: #1136dd;
  --lima: #d2f944;
  --acento-oscuro: #0c28a8;
  --radio: 16px;
  --separacion: 10px;
  --alto-barra: 76px;

  --bs-body-bg: var(--fondo);
  --bs-body-color: var(--tinta);
  --bs-link-color-rgb: 25, 25, 25;
  --bs-link-hover-color-rgb: 17, 54, 221;
}

@media (min-width: 560px) {
  :root { --separacion: 14px; }
}

body { -webkit-tap-highlight-color: transparent; }

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

/* ---------- Barra superior ---------- */

.barra {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--fondo);
}

.marca {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.45rem;
  font-style: italic;
  font-weight: 700;
  color: var(--acento);
  text-decoration: none;
  letter-spacing: -.02em;
}

.buscador {
  position: relative;
  flex: 1;
  min-width: 0;
}

.buscador svg {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--tinta-suave);
  pointer-events: none;
}

/* 16px evita que iOS haga zoom al enfocar el campo. */
.buscador input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  font-size: 16px;
  color: var(--tinta);
  background: #efeae1;
  border: 0;
  border-radius: 999px;
  -webkit-appearance: none;
  appearance: none;
}

.buscador input::placeholder { color: var(--tinta-suave); }

.icono {
  position: relative;
  display: grid;
  flex: none;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  color: var(--tinta);
  background: none;
  border: 0;
  border-radius: 50%;
}

.icono-fondo {
  background: var(--superficie);
  box-shadow: 0 1px 4px rgb(25 25 25 / 12%);
}

.globo {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  color: #fff;
  text-align: center;
  background: var(--acento);
  border-radius: 999px;
}

/* ---------- Categorías ---------- */

.chips {
  display: flex;
  gap: 8px;
  padding: 2px 12px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 38px;
  padding: 0 16px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--tinta);
  background: transparent;
  border: 1px solid var(--linea);
  border-radius: 999px;
}

.chip[aria-pressed='true'] {
  color: var(--lima);
  background: var(--tinta);
  border-color: var(--tinta);
}

/* ---------- Grid masonry ---------- */

.masonry {
  display: flex;
  gap: var(--separacion);
  align-items: flex-start;
}

.masonry-col {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.producto {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radio);
}

.producto-foto {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radio);
}

.producto-foto img {
  display: block;
  width: 100%;
  height: auto;
}

.producto-oferta {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--tinta);
  background: var(--lima);
  border-radius: 999px;
}

.producto-nombre {
  display: -webkit-box;
  margin: 8px 4px 0;
  overflow: hidden;
  font-size: .875rem;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.producto-precio {
  display: block;
  margin: 2px 4px 0;
  font-size: .95rem;
  font-weight: 700;
}

.producto-precio s {
  font-size: .8rem;
  font-weight: 400;
  color: var(--tinta-suave);
}

@media (hover: hover) {
  .producto-foto img { transition: transform .25s ease; }
  .producto:hover .producto-foto img { transform: scale(1.03); }
  .chip:hover { border-color: var(--tinta); }
}

@media (prefers-reduced-motion: reduce) {
  .producto-foto img { transition: none; }
  .producto:hover .producto-foto img { transform: none; }
}

/* ---------- Detalle: galería ---------- */

.galeria { position: relative; }

.galeria-carril {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.galeria-carril::-webkit-scrollbar { display: none; }






.volver {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  z-index: 2;
}

.carrito-flotante {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  z-index: 2;
}

/* ---------- Detalle: información ---------- */

.info { padding: 18px 16px 24px; }

.info-categoria {
  font-size: .85rem;
  color: var(--acento-oscuro);
  text-decoration: none;
}

.info-nombre {
  margin: 4px 0 8px;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
}

.info-precio {
  font-size: 1.4rem;
  font-weight: 700;
}

.info-precio s {
  margin-left: 6px;
  font-size: 1rem;
  font-weight: 400;
  color: var(--tinta-suave);
}

.info-titulo {
  margin: 20px 0 8px;
  font-size: .9rem;
  font-weight: 700;
}

.opciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opcion {
  min-width: 48px;
  height: 44px;
  padding: 0 14px;
  font-weight: 600;
  line-height: 42px;
  text-align: center;
  cursor: pointer;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 12px;
}

.btn-check:checked + .opcion {
  color: var(--lima);
  background: var(--tinta);
  border-color: var(--tinta);
}

.btn-check:focus-visible + .opcion {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

.info-descripcion {
  margin: 20px 0 0;
  line-height: 1.55;
}

.plegable {
  border-bottom: 1px solid var(--linea);
}

.plegable:first-of-type {
  margin-top: 20px;
  border-top: 1px solid var(--linea);
}

.plegable summary {
  padding: 13px 0;
  font-weight: 600;
  cursor: pointer;
}

.plegable p {
  margin: 0 0 14px;
  color: var(--tinta-suave);
}

/* ---------- Barra de compra: fija en celular, en línea desde tablet ---------- */

.con-barra { padding-bottom: calc(var(--alto-barra) + env(safe-area-inset-bottom)); }

.compra {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  gap: 10px;
  align-items: center;
  height: calc(var(--alto-barra) + env(safe-area-inset-bottom));
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--superficie);
  border-top: 1px solid var(--linea);
}

.cantidad {
  display: flex;
  flex: none;
  align-items: center;
  background: #efeae1;
  border-radius: 999px;
}

.cantidad button {
  width: 40px;
  height: 48px;
  padding: 0;
  font-size: 1.25rem;
  color: var(--tinta);
  background: none;
  border: 0;
  border-radius: 999px;
}

.cantidad button:disabled { opacity: .35; }

.cantidad output {
  min-width: 20px;
  font-weight: 700;
  text-align: center;
}

.agregar {
  flex: 1;
  height: 52px;
  min-width: 0;
  padding: 0 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  background: var(--acento);
  border: 0;
  border-radius: 999px;
}

.agregar:active { background: var(--acento-oscuro); }

.aviso {
  position: fixed;
  bottom: calc(var(--alto-barra) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  z-index: 40;
  padding: 10px 18px;
  font-size: .9rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
  background: var(--tinta);
  border-radius: 999px;
  opacity: 0;
  transition: opacity .2s ease, visibility .2s;
  transform: translateX(-50%);
}

.aviso.visible {
  visibility: visible;
  opacity: 1;
}

.seccion { padding: 12px 12px 24px; }

.seccion-titulo {
  margin: 8px 4px 14px;
  font-size: 1.3rem;
  font-weight: 700;
}

/* ---------- Tablet y escritorio ---------- */

@media (min-width: 800px) {
  .barra { padding: 12px 20px; }
  .chips { padding: 2px 20px 14px; }
  .seccion { padding: 12px 20px 32px; }

  .detalle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    max-width: 1180px;
    padding: 66px 20px 20px; /* deja libre la fila de los botones flotantes */
    margin: 0 auto;
  }

  .galeria {
    position: sticky;
    top: 20px;
  }

  .galeria-carril { border-radius: var(--radio); }
  .info { padding: 4px 0 0; }

  .con-barra { padding-bottom: 0; }

  .compra {
    position: static;
    height: auto;
    padding: 0;
    margin-top: 24px;
    background: none;
    border: 0;
  }

  .aviso { bottom: 24px; }
}
