@font-face {
  font-family: "Abril Fatface";
  src: url("../fonts/abril-fatface-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;
}

:root {
  --papel: #fbfcff;
  --linea: #d8e2f1;
  --azul: #2e4fa5;
  --azul-oscuro: #1b2f6b;
  --celeste: #4cc9f0;
  --rojo: #e42346;
  --tinta: #17254f;
  --suave: #55648a;
  --display: "Abril Fatface", "Bodoni 72", Georgia, serif;
  --texto: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { 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(--papel);
  background-image:
    linear-gradient(var(--linea) 1px, transparent 1px),
    linear-gradient(90deg, var(--linea) 1px, transparent 1px);
  background-size: 32px 32px;
  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(--celeste); outline-offset: 2px; }

.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: var(--rojo); color: #fff; font-weight: 700; font-size: .9rem;
}

/* ---------- cabecera ---------- */
.hero { text-align: center; padding: 28px 16px 10px; }
.hero-mascota { height: 150px; width: auto; margin: 0 auto 4px; }
.hero-logo { margin: 0 auto; width: min(78vw, 340px); }
.hero-logo img { width: 100%; height: auto; }
.hero-frase { margin: 12px 0 2px; font-family: var(--display); font-size: 1.35rem; color: var(--azul); }
.hero-sub { margin: 0; color: var(--suave); font-weight: 600; }

/* ---------- navegación por secciones ---------- */
.secciones {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px;
  background: var(--papel); border-bottom: 1.5px solid var(--azul);
  scrollbar-width: none;
}
.secciones::-webkit-scrollbar { display: none; }
.secciones a {
  flex: none; padding: 7px 14px; border: 1.5px solid var(--azul);
  color: var(--azul); text-decoration: none; font-weight: 800; font-size: .92rem;
  background: #fff;
}
.secciones a:hover { background: var(--azul); color: #fff; }

/* ---------- menú ---------- */
main { max-width: 1040px; margin: 0 auto; padding: 8px 16px 0; }
.seccion { padding-top: 22px; scroll-margin-top: 62px; }
.seccion-titulo {
  margin: 0 0 14px; padding: 12px 16px;
  background: var(--azul); color: var(--celeste);
  font-family: var(--display); font-weight: 400; font-size: 1.75rem; line-height: 1.1;
}
.platos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.plato {
  display: block; width: 100%; padding: 0; text-align: left;
  background: #fff; border: 1.5px solid var(--azul);
}
.plato.con-foto { display: grid; grid-template-columns: 112px 1fr; }
.plato-foto { width: 112px; height: 100%; min-height: 112px; 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.25rem; line-height: 1.15; color: var(--azul-oscuro); }
.plato-desc { font-size: .88rem; color: var(--suave); 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.1rem; color: var(--azul); }
.plato-mas {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: var(--rojo); color: #fff; font-size: 1.5rem; font-weight: 800; line-height: 1;
}
.plato:hover { background: #f3f7ff; }

.seccion.compacta .platos { grid-template-columns: 1fr; gap: 8px; }
.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: 800; font-size: 1rem; }
.seccion.compacta .plato-pie { margin: 0; padding: 0; gap: 14px; }
.seccion.compacta .plato-precio { font-size: 1rem; }
.seccion.compacta .plato-mas { width: 30px; height: 30px; font-size: 1.3rem; }
.seccion.compacta .plato-desc { display: none; }

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

@media (min-width: 720px) {
  .platos { grid-template-columns: 1fr 1fr; gap: 14px; }
  .platos:has(> li:only-child) { grid-template-columns: 1fr; }
  .seccion.compacta .platos { grid-template-columns: 1fr 1fr; }
  .hero { padding-top: 40px; }
  .hero-mascota { height: 170px; }
}

/* ---------- 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(--papel); border-top: 1.5px solid var(--azul);
}
.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 16px; border: 0; background: var(--rojo); color: #fff; font-weight: 800; font-size: 1.05rem;
}
.barra-cuenta { display: grid; place-items: center; min-width: 28px; height: 28px; background: #fff; color: var(--rojo); font-family: var(--display); }
.barra-texto { flex: 1; text-align: left; }
.barra-total { font-family: var(--display); font-size: 1.15rem; }

/* ---------- ventanas ---------- */
dialog {
  width: min(540px, 100%); max-height: 94dvh; padding: 0; overflow: auto;
  border: 1.5px solid var(--azul); background: var(--papel); color: var(--tinta);
  margin: auto auto 0;
}
dialog::backdrop { background: rgba(23, 37, 79, .6); }
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; } }

.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; background: #fff; color: var(--azul-oscuro);
  font-size: 1.7rem; line-height: 1; font-weight: 700;
}
.dlg-cuerpo { padding: 56px 18px 22px; }
.dlg-titulo { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 1.8rem; color: var(--azul-oscuro); }

.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: 1.8rem; line-height: 1.1; color: var(--azul-oscuro); }
.item-desc { margin: 0 0 14px; color: var(--suave); }

fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 800; }
.opciones { display: grid; gap: 8px; }
.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; gap: 12px; padding: 11px 14px;
  background: #fff; border: 1.5px solid var(--azul); font-weight: 700;
}
.opcion > span b { font-family: var(--display); font-weight: 400; color: var(--azul); }
.opcion input:checked + span { background: var(--azul); color: #fff; }
.opcion input:checked + span b { color: var(--celeste); }
.opcion input:focus-visible + span { outline: 3px solid var(--celeste); 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: 800; }
.campo input, .campo textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font-size: 1rem; font-weight: 500;
  background: #fff; border: 1.5px solid var(--azul); border-radius: 0;
}
.campo textarea { min-height: 76px; resize: vertical; }
.campo.invalido input { border-color: var(--rojo); }

.pie-item { display: flex; gap: 12px; align-items: stretch; margin-top: 6px; }
.cantidad { display: flex; align-items: center; border: 1.5px solid var(--azul); background: #fff; }
.cantidad button { width: 44px; height: 100%; min-height: 44px; border: 0; background: transparent; font-size: 1.4rem; font-weight: 800; color: var(--azul); }
.cantidad output { min-width: 28px; text-align: center; font-family: var(--display); font-size: 1.2rem; }
.btn-agregar, .btn-pagar {
  flex: 1; padding: 13px 16px; border: 0; background: var(--rojo); color: #fff;
  font-weight: 800; font-size: 1.05rem;
}
.btn-agregar:disabled, .btn-pagar:disabled { background: #b9c1d6; cursor: not-allowed; }
.btn-pagar { width: 100%; margin-top: 4px; }
.pista { color: var(--rojo); font-weight: 700; font-size: .9rem; 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: 1.5px solid var(--azul); }
.linea-nombre { font-weight: 800; }
.linea-detalle { color: var(--suave); font-size: .92rem; }
.linea-nota { grid-column: 1 / -1; font-size: .92rem; background: #eaf8fd; padding: 4px 8px; }
.linea-precio { font-family: var(--display); color: var(--azul); 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: 800; padding: 8px 4px; text-decoration: underline; }
.vacio { color: var(--suave); }

.totales { margin: 16px 0; padding: 12px 14px; background: #fff; border: 1.5px solid var(--azul); }
.totales div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; font-weight: 700; }
.totales dt, .totales dd { margin: 0; }
.totales .total { margin-top: 6px; padding-top: 8px; border-top: 1.5px solid var(--azul); font-family: var(--display); font-weight: 400; font-size: 1.25rem; color: var(--azul-oscuro); }
.errores { margin: 0 0 12px; padding: 10px 12px 10px 30px; background: #fff0f2; border: 1.5px solid var(--rojo); color: #8d1028; font-weight: 700; }
.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: 36px 16px; text-align: center; }
.estado .hero-mascota { margin-bottom: 8px; }
.estado h1 { margin: 6px 0 8px; font-family: var(--display); font-weight: 400; font-size: 2rem; color: var(--azul-oscuro); }
.estado p { margin: 0 0 12px; }
.estado .caja { text-align: left; margin: 18px 0; padding: 14px; background: #fff; border: 1.5px solid var(--azul); }
.estado .caja ul { margin: 6px 0 0; padding-left: 18px; }
.btn-enlace {
  display: inline-block; padding: 13px 22px; background: var(--rojo); color: #fff;
  font-weight: 800; text-decoration: none; border: 0;
}
.btn-secundario { background: #fff; color: var(--azul); border: 1.5px solid var(--azul); }
.fila-botones { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
