/* PROEX Cárnicos — catálogo tipo libro. Colores tomados del catálogo impreso. */
:root {
  --rojo: #e3161d;
  --rojo-osc: #a80f14;
  --verde: #1f8a3c;
  --negro: #0d0d0d;
  --hoja: #161616;
  --hoja-2: #1d1d1d;
  --texto: #f4f1ec;
  --suave: #b9b2a8;
  --pw: 360px;   /* ancho de una página (lo calcula app.js) */
  --ph: 530px;   /* alto de una página */
  font-family: "Montserrat", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 30%, #2a1414 0%, #120a0a 45%, #060606 100%);
  color: var(--texto);
  display: flex; flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- barra superior ---------- */
.barra {
  display: flex; align-items: center; gap: .7rem;
  padding: .5rem .9rem; padding-top: max(.5rem, env(safe-area-inset-top));
  background: rgba(0,0,0,.55); border-bottom: 1px solid #2a2a2a;
}
.barra-logo { width: 46px; height: 46px; object-fit: contain; }
.barra-texto { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.barra-texto strong { font-size: 1.05rem; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-texto span { font-size: .75rem; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-instalar {
  margin-left: auto; border: 1px solid #3a3a3a; background: #1a1a1a; color: var(--texto);
  font-size: .72rem; font-weight: 800; padding: .45rem .65rem; border-radius: 999px; white-space: nowrap; flex: none;
}
.btn-instalar:not([hidden]) + .btn-carrito { margin-left: .5rem; }
.btn-carrito {
  margin-left: auto; position: relative; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: var(--rojo); display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(227,22,29,.4);
}
.btn-carrito svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-carrito svg circle { fill: #fff; stroke: none; }
.contador {
  position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: #fff; color: var(--rojo); font-size: .75rem; font-weight: 800;
  display: grid; place-items: center;
}
.contador.salta { animation: salta .4s; }
@keyframes salta { 40% { transform: scale(1.4); } }

/* ---------- pestañas (marcadores del libro) ---------- */
.pestanas {
  display: flex; gap: .4rem; padding: .55rem .6rem .2rem;
  overflow-x: auto; scrollbar-width: none;
}
.pestanas::-webkit-scrollbar { display: none; }
.pestanas button:first-child { margin-left: auto; }
.pestanas button:last-child { margin-right: auto; }
.pestanas button {
  flex: none; border: 1px solid #3a3a3a; background: #1a1a1a; color: var(--suave);
  padding: .38rem .85rem; border-radius: 999px; font-size: .82rem; font-weight: 700; letter-spacing: .02em;
}
.pestanas button.activa { background: var(--rojo); border-color: var(--rojo); color: #fff; }

/* ---------- escena y libro ---------- */
.escena {
  flex: 1; min-height: 0; display: grid; place-items: center;
  perspective: 2200px; overflow: hidden; padding: .4rem;
  touch-action: pan-y;
}
.libro {
  position: relative; width: calc(var(--pw) * 2); height: var(--ph);
  transform-style: preserve-3d;
  transition: transform .6s ease;
}
.libro.simple { width: var(--pw); }
/* lomo y sombra del libro abierto */
.libro::before {
  content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none;
  box-shadow: 0 14px 34px rgba(0,0,0,.7);
}
/* libro cerrado: la sombra solo bajo la tapa visible */
.libro.cerrado:not(.simple)::before { left: 50%; }
.libro.al-final:not(.simple)::before { right: 50%; }
/* libro cerrado (solo portada a la derecha): se corre para quedar centrado */
.libro.cerrado:not(.simple) { transform: translateX(calc(var(--pw) * -.5)); }
.libro.al-final:not(.simple) { transform: translateX(calc(var(--pw) * .5)); }

.hoja {
  position: absolute; top: 0; left: 50%; width: 50%; height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform .85s cubic-bezier(.45,.05,.3,1);
}
.libro.simple .hoja { left: 0; width: 100%; transition-duration: .6s; transition-timing-function: cubic-bezier(.3,.1,.3,1); }
.hoja.lejos { visibility: hidden; }
.hoja.girando { will-change: transform; }
.hoja.vuelta { transform: rotateY(-180deg); }
.libro.simple .hoja.vuelta { transform: rotateY(-178deg); }
.libro.rapido .hoja { transition-duration: .45s; }

.cara {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: linear-gradient(90deg, var(--hoja) 0%, var(--hoja-2) 60%, #191919 100%);
  border-radius: 0 6px 6px 0;
}
.cara.atras {
  transform: rotateY(180deg);
  border-radius: 6px 0 0 6px;
  background: linear-gradient(270deg, var(--hoja) 0%, var(--hoja-2) 60%, #191919 100%);
}
/* sombra del lomo dentro de cada página */
.cara::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 9%; z-index: 3; pointer-events: none;
}
.cara.frente::before { left: 0; background: linear-gradient(90deg, rgba(0,0,0,.55), transparent); }
.cara.atras::before { right: 0; background: linear-gradient(270deg, rgba(0,0,0,.55), transparent); }
.libro.simple .cara.frente::before { width: 4%; }
/* brillo/sombra mientras la hoja gira */
.cara::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0;
  transition: opacity .3s;
  background: linear-gradient(90deg, transparent 30%, rgba(0,0,0,.4));
}
.hoja.girando .cara::after { opacity: 1; }
/* borde de páginas apiladas */
.hoja .cara.frente { box-shadow: inset -1px 0 0 #2c2c2c, 2px 0 0 #101010, 4px 0 0 #0b0b0b; }

/* esquina para pasar la hoja */
.doblez {
  position: absolute; right: 0; bottom: 0; z-index: 5; width: 12%; aspect-ratio: 1; transform-origin: 100% 100%;
  border: 0; padding: 0; background: linear-gradient(315deg, transparent 50%, rgba(255,255,255,.14) 50%, rgba(0,0,0,.35) 100%);
  border-top-left-radius: 4px;
  animation: doblez 2.6s ease-in-out infinite;
}
@keyframes doblez { 0%, 70%, 100% { transform: scale(1); } 85% { transform: scale(1.35); } }
.cara.atras .doblez {
  right: auto; left: 0;
  background: linear-gradient(45deg, transparent 50%, rgba(255,255,255,.14) 50%, rgba(0,0,0,.35) 100%);
  border-radius: 0 4px 0 0; animation: none;
}

/* ---------- contenido de las páginas ---------- */
.pagina {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  font-size: calc(var(--pw) / 25); padding: 4.5% 6% 4%;
}
.cara.atras .pagina { padding: 4.5% 6% 4%; }
.pagina-pie {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center;
  font-size: .62em; color: #8a847b; padding-top: .5em; letter-spacing: .04em;
}
.cab-cat {
  display: flex; align-items: center; gap: .6em; margin-bottom: .7em;
}
.cab-cat img { width: 2.6em; height: 2.6em; object-fit: contain; }
.cab-cat small { display: block; font-size: .55em; letter-spacing: .14em; color: var(--suave); font-weight: 700; }
.cab-cat h2 { margin: 0; font-size: 1.6em; line-height: 1; font-weight: 900; letter-spacing: .01em; text-transform: uppercase; }
.cab-cat h2::after { content: ""; display: block; width: 2.2em; height: .16em; background: var(--rojo); margin-top: .22em; border-radius: 1em; }
.cab-cat.sigue h2 { font-size: 1.05em; }
.cab-cat.sigue h2::after { width: 1.6em; }

.rejilla {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: .55em;
}
.producto {
  position: relative; display: flex; flex-direction: column; min-height: 0;
  background: #0e0e0e; border: 1px solid #2b2b2b; border-radius: .6em; overflow: hidden;
}
.producto.en-pedido { border-color: var(--rojo); box-shadow: 0 0 0 1px var(--rojo); }
.producto .foto { flex: 1; min-height: 0; background: #0e0e0e center / cover no-repeat; }
.producto .info { padding: .32em .45em .4em; display: flex; flex-direction: column; gap: .25em; }
.producto h3 {
  margin: 0; font-size: .68em; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
  line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fila { display: flex; align-items: center; justify-content: space-between; gap: .3em; }
.precio {
  background: var(--rojo); color: #fff; font-weight: 800; font-size: .66em;
  padding: .18em .45em; border-radius: .3em; white-space: nowrap;
}
.precio small { font-weight: 600; opacity: .9; }
.agregar {
  border: 0; background: #fff; color: #111; font-weight: 800; font-size: .62em;
  border-radius: 999px; padding: .32em .7em; white-space: nowrap;
}
.paso { display: flex; align-items: center; background: #fff; color: #111; border-radius: 999px; font-size: .62em; font-weight: 800; }
.paso button { border: 0; background: none; color: var(--rojo-osc); width: 1.9em; height: 1.9em; font-weight: 900; font-size: 1.05em; padding: 0; }
.paso span { min-width: 2.6em; text-align: center; white-space: nowrap; }

/* portada */
.portada {
  align-items: center; justify-content: center; text-align: center; padding: 8% 8% 6%;
  background:
    radial-gradient(circle at 50% 38%, rgba(227,22,29,.22), transparent 55%),
    linear-gradient(160deg, #1b1b1b, #090909);
}
.portada img { width: 66%; max-width: 280px; filter: drop-shadow(0 .4em 1.2em rgba(0,0,0,.6)); }
.portada .kicker { margin-top: 1.1em; font-size: .7em; letter-spacing: .3em; color: var(--suave); font-weight: 700; }
.portada h1 { margin: .15em 0 0; font-size: 2.1em; line-height: 1; font-weight: 900; letter-spacing: .02em; }
.portada .lema { margin: .6em 0 0; font-size: .82em; color: var(--suave); }
.portada .cinta {
  margin-top: 1.3em; background: var(--rojo); color: #fff; font-weight: 800; padding: .55em 1.1em;
  border-radius: .5em; font-size: .8em; letter-spacing: .03em;
}
.portada .cinta small { display: block; font-weight: 600; font-size: .8em; opacity: .9; margin-top: .15em; }
.portada .pista { margin-top: auto; font-size: .64em; color: #8a847b; }
.portada .pista b { color: var(--texto); }

/* página informativa */
.info-pag h2 { margin: 0 0 .2em; font-size: 1.35em; font-weight: 900; line-height: 1.05; text-transform: uppercase; }
.info-pag h2 em { font-style: normal; color: var(--rojo); }
.info-pag p { margin: .4em 0; font-size: .74em; line-height: 1.45; color: #d8d2c9; }
.bloque {
  margin-top: .65em; padding: .6em .75em; border-radius: .55em;
  background: #0f0f0f; border: 1px solid #2b2b2b; border-left: .25em solid var(--rojo);
}
.bloque b { display: block; font-size: .72em; letter-spacing: .06em; text-transform: uppercase; }
.bloque span { display: block; font-size: .68em; color: var(--suave); line-height: 1.4; margin-top: .15em; }
.pasos { list-style: none; padding: 0; margin: .5em 0 0; counter-reset: p; }
.pasos li {
  counter-increment: p; display: flex; align-items: center; gap: .55em; font-size: .74em; margin: .45em 0;
}
.pasos li::before {
  content: counter(p); flex: none; width: 1.7em; height: 1.7em; border-radius: 50%;
  background: var(--rojo); color: #fff; font-weight: 900; display: grid; place-items: center;
}
.btn-wa {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  margin-top: .9em; padding: .7em 1em; border-radius: .6em; background: #1faa53; color: #fff;
  text-decoration: none; font-weight: 800; font-size: .8em;
}
.contra { align-items: center; justify-content: center; text-align: center; }
.contra img { width: 46%; }
.contra h2 { margin: .6em 0 .1em; font-size: 1.4em; font-weight: 900; line-height: 1.1; text-transform: uppercase; }
.contra p { margin: .3em 0; font-size: .74em; color: var(--suave); }
.contra .tel { font-size: 1.3em; font-weight: 900; color: var(--texto); letter-spacing: .03em; margin-top: .4em; }
.dorso { display: grid; place-items: center; background: linear-gradient(270deg, #121212, #1c1c1c); }
.dorso img { width: 34%; opacity: .12; }
.vacia { align-items: center; justify-content: center; color: #5d5852; font-size: .7em; text-align: center; }
.vacia img { width: 30%; opacity: .25; margin-bottom: 1em; }

/* ---------- controles ---------- */
.controles {
  display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .25rem 0 .5rem;
}
.flecha {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid #3a3a3a; background: #1a1a1a;
  font-size: 1.6rem; line-height: 1; display: grid; place-items: center; padding-bottom: 3px;
}
.flecha:disabled { opacity: .3; cursor: default; }
.num-pagina { font-size: .8rem; color: var(--suave); min-width: 8.5em; text-align: center; }

.resumen {
  position: fixed; left: 50%; bottom: max(.8rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 30; display: flex; gap: 1rem; align-items: center; white-space: nowrap;
  border: 0; border-radius: 999px; padding: .75rem 1.2rem; background: var(--rojo); color: #fff;
  font-size: .9rem; box-shadow: 0 8px 26px rgba(0,0,0,.55);
}
body.con-pedido .controles { padding-bottom: 4.4rem; }

/* ---------- carrito ---------- */
.velo { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; }
.carrito {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); z-index: 50;
  background: #121212; border-left: 1px solid #2b2b2b; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s ease;
}
.carrito.abierto { transform: none; }
.carrito-cab { display: flex; align-items: center; padding: 1rem 1.1rem; border-bottom: 1px solid #2b2b2b; padding-top: max(1rem, env(safe-area-inset-top)); }
.carrito-cab h2 { margin: 0; font-size: 1.2rem; }
.cerrar { margin-left: auto; border: 0; background: none; font-size: 2rem; line-height: 1; color: var(--suave); }
.carrito-cuerpo { flex: 1; overflow-y: auto; padding: .6rem 1.1rem 2rem; }
.lineas { list-style: none; margin: 0; padding: 0; }
.lineas li { display: flex; gap: .7rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid #222; }
.lineas img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; }
.lineas .ln-info { flex: 1; min-width: 0; }
.lineas .ln-info b { display: block; font-size: .88rem; }
.lineas .ln-info span { font-size: .75rem; color: var(--suave); }
.lineas .ln-der { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.lineas .ln-total { font-weight: 800; font-size: .88rem; }
.lineas .paso { font-size: .8rem; }
.vacio { color: var(--suave); font-size: .9rem; line-height: 1.5; }
.totales { margin-top: .8rem; }
.totales div { display: flex; justify-content: space-between; font-size: 1.1rem; }
.nota-peso { font-size: .75rem; color: var(--suave); line-height: 1.45; }
.datos { margin-top: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.datos h3 { margin: .4rem 0 0; font-size: 1rem; }
.datos label { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; color: var(--suave); }
.datos input, .datos select, .datos textarea {
  font: inherit; font-size: 1rem; color: var(--texto); background: #1b1b1b; border: 1px solid #333;
  border-radius: 8px; padding: .65rem .7rem;
}
.datos input:focus, .datos select:focus, .datos textarea:focus { outline: 2px solid var(--rojo); border-color: transparent; }
.enviar {
  margin-top: .3rem; display: flex; align-items: center; justify-content: center; gap: .55rem;
  border: 0; border-radius: 10px; padding: .95rem; background: #1faa53; color: #fff; font-weight: 800; font-size: 1rem;
}
.enviar svg, .btn-wa svg { width: 1.3em; height: 1.3em; fill: #fff; }
.horario-aviso { font-size: .78rem; color: #f1c27d; line-height: 1.4; margin: 0; }

.aviso {
  position: fixed; left: 50%; top: 4.5rem; transform: translate(-50%, -20px); opacity: 0; z-index: 60;
  background: #fff; color: #111; font-weight: 700; font-size: .85rem; padding: .55rem 1rem; border-radius: 999px;
  transition: opacity .25s, transform .25s; pointer-events: none; max-width: 90vw; text-align: center;
}
.aviso.ver { opacity: 1; transform: translate(-50%, 0); }

/* firma de la agencia */
.firma { margin-top: 1.2em; font-size: .6em; color: #8a847b; text-decoration: none; letter-spacing: .04em; }
.firma b, .firma-pie b { color: var(--texto); font-weight: 800; letter-spacing: .02em; }
.firma-pie {
  display: block; text-align: center; font-size: .68rem; color: #7d776f; text-decoration: none;
  padding: 0 0 max(.45rem, env(safe-area-inset-bottom)); margin-top: -.3rem; letter-spacing: .04em;
}
body.con-pedido .firma-pie { display: none; }

@media (max-width: 720px) { .doblez { animation: none; } }

@media (prefers-reduced-motion: reduce) {
  .hoja, .libro { transition-duration: .01s !important; }
  .doblez { animation: none; }
}
