/* Carta de El Paisano. Paleta de la marca real (negro cálido, crema, chile, tallo, mostaza).
   Sin fuentes externas: la CSP no las deja y en la playa pesan. */
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/barlow-condensed-800.woff2") format("woff2");
}
:root {
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --red: #c7321f;
  --red-dark: #9e2414;
  --mustard: #d9a441;
  --green: #3f6b35;
  --ink: #1a1512;
  --muted: #6b625b;
  --line: #e4d9c6;
  --paper: #f7eedd;
  --card: #ffffff;
  --warn: #fff1c2;
  --radius: 12px;
  --focus: #1a1512;
  --safe-top: env(safe-area-inset-top, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); line-height: 1.4; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--red-dark); }
/* Foco visible en todo control: anillo oscuro + halo crema que se ve sobre crema, blanco y negro. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--paper); }
.topbar :focus-visible, .mesero :focus-visible, .ktop :focus-visible { outline-color: var(--mustard); box-shadow: none; }
[hidden] { display: none !important; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { position: sticky; top: 0; z-index: 10; background: var(--ink); color: #fff; padding-top: var(--safe-top); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand { flex: 1; font-family: var(--display); font-size: 1.5rem; font-weight: 800; line-height: 1; letter-spacing: 0.01em; text-transform: uppercase; }
.brand-sub { display: block; margin-top: 2px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 500; font-size: 0.75rem; opacity: 0.8; letter-spacing: 0; text-transform: none; }
.logo { width: 40px; height: 40px; flex: 0 0 auto; }
.chip-btn { border: 1px solid rgba(255, 255, 255, 0.5); background: transparent; color: #fff; border-radius: 999px; padding: 6px 14px; min-height: 44px; min-width: 44px; }

.banner { padding: 9px 14px; border-radius: var(--radius); margin: 6px 0; font-size: 0.92rem; }
.banner.closed { background: var(--warn); border: 1px solid var(--mustard); }
.banner.ok { background: #e8f3e3; border: 1px solid #b8d4ae; }
.banner.err { background: #fde7e3; border: 1px solid #f0b3a8; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; text-decoration: none; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:disabled { background: #e9ddcb; border-color: #cdbfa8; color: #5b524b; cursor: not-allowed; }
.btn.green:disabled { background: #e9ddcb; border-color: #cdbfa8; color: #5b524b; cursor: not-allowed; }
.btn:disabled, .stepper button:disabled { cursor: not-allowed; }
.stepper button:disabled { color: #5b524b; background: #efe6d6; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.lg { min-height: 56px; font-size: 1.1rem; }

/* Pestañas de categoría: una a la vez, fijas bajo el encabezado. */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; margin: 0 -16px; position: sticky; top: calc(56px + var(--safe-top)); background: var(--paper); border-bottom: 1px solid var(--line); z-index: 5; scrollbar-width: none; scroll-padding-inline: 16px; }
.cats::-webkit-scrollbar { display: none; }
.cat-tab { flex: 0 0 auto; min-height: 44px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-family: var(--display); font-size: 1.1rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.cat-tab[aria-selected="true"] { background: var(--red); border-color: var(--red); color: #fff; }
section.cat { margin: 14px 0 8px; }

.upsell-opt { display: inline-flex; align-items: center; gap: 8px; }
.upsell-opt .thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
#del-dia .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }

/* Mosaico de platillos con foto */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.tile:last-child:nth-child(odd) .tile-photo { aspect-ratio: 16 / 10; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tile-main { display: flex; flex-direction: column; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.tile-photo { display: block; aspect-ratio: 4 / 3; background: var(--line); }
.tile-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-height: 2.1em; padding: 10px 12px 0; font-family: var(--display); font-size: 1.2rem; font-weight: 800; line-height: 1.05; letter-spacing: 0.01em; text-transform: uppercase; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 52px; padding: 2px 8px 8px 12px; }
.tile-price, .row-price { font-weight: 800; color: var(--red-dark); }
.tile-price.soft, .row-price.soft { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.add-fab { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--red); color: #fff; font-size: 1.6rem; font-weight: 700; line-height: 1; }
.add-fab:active { background: var(--red-dark); }

/* Platillos sin foto: filas compactas */
.rows { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 8px; padding-right: 10px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; min-height: 56px; padding: 12px 6px 12px 14px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.row-name { font-family: var(--display); font-size: 1.15rem; font-weight: 800; line-height: 1.1; text-transform: uppercase; }
.row-price { white-space: nowrap; font-size: 0.95rem; }
.row-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--muted); font-size: 0.85rem; }
.sold-out .tile-photo img { filter: grayscale(1); opacity: 0.55; }
.sold-out .tile-name, .sold-out .row-name { color: #5b524b; }

/* Ficha del platillo */
dialog.detail { width: min(100%, 520px); max-height: 92vh; max-height: 92dvh; padding: 0; border: 0; border-radius: 18px; background: var(--paper); color: var(--ink); overflow: auto; overscroll-behavior: contain; }
dialog.detail::backdrop { background: rgba(26, 21, 18, 0.55); }
@media (max-width: 600px) { dialog.detail { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; } }
.detail-card { position: relative; }
.detail-photo { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line); }
.detail-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(26, 21, 18, 0.72); color: #fff; font-size: 1.05rem; }
.detail-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.detail-body h2 { margin: 0; padding-right: 48px; font-family: var(--display); font-size: 2.1rem; font-weight: 800; line-height: 1; text-transform: uppercase; }
.detail-price { margin: 6px 0 10px; color: var(--red-dark); font-size: 1.25rem; font-weight: 800; }
.detail-desc { margin: 0 0 16px; color: #3b332e; }
.stepper.big { justify-content: center; gap: 14px; }
.stepper.big button { width: 52px; height: 52px; }
.stepper.big .qty { min-width: 36px; font-size: 1.4rem; }
@media (prefers-reduced-motion: no-preference) {
  dialog.detail[open] { animation: detail-up 240ms cubic-bezier(0.22, 1, 0.36, 1); }
  @keyframes detail-up { from { opacity: 0; transform: translateY(24px); } }
}

/* El Paisanito: el botón del chat es la mascota, con un movimiento suave de reposo. */
.paisanito { position: fixed; z-index: 15; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); min-width: 64px; min-height: 64px; padding: 0; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.has-cart .paisanito { bottom: calc(84px + env(safe-area-inset-bottom)); }
.paisanito img { display: block; width: 68px; height: 68px; object-fit: contain; filter: drop-shadow(0 6px 10px rgb(26 21 18 / 35%)); transform-origin: 50% 90%; animation: paisanito-bob 3.4s ease-in-out infinite; }
.paisanito:hover img, .paisanito:focus-visible img { animation: paisanito-wave 760ms ease-in-out 1; }
@keyframes paisanito-bob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-5px) rotate(-2.5deg); } }
@keyframes paisanito-wave { 0%, 100% { transform: rotate(0deg); } 20% { transform: rotate(-12deg); } 45% { transform: rotate(9deg); } 70% { transform: rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .paisanito img { animation: none; } }

/* Datos prácticos al abrir el QR: horario, cómo llegar y llamar. */
.info { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.info > * { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-size: 0.9rem; font-weight: 700; text-decoration: none; }
.info a:hover { border-color: var(--red); }
#contact { margin: 8px 0 0; text-align: center; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 1.3rem; font-weight: 700; }
.stepper .qty { min-width: 24px; text-align: center; font-weight: 700; }
.add { min-width: 96px; }

.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.cartbar .wrap { padding: 0; display: flex; gap: 8px; }
.spacer { height: calc(96px + env(safe-area-inset-bottom, 0px)); }

.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(26, 21, 18, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet .panel { background: var(--paper); width: 100%; max-width: 760px; max-height: 92vh; max-height: 92dvh; overscroll-behavior: contain; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 4px 0 12px; }
.line { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.line .lname { flex: 1; }
.line.bad { background: #fde7e3; }

label.field { display: block; margin: 12px 0; font-weight: 600; }
label.field input, label.field select, label.field textarea { display: block; width: 100%; margin-top: 4px; min-height: 44px; padding: 10px 12px; border: 1px solid #cdbfa8; border-radius: 10px; background: #fff; font-weight: 400; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.totals { display: flex; justify-content: space-between; font-weight: 700; margin: 12px 0; }

/* Seguimiento del pedido */
.ticket { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.bignum { font-size: 3.5rem; font-weight: 900; line-height: 1; margin: 8px 0; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 16px 0; }
.steps span { text-align: center; font-size: 0.8rem; padding: 8px 4px; border-radius: 8px; background: #efe6d6; color: var(--muted); }
.steps span.on { background: var(--green); color: #fff; font-weight: 700; }
.state-title { font-size: 1.4rem; font-weight: 800; margin: 4px 0; }
.ready { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }
@media (prefers-reduced-motion: reduce) { .ready { animation: none; } }

/* Mesero IA */
.mesero { background: var(--ink); color: #fff; border-radius: 16px; padding: 16px; margin: 12px 0 8px; }
.mesero h2 { margin: 0 0 2px; font-size: 1.25rem; }
.mesero .muted { color: rgba(255, 255, 255, 0.75); }
.mesero p { margin: 0 0 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip { flex: 0 0 auto; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35); background: transparent; color: #fff; font-size: 0.9rem; }
.chip:active { background: rgba(255, 255, 255, 0.12); }
.ask { display: flex; gap: 8px; margin-top: 10px; }
.ask input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 0; background: #fff; color: var(--ink); }
.ask .btn { min-height: 48px; }
.answer { margin-top: 12px; background: var(--paper); color: var(--ink); border-radius: 12px; padding: 12px 14px; }
.answer .muted { color: var(--muted); }
.answer .say { font-weight: 600; margin: 0 0 8px; }
.picks { list-style: none; margin: 0 0 10px; padding: 0; }
.picks li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ok-text { color: var(--green); font-weight: 700; margin: 4px 0 0; }

/* Buscador */
.search input { width: 100%; min-height: 48px; margin-top: 4px; padding: 10px 14px; border: 1px solid #cdbfa8; border-radius: 12px; background: #fff; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .answer { animation: rise 0.18s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(4px); } }
}

/* Plato del día y upsell del carrito: una sola oferta, un toque para aceptarla. */
.del-dia { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 2px solid var(--green); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; }
.upsell { border: 1px dashed var(--green); border-radius: 12px; padding: 12px; margin: 12px 0; }
.upsell-title { margin: 0 0 8px; font-weight: 700; }
.upsell-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.upsell-opts .btn { flex: 1 1 auto; }
.line input { min-height: 44px; width: 100%; margin-top: 4px; border: 1px solid #cdbfa8; border-radius: 8px; padding: 4px 8px; background: #fff; }
