@font-face {
  font-family: "Fascinate";
  src: url("../fonts/fascinate-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 1000; font-style: normal; font-display: swap;
}

/* Colores tomados del logo y del menú de El Divino Burro */
:root {
  --rojo: #d90f40;
  --rojo-fondo: #a50d32;
  --vino: #5e0a1f;
  --amarillo: #f6cb25;
  --crema: #fff7e3;
  --borde: #ecd3c2;
  --tinta: #2a0d12;
  --suave: #7b4a4f;
  --display: "Fascinate", "Cooper Black", Georgia, serif;
  --texto: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Precios y cifras en Nunito negrita: los números de Fascinate se confunden con letras */
.plato-precio, .barra-total, .opcion > span b, .linea-precio, .totales .total dd, .cantidad output {
  font-family: var(--texto) !important; font-weight: 900 !important;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--texto);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--tinta);
  background-color: var(--rojo-fondo);
  background-image: radial-gradient(circle, rgba(255, 255, 255, .07) 2px, transparent 2.6px);
  background-size: 22px 22px;
  padding-bottom: 96px;
}
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; }
dialog :focus-visible { outline-color: var(--rojo); }

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

.aviso-prueba {
  margin: 0; padding: 8px 16px; text-align: center;
  background: #111; color: var(--amarillo); font-weight: 800; font-size: .9rem;
}

/* ---------- cabecera ---------- */
.hero {
  position: relative; text-align: center; padding: 26px 16px 22px;
  background: var(--amarillo);
}
/* borde ondulado, como los bordes del menú impreso */
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 14px;
  background: radial-gradient(circle at 12px 0, var(--amarillo) 11px, transparent 11.5px) repeat-x;
  background-size: 24px 14px;
}
.hero-logo { margin: 0 auto; width: min(40vw, 160px); transform: rotate(-3deg); }
.hero-logo img { width: 100%; height: auto; filter: drop-shadow(0 6px 0 rgba(94, 10, 31, .25)); }
.hero-frase { margin: 16px 0 2px; font-family: var(--display); font-size: 1.7rem; line-height: 1.1; color: var(--rojo); }
.hero-sub { margin: 0; color: var(--vino); font-weight: 700; }

/* ---------- navegación por secciones ---------- */
.secciones {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 8px; overflow-x: auto; padding: 22px 16px 10px;
  background: var(--rojo-fondo);
  scrollbar-width: none;
}
.secciones::-webkit-scrollbar { display: none; }
.secciones a {
  flex: none; padding: 7px 16px; border: 2px solid var(--amarillo); border-radius: 999px;
  color: var(--amarillo); text-decoration: none; font-weight: 900; font-size: .95rem;
}
.secciones a:hover { background: var(--amarillo); color: var(--vino); }

/* ---------- menú ---------- */
main { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.seccion { padding-top: 18px; scroll-margin-top: 64px; }
.seccion-titulo {
  margin: 0 0 12px; color: var(--amarillo);
  font-family: var(--display); font-weight: 400; font-size: 2.2rem; line-height: 1.05;
  text-shadow: 3px 3px 0 var(--vino);
}
.platos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.plato {
  display: block; width: 100%; padding: 0; text-align: left; overflow: hidden;
  background: var(--crema); border: 0; border-radius: 16px;
  box-shadow: 0 5px 0 var(--vino);
}
.plato.con-foto { display: grid; grid-template-columns: 116px 1fr; }
.plato-foto { width: 116px; height: 100%; min-height: 116px; object-fit: cover; }
.plato-texto { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; min-height: 100%; }
.plato-nombre { font-family: var(--display); font-size: 1.3rem; line-height: 1.1; color: var(--rojo); }
.plato-desc { font-size: .9rem; color: var(--suave); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.plato-pie { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.plato-precio { font-family: var(--display); font-size: 1.15rem; color: var(--tinta); }
.plato-mas {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--amarillo); color: var(--rojo); font-size: 1.6rem; font-weight: 900; line-height: 1;
}
.plato:hover { background: #fff; }
.plato:active { transform: translateY(2px); box-shadow: 0 3px 0 var(--vino); }

.seccion.compacta .platos { grid-template-columns: 1fr; gap: 10px; }
.seccion.compacta .plato-texto { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.seccion.compacta .plato-nombre { font-family: var(--texto); font-weight: 900; font-size: 1.05rem; color: var(--tinta); }
.seccion.compacta .plato-pie { margin: 0; padding: 0; gap: 14px; }
.seccion.compacta .plato-precio { font-size: 1.05rem; }
.seccion.compacta .plato-mas { width: 32px; height: 32px; font-size: 1.4rem; }
.seccion.compacta .plato-desc { display: none; }

.pie-iva { text-align: center; color: var(--crema); font-weight: 700; margin: 30px 0 0; }

@media (min-width: 720px) {
  .platos { grid-template-columns: 1fr 1fr; gap: 16px; }
  .platos:has(> li:only-child) { grid-template-columns: 1fr; }
  .seccion.compacta .platos { grid-template-columns: 1fr 1fr; }
  .plato.con-foto { grid-template-columns: 150px 1fr; }
  .plato-foto { width: 150px; min-height: 150px; }
  .hero { padding-top: 34px; }
  .hero-logo { width: 180px; }
  .secciones { justify-content: center; }
  .seccion-titulo { font-size: 2.6rem; }
}

/* ---------- barra inferior ---------- */
.barra-pedido {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--vino);
}
.barra-pedido[hidden] { display: none; }
.barra-pedido button {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 520px; margin: 0 auto;
  padding: 12px 18px; border: 0; border-radius: 999px;
  background: var(--amarillo); color: var(--tinta); font-weight: 900; font-size: 1.05rem;
}
.barra-cuenta { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; background: var(--rojo); color: #fff; font-weight: 900; }
.barra-texto { flex: 1; text-align: left; }
.barra-total { font-family: var(--display); font-size: 1.2rem; color: var(--rojo); }

/* ---------- ventanas ---------- */
dialog {
  width: min(540px, 100%); max-height: 94dvh; padding: 0; overflow: auto;
  border: 0; border-radius: 22px 22px 0 0; background: var(--crema); color: var(--tinta);
  margin: auto auto 0;
}
dialog::backdrop { background: rgba(42, 13, 18, .65); }
dialog[open] { animation: subir .22s ease-out; }
@keyframes subir { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
@media (min-width: 640px) { dialog { margin: auto; border-radius: 22px; } }

.dlg-cerrar-fila { position: sticky; top: 0; z-index: 2; margin: 0; display: flex; justify-content: flex-end; height: 0; }
.dlg-cerrar {
  width: 44px; height: 44px; margin: 8px; border: 0; border-radius: 50%; background: #fff; color: var(--rojo);
  font-size: 1.7rem; line-height: 1; font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.dlg-cuerpo { padding: 56px 18px 22px; }
.dlg-titulo { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 1.9rem; color: var(--rojo); }

.item-foto { margin: -56px -18px 14px; width: calc(100% + 36px); max-width: none; aspect-ratio: 4 / 3; object-fit: cover; }
.item-nombre { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 2rem; line-height: 1.05; color: var(--rojo); }
.item-desc { margin: 0 0 14px; color: var(--suave); font-weight: 600; }

fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset[hidden] { display: none; }
legend { padding: 0; margin-bottom: 8px; font-weight: 900; }
legend .contador { font-weight: 700; color: var(--suave); }
.opciones { display: grid; gap: 8px; }
.opciones.dos-columnas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opcion { position: relative; display: block; }
.opcion input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opcion > span {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; height: 100%; padding: 11px 14px;
  background: #fff; border: 2px solid var(--borde); border-radius: 12px; font-weight: 800;
}
.opcion > span b { color: var(--rojo); white-space: nowrap; }
.opcion input:checked + span { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.opcion input:checked + span b { color: var(--amarillo); }
.opcion input:disabled { cursor: not-allowed; }
.opcion input:disabled + span { opacity: .45; }
.opcion input:focus-visible + span { outline: 3px solid var(--rojo); outline-offset: 2px; }
.entrega { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.entrega legend { grid-column: 1 / -1; }

.campo { display: block; margin-bottom: 12px; font-weight: 900; }
.campo input, .campo textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font-size: 1rem; font-weight: 600;
  background: #fff; border: 2px solid var(--borde); border-radius: 12px;
}
.campo textarea { min-height: 76px; resize: vertical; }
.campo input:focus, .campo textarea:focus { border-color: var(--rojo); outline: none; }

.pie-item { display: flex; gap: 12px; align-items: stretch; margin-top: 6px; }
.cantidad { display: flex; align-items: center; border: 2px solid var(--rojo); border-radius: 999px; background: #fff; }
.cantidad button { width: 44px; height: 100%; min-height: 44px; border: 0; background: transparent; font-size: 1.4rem; font-weight: 900; color: var(--rojo); }
.cantidad output { min-width: 26px; text-align: center; font-family: var(--display); font-size: 1.2rem; }
.btn-agregar, .btn-pagar {
  flex: 1; padding: 13px 16px; border: 0; border-radius: 999px; background: var(--rojo); color: #fff;
  font-weight: 900; font-size: 1.05rem;
}
.btn-agregar:disabled, .btn-pagar:disabled { background: #c9b5b0; cursor: not-allowed; }
.btn-pagar { width: 100%; margin-top: 4px; }
.pista { color: var(--rojo); font-weight: 800; font-size: .92rem; margin: -6px 0 12px; }

/* ---------- pedido ---------- */
.lineas { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.linea { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px; background: #fff; border: 2px solid var(--borde); border-radius: 14px; }
.linea-nombre { font-weight: 900; }
.linea-detalle { color: var(--suave); font-size: .92rem; font-weight: 600; }
.linea-nota { grid-column: 1 / -1; font-size: .92rem; background: #fff1b8; padding: 4px 8px; border-radius: 8px; }
.linea-precio { font-family: var(--display); color: var(--rojo); text-align: right; }
.linea-acciones { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.linea .cantidad button { min-height: 38px; width: 40px; }
.quitar { border: 0; background: none; color: var(--rojo); font-weight: 900; padding: 8px 4px; text-decoration: underline; }
.vacio { color: var(--suave); }

.totales { margin: 16px 0; padding: 12px 14px; background: #fff; border: 2px solid var(--borde); border-radius: 14px; }
.totales div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; font-weight: 800; }
.totales dt, .totales dd { margin: 0; }
.totales div[hidden] { display: none; }
.totales .total { margin-top: 6px; padding-top: 8px; border-top: 2px dashed var(--borde); font-weight: 900; font-size: 1.2rem; color: var(--rojo); }
.errores { margin: 0 0 12px; padding: 10px 12px 10px 30px; background: #fff0f2; border: 2px solid var(--rojo); border-radius: 12px; color: #8d1028; font-weight: 800; }
.nota-pago { margin: 10px 0 0; font-size: .88rem; color: var(--suave); text-align: center; }

/* ---------- páginas de estado ---------- */
.estado { max-width: 560px; margin: 0 auto; padding: 32px 16px; text-align: center; color: var(--crema); }
.estado-logo { width: 140px; height: auto; margin: 0 auto 10px; transform: rotate(-3deg); }
.estado h1 { margin: 6px 0 8px; font-family: var(--display); font-weight: 400; font-size: 2.1rem; line-height: 1.1; color: var(--amarillo); text-shadow: 3px 3px 0 var(--vino); }
.estado p { margin: 0 0 12px; }
.estado .caja { text-align: left; margin: 18px 0; padding: 14px; background: var(--crema); color: var(--tinta); border-radius: 16px; }
.estado .caja ul { margin: 6px 0 0; padding-left: 18px; }
.estado .caja small { color: var(--suave); font-weight: 700; }
.btn-enlace {
  display: inline-block; padding: 13px 24px; border: 0; border-radius: 999px;
  background: var(--amarillo); color: var(--tinta); font-weight: 900; text-decoration: none;
}
.btn-secundario { background: transparent; color: var(--crema); border: 2px solid var(--crema); }
.fila-botones { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
