/* ============================================================
   NAVDYEL STORE — Sistema de diseño compartido
   Marca: tienda peruana/latina en Italia · estilo editorial cálido
   ============================================================ */

:root {
  /* Marca */
  --carmin: #A6221B;
  --carmin-hover: #8C1B15;
  --carmin-osc: #7E1710;
  --crema: #FAF5EC;
  --superficie: #FFFDF8;
  --blanco: #FFFFFF;
  --tinta: #241D17;
  --texto-2: #52463A;
  --texto-suave: #8A7B66;
  --deshab: #A99C8A;
  --linea-1: #E8DFCE;
  --linea-2: #D8CCBB;
  --linea-3: #F0E8D6;
  --dorado: #E9A33D;
  --dorado-hover: #F2B65A;
  --dorado-txt: #8A6A1F;
  --ambar-bg: #FBF6E9;
  --ambar-borde: #EFD9A8;
  --verde: #2F7A46;
  --verde-bg: #E7F2E9;
  --naranja: #B4690E;
  --error: #8C1B15;
  --error-bg: #FBEAE7;
  --error-borde: #EFC5BE;
  --eyebrow: #B08954;
  --superf-card: #F7F1E3;

  --r: 4px;           /* radio base */
  --r-badge: 2px;
  --max: 1240px;      /* contenedor tienda */
  --max-panel: 1060px;
  --pad: 20px;

  /* Motion con física (resorte suave, tipo Apple/Linear) */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-suave: cubic-bezier(0.4, 0, 0.2, 1);

  /* Franja "manta peruana" — firma visual */
  --manta: repeating-linear-gradient(90deg,
      var(--carmin) 0 28px, var(--dorado) 28px 42px,
      #C65A1E 42px 54px, var(--carmin-osc) 54px 82px,
      var(--crema) 82px 90px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* overflow-x clip (no hidden): corta cualquier desborde lateral sin romper el header sticky */
html, body { overflow-x: clip; }
body {
  margin: 0;
  font-family: 'Archivo', system-ui, sans-serif;
  color: var(--tinta);
  background: var(--crema);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--carmin); text-decoration: none; }
a:hover { color: var(--carmin-osc); }
input, select, button, textarea { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--deshab); }
h1, h2, h3 { text-wrap: balance; }
.negra { font-family: 'Archivo Black', 'Archivo', sans-serif; font-weight: 400; }
.eyebrow {
  font-size: 12px; font-weight: 800; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--eyebrow);
}
:focus-visible { outline: 2px solid var(--carmin); outline-offset: 2px; border-radius: 3px; }

/* Utilidades layout */
.contenedor { max-width: var(--max); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); width: 100%; }
.contenedor-panel { max-width: var(--max-panel); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); width: 100%; }
.manta { height: 6px; background: var(--manta); }
main { flex: 1; }

/* ---------- Barra de aviso ---------- */
.aviso-bar {
  background: var(--tinta); color: #D8CCBB;
  font-size: 12.5px; font-weight: 600; padding: 8px 0;
}
.aviso-bar .contenedor { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.aviso-bar .der { color: #B5A891; }

/* ---------- Header ---------- */
.header { position: sticky; top: 0; z-index: 40; background: var(--superficie); border-bottom: 1px solid var(--linea-1); }
.header-top { display: flex; align-items: center; gap: 18px; padding: 14px var(--pad) 12px; max-width: var(--max); margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 11px; flex-shrink: 0; cursor: pointer; }
.logo img { height: 46px; }
.logo .wm { font-family: 'Archivo Black','Archivo',sans-serif; font-size: 18px; line-height: 1; color: var(--carmin); letter-spacing: 0.01em; }
.logo .sub { font-size: 10.5px; font-weight: 700; color: var(--texto-suave); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 3px; }
.buscador { flex: 1 1 260px; display: flex; min-width: 160px; position: relative; }
/* Sugerencias en vivo del buscador */
.sug-box { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--linea-1); border-radius: var(--r); box-shadow: 0 16px 38px rgba(26, 10, 5, 0.16); z-index: 60; overflow-y: auto; max-height: min(420px, 60vh); }
.sug-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; text-decoration: none; color: var(--tinta); border-bottom: 1px solid var(--linea-2); }
.sug-item img, .sug-item .sug-mono { width: 36px; height: 36px; flex: 0 0 auto; object-fit: contain; background: #fff; }
.sug-item .sug-mono { display: flex; align-items: center; justify-content: center; background: var(--crema); color: var(--carmin); font-weight: 800; font-size: 12px; }
.sug-item .n { flex: 1; font-size: 13.5px; min-width: 0; line-height: 1.3; }
.sug-item .n b { color: var(--carmin); }
.sug-item strong { font-size: 13px; white-space: nowrap; }
.sug-item:hover, .sug-item.sel { background: var(--crema); }
.sug-todos { display: block; text-align: center; padding: 11px; font-size: 12.5px; font-weight: 800; color: var(--carmin); text-decoration: none; background: #FBF6EC; }
.sug-todos:hover { text-decoration: underline; }
.sug-vacio { padding: 16px; font-size: 13px; color: var(--texto-suave); text-align: center; }
.buscador .caja {
  display: flex; align-items: center; gap: 9px; background: var(--blanco);
  border: 1px solid var(--linea-2); border-radius: var(--r); padding: 10px 13px; width: 100%;
  transition: border-color .2s var(--ease-suave), box-shadow .2s var(--ease-suave);
}
.buscador .caja:focus-within { border-color: var(--carmin); box-shadow: 0 0 0 3px rgba(166,34,27,0.08); }
.buscador input { border: none; outline: none; background: transparent; font-size: 14px; width: 100%; color: var(--tinta); }
.btn-carrito {
  display: flex; align-items: center; gap: 10px; background: var(--carmin); color: #fff;
  border: none; border-radius: var(--r); padding: 11px 16px; cursor: pointer; font-weight: 700; font-size: 14px;
  transition: background .25s var(--ease-suave), transform .15s var(--ease);
}
.btn-carrito:hover { background: var(--carmin-hover); }
.btn-carrito:active { transform: scale(0.97); }
.btn-carrito .sep { border-left: 1px solid rgba(255,255,255,0.35); padding-left: 10px; font-weight: 800; }
.btn-carrito .cnt {
  background: #fff; color: var(--carmin); min-width: 20px; height: 20px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; padding: 0 5px;
}
.nav-cats { display: flex; gap: 24px; overflow-x: auto; padding: 0 var(--pad); max-width: var(--max); margin: 0 auto; scrollbar-width: none; }
.nav-cats::-webkit-scrollbar { display: none; }
.nav-cats a {
  white-space: nowrap; color: var(--texto-2); border-bottom: 2px solid transparent;
  padding: 9px 2px 11px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: color .2s var(--ease-suave), border-color .2s var(--ease-suave);
}
.nav-cats a:hover { color: var(--carmin); }
.nav-cats a.activo { color: var(--carmin); border-color: var(--carmin); }

/* ---------- Botones ---------- */
.btn {
  border-radius: var(--r); padding: 13px 26px; font-size: 13.5px; font-weight: 800;
  letter-spacing: 0.07em; text-transform: uppercase; cursor: pointer; border: none;
  transition: background .25s var(--ease-suave), color .2s var(--ease-suave), transform .14s var(--ease), border-color .2s var(--ease-suave);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn:active { transform: scale(0.98); }
.btn-primario { background: var(--carmin); color: #fff; }
.btn-primario:hover { background: var(--carmin-hover); color: #fff; }
.btn-dorado { background: var(--dorado); color: #3A1310; letter-spacing: 0.02em; }
.btn-dorado:hover { background: var(--dorado-hover); color: #3A1310; }
.btn-outline { background: transparent; border: 1.5px solid var(--carmin); color: var(--carmin); }
.btn-outline:hover { background: var(--carmin); color: #fff; }
.btn[disabled] { cursor: not-allowed; opacity: 1; background: #EFE6D4; color: var(--deshab); border-color: var(--linea-2); }
.btn[disabled]:hover { background: #EFE6D4; color: var(--deshab); }
.btn[disabled]:active { transform: none; }
/* Icono en círculo dentro del botón (patrón "botón dentro de botón") */
.btn .ico-circ {
  width: 26px; height: 26px; border-radius: 999px; background: rgba(255,255,255,0.18);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform .3s var(--ease);
}
.btn:hover .ico-circ { transform: translateX(3px); }
.btn-dorado .ico-circ { background: rgba(58,19,16,0.12); }

/* ---------- Cards de producto ---------- */
.grid-productos { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 14px; }
.card {
  background: var(--blanco); border: 1px solid var(--linea-1); border-radius: var(--r);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .25s var(--ease-suave), transform .3s var(--ease), box-shadow .3s var(--ease);
}
.card:hover { border-color: #C9A97E; transform: translateY(-3px); box-shadow: 0 12px 28px rgba(126,23,16,0.09); }
.card-img {
  cursor: pointer; position: relative; aspect-ratio: 1/1;
  background: var(--superf-card); border-bottom: 1px solid var(--linea-3); overflow: hidden;
}
.card-img .ph {
  position: absolute; inset: 12px; border: 1px solid rgba(166,34,27,0.12);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
}
.card-img .ph .mono { font-family: 'Archivo Black','Archivo',sans-serif; font-size: 36px; color: var(--carmin); opacity: 0.13; }
.card-img .ph .cat { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--eyebrow); }
.card-img .foto {
  position: absolute; inset: 0; background-color: #fff; background-size: contain;
  background-position: center; background-repeat: no-repeat; background-origin: content-box; padding: 12px;
  transition: transform .5s var(--ease);
}
.card:hover .card-img .foto { transform: scale(1.05); }
.badge {
  position: absolute; top: 10px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em;
  border-radius: var(--r-badge); padding: 4px 8px;
}
.badge-oferta { left: 10px; background: var(--dorado); color: #3A1310; }
.badge-agotado { left: 10px; background: var(--tinta); color: #FFF8EE; }
.badge-nuevo { right: 10px; background: var(--verde); color: #FFF8EE; }
.card-body { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-nombre { cursor: pointer; font-weight: 700; font-size: 14px; line-height: 1.4; min-height: 39px; transition: color .2s var(--ease-suave); }
.card-nombre:hover { color: var(--carmin); }
.card-precio-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: auto; }
.precio { font-family: 'Archivo Black','Archivo',sans-serif; font-size: 16.5px; }
.precio-antes { font-size: 12.5px; color: var(--deshab); text-decoration: line-through; }
.stock-txt { font-size: 11px; font-weight: 700; }
.btn-agregar {
  margin-top: 6px; border: 1.5px solid var(--carmin); border-radius: var(--r); padding: 9px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; background: transparent; color: var(--carmin);
  transition: background .22s var(--ease-suave), color .22s var(--ease-suave), transform .14s var(--ease);
}
.btn-agregar:hover { background: var(--carmin); color: #fff; }
.btn-agregar:active { transform: scale(0.97); }
.btn-agregar[disabled] { border-color: var(--linea-2); color: var(--deshab); cursor: not-allowed; background: transparent; }
.btn-agregar[disabled]:hover { background: transparent; color: var(--deshab); }

/* Encabezado de sección con regla */
.sec-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.sec-head h2 { font-family: 'Archivo Black','Archivo',sans-serif; font-size: 22px; margin: 0; white-space: nowrap; }
.sec-head .regla { flex: 1; height: 1px; background: var(--linea-1); }
.sec-head .ver-todo { background: none; border: none; color: var(--carmin); font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.sec-head .ver-todo:hover { text-decoration: underline; }

/* ---------- Formularios ---------- */
.input, .select, textarea.input {
  border: 1px solid var(--linea-2); border-radius: var(--r); padding: 12px 13px; font-size: 14px;
  outline: none; background: #fff; width: 100%; color: var(--tinta);
  transition: border-color .2s var(--ease-suave), box-shadow .2s var(--ease-suave);
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--carmin); box-shadow: 0 0 0 3px rgba(166,34,27,0.08); }
.caja-error { background: var(--error-bg); border: 1px solid var(--error-borde); color: var(--error); font-size: 13px; font-weight: 600; border-radius: var(--r); padding: 11px 13px; }

/* ---------- Footer ---------- */
.footer { background: var(--tinta); color: #D8CCBB; margin-top: auto; }
.footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 30px; padding: 44px var(--pad) 20px; max-width: var(--max); margin: 0 auto; }
.footer .wm { font-family: 'Archivo Black','Archivo',sans-serif; font-size: 18px; color: #FFF3E4; margin-bottom: 10px; }
.footer p { font-size: 13.5px; line-height: 1.6; margin: 0 0 12px; color: #B5A891; }
.footer .tit { font-weight: 800; font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--texto-suave); margin-bottom: 12px; }
.footer .lista { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.footer .lista a, .footer .lista span { color: #D8CCBB; cursor: pointer; transition: color .2s var(--ease-suave); }
.footer .lista a:hover, .footer .lista span:hover { color: var(--dorado); }
.footer .redes a { color: var(--dorado); font-weight: 700; margin-right: 16px; }
.footer .legal { border-top: 1px solid #3A3128; text-align: center; padding: 16px var(--pad); font-size: 12px; color: var(--texto-suave); }
.footer .legal a { color: var(--texto-suave); text-decoration: underline; }

/* ---------- Carrito (drawer) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30,18,12,0.45); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .25s var(--ease-suave); }
.overlay.abierto { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 94vw); background: var(--superficie);
  z-index: 61; box-shadow: -10px 0 34px rgba(30,18,12,0.22); transform: translateX(105%);
  transition: transform .34s var(--ease); display: flex; flex-direction: column;
}
.drawer.abierto { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--linea-1); }
.drawer-head .t { font-family: 'Archivo Black','Archivo',sans-serif; font-size: 17px; }
.icon-btn { border: 1px solid var(--linea-2); background: none; width: 32px; height: 32px; border-radius: var(--r); cursor: pointer; color: var(--texto-2); display: flex; align-items: center; justify-content: center; transition: border-color .2s, color .2s; }
.icon-btn:hover { border-color: var(--carmin); color: var(--carmin); }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 20px; }
.drawer-linea { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--linea-3); }
.thumb { width: 58px; height: 58px; border-radius: var(--r); background: var(--superf-card); border: 1px solid var(--linea-3); display: flex; align-items: center; justify-content: center; font-family: 'Archivo Black','Archivo',sans-serif; font-size: 17px; color: var(--carmin); flex-shrink: 0; position: relative; overflow: hidden; }
.thumb .mono { opacity: .3; }
.thumb .foto { position: absolute; inset: 0; background-color: #fff; background-size: contain; background-position: center; background-repeat: no-repeat; background-origin: content-box; padding: 4px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--linea-2); border-radius: var(--r); }
.stepper button { width: 27px; height: 27px; border: none; background: none; cursor: pointer; font-weight: 800; color: var(--texto-suave); font-size: 14px; transition: color .18s; }
.stepper button:hover { color: var(--carmin); }
.stepper .val { min-width: 24px; text-align: center; font-weight: 800; font-size: 13px; }
.linea-2col { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.nombre-2l { font-size: 13px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.drawer-foot { border-top: 1px solid var(--linea-1); padding: 16px 20px 20px; background: var(--superficie); }
.fila { display: flex; justify-content: space-between; }
.barra-envio { height: 4px; background: var(--linea-3); overflow: hidden; border-radius: 999px; }
.barra-envio > div { height: 100%; background: var(--dorado); transition: width .4s var(--ease); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 70; transform: translate(-50%, 130px); transition: transform .35s var(--ease); pointer-events: none; }
.toast.visible { transform: translate(-50%, 0); }
.toast .caja { background: var(--tinta); color: #FFF8EE; border-radius: var(--r); padding: 12px 18px; font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 26px rgba(30,18,12,0.3); display: flex; align-items: center; gap: 12px; white-space: nowrap; pointer-events: auto; }
.toast .accion { color: var(--dorado); font-weight: 800; cursor: pointer; border-left: 1px solid #4A4038; padding-left: 12px; }

/* ---------- Botón "volver arriba" ---------- */
.top-btn {
  position: fixed; left: 20px; bottom: 20px; z-index: 54;
  width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid var(--linea-2); background: var(--superficie); color: var(--carmin);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 6px 18px rgba(30,18,12,0.16);
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .3s var(--ease-suave), transform .35s var(--ease), border-color .2s var(--ease-suave);
}
.top-btn.visible { opacity: 1; transform: none; pointer-events: auto; }
.top-btn:hover { border-color: var(--carmin); }
@media (max-width: 640px) { .top-btn { left: 14px; bottom: 14px; width: 42px; height: 42px; } }

/* ---------- Botón flotante de WhatsApp ---------- */
.wa-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 55;
  display: inline-flex; align-items: center; background: #25D366; color: #fff;
  border-radius: 999px; text-decoration: none;
  box-shadow: 0 8px 24px rgba(18,140,70,0.34), 0 2px 6px rgba(0,0,0,0.12);
  transition: transform .2s var(--ease), box-shadow .3s var(--ease);
}
.wa-float:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 14px 32px rgba(18,140,70,0.46); }
.wa-float:active { transform: translateY(0) scale(0.97); }
.wa-float .wa-ic { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wa-float .wa-label {
  max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap;
  font-weight: 800; font-size: 13.5px; letter-spacing: 0.01em;
  transition: max-width .38s var(--ease), opacity .3s var(--ease-suave), padding .38s var(--ease);
}
.wa-float:hover .wa-label, .wa-float:focus-visible .wa-label { max-width: 220px; opacity: 1; padding-right: 22px; }
.wa-float .wa-ring {
  position: absolute; left: 0; top: 0; width: 56px; height: 56px; border-radius: 999px;
  background: #25D366; z-index: -1; animation: waPulse 2.6s ease-out infinite;
}
@keyframes waPulse { 0% { transform: scale(1); opacity: 0.5; } 70% { transform: scale(1.9); opacity: 0; } 100% { opacity: 0; } }
@media (max-width: 640px) { .wa-float { right: 14px; bottom: 14px; } }
@media (prefers-reduced-motion: reduce) { .wa-float .wa-ring { animation: none; display: none; } }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); filter: blur(4px); transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease); }
.reveal.visible { opacity: 1; transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
  .card:hover { transform: none; }
}

/* ============================================================
   RESPONSIVE — el arreglo clave (los prototipos no tenían nada)
   ============================================================ */

/* Tablet */
@media (max-width: 900px) {
  .layout-catalogo { grid-template-columns: 1fr !important; }
  .sidebar-cat { position: static !important; }
  .layout-checkout { grid-template-columns: 1fr !important; }
  .checkout-aside { position: static !important; order: -1; }
}

/* Móvil */
@media (max-width: 640px) {
  :root { --pad: 16px; }
  .header-top { flex-wrap: wrap; gap: 12px 14px; padding-top: 12px; }
  /* Fila 1: logo solo. Fila 2: buscador largo a la izquierda + carrito compacto (icono y número) */
  .logo { flex: 0 0 100%; }
  .logo img { height: 40px; }
  .buscador { order: 2; flex: 1 1 auto; min-width: 0; }
  .btn-carrito { order: 3; margin-left: 0; padding: 11px 14px; gap: 8px; }
  .btn-carrito .lbl, .btn-carrito .sep { display: none; }
  .grid-productos { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card-nombre { font-size: 13px; min-height: 34px; }
  .sec-head h2 { font-size: 19px; }
  /* En pantallas estrechas la cabecera de sección puede saltar de línea: si no, "Ver todo →" se sale por la derecha y crea scroll horizontal */
  .sec-head { flex-wrap: wrap; row-gap: 6px; }
  .hero-grid { flex-direction: column; }
  .form-2col { grid-template-columns: 1fr !important; }
  .btn { padding: 12px 20px; }
}
@media (max-width: 380px) {
  .grid-productos { grid-template-columns: 1fr 1fr; }
}
