/* Carta pública. La marca del cliente entra por --brand / --accent (inyectadas por el Worker).
   Todo lo demás es neutro para que cualquier paleta funcione. */
:root {
  --brand: #9E1B1B; --brand-ink: #fff; --accent: #F2A900; --accent-ink: #161616;
  --ink: #1C1C1A; --muted: #62625D; --line: #E6E4DF; --paper: #FFFFFF; --soft: #F6F5F2;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.45; -webkit-text-size-adjust: 100%; }
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Cabecera: el nombre del local como letrero pintado ---------- */
.masthead { background: var(--brand); color: var(--brand-ink); padding: 28px 20px 24px; }
.masthead__inner { max-width: 44rem; margin: 0 auto; display: grid; gap: 10px; }
.masthead__logo { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; background: var(--paper); }
.masthead__logo--mono { display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 1.4rem; font-stretch: 75%; }
.masthead h1 { margin: 6px 0 0; font-size: clamp(2.6rem, 11vw, 4.6rem); line-height: .9; font-weight: 800;
  font-stretch: 68%; letter-spacing: -.01em; overflow-wrap: anywhere; }
.masthead__tagline { margin: 0; font-size: 1.05rem; max-width: 34ch; opacity: .92; }
.masthead__facts { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .9rem; }
.masthead__facts div { display: flex; gap: 6px; }
.masthead__facts dt { opacity: .75; }
.masthead__facts dd { margin: 0; font-weight: 600; }

/* ---------- Navegación de categorías ---------- */
.cats { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); }
.cats__track { max-width: 44rem; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; padding: 8px 14px; scrollbar-width: none; }
.cats__track::-webkit-scrollbar { display: none; }
.cats a { flex: none; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem; color: var(--muted); }
.cats a[aria-current="true"] { background: var(--brand); color: var(--brand-ink); }

/* ---------- Carta ---------- */
.menu { max-width: 44rem; margin: 0 auto; padding: 8px 16px 120px; }
.cat { padding-top: 26px; }
.cat h2 { margin: 0 0 6px; font-size: 1.9rem; font-weight: 800; font-stretch: 72%; line-height: 1; }
.dishes { list-style: none; margin: 0; padding: 0; }
.dishes li + li { border-top: 1px solid var(--line); }
.dish { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 64px 1fr;
  gap: 14px; padding: 14px 4px; align-items: start; border-radius: 10px; }
.dish:hover { background: var(--soft); }
.dish:focus-visible { outline: 3px solid var(--accent); }
.dish__media { width: 64px; height: 64px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; font-size: 2rem; overflow: hidden; }
.dish__media img { width: 100%; height: 100%; object-fit: cover; }
.dish__body { display: grid; gap: 4px; min-width: 0; }
.dish__line { display: flex; align-items: baseline; gap: 8px; }
.dish__name { font-weight: 700; font-size: 1.08rem; }
.dish__leader { flex: 1; border-bottom: 2px dotted var(--line); transform: translateY(-4px); min-width: 12px; }
.dish__price { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dish__price small { font-weight: 500; color: var(--muted); font-size: .8rem; }
.dish__desc { color: var(--muted); font-size: .94rem; max-width: 60ch; }
.dish__badge { justify-self: start; background: var(--accent); color: var(--accent-ink); font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.empty { padding: 40px 0; color: var(--muted); }

.foot { max-width: 44rem; margin: 0 auto; padding: 24px 20px calc(120px + var(--safe-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.foot p { margin: 4px 0; }
.foot strong { color: var(--ink); }
.foot__social { display: flex; gap: 16px; }
.foot__credit { margin-top: 18px !important; font-size: .8rem; }

/* ---------- Barra de pedido ---------- */
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 10px 14px calc(10px + var(--safe-bottom)); pointer-events: none; }
.cartbar__btn { pointer-events: auto; width: 100%; max-width: 42rem; margin: 0 auto; display: flex; justify-content: space-between; align-items: center;
  border: 0; border-radius: var(--radius); padding: 16px 18px; background: var(--brand); color: var(--brand-ink);
  font: 700 1.05rem var(--font); cursor: pointer; box-shadow: 0 10px 30px -10px rgba(0,0,0,.45); }
.cartbar__sum { display: flex; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
#cart-count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 28px; padding: 2px 8px; text-align: center; }
.cartbar.bump .cartbar__btn { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.03); } }

/* ---------- Hojas (dialog) ---------- */
.sheet { border: 0; padding: 0; width: 100%; max-width: 34rem; max-height: 92dvh; border-radius: 20px 20px 0 0; margin: auto auto 0; color: var(--ink); background: var(--paper); }
.sheet::backdrop { background: rgba(20,20,18,.55); }
.sheet[open] { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
@media (min-width: 640px) { .sheet { border-radius: 20px; margin: auto; } }
.sheet form { display: flex; flex-direction: column; max-height: 92dvh; }
.sheet__scroll { overflow-y: auto; padding: 20px 20px 8px; }
.sheet__head { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.sheet__head h2 { margin: 0; font-size: 1.6rem; font-weight: 800; font-stretch: 75%; line-height: 1.05; }
.sheet__close { border: 0; background: var(--soft); width: 36px; height: 36px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; color: var(--ink); }
.sheet__hero { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 14px; margin: 12px 0 4px; }
.sheet__desc { color: var(--muted); margin: 6px 0 0; }
.sheet__foot { border-top: 1px solid var(--line); padding: 14px 20px calc(14px + var(--safe-bottom)); display: flex; gap: 12px; align-items: center; background: var(--paper); }

.opt-group { border: 0; padding: 0; margin: 18px 0 0; }
.opt-group legend { font-weight: 700; font-size: 1.05rem; padding: 0; display: flex; gap: 8px; align-items: baseline; width: 100%; }
.opt-group legend small { font-weight: 500; color: var(--muted); font-size: .85rem; }
.opt-group.is-invalid legend small { color: #B42318; font-weight: 700; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.opt input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }
.opt span:first-of-type { flex: 1; }
.opt__price { color: var(--muted); font-variant-numeric: tabular-nums; }

.field { display: grid; gap: 6px; margin: 16px 0 0; font-weight: 600; font-size: .95rem; }
.field input, .field textarea, .field select { font: 400 1rem var(--font); padding: 12px; border: 1px solid #CFCCC5; border-radius: 10px; background: var(--paper); color: var(--ink); width: 100%; }
.field textarea { resize: vertical; min-height: 64px; }
.seg { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.seg label { flex: 1; min-width: 120px; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 12px; border: 1px solid #CFCCC5; border-radius: 10px; font-weight: 600; cursor: pointer; }
.seg input:checked + span { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid #CFCCC5; border-radius: 999px; }
.stepper button { border: 0; background: none; width: 40px; height: 40px; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.stepper output { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper--sm button { width: 32px; height: 32px; font-size: 1.1rem; }

.btn-primary { flex: 1; border: 0; border-radius: 12px; padding: 15px 16px; background: var(--brand); color: var(--brand-ink);
  font: 700 1rem var(--font); cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-link { border: 0; background: none; color: var(--muted); text-decoration: underline; font: 500 .9rem var(--font); cursor: pointer; padding: 4px 0; }

.lines { list-style: none; margin: 14px 0 0; padding: 0; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line__name { font-weight: 700; }
.line__meta { color: var(--muted); font-size: .88rem; grid-column: 1; }
.line__price { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.line__ctrl { grid-column: 2; display: flex; justify-content: flex-end; }
.total { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 800; margin: 16px 0 0; }
.form-error { color: #B42318; font-weight: 600; margin: 12px 0 0; }

.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Páginas de aviso ---------- */
.notice { min-height: 100dvh; display: grid; align-content: center; gap: 8px; padding: 32px 24px; max-width: 34rem; margin: 0 auto; }
.notice h1 { font-size: clamp(2.2rem, 9vw, 3.6rem); font-weight: 800; font-stretch: 70%; line-height: .95; margin: 0; }
.notice p { color: var(--muted); font-size: 1.1rem; margin: 0; }
.btn { display: inline-block; margin-top: 12px; background: var(--brand); color: var(--brand-ink); padding: 12px 18px; border-radius: 12px; text-decoration: none; font-weight: 700; }

/* ---------- Portada: lista de demos ---------- */
.demo-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.demo-list a { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.demo-list a:hover { border-color: var(--brand); }
.demo-list span { color: var(--muted); font-size: .88rem; }
.demo-list strong { font-size: 1.1rem; }

/* ---------- Franja de demostración ---------- */
.demo-bar { background: var(--ink); color: #fff; padding: 10px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: .92rem; text-align: center; }
.demo-bar p { margin: 0; max-width: 46ch; }
.demo-bar a { background: #fff; color: var(--ink); padding: 6px 12px; border-radius: 8px; font-weight: 700; text-decoration: none; white-space: nowrap; }
