:root {
  color-scheme: light;
  --fondo: #f6f0e7;
  --superficie: #fffcf7;
  --tinta: #2b1e1b;
  --tinta-suave: #6d5b53;
  --borde: #e6dacb;
  --vino: #6b1d2a;
  --vino-oscuro: #4a1119;
  --crema: #f8ead6;
  --dorado: #b4863a;
  --wa: #128c4a;
  --wa-oscuro: #0d7139;
  --apagado: #8f8179;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(60, 30, 20, .06), 0 4px 14px rgba(60, 30, 20, .07);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

/* "hidden" siempre gana (si no, reglas como .btn { display: inline-flex } lo anulan) */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font: 400 16px/1.5 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }

.solo-lector {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------- cabecera */

.cabecera {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(180, 134, 58, .22), transparent 55%),
    linear-gradient(160deg, var(--vino) 0%, var(--vino-oscuro) 100%);
  color: var(--crema);
}

.cabecera-dentro {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 16px 24px;
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.marca-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--crema);
  border: 2px solid rgba(248, 234, 214, .55);
  flex: none;
}

.marca-texto { display: flex; flex-direction: column; }

.marca-nombre {
  font-family: var(--serif);
  font-weight: 650;
  font-size: clamp(1.55rem, 5vw, 2.3rem);
  line-height: 1.1;
  letter-spacing: -.01em;
}

.marca-eslogan {
  margin-top: 4px;
  font-size: .95rem;
  color: rgba(248, 234, 214, .82);
}

.aviso {
  margin: 0;
  padding: 10px 16px;
  background: var(--dorado);
  color: #23170a;
  text-align: center;
  font-weight: 500;
  font-size: .94rem;
}

/* ---------------------------------------------------------------- barra de búsqueda y categorías */

.barra {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 240, 231, .94);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--borde);
}

.barra-dentro {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.buscador {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 999px;
  padding: 0 16px;
  height: 46px;
  transition: border-color .15s, box-shadow .15s;
}

.buscador:focus-within {
  border-color: var(--vino);
  box-shadow: 0 0 0 3px rgba(107, 29, 42, .14);
}

.buscador svg {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: var(--tinta-suave); stroke-width: 2; stroke-linecap: round;
}

.buscador input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  height: 100%;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }

.chip {
  flex: none;
  border: 1px solid var(--borde);
  background: var(--superficie);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--vino); }
.chip[aria-pressed="true"] {
  background: var(--vino);
  border-color: var(--vino);
  color: var(--crema);
}

/* ---------------------------------------------------------------- contenido */

.contenido {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 16px 110px;
  outline: none;
}

.seccion { margin-top: 26px; scroll-margin-top: 130px; }

.seccion-titulo {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 650;
  font-size: 1.45rem;
  line-height: 1.2;
}
.seccion-titulo::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--borde);
  transform: translateY(-4px);
}
.seccion-cuenta {
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 500;
  color: var(--tinta-suave);
}

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

.fila-destacados {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 72%);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 2px 16px 6px;
}
.fila-destacados::-webkit-scrollbar { display: none; }
.fila-destacados > * { scroll-snap-align: start; }
@media (min-width: 640px) { .fila-destacados { grid-auto-columns: minmax(260px, 34%); gap: 16px; } }
@media (min-width: 960px) { .fila-destacados { grid-auto-columns: calc((100% - 60px) / 4); gap: 20px; } }

/* ---------------------------------------------------------------- tarjeta de producto */

.tarjeta {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  overflow: hidden;
  box-shadow: var(--sombra);
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: transform .18s ease, box-shadow .18s ease;
}
.tarjeta:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(60, 30, 20, .08), 0 10px 26px rgba(60, 30, 20, .12); }
.tarjeta:focus-visible { outline: 3px solid var(--vino); outline-offset: 2px; }

.tarjeta-foto {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--crema);
  overflow: hidden;
}
.tarjeta-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sin-foto {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 650;
  font-size: 3rem;
  color: rgba(107, 29, 42, .38);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(107, 29, 42, .035) 14px 28px),
    var(--crema);
}

.etiqueta {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.etiqueta-agotado { background: rgba(43, 30, 27, .82); color: #fff; }
.etiqueta-destacado { background: var(--dorado); color: #23170a; }

.tarjeta.agotado .tarjeta-foto img,
.tarjeta.agotado .sin-foto { filter: grayscale(.85); opacity: .7; }

.tarjeta-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
}

.tarjeta-nombre {
  font-weight: 600;
  font-size: .98rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tarjeta-precio {
  margin-top: auto;
  padding-top: 6px;
  font-family: var(--serif);
  font-weight: 650;
  font-size: 1.12rem;
  color: var(--vino);
}
.tarjeta-precio small {
  font-family: var(--sans);
  font-weight: 500;
  font-size: .78rem;
  color: var(--tinta-suave);
}
.tarjeta-precio.consultar {
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 600;
}

.tarjeta-pedir {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  border-radius: 10px;
  background: var(--wa);
  color: #fff;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  transition: background .15s;
}
.tarjeta-pedir:hover { background: var(--wa-oscuro); }
.tarjeta-pedir svg { width: 17px; height: 17px; fill: currentColor; }

/* ---------------------------------------------------------------- vacío */

.vacio {
  text-align: center;
  padding: 60px 16px;
  color: var(--tinta-suave);
}
.vacio strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--tinta);
  margin-bottom: 6px;
}

/* ---------------------------------------------------------------- botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-oscuro); }
.btn-borde { background: transparent; border-color: var(--borde); }
.btn-borde:hover { border-color: var(--vino); }

/* ---------------------------------------------------------------- ficha (detalle) */

.ficha {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100dvh;
  width: 100%;
  margin: auto 0 0;
  color: var(--tinta);
}
.ficha::backdrop { background: rgba(30, 14, 12, .55); }

.ficha-caja {
  position: relative;
  background: var(--superficie);
  border-radius: 20px 20px 0 0;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ficha[open] .ficha-caja { animation: subir .24s ease-out; }
@keyframes subir { from { transform: translateY(30px); opacity: .4; } }

.ficha-cerrar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 252, 247, .92);
  box-shadow: var(--sombra);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ficha-cerrar svg { width: 20px; height: 20px; stroke: var(--tinta); stroke-width: 2.2; stroke-linecap: round; fill: none; }

.ficha-foto { aspect-ratio: 4 / 3; background: var(--crema); }
.ficha-foto img { width: 100%; height: 100%; object-fit: cover; }
.ficha-foto .sin-foto { font-size: 5rem; }

.ficha-info { padding: 18px 20px 24px; }

.ficha-categoria {
  margin: 0;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dorado);
}

.ficha-nombre {
  margin: 4px 0 6px;
  font-family: var(--serif);
  font-weight: 650;
  font-size: 1.7rem;
  line-height: 1.15;
}

.ficha-precio {
  margin: 0;
  font-family: var(--serif);
  font-weight: 650;
  font-size: 1.45rem;
  color: var(--vino);
}
.ficha-precio small { font-family: var(--sans); font-size: .95rem; font-weight: 500; color: var(--tinta-suave); }

.ficha-agotado {
  display: inline-block;
  margin: 10px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: #efe6dc;
  color: var(--tinta-suave);
  font-weight: 600;
  font-size: .88rem;
}

.ficha-descripcion {
  margin: 14px 0 0;
  white-space: pre-line;
  color: #4a3a34;
}
.ficha-descripcion:empty { display: none; }

.ficha-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.ficha-acciones .btn-wa { flex: 1 1 220px; }

@media (min-width: 760px) {
  .ficha { width: min(860px, calc(100vw - 48px)); margin: auto; }
  .ficha-caja {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: 20px;
    max-height: min(640px, 90vh);
  }
  .ficha-foto { aspect-ratio: auto; min-height: 100%; }
  .ficha-info { padding: 30px 28px; align-self: center; }
  .ficha[open] .ficha-caja { animation-name: aparecer; }
  @keyframes aparecer { from { transform: scale(.97); opacity: .4; } }
}

/* ---------------------------------------------------------------- pie */

.pie {
  background: var(--vino-oscuro);
  color: rgba(248, 234, 214, .86);
  font-size: .93rem;
}
.pie-dentro {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 16px 100px;
  display: grid;
  gap: 18px;
}
@media (min-width: 760px) { .pie-dentro { grid-template-columns: repeat(3, 1fr); padding-bottom: 40px; } }

.pie-nombre { font-family: var(--serif); font-weight: 650; font-size: 1.2rem; color: var(--crema); margin: 0 0 4px; }
.pie-titulo { margin: 0 0 4px; font-weight: 600; color: var(--crema); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.pie p { margin: 0; }
.pie a { color: var(--crema); text-underline-offset: 3px; }
.pie-enlaces { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.pie-legal { grid-column: 1 / -1; font-size: .8rem; color: rgba(248, 234, 214, .55); }

/* ---------------------------------------------------------------- WhatsApp flotante */

.wa-flotante {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 54px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  background: var(--wa);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(18, 140, 74, .35);
  transition: background .15s, transform .15s;
}
.wa-flotante:hover { background: var(--wa-oscuro); transform: translateY(-1px); }
.wa-flotante svg { width: 26px; height: 26px; fill: currentColor; }

/* ---------------------------------------------------------------- aviso flotante */

.aviso-flotante {
  position: fixed;
  left: 50%;
  bottom: 90px;
  z-index: 30;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: var(--tinta);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .92rem;
  transition: opacity .2s, transform .2s;
}
.aviso-flotante.visible { opacity: 1; transform: translate(-50%, 0); }

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