:root {
  --rojo: #D21F27;
  --rojo-oscuro: #A8161D;
  --negro: #161616;
  --dorado: #C9A227;
  --dorado-claro: #F3E6B8;
  --papel: #FBF6EC;
  --blanco: #FFFFFF;
  --gris: #6B655C;
  --linea: #E6DDCB;
  --verde-wa: #1FAF54;

  --titulos: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --precios: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radio: 14px;
  --gutter: 16px;
  --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--negro);
  background: var(--papel);
  padding-bottom: 96px; /* lugar para la barra del carrito */
}

h1, h2, h3 { font-family: var(--titulos); font-weight: 800; margin: 0; line-height: 1.05; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* DEMO: borrar al lanzar */
.demo {
  padding: 8px var(--gutter); text-align: center;
  background: var(--dorado); color: var(--negro);
  font-size: 13px; font-weight: 700;
}

/* ---------- Cabecera ---------- */

.topbar {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px var(--gutter);
  background: var(--negro); color: var(--papel);
  font-size: 13px; letter-spacing: .02em;
}
.topbar a { color: var(--dorado); font-weight: 700; text-decoration: none; }

.masthead {
  max-width: var(--max); margin: 0 auto;
  padding: 24px var(--gutter) 20px;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center;
  border-bottom: 3px double var(--negro);
}
.masthead__logo { width: 72px; height: 72px; object-fit: contain; }
.masthead__kicker {
  font-size: 12px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase;
  color: var(--rojo);
}
.masthead__name {
  font-size: clamp(38px, 11vw, 80px); font-weight: 900; letter-spacing: -.03em;
  text-transform: uppercase;
}
.masthead__tagline { font-size: 15px; font-weight: 600; color: var(--gris); margin-top: 6px; }
.masthead__edition {
  grid-column: 1 / -1; margin-top: 14px; padding-top: 10px;
  border-top: 1px solid var(--linea);
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gris);
  display: flex; justify-content: space-between; gap: 8px; white-space: nowrap;
}

/* ---------- Ofertas ---------- */

.ofertas {
  background: var(--rojo); color: var(--papel);
  padding: 28px 0 24px; margin-top: 24px;
  position: relative;
}
.ofertas::before, .ofertas::after {
  content: ""; position: absolute; left: 0; right: 0; height: 4px; background: var(--dorado);
}
.ofertas::before { top: 6px; }
.ofertas::after { bottom: 6px; }
.ofertas__head { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 16px; }
.ofertas__head h2 { font-size: clamp(30px, 8.5vw, 52px); font-weight: 900; text-transform: uppercase; letter-spacing: -.02em; }
.ofertas__head h2 em { font-style: normal; font-weight: 700; color: var(--dorado-claro); text-transform: none; letter-spacing: 0; display: block; font-size: .55em; }
.ofertas__head p { margin-top: 6px; opacity: .9; }

.ofertas__track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 46%);
  gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px var(--gutter) 12px;
  max-width: var(--max); margin: 0 auto;
  scrollbar-width: thin; scrollbar-color: var(--dorado) transparent;
}
.ofertas__track > * { scroll-snap-align: start; }
@media (min-width: 640px) { .ofertas__track { grid-auto-columns: 240px; } }

/* ---------- Controles (buscador + chips) ---------- */

.controles {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--papel) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linea);
  padding: 12px 0 10px;
}
.buscador {
  display: flex; align-items: center; gap: 8px;
  max-width: var(--max); margin: 0 auto 10px;
  margin-inline: var(--gutter);
  padding: 0 14px; height: 46px;
  background: var(--blanco); border: 1.5px solid var(--negro); border-radius: 999px;
}
@media (min-width: 1152px) { .buscador { margin-inline: auto; } }
.buscador svg { width: 20px; height: 20px; fill: none; stroke: var(--negro); stroke-width: 2; flex: none; }
.buscador input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; color: var(--negro);
}
.buscador:focus-within { outline: 3px solid var(--dorado); outline-offset: 1px; }

.chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px var(--gutter);
  max-width: var(--max); margin: 0 auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--negro); background: transparent;
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--negro); color: var(--papel); }
.chip--oferta { border-color: var(--rojo); color: var(--rojo); }
.chip--oferta[aria-pressed="true"] { background: var(--rojo); color: var(--papel); }

/* ---------- Catálogo ---------- */

.catalogo { max-width: var(--max); margin: 0 auto; padding: 8px var(--gutter) 32px; }

.seccion { margin-top: 28px; }
.seccion__head {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1.5px solid var(--negro);
}
.seccion__num { font-family: var(--precios); font-weight: 800; font-size: 22px; color: var(--rojo); }
.seccion__head h2 { font-size: clamp(24px, 6.5vw, 34px); font-weight: 800; letter-spacing: -.01em; }
.seccion__count { margin-left: auto; font-size: 13px; color: var(--gris); }

.grilla {
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px) { .grilla { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .grilla { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Tarjeta de producto ---------- */

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--blanco); border-radius: var(--radio);
  border: 1px solid var(--linea); overflow: hidden;
  color: var(--negro);
}
.card__media { position: relative; aspect-ratio: 1 / 1; background: var(--dorado-claro); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }

.placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 10px; text-align: center;
}
.placeholder__letra { font-family: var(--titulos); font-weight: 900; font-size: 60px; line-height: 1; }
.placeholder__cat { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; opacity: .75; }
.tono-0 { background: #F6DCD2; color: var(--rojo-oscuro); }
.tono-1 { background: var(--dorado-claro); color: #7A5F0E; }
.tono-2 { background: #E4E0D6; color: var(--negro); }
.tono-3 { background: #F1E3CF; color: #8A3B12; }
.tono-4 { background: #DCE6DA; color: #2F4A2C; }
.tono-5 { background: #E3DDEA; color: #3F2F55; }

.badge {
  position: absolute; top: 8px; left: 8px;
  padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.badge--oferta { background: var(--rojo); color: var(--papel); box-shadow: 0 0 0 2px var(--dorado); }
.badge--agotado { background: var(--negro); color: var(--papel); }

.card__body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; flex: 1; }
.card__nombre { font-size: 14px; font-weight: 600; line-height: 1.3; min-height: 2.6em; }
.card__precio { font-family: var(--precios); font-weight: 800; font-size: 30px; line-height: 1; margin-top: auto; }

.card--agotado .card__media { filter: grayscale(1); opacity: .55; }
.card--agotado .card__precio { color: var(--gris); }

/* Tarjeta dentro de la franja de ofertas */
.ofertas .card { border: 0; box-shadow: 0 0 0 2px var(--dorado); }
.ofertas .card__precio { color: var(--rojo); font-size: 34px; }

/* ---------- Botones ---------- */

.btn-agregar {
  height: 40px; border-radius: 999px; border: 0;
  background: var(--negro); color: var(--papel);
  font-weight: 700; font-size: 14px;
}
.btn-agregar:hover { background: var(--rojo); }
.btn-agregar:disabled { background: var(--linea); color: var(--gris); cursor: not-allowed; }

.stepper {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
  height: 40px; border-radius: 999px; background: var(--rojo); color: var(--papel);
  overflow: hidden;
}
.stepper button {
  height: 100%; border: 0; background: transparent; color: inherit;
  font-size: 20px; font-weight: 700; line-height: 1;
}
.stepper button:hover { background: var(--rojo-oscuro); }
.stepper output { text-align: center; font-weight: 700; }
.stepper--sm { height: 34px; grid-template-columns: 34px 34px 34px; justify-self: start; }

.icono-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center;
}
.icono-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icono-btn:hover { background: var(--linea); }

.btn-link { border: 0; background: transparent; text-decoration: underline; color: var(--gris); font-size: 14px; padding: 8px; }

.btn-primario {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 0;
  background: var(--rojo); color: var(--papel); font-weight: 700; text-decoration: none;
}

/* ---------- Estados ---------- */

.estado {
  text-align: center; padding: 48px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.estado svg { width: 72px; height: 72px; fill: none; stroke: var(--dorado); stroke-width: 1.5; }
.estado h3 { font-size: 22px; }
.estado p { color: var(--gris); max-width: 32ch; }
.estado .btn-primario { margin-top: 8px; }

.resumen { margin-top: 20px; font-size: 14px; color: var(--gris); }
.resumen strong { color: var(--negro); }

/* ---------- Barra flotante del carrito ---------- */

.carrito-barra {
  position: fixed; z-index: 10;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(14px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  height: 58px; padding: 0 18px 0 8px; border: 0; border-radius: 999px;
  background: var(--negro); color: var(--papel);
  box-shadow: 0 10px 30px rgba(22, 22, 22, .3);
}
.carrito-barra[hidden] { display: none; }
.carrito-barra__cant {
  min-width: 42px; height: 42px; padding: 0 8px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--rojo); font-weight: 700;
}
.carrito-barra__label { font-weight: 700; }
.carrito-barra__total { margin-left: auto; font-family: var(--precios); font-weight: 800; font-size: 26px; color: var(--dorado); }
.carrito-barra.pulso { animation: pulso .35s ease; }
@keyframes pulso { 50% { transform: scale(1.03); } }

/* ---------- Panel del carrito ---------- */

.carrito {
  margin: auto 0 0; padding: 0; border: 0;
  width: 100%; max-width: 100%; max-height: 88dvh;
  border-radius: 22px 22px 0 0;
  background: var(--papel); color: var(--negro);
  display: none; flex-direction: column;
}
.carrito[open] { display: flex; animation: subir .25s ease-out; }
.carrito::backdrop { background: rgba(22, 22, 22, .55); }
@keyframes subir { from { transform: translateY(40px); opacity: 0; } }

@media (min-width: 720px) {
  .carrito {
    margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: 420px;
    border-radius: 0;
  }
  @keyframes subir { from { transform: translateX(40px); opacity: 0; } }
}

.carrito__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter) 12px; border-bottom: 3px double var(--negro);
}
.carrito__head h2 { font-size: 26px; font-weight: 900; text-transform: uppercase; }
.carrito__body { overflow-y: auto; flex: 1; padding: 4px var(--gutter); }

.linea {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--linea);
}
.linea__nombre { font-weight: 500; }
.linea__unit { font-size: 13px; color: var(--gris); }
.linea__sub { font-family: var(--precios); font-weight: 800; font-size: 22px; text-align: right; }
.linea__aviso { grid-column: 1 / -1; font-size: 13px; color: var(--rojo); }
.linea--agotado .linea__nombre { text-decoration: line-through; color: var(--gris); }

.carrito__foot {
  padding: 14px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  border-top: 1.5px solid var(--negro); background: var(--blanco);
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.carrito__foot[hidden] { display: none; }
.carrito__total { display: flex; justify-content: space-between; align-items: baseline; }
.carrito__total strong { font-family: var(--precios); font-weight: 800; font-size: 38px; }

.btn-whatsapp {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 54px; border-radius: 999px;
  background: var(--verde-wa); color: var(--blanco);
  font-weight: 700; font-size: 17px; text-decoration: none;
}
.btn-whatsapp svg { width: 24px; height: 24px; fill: currentColor; }
.btn-whatsapp:hover { filter: brightness(.95); }

/* ---------- Pie ---------- */

.pie {
  background: var(--negro); color: var(--papel);
  padding: 32px var(--gutter) 40px; text-align: center;
  display: flex; flex-direction: column; gap: 6px; font-size: 14px;
  border-top: 4px solid var(--dorado);
}
.pie__name { font-family: var(--titulos); font-size: 20px; font-weight: 900; text-transform: uppercase; }
.pie a { color: var(--dorado); }
.pie__nota { opacity: .6; font-size: 12px; }

/* ---------- Carga ---------- */

.esqueleto { background: var(--linea); border-radius: var(--radio); aspect-ratio: 3 / 4; animation: brillo 1.2s infinite alternate; }
@keyframes brillo { to { opacity: .5; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
