/* ==========================================================================
   SodaCOVAO — sistema de diseño
   Idea visual: la soda se pide con un tiquete. El tiquete (con borde dentado)
   es el elemento memorable; el resto queda sobrio para que el menú respire.
   ========================================================================== */

:root {
  --red: #d9242b;
  --red-dark: #b01a20;
  --sun: #ffc531;
  --leaf: #17784a;
  --ink: #15181f;
  --muted: #566070;
  --paper: #f4f6f9;
  --surface: #ffffff;
  --line: #dde2ea;
  --focus: #1456d9;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(21 24 31 / .06), 0 8px 24px rgb(21 24 31 / .06);
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Figtree', 'Segoe UI', system-ui, sans-serif;
  --ticket-font: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

[data-theme='dark'] {
  --red: #f0484e;
  --red-dark: #ff6b70;
  --leaf: #46d08c;
  --ink: #eef1f6;
  --muted: #a4adbd;
  --paper: #0e1117;
  --surface: #171b24;
  --line: #2a303c;
  --focus: #7aa7ff;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
}

[data-contrast='high'] {
  --ink: #000;
  --muted: #1c1c1c;
  --line: #000;
  --paper: #fff;
  --surface: #fff;
  --red: #a00008;
}
[data-contrast='high'][data-theme='dark'] {
  --ink: #fff;
  --muted: #f0f0f0;
  --line: #fff;
  --paper: #000;
  --surface: #000;
  --red: #ff7a80;
}
[data-contrast='high'] a { text-decoration: underline; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1rem/1.6 var(--font-body);
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0 0 .6em; letter-spacing: -.02em; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.9rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.wrap { width: min(1160px, 100% - 2rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.no-scroll { overflow: hidden; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 8px; z-index: 100; }
.skip:focus { top: 1rem; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 700 1rem/1 var(--font-body);
  padding: .95rem 1.4rem; min-height: 48px;
  color: #fff; background: var(--red);
  border: 2px solid var(--red); border-radius: 999px;
  text-decoration: none; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface); border-color: var(--ink); }
.btn--small { padding: .6rem 1rem; min-height: 40px; font-size: .9rem; }
.btn--block { width: 100%; }
.btn--danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn--danger:hover { background: var(--red); color: #fff; }
.btn.is-done { background: var(--leaf); border-color: var(--leaf); }
.icon-btn, .link-btn {
  font: 600 .9rem var(--font-body); color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: .5rem .9rem; min-height: 40px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.link-btn { border: 0; padding: 0; min-height: 0; text-decoration: underline; color: var(--muted); }

/* ---------- Encabezado ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.header__row { display: flex; align-items: center; gap: .75rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font: 500 1.35rem var(--font-display); letter-spacing: -.02em; }
.brand strong { font-weight: 800; color: var(--red); }
.brand__mark { width: 38px; height: 38px; padding: 6px; background: var(--red); border-radius: 50%; flex: none; }
.brand--footer { font-size: 1.5rem; margin-bottom: .5rem; }
.nav { display: flex; gap: .25rem; margin-left: .75rem; }
.nav a { padding: .55rem .8rem; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--muted); }
.nav a:hover, .nav a[aria-current] { color: var(--ink); background: var(--surface); }
.nav__admin { border: 1px solid var(--line); }
.nav-toggle { display: none; }
[data-theme='dark'] 
/* ---------- Hero ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(3rem, 7vw, 5rem); }
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 52ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.status { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .92rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; margin-bottom: 1.25rem; }
.status__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.status--open .status__dot { background: var(--leaf); box-shadow: 0 0 0 4px color-mix(in srgb, var(--leaf) 25%, transparent); }

/* ---------- Tiquete (elemento memorable) ---------- */
.ticket {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-bottom: 0; padding: 1.25rem 1.25rem 1.5rem; margin-bottom: 12px;
  font-family: var(--ticket-font); font-size: .9rem; box-shadow: var(--shadow);
}
.ticket::after {
  content: ''; position: absolute; left: -1px; right: -1px; bottom: -11px; height: 12px;
  background:
    linear-gradient(135deg, var(--surface) 6px, transparent 0) 0 0 / 12px 12px repeat-x,
    linear-gradient(225deg, var(--surface) 6px, transparent 0) 0 0 / 12px 12px repeat-x;
  filter: drop-shadow(0 1px 0 var(--line));
}
.ticket--hero { transform: rotate(1.6deg); max-width: 400px; margin-inline: auto; }
.ticket--hero img { border-radius: 8px; margin: .75rem 0; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.ticket__title { font-weight: 700; margin: 0; padding-bottom: .6rem; border-bottom: 2px dashed var(--line); }
.ticket__list, .ticket__lines { list-style: none; margin: 0; padding: 0; }
.ticket__list li, .ticket__sum { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; }
.ticket__sum { border-top: 2px dashed var(--line); margin: .75rem 0 0; padding-top: .75rem; font-weight: 700; font-size: 1.05rem; }
.ticket__pickup { margin: .5rem 0 0; color: var(--muted); }
.ticket__line { display: grid; grid-template-columns: 1fr auto auto; gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.ticket__name small { display: block; color: var(--leaf); font-weight: 700; }
.ticket__price { min-width: 5.2rem; text-align: right; }
.qty { display: inline-flex; align-items: center; gap: .15rem; }
.qty button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 700 1rem var(--ticket-font); cursor: pointer; }
.qty button:hover { border-color: var(--ink); }
.qty span { min-width: 1.6rem; text-align: center; font-weight: 700; }

/* ---------- Secciones ---------- */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section--tint { background: color-mix(in srgb, var(--surface) 70%, var(--paper)); border-block: 1px solid var(--line); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section__head h2 { margin: 0; }
.about { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.about__text p { max-width: 60ch; color: var(--muted); }
.facts { margin: 1.5rem 0 0; display: grid; gap: .9rem; }
.facts div { border-left: 4px solid var(--sun); padding-left: 1rem; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: var(--muted); }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 1rem; }
.steps li { counter-increment: step; position: relative; padding: 1.1rem 1.25rem 1.1rem 4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(step); position: absolute; left: 1.1rem; top: 1rem; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; background: var(--red); color: #fff; border-radius: 50%; font: 800 1.1rem var(--font-display); }
.steps h3 { margin-bottom: .2rem; }
.steps p { margin: 0; color: var(--muted); }

/* ---------- Menú ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; margin-bottom: 1rem; }
.field--inline { margin: 0; min-width: min(260px, 100%); }
.tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.tabs button { font: 600 .95rem var(--font-body); padding: .6rem 1.1rem; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.tabs button[aria-pressed='true'], .tabs button[aria-selected='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.1rem; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--ink); box-shadow: var(--shadow); }
.card__media { position: relative; background: #fff; aspect-ratio: 4 / 3; display: grid; place-items: center; border-bottom: 1px solid var(--line); }
.card__media img { width: 100%; height: 100%; object-fit: contain; padding: .5rem; }
.badge { position: absolute; top: .6rem; left: .6rem; z-index: 1; background: var(--sun); color: #15181f; font-weight: 700; font-size: .78rem; padding: .25rem .6rem; border-radius: 999px; }
.card__body { display: flex; flex-direction: column; flex: 1; padding: 1rem 1rem 1.1rem; }
.card__cat { margin: 0 0 .15rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.card h3 { margin-bottom: .35rem; }
.card__desc { color: var(--muted); font-size: .92rem; margin-bottom: 1rem; flex: 1; }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.prices { display: flex; flex-direction: column; line-height: 1.2; }
.price { font: 800 1.25rem var(--font-display); }
.old { color: var(--muted); font-size: .85rem; }
.promo { color: var(--leaf); font-weight: 700; font-size: .85rem; }
.card--skeleton { min-height: 340px; background: linear-gradient(100deg, var(--surface) 30%, var(--line) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.state { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; text-align: center; margin-top: 1rem; }
.state .btn { margin-top: .5rem; }

/* ---------- FAQ ---------- */
.faq { max-width: 780px; }
.faq details { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.faq summary { font: 700 1.1rem var(--font-display); cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.4rem; line-height: 1; color: var(--red); }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: .75rem 0 0; color: var(--muted); max-width: 62ch; }

/* ---------- Contacto y formularios ---------- */
.contact { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.contact p { color: var(--muted); max-width: 46ch; }
.contact__info { font-style: normal; margin-top: 1.5rem; }
.contact__info p { margin-bottom: .9rem; }
.contact__info strong { color: var(--ink); }
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.1rem, 3vw, 1.75rem); display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; margin: 0; }
.field label { font-weight: 600; font-size: .95rem; }
.opt { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: 400 1rem var(--font-body); color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 10px; padding: .75rem .9rem; min-height: 46px; width: 100%;
}
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
.field--invalid input, .field--invalid select, .field--invalid textarea { border-color: var(--red); background: color-mix(in srgb, var(--red) 6%, var(--paper)); }
.field__error { margin: 0; color: var(--red); font-size: .88rem; font-weight: 600; }
.hint, .counter { margin: 0; font-size: .85rem; color: var(--muted); }
.counter.is-low { color: var(--red); font-weight: 600; }
.form-status { margin: 0; font-weight: 600; min-height: 1.4em; }
.form-status--ok { color: var(--leaf); }
.form-status--error { color: var(--red); }
.check { display: flex; gap: .6rem; align-items: center; font-size: .95rem; }
.check input { width: 1.2rem; min-height: 0; height: 1.2rem; }
.pass { display: flex; gap: .5rem; }
.pass button { font: 600 .9rem var(--font-body); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 0 .9rem; cursor: pointer; }

/* ---------- Pie ---------- */
.site-footer { padding: 3rem 0 1.5rem; border-top: 1px solid var(--line); }
.footer__grid { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 2rem; }
.site-footer nav { display: grid; gap: .4rem; align-content: start; }
.site-footer nav a { text-decoration: none; color: var(--muted); }
.site-footer nav a:hover { color: var(--ink); text-decoration: underline; }
.a11y { display: flex; flex-wrap: wrap; gap: .5rem; align-content: start; }
.a11y p { flex-basis: 100%; margin: 0 0 .25rem; }
.a11y button { font: 600 .9rem var(--font-body); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: .45rem .8rem; min-height: 40px; cursor: pointer; }
.a11y button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.legal { margin-top: 2rem; color: var(--muted); font-size: .88rem; }

/* ---------- Cajón del tiquete ---------- */
.overlay { position: fixed; inset: 0; background: rgb(10 12 18 / .55); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(440px, 100%);
  background: var(--paper); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgb(0 0 0 / .18);
  display: flex; flex-direction: column; transition: transform .25s ease, visibility .25s;
}
.drawer[aria-hidden='true'] { transform: translateX(100%); visibility: hidden; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.drawer__head h2 { margin: 0; font-size: 1.4rem; }
.drawer__scroll { overflow-y: auto; padding: 1.25rem; flex: 1; }
.drawer .form { margin-top: 1rem; }
.state--done { border-style: solid; border-color: var(--leaf); }
.done__label { color: var(--leaf); font-weight: 700; margin: 0; }
.done__id { font: 800 2.4rem var(--font-display); margin: .2rem 0 .6rem; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 90; display: grid; gap: .5rem; width: min(480px, calc(100% - 2rem)); }
.toast { margin: 0; padding: .85rem 1.1rem; border-radius: 12px; background: var(--ink); color: var(--paper); font-weight: 600; box-shadow: var(--shadow); border-left: 6px solid var(--sun); animation: pop .2s ease; }
.toast--ok { border-left-color: var(--leaf); }
.toast--warn { border-left-color: var(--sun); }
.toast--error { border-left-color: var(--red); }
.toast--out { opacity: 0; transition: opacity .25s; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Login ---------- */
.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 1.5rem; }
.auth { width: min(440px, 100%); display: grid; gap: .5rem; }
.auth h1 { font-size: 2rem; margin: 1rem 0 0; }
.auth .form { margin-top: .5rem; }
code { font-family: var(--ticket-font); background: var(--paper); padding: .1rem .4rem; border-radius: 6px; }
.back { text-align: center; color: var(--muted); margin-top: .5rem; }

/* ---------- Panel de administración ---------- */
.header__user { margin: 0 0 0 auto; color: var(--muted); font-size: .92rem; }
.admin { padding-block: 2rem 4rem; }
.admin h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.note { background: color-mix(in srgb, var(--sun) 20%, var(--surface)); border: 1px solid var(--sun); border-radius: 10px; padding: .75rem 1rem; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.kpis div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.kpis p { margin: 0; color: var(--muted); font-size: .9rem; }
.kpis strong { font: 800 1.9rem var(--font-display); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: var(--paper); }
tbody tr:last-child td { border-bottom: 0; }
td small { color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
.actions { white-space: nowrap; display: flex; gap: .4rem; }
.thumb { width: 48px; height: 36px; object-fit: contain; background: #fff; border-radius: 6px; border: 1px solid var(--line); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.msgs { display: grid; gap: 1rem; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.msg h3 { margin-bottom: .3rem; }
.msg__meta { color: var(--muted); font-size: .9rem; margin: 0; }
dialog { width: min(480px, calc(100% - 2rem)); border: 0; border-radius: var(--radius); padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / .35); }
dialog::backdrop { background: rgb(10 12 18 / .6); }
dialog .form { border: 0; }
.dialog__actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero__grid, .about, .contact, .footer__grid { grid-template-columns: 1fr; }
  .ticket--hero { transform: none; }
  .site-header { position: sticky; }
  #theme-toggle span { display: none; }
  #theme-toggle::before { content: 'Tema'; }
  .header__user { display: none; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .card__foot { flex-direction: column; align-items: stretch; }
  .card__body { padding: .8rem; }
  .card h3 { font-size: 1rem; }
  .price { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

html.a11y-links a { text-decoration: underline !important; outline: 2px solid currentColor; outline-offset: 2px; }

/* ==========================================================================
   Menú: tarjetas, filtros y origen de los datos
   ========================================================================== */
:root {
  --cat-comidas: #d9242b;
  --cat-bebidas: #1456d9;
  --cat-dulces: #b8860b;
  --cat-frutas: #17784a;
}
[data-theme='dark'] {
  --cat-comidas: #f0484e;
  --cat-bebidas: #7aa7ff;
  --cat-dulces: #ffc531;
  --cat-frutas: #46d08c;
}

.section__head { align-items: flex-end; }
.source-note {
  display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 1.25rem;
  font-size: .9rem; color: var(--muted);
}
.source-note:empty { display: none; }
.source-note::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.source-note[data-state='ok']::before { background: var(--leaf); box-shadow: 0 0 0 3px color-mix(in srgb, var(--leaf) 25%, transparent); }
.source-note[data-state='cache']::before { background: var(--sun); }

.toolbar {
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px);
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
}
.toolbar .field--inline { flex: 1 1 240px; }
.toolbar .btn { align-self: flex-end; }
.tabs { margin-top: 1.1rem; }
.tabs button { transition: background .15s, color .15s, border-color .15s; }
.tabs button:hover { border-color: var(--ink); }

.grid { gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { border-radius: 18px; border-color: color-mix(in srgb, var(--line) 80%, transparent); }
.card:hover { border-color: var(--line); box-shadow: 0 2px 4px rgb(21 24 31 / .06), 0 14px 32px rgb(21 24 31 / .1); }
.card__media { background: #fff; border-bottom: 0; aspect-ratio: 5 / 4; }
.card__media img { padding: .9rem; }
.card__body { padding: 1rem 1.15rem 1.2rem; border-top: 3px solid var(--cat, var(--line)); }
.card[data-cat='comidas'] { --cat: var(--cat-comidas); }
.card[data-cat='bebidas'] { --cat: var(--cat-bebidas); }
.card[data-cat='dulces'] { --cat: var(--cat-dulces); }
.card[data-cat='frutas'] { --cat: var(--cat-frutas); }
.card__cat { display: flex; justify-content: space-between; align-items: center; gap: .5rem; color: var(--cat, var(--muted)); font-weight: 700; }
[data-theme='light'] .card[data-cat='dulces'] .card__cat { color: #8a6508; }
.rating { color: var(--muted); font-weight: 600; font-size: .85rem; }
.rating::first-letter { color: #e5a400; }
.card h3 { font-size: 1.12rem; }
.price { font-size: 1.35rem; }
.chip {
  position: absolute; right: .6rem; bottom: .6rem; z-index: 1;
  background: #15181f; color: #fff; font-size: .72rem; font-weight: 600;
  padding: .2rem .6rem; border-radius: 999px;
}
.card__foot .btn--small { padding-inline: 1.15rem; }

/* El tiquete del inicio gana presencia */
.hero { border-bottom: 1px solid var(--line); }
.hero h1 { max-width: 14ch; }
.ticket--hero { box-shadow: 0 2px 4px rgb(21 24 31 / .08), 0 24px 48px rgb(21 24 31 / .14); }

@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .card__body { padding: .8rem .85rem 1rem; }
  .card__desc { display: none; }
  .card__foot { flex-direction: column; align-items: stretch; }
  .card__foot .btn { width: 100%; }
  .toolbar .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .tabs button { transition: none; }
}

/* ==========================================================================
   Widget de accesibilidad (panel blanco sobre botón rojo, esquina inferior izquierda)
   ========================================================================== */
.a11y-widget {
  position: fixed; left: 28px; right: auto; bottom: 24px; z-index: 80;
  display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 12px;
  font-family: 'Poppins', var(--font-body);
}
.a11y-launcher {
  width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--red); box-shadow: 0 6px 22px rgb(217 36 43 / .38);
  transition: background .15s, transform .15s;
}
.a11y-launcher:hover { background: var(--red-dark); transform: translateY(-1px); }
.a11y-launcher svg { width: 34px; height: 34px; padding: 6px; border-radius: 50%; background: #fff; color: #b01a20; }

.a11y-panel {
  display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px;
  width: min(340px, calc(100vw - 36px)); padding: 22px 22px 18px;
  background: #fff; color: #444;
  border: 0; border-top: 4px solid var(--sun); border-radius: 22px;
  box-shadow: 0 14px 38px rgb(0 0 0 / .20);
}
.a11y-panel[hidden] { display: none; }
.a11y-panel .a11y-title {
  flex-basis: auto; margin: 0 0 8px; padding: 0 0 14px;
  border-bottom: 1px solid #e3e6ec; font: 600 1.15rem/1.2 'Poppins', var(--font-body); color: #15181f;
}
.a11y-panel .a11y-title strong { font-weight: 600; }
.a11y-panel > button {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 50px;
  padding: 10px 12px; border: 0; border-radius: 10px; background: transparent;
  font: 500 1rem/1.2 'Poppins', var(--font-body); color: #444; text-align: left; cursor: pointer;
}
.a11y-panel > button span { min-width: 24px; text-align: center; font-size: 1.3rem; font-weight: 600; color: #b01a20; }
.a11y-panel > button:hover { background: #fdeeee; }
.a11y-panel > button[aria-pressed='true'] { background: #fbdcdd; color: #15181f; }
.a11y-panel > button:focus-visible, .a11y-launcher:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* "U" subrayada, como en el modelo */
#a11y-links span { text-decoration: underline; text-underline-offset: 3px; font-size: 1.15rem; }

[data-theme='dark'] .a11y-panel { background: #171b24; color: #dfe4ee; }
[data-theme='dark'] .a11y-panel .a11y-title { color: #fff; border-color: #2a303c; }
[data-theme='dark'] .a11y-panel > button { color: #dfe4ee; }
[data-theme='dark'] .a11y-panel > button span { color: #ff8a8f; }
[data-theme='dark'] .a11y-panel > button:hover { background: #222836; }
[data-theme='dark'] .a11y-panel > button[aria-pressed='true'] { background: #4a2328; color: #fff; }

@media (max-width: 520px) {
  .a11y-widget { left: 14px; bottom: 14px; }
  .a11y-launcher { width: 52px; height: 52px; }
  .a11y-launcher svg { width: 30px; height: 30px; padding: 5px; }
}

/* ==========================================================================
   Sesión, login/registro y tarjetas alineadas
   ========================================================================== */
.form[hidden] { display: none; }
.auth-tabs { margin: .5rem 0 .25rem; }
.auth-tabs button { flex: 1; }

/* La foto ocupa siempre el mismo espacio: así nombre, descripción y precio quedan a la misma altura en todas las tarjetas */
.card__media { position: relative; overflow: hidden; display: block; aspect-ratio: 5 / 4; }
.card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: .9rem; }
.card h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }
.card__desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) { .card__desc { display: none; } }
.card__foot { min-height: 3rem; }

/* ==========================================================================
   Botón de cuenta y panel "Mi cuenta"
   ========================================================================== */
.account-btn {
  display: inline-flex; align-items: center; gap: .55rem; min-height: 44px; padding: .25rem 1rem .25rem .3rem;
  font: 600 .92rem var(--font-body); color: var(--ink); white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: border-color .15s;
}
.account-btn:hover { border-color: var(--ink); }
.account-btn__avatar, .profile__avatar {
  display: grid; place-items: center; flex: none; border-radius: 50%;
  background: var(--red); color: #fff; font: 800 .85rem var(--font-display); letter-spacing: 0;
}
.account-btn__avatar { width: 34px; height: 34px; }
.account-btn__name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .account-btn { padding: .25rem; }
  .account-btn__name { display: none; }
}

.drawer__scroll { display: flex; flex-direction: column; gap: .25rem; }
.drawer__foot { padding: 1rem 1.25rem; border-top: 1px solid var(--line); background: var(--paper); display: grid; gap: .6rem; }
.drawer__foot [hidden] { display: none; }
.drawer__sub { margin: 1.5rem 0 .6rem; font-size: 1.1rem; }

.profile { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.profile__avatar { width: 56px; height: 56px; font-size: 1.3rem; }
.profile p { margin: 0; }
.profile__name { font: 800 1.2rem/1.2 var(--font-display); }
.profile__user { color: var(--muted); font-size: .92rem; }
.profile__role { display: inline-block; margin-top: .4rem !important; padding: .15rem .7rem; border-radius: 999px; background: var(--sun); color: #15181f; font-size: .82rem; font-weight: 700; }

.orders { display: grid; gap: .8rem; }
.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.order__head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-family: var(--ticket-font); }
.order__meta { margin: .2rem 0 .5rem; font-size: .88rem; }
.order__items { list-style: none; margin: 0; padding: .5rem 0; border-block: 1px dashed var(--line); font-size: .92rem; }
.order__total { display: flex; justify-content: space-between; margin: .5rem 0 0; font-weight: 700; }
.pill { padding: .15rem .65rem; border-radius: 999px; font: 700 .78rem var(--font-body); background: color-mix(in srgb, var(--sun) 35%, var(--surface)); color: var(--ink); }
.pill--listo { background: color-mix(in srgb, var(--leaf) 25%, var(--surface)); }
.pill--entregado { background: var(--line); color: var(--muted); }

/* Enlace entre login y registro */
.auth-switch { margin: .75rem 0 0; text-align: center; color: var(--muted); }
.auth-switch a { color: var(--red); font-weight: 700; }

/* ==========================================================================
   Encabezado: buscador, perfil con el tiquete adentro
   ========================================================================== */
.site-search { position: relative; flex: 1 1 220px; max-width: 360px; min-width: 0; margin-left: auto; }
.site-search input {
  width: 100%; min-height: 44px; padding: .55rem 2.6rem .55rem 2.65rem;
  font: 500 .95rem var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  transition: border-color .15s;
}
.site-search input::placeholder { color: var(--muted); opacity: 1; }
.site-search input:hover { border-color: var(--ink); }
.site-search input:focus-visible { border-color: var(--red); outline: 3px solid var(--focus); outline-offset: 2px; }
.site-search input::-webkit-search-cancel-button, .site-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.site-search__icon { position: absolute; left: 1rem; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.site-search__clear {
  position: absolute; right: .3rem; top: 50%; width: 36px; height: 36px; transform: translateY(-50%);
  display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font: 500 1.5rem/1 var(--font-body); cursor: pointer;
}
.site-search__clear:hover { background: var(--line); color: var(--ink); }
.site-search__clear[hidden] { display: none; }

.account-btn { position: relative; }
.account-btn__badge {
  position: absolute; top: -6px; left: 24px; min-width: 22px; height: 22px; padding: 0 .35rem;
  border: 2px solid var(--paper); border-radius: 999px; background: var(--sun); color: #15181f;
  font: 800 .72rem/18px var(--font-body); text-align: center;
}
.account-btn__badge[hidden] { display: none; }

.account-tabs { margin: 1.25rem 0 1rem; gap: .4rem; }
.account-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding-inline: .8rem; }
.tab-count {
  display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem;
  border-radius: 999px; background: var(--sun); color: #15181f; font-size: .75rem; font-weight: 800;
}
.tab-count[hidden] { display: none; }
[role='tabpanel'][hidden] { display: none; }

/* Pantallas medianas: el menú pasa a botón desplegable para que el buscador tenga espacio */
@media (max-width: 1080px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    background: var(--paper); border-bottom: 1px solid var(--line); padding: .75rem 1rem 1rem; margin: 0;
  }
  .nav.is-open { display: flex; }
}
/* Celular: logo, menú y perfil arriba; el buscador ocupa su propia fila */
@media (max-width: 640px) {
  html { scroll-padding-top: 8.5rem; }
  .header__row { flex-wrap: wrap; padding-block: .6rem; row-gap: .6rem; min-height: 0; }
  .brand { margin-right: auto; }
  .site-search { order: 5; flex: 1 0 100%; max-width: none; margin-left: 0; }
}

.thumb--preview { width: 96px; height: 72px; margin-top: .4rem; }
.thumb--preview[hidden] { display: none; }

/* ==========================================================================
   Tarjetas que abren detalle, "Ver más" y modal de producto
   ========================================================================== */
.card { cursor: pointer; }
.card__title { display: inline; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.card:hover .card__title, .card__title:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

.more { display: flex; justify-content: center; margin-top: 1.5rem; }
.more[hidden] { display: none; }
.more .btn { gap: .5rem; padding-inline: 1.6rem; }
.more .btn small { font-weight: 500; color: var(--muted); font-size: .85rem; }
.more .chev { transition: transform .2s; }
.more .btn.is-up .chev { transform: rotate(180deg); }

.product-modal { width: min(820px, calc(100% - 1.5rem)); max-height: calc(100dvh - 1.5rem); overflow: auto; border-radius: 22px; background: var(--surface); }
.product-modal[open] { display: grid; grid-template-columns: 1fr 1fr; }
.pm__close {
  position: absolute; top: .7rem; right: .7rem; z-index: 2; width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink);
  font: 500 1.6rem/1 var(--font-body); cursor: pointer;
}
.pm__close:hover { border-color: var(--ink); }
.pm__media { position: relative; background: #fff; display: grid; place-items: center; min-height: 280px; border-radius: 22px 0 0 22px; }
.pm__media img { width: 100%; height: 100%; max-height: 460px; object-fit: contain; padding: 1.25rem; }
.pm__body { display: flex; flex-direction: column; gap: .6rem; padding: 1.75rem 1.6rem 1.5rem; }
.pm__body p, .pm__body h2 { margin: 0; }
.pm__cat { color: var(--red); font-weight: 700; }
.pm__body h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); padding-right: 2.5rem; }
.pm__rating { color: var(--muted); font-weight: 600; }
.pm__rating::first-letter { color: #e5a400; }
.pm__desc { color: var(--muted); }
.pm__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .8rem; }
.pm__price .price { font-size: 1.9rem; }
.pm__facts { margin: .4rem 0 0; display: grid; gap: .5rem; }
.pm__facts div { display: grid; grid-template-columns: 6rem 1fr; gap: .75rem; padding-top: .5rem; border-top: 1px dashed var(--line); font-size: .93rem; }
.pm__facts dt { color: var(--muted); font-weight: 600; }
.pm__facts dd { margin: 0; }
.pm__buy { display: flex; align-items: center; gap: .9rem; margin-top: auto; padding-top: 1rem; }
.pm__buy .btn { flex: 1; }
@media (max-width: 680px) {
  .product-modal[open] { grid-template-columns: 1fr; }
  .pm__media { min-height: 0; aspect-ratio: 4 / 3; border-radius: 22px 22px 0 0; }
  .pm__body { padding: 1.25rem 1.2rem 1.3rem; }
}

/* Pie de página completo */
.footer__grid { grid-template-columns: 1.2fr .9fr .9fr 1.5fr; }
.site-footer h2 { margin: 0 0 .7rem; font-size: 1.05rem; }
.footer__contact { display: grid; gap: .4rem; align-content: start; font-style: normal; color: var(--muted); }
.footer__contact h2 { color: var(--ink); }
.footer__contact a { color: var(--muted); text-decoration: none; }
.footer__contact a:hover { color: var(--ink); text-decoration: underline; }
.site-footer .status { margin: 1rem 0 0; }
@media (max-width: 900px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer__grid { grid-template-columns: 1fr; } }
