
:root {
  /* ---- Colores ---- */
  --hoja:      #12372a;  /* verde profundo: encabezado, botones principales */
  --hoja-2:    #1b4d3b;  /* verde medio: álamos del encabezado, bordes activos */
  --fondo:     #f4f7ef;  /* fondo de la página */
  --papel:     #ffffff;  /* tarjetas */
  --tinta:     #15231c;  /* texto */
  --suave:     #5a6a60;  /* texto secundario */
  --aji:       #ffc83d;  /* cartel de precio */
  --rocoto:    #c7321f;  /* cifras del precio */
  --whatsapp:  #25d366;  /* botón de enviar */
  --error:     #b3261e;

  /* ---- Tipografía ---- */
  --f-titulo: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --f-texto:  "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font-family: var(--f-texto); font-size: 17px; line-height: 1.5;
  padding-bottom: 100px;
}
body.lock { overflow: hidden; }
body { overflow-x: clip; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--f-titulo); margin: 0; line-height: 1.08; letter-spacing: -.01em; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--aji); outline-offset: 3px; }

/* ---------- Encabezado ---------- */
.hero { position: relative; background: var(--hoja); color: #fff; overflow: hidden; }
.hero-in { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; padding: 22px 20px 120px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--aji); font-family: var(--f-titulo); font-weight: 800; font-size: 1.25rem; }
.brand-mark { width: 38px; height: 34px; }
.brand-img { display: block; height: 100px; width: auto; max-width: 500vw; }
.hero h1 { font-weight: 800; font-size: clamp(2.1rem, 8.2vw, 3.9rem); max-width: 14em; margin: 36px 0 14px; text-wrap: balance; }
.hero-sub { margin: 0 0 24px; max-width: 30em; font-size: 1.1rem; color: #d9e6dc; }
.hero-cta {
  display: inline-flex; align-items: center; min-height: 54px; padding: 0 26px; border-radius: 12px;
  background: var(--aji); color: var(--tinta); font-weight: 700; font-size: 1.05rem; text-decoration: none;
}
.hero-cta:active { transform: translateY(1px); }

/* Fila de álamos (una alameda) como borde inferior del encabezado */
.poplars {
  position: absolute; left: 0; right: 0; bottom: 0; height: 92px;
  background-repeat: repeat-x; background-position: bottom left; background-size: 150px 92px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='92' viewBox='0 0 150 92'%3E%3Cg fill='%231b4d3b'%3E%3Crect x='19' y='70' width='4' height='22'/%3E%3Cellipse cx='21' cy='40' rx='13' ry='36'/%3E%3Crect x='73' y='74' width='4' height='18'/%3E%3Cellipse cx='75' cy='42' rx='15' ry='38'/%3E%3Crect x='123' y='72' width='4' height='20'/%3E%3Cellipse cx='125' cy='54' rx='12' ry='32'/%3E%3C/g%3E%3C/svg%3E");
}
.poplars::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: var(--fondo); }

/* ---------- Catálogo ---------- */
main { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.catalog { padding-top: 30px; scroll-margin-top: 8px; }
.catalog-head { margin-bottom: 22px; }
.catalog-head h2 { font-weight: 800; font-size: clamp(1.8rem, 6vw, 2.5rem); }
.catalog-head p { margin: 6px 0 0; color: var(--suave); }

.empty { padding: 36px 0; }
.empty p { font-size: 1.15rem; margin: 0 0 16px; }
.btn-wa { display: inline-flex; align-items: center; min-height: 54px; padding: 0 24px; border-radius: 12px; background: var(--whatsapp); color: #0b2a14; font-weight: 800; text-decoration: none; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
@media (min-width: 700px)  { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px 22px; } }
@media (min-width: 980px)  { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { display: flex; flex-direction: column; background: var(--papel); border-radius: 18px; outline: 3px solid transparent; transition: outline-color .15s; }
.card.in-cart { outline-color: var(--hoja-2); }
.card-media { position: relative; padding-bottom: 20px; }
.card-img { display: block; width: 100%; aspect-ratio: 4 / 3; height: auto; object-fit: cover; border-radius: 18px 18px 0 0; background: #dfe7da; }

/* Cartel de precio, como los de los mercados */
.tag {
  position: absolute; left: 10px; bottom: 0; margin: 0;
  display: flex; align-items: baseline; gap: 3px;
  padding: 5px 12px 6px 22px; background: var(--aji); color: var(--rocoto);
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%);
  transform: rotate(-2.5deg); transform-origin: left center;
  box-shadow: none;
}
.tag::before { content: ""; position: absolute; left: 12px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--papel); }
.tag-cur { font-family: var(--f-titulo); font-weight: 700; font-size: .95rem; }
.tag-num { font-family: var(--f-titulo); font-weight: 800; font-size: 1.6rem; line-height: 1; letter-spacing: -.02em; }
.tag-per { font-size: .75rem; font-weight: 600; color: var(--tinta); margin-left: 3px; }

.card-body { display: flex; flex-direction: column; gap: 10px; padding: 8px 12px 14px; flex: 1; }
.card h3 { font-weight: 700; font-size: 1.15rem; }
.buy { margin-top: auto; }

.btn-add {
  width: 100%; min-height: 50px; border: 0; border-radius: 12px;
  background: var(--hoja); color: #fff; font-size: 1.05rem; font-weight: 700;
}
.btn-add:active { background: var(--hoja-2); }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.stepper[hidden], .btn-add[hidden] { display: none; }
.stepper button {
  flex: 0 0 46px; width: 46px; height: 50px; border-radius: 12px; border: 2px solid var(--hoja);
  background: #fff; color: var(--hoja); font-size: 1.7rem; font-weight: 700; line-height: 1; padding: 0;
}
.stepper button:active { background: var(--hoja); color: #fff; }
.qty { flex: 1; min-width: 0; font-weight: 700; font-size: 1.05rem; text-align: center; white-space: nowrap; }

/* ---------- Cómo pedir ---------- */
.how { margin: 56px 0 8px; padding: 26px 20px; background: var(--hoja); color: #fff; border-radius: 22px; }
.how h2 { font-weight: 800; font-size: 1.5rem; margin-bottom: 14px; }
.how ol { list-style: none; counter-reset: paso; margin: 0; padding: 0; display: grid; gap: 14px; }
.how li { counter-increment: paso; position: relative; padding-left: 46px; color: #d9e6dc; }
.how li::before {
  content: counter(paso); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--aji); color: var(--tinta); font-family: var(--f-titulo); font-weight: 800; display: grid; place-items: center;
}
.how b { color: #fff; }
@media (min-width: 760px) { .how ol { grid-template-columns: repeat(3, 1fr); gap: 24px; } }

/* ---------- Pie ---------- */
.foot { text-align: center; padding: 34px 20px 20px; color: var(--suave); }
.foot p { margin: 0 0 4px; }
.foot-name { font-family: var(--f-titulo); font-weight: 800; font-size: 1.2rem; color: var(--hoja); }
.foot a { font-weight: 700; color: var(--hoja); white-space: nowrap; }

/* ---------- Barra fija del pedido ---------- */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--fondo) 65%, rgba(244,247,239,0));
}
.cartbar[hidden] { display: none; }
.cartbar button {
  width: 100%; max-width: 640px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  min-height: 60px; padding: 0 12px 0 20px; border: 0; border-radius: 16px;
  background: var(--hoja); color: #fff; font-size: 1.05rem; box-shadow: 0 8px 22px rgba(18,55,42,.35);
}
.cartbar-sum { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; min-width: 0; }
.cartbar-sum b#cart-total { font-size: 1.2rem; }
.cartbar-cta { white-space: nowrap; flex-shrink: 0; background: var(--aji); color: var(--tinta); padding: 10px 16px; border-radius: 11px; font-weight: 700; }

/* ---------- Ventana del pedido ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,25,18,.55); z-index: 30; }
.sheet-bg[hidden], .sheet[hidden] { display: none; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff;
  border-radius: 24px 24px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto; max-width: 640px; margin: 0 auto;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-weight: 800; font-size: 1.6rem; }
.sheet-head button { border: 0; background: #edf1e8; width: 46px; height: 46px; border-radius: 50%; font-size: 1.1rem; }
.order-list { list-style: none; margin: 12px 0 0; padding: 0; }
.order-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e7ece2; }
.order-total { font-size: 1.15rem; text-align: right; margin: 12px 0; }
.field { display: block; font-weight: 600; }
.field input {
  display: block; width: 100%; margin-top: 6px; min-height: 54px; padding: 0 14px;
  border: 2px solid #c9d3c4; border-radius: 12px; font-size: 1.05rem; font-family: inherit; color: var(--tinta);
}
.field input:focus { outline: none; border-color: var(--hoja-2); }
.hint { color: var(--error); margin: 6px 0 0; font-weight: 600; }
.btn-send { width: 100%; min-height: 60px; margin-top: 14px; border: 0; border-radius: 14px; background: var(--whatsapp); color: #0b2a14; font-size: 1.1rem; font-weight: 800; }
.btn-clear { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--suave); text-decoration: underline; font-size: .95rem; padding: 8px; }
.note { text-align: center; color: var(--suave); font-size: .85rem; margin: 8px 0 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Pantallas angostas: "por kilo" pasa debajo del precio para que el cartel no se salga de la tarjeta */
@media (max-width: 520px) {
  .tag { flex-wrap: wrap; max-width: calc(100% - 8px); row-gap: 0; padding-bottom: 5px; }
  .tag-per { flex-basis: 100%; margin: 1px 0 0; line-height: 1.1; }
  .tag-num { font-size: 1.45rem; }
}

/* Pantallas angostas: la cantidad va arriba y los botones − + abajo, grandes y sin apretarse */
@media (max-width: 520px) {
  .stepper { flex-wrap: wrap; gap: 6px; }
  .qty { order: -1; flex: 1 0 100%; font-size: 1.1rem; line-height: 1.1; }
  .stepper button { flex: 1 1 0; width: auto; }
}
.credit { margin: 14px 0 0; font-size: .8rem; opacity: .65; }
.credit a { color: inherit; font-weight: 600; }