/* Mejoras para celular y animaciones. Se carga después de store.css. */

/* ================================================================ */
/* Filtros rápidos (fila deslizable)                                 */
/* ================================================================ */
main > section { min-width: 0; } /* sin esto, la fila deslizable ensancha la página */
.quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.quick::-webkit-scrollbar { display: none; }
.quick .chip { flex-shrink: 0; white-space: nowrap; }

/* Galería deslizable */
.gallery .track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 18px; aspect-ratio: 4/5; background: #fff; }
.gallery .track::-webkit-scrollbar { display: none; }
.gallery .track > * { flex: 0 0 100%; scroll-snap-align: center; height: 100%; }
.gallery .track img { width: 100%; height: 100%; object-fit: cover; }
.dots { display: none; justify-content: center; gap: 6px; margin-top: 10px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: #e3d3c7; transition: .25s; }
.dots span.on { width: 20px; border-radius: 4px; background: var(--brand); }
.sheet-handle { display: none; }

/* Esqueleto mientras cargan los productos */
.skel { border-radius: var(--radius); background: #fff; overflow: hidden; box-shadow: var(--shadow); }
.skel div { aspect-ratio: 4/5; }
.skel p { height: 12px; margin: 12px 14px; border-radius: 6px; }
.skel p + p { width: 50%; margin-top: 0; }
.skel div, .skel p { background: linear-gradient(90deg, #f6ece5 25%, #fbf5f0 50%, #f6ece5 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ================================================================ */
/* Animaciones                                                      */
/* ================================================================ */
/* Aparecer al hacer scroll */
/* Solo se ocultan si el script de animaciones está activo (clase "anim" en <html>) */
.anim .reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 60ms); }
.anim .reveal.in { opacity: 1; transform: none; }

/* Portada: logo flotando y corazoncitos */
.hero-card { position: relative; }
.hero-card > div { position: relative; z-index: 1; }
.hero-logo { animation: float 5s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1.5deg); } }
.hero h1 { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.hero p { animation: rise .7s .12s cubic-bezier(.2, .8, .2, 1) both; }
.hero-actions { animation: rise .7s .24s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.floaties { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floaties span { position: absolute; bottom: -30px; color: #d9a88a; opacity: 0; font-size: var(--s, 16px); animation: drift var(--d, 9s) linear infinite; animation-delay: var(--w, 0s); }
@keyframes drift {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  15% { opacity: .7; }
  100% { transform: translate(var(--x, 20px), -360px) rotate(25deg); opacity: 0; }
}

/* Tarjetas */
.card { transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s; }
.card:hover { transform: translateY(-5px); box-shadow: 0 14px 34px rgba(120, 80, 50, .14); }
.card:active { transform: scale(.97); }
.thumb img { transition: transform .5s ease; }
.card:hover .thumb img { transform: scale(1.05); }
.tag.sale { animation: wiggle 2.8s ease-in-out infinite; }
@keyframes wiggle { 0%, 88%, 100% { transform: rotate(0); } 92% { transform: rotate(-8deg) scale(1.08); } 96% { transform: rotate(8deg) scale(1.08); } }

/* Botones y chips */
.btn, .chip, .size, .cart-btn, .qty button, .x { transition: transform .15s ease, background-color .2s, border-color .2s, filter .2s; }
.btn:active, .chip:active, .size:active:not(:disabled), .cart-btn:active, .qty button:active, .x:active { transform: scale(.94); }
.size.sel { animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 50% { transform: scale(1.12); } }
.cart-btn.bump { animation: bump2 .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bump2 { 30% { transform: scale(1.18) rotate(-6deg); } 60% { transform: scale(.95) rotate(4deg); } }
.badge.pop { animation: pop .4s cubic-bezier(.3, 1.6, .5, 1); }

/* Producto volando al carrito */
.fly { position: fixed; z-index: 120; border-radius: 14px; overflow: hidden; pointer-events: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  transition: transform .75s cubic-bezier(.5, -0.3, .7, .9), opacity .75s ease; }
.fly img, .fly .ph { width: 100%; height: 100%; object-fit: cover; }

/* Ventanas */
.modal-bg.open { animation: fade .25s ease both; }
.modal-bg.open .modal { animation: zoomIn .35s cubic-bezier(.2, .9, .3, 1.1) both; }
@keyframes fade { from { opacity: 0; } }
@keyframes zoomIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.drawer { transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.drawer.open .item, .drawer.open .co { animation: slideIn .4s cubic-bezier(.2, .8, .2, 1) both; }
.drawer.open .item:nth-child(2) { animation-delay: .05s; }
.drawer.open .item:nth-child(3) { animation-delay: .1s; }
.drawer.open .item:nth-child(n+4) { animation-delay: .15s; }
.drawer.open .co { animation-delay: .12s; }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } }
.opt { transition: border-color .2s, background-color .2s, transform .15s; }
.opt:active { transform: scale(.98); }

/* Zorritos con vida */
.with-fox .fox, .info-card .ic, .about-card > .fox { transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.with-fox:hover .fox, .info-card:hover .ic, .about-card:hover > .fox { transform: rotate(-6deg) scale(1.08); }
.info-card { transition: transform .3s, box-shadow .3s; }
.info-card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(120, 80, 50, .12); }
.foot-fox { animation: breathe 3.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04, .97); } }
.empty .fox, .empty-cart .fox, .loading .fox, .guide-fox { animation: sway 3s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.sent .fox { animation: hop 1s cubic-bezier(.3, 1.6, .5, 1) both, sway 3s 1s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes hop { 0% { transform: translateY(30px) scale(.6); opacity: 0; } 60% { transform: translateY(-10px) scale(1.05); opacity: 1; } }

/* Lluvia de corazones al enviar el pedido */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 130; overflow: hidden; }
.confetti span { position: absolute; top: -30px; font-size: var(--s, 18px); color: var(--c, #d9a88a); animation: fall var(--d, 2.2s) cubic-bezier(.3, .6, .5, 1) forwards; animation-delay: var(--w, 0s); }
@keyframes fall { to { transform: translate(var(--x, 0), 110vh) rotate(var(--r, 180deg)); opacity: .2; } }

/* Botón de WhatsApp con pulso suave */
.wa-float::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--wa); animation: ring 2.6s ease-out infinite; }
@keyframes ring { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
.wa-float { transition: transform .2s; }
.wa-float:active { transform: scale(.92); }

/* Preguntas frecuentes con "+" que gira */
.faq details[open] summary ~ * { animation: rise .35s ease both; }
.faq summary { list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--brand); transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }

/* ================================================================ */
/* Celular                                                          */
/* ================================================================ */
@media (max-width: 860px) {
  /* Con 16px el iPhone no hace zoom al escribir */
  .input, select.input, textarea.input { font-size: 16px; }
  .bar { padding: 8px 14px; }
  .logo { width: 40px; height: 40px; }
  .hero { margin-top: 12px; }
  .hero-card { padding: 18px 16px 22px; border-radius: 24px; }
  .hero-logo { width: 150px; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: .95rem; }
  .featured-wrap, main { margin-top: 22px; }
  .featured { grid-auto-columns: 46%; gap: 12px; margin: 0 -16px; padding: 0 16px 8px; scroll-padding: 0 16px; }

  .toolbar { gap: 8px; }
  .chip { padding: 8px 14px; }
  .grid { gap: 10px; }
  .info-c { padding: 10px 11px 12px; gap: 3px; }
  .info-c h3 { font-size: .92rem; line-height: 1.25; }
  .price { font-size: 1rem; }
  .info-c .price s { display: block; margin: 0; font-size: .78rem; }
  .tags { top: 7px; left: 7px; }
  .tag { font-size: .62rem; padding: 3px 7px; }

  /* Filtros como hoja desde abajo */
  aside#filters { padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
  aside#filters::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: #e3d3c7; margin: 4px auto 10px; }
  .filters-foot { position: sticky; bottom: 0; background: #fff; padding-top: 10px; }
  .filters-foot .btn { flex: 1; padding: 13px; }

  /* Detalle del producto: hoja que sube desde abajo */
  #productModal { padding: 0; align-items: flex-end; overflow: hidden; }
  #productModal .modal { width: 100%; max-height: 94vh; max-height: 94dvh; overflow: auto; border-radius: 24px 24px 0 0; }
  #productModal.open .modal { animation: sheetUp .4s cubic-bezier(.2, .8, .2, 1) both; }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .sheet-handle { display: block; position: sticky; top: 0; z-index: 3; height: 0; }
  .sheet-handle::before { content: ""; position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .9); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
  #productModal .modal > .x { position: sticky; top: 12px; float: right; margin: 12px 12px -50px 0; }
  .gallery { padding: 0; }
  .gallery .track { border-radius: 24px 24px 0 0; }
  .thumbs { display: none; }
  .dots { display: flex; }
  .pinfo { padding: 12px 18px 0; gap: 9px; }
  .pinfo h2 { font-size: 1.35rem; padding-right: 0; }
  .size { min-height: 44px; min-width: 58px; font-size: .95rem; }
  .add-row { position: sticky; bottom: 0; z-index: 2; margin: 6px -18px 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: rgba(251, 242, 237, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
  .add-row .btn { padding: 14px; }
  .qty button { width: 42px; height: 44px; }
  .small-links { padding: 4px 0 14px; }

  /* Carrito a pantalla completa */
  .drawer { width: 100%; }
  .drawer-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .item .qty button { width: 34px; height: 36px; }
  .opt { padding: 13px 12px; }

  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .wa-float { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); width: 54px; height: 54px; }
  .about-card > .fox { width: 130px; }
  .info-card .ic { height: 90px; }
}

/* En pantallas táctiles no hay "hover" */
@media (hover: none) {
  .card:hover { transform: none; box-shadow: var(--shadow); }
  .card:hover .thumb img { transform: none; }
}

/* Si el celular tiene activado "reducir movimiento", se respetan sus preferencias */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .anim .reveal { opacity: 1; transform: none; }
}
