html { scroll-padding-top: 230px; }

.cat-band { background: var(--mustard); }
.cat-head { padding-top: calc(76px + clamp(40px, 6vw, 80px)); padding-bottom: clamp(32px, 4vw, 48px); }
.cat-head h1 { font-size: clamp(3.25rem, 8vw, 6rem); }
.cat-head p { margin-top: 14px; color: var(--ink); font-size: 1.0625rem; }

/* ---------- Barra de búsqueda y filtros ---------- */
.toolbar {
  position: sticky;
  top: 76px;
  z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.toolbar .wrap { padding-block: 12px; }
.toolbar-row { display: flex; gap: 10px; }

.search { position: relative; flex: 1; max-width: 560px; }
.search > .icon { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 46px; padding-right: 44px; background: var(--paper-2); border-color: var(--line); }
.search .input:hover { border-color: var(--line-strong); }
.search .input:focus { background: var(--paper); border-color: var(--ink); }
.search .input::-webkit-search-cancel-button { display: none; }
.search .input:placeholder-shown { padding-right: 12px; }
.search-clear {
  position: absolute; right: 4px; top: 50%; translate: 0 -50%;
  width: 40px; height: 40px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-2);
  display: grid; place-items: center;
}
.search-clear:hover { background: var(--line); }

.filters-toggle { margin-left: auto; }
.filters-count {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 0.75rem; font-weight: 700;
}
.filters-count[hidden] { display: none; }

.cats {
  display: flex;
  gap: 8px;
  margin: 12px calc(var(--gutter) * -1) 0;
  padding: 2px var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 40px;
  padding: 18px 0 6px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.filters[hidden] { display: none; }
.filters fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.filters legend { padding: 0; margin-bottom: 8px; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-2); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip .icon { width: 16px; height: 16px; }
.link-clear { border: 0; background: none; padding: 0 4px; min-height: 40px; font-weight: 600; text-decoration: underline; text-underline-offset: 0.25em; color: var(--ink-2); }
.link-clear:hover { color: var(--ink); }

/* ---------- Resultados ---------- */
.result-count { margin: 20px 0 0; color: var(--ink-3); font-size: 0.9375rem; }
.results:focus { outline: none; }

.results {
  --cols: 4;
  --gap-x: clamp(20px, 2vw, 32px);
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: clamp(48px, 5vw, 72px) var(--gap-x);
  padding-top: 24px;
}
/* Una sección ocupa tantas columnas como platos tiene; las pequeñas se juntan en la misma fila, siempre en el orden de la carta. */
.cat-section {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: span 1;
  align-content: start;
  row-gap: clamp(28px, 3vw, 44px);
}
.cat-section[data-n="2"] { grid-column: span 2; }
.cat-section[data-n="3"] { grid-column: span 3; }
.cat-section[data-n="4+"] { grid-column: 1 / -1; }
.dish-grid { display: contents; }
.cat-section-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-top: 16px;
  border-top: 3px solid var(--mustard);
}
.cat-section-head h2 { font-size: clamp(2rem, 3.2vw, 2.75rem); }
.cat-section-head span { color: var(--ink-3); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.results > .dish-grid.is-loading { display: contents; }
@media (max-width: 1239px) {
  .results { --cols: 3; }
  .cat-section[data-n="3"] { grid-column: 1 / -1; }
}
@media (max-width: 899px) {
  .results { --cols: 2; }
  .cat-section[data-n="2"], .cat-section[data-n="3"] { grid-column: 1 / -1; }
}
@media (max-width: 599px) {
  .results { --cols: 1; }
  .cat-section { grid-column: 1 / -1; }
}

.dish { display: flex; flex-direction: column; scroll-margin-top: 240px; }
.dish-img {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 4px;
  background: var(--paper-2);
}
.dish-img img { width: 100%; height: 100%; object-fit: cover; }
.dish-badges { position: absolute; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.dish-body { display: flex; flex-direction: column; flex: 1; padding-top: 16px; }
.dish-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.dish-title h3 { font-size: 1.25rem; font-weight: 700; }
.dish-title .price { font-size: 1.125rem; }
.dish-desc { margin-top: 8px; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.5; }
.dish-ing { margin-top: 10px; font-size: 0.875rem; line-height: 1.5; color: var(--ink-2); }
.dish-ing b { color: var(--ink); font-weight: 600; }
.dish-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; }
.heat-label { font-size: 0.8125rem; color: var(--ink-2); }
.dish-add { margin-top: auto; padding-top: 18px; }
.dish-add .btn { width: 100%; min-height: 46px; }

.stepper {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  height: 46px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
}
.stepper button {
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
}
.stepper button:hover { background: rgb(255 255 255 / 0.12); }
.stepper output { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* plato sin foto: se ve el logo sobre su mostaza */
.dish-img img[src$="logo.webp"] { object-fit: contain; background: var(--mustard); }
.dish.is-target .dish-img { animation: target 2.2s var(--ease-out); }
@keyframes target {
  0%, 40% { box-shadow: 0 0 0 4px var(--red); }
  100% { box-shadow: 0 0 0 4px transparent; }
}

.skeleton { min-height: 420px; border-radius: 4px; background: linear-gradient(100deg, var(--paper-2) 40%, #e8e8e5 50%, var(--paper-2) 60%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { padding: 64px 0 24px; max-width: 520px; }
.empty h2 { font-size: clamp(2.25rem, 4vw, 3.25rem); }
.empty p { margin: 14px 0 24px; color: var(--ink-2); font-size: 1.0625rem; }

main { padding-bottom: clamp(80px, 10vw, 140px); }

/* ---------- Lista para la mesa ---------- */
.list-bar { position: fixed; inset: auto 0 0 0; z-index: 35; padding-bottom: max(12px, env(safe-area-inset-bottom)); pointer-events: none; }
.list-bar[hidden] { display: none; }
.list-bar .wrap { display: flex; justify-content: flex-end; }
.list-bar-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(440px, 100%);
  min-height: 60px;
  padding: 0 16px 0 10px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-2);
  text-align: left;
  animation: toast-in 0.4s var(--ease-out);
}
.list-bar-btn:hover { background: #2f2723; }
.list-bar-count {
  display: grid; place-items: center;
  min-width: 40px; height: 40px; padding: 0 8px;
  border-radius: 8px; background: var(--red);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.list-bar-label { flex: 1; font-weight: 600; }
.list-bar-total { font-size: 1.0625rem; }
body:has(.list-bar:not([hidden])) .preview-note { bottom: 88px; }

.drawer {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: none;
  width: min(440px, 100vw);
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  display: none;
  flex-direction: column;
}
.drawer[open] { display: flex; animation: drawer-in 0.4s var(--ease-out); }
.drawer::backdrop { background: rgb(23 18 15 / 0.45); }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 8px; }
.drawer-head h2 { font-size: 1.5rem; font-weight: 700; }
.drawer-note { padding: 0 24px 16px; color: var(--ink-2); font-size: 0.9375rem; border-bottom: 1px solid var(--line); }
.drawer-list { list-style: none; margin: 0; padding: 8px 24px; overflow-y: auto; flex: 1; }
.drawer-list li { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.drawer-list img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; }
.drawer-list .name { font-weight: 600; line-height: 1.3; }
.drawer-list .sub { color: var(--ink-3); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.drawer-list .stepper { width: 124px; height: 40px; grid-template-columns: 40px 1fr 40px; }
.drawer-foot { padding: 18px 24px max(24px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; gap: 14px; }
.drawer-total { display: flex; justify-content: space-between; font-size: 1.125rem; font-weight: 600; }

@media (max-width: 640px) {
  html { scroll-padding-top: 250px; }
  .toolbar-row .filters-toggle { padding-inline: 14px; }
  .filters { gap: 16px; }
  .drawer { margin: auto 0 0; width: 100vw; max-width: 100vw; height: auto; max-height: 85dvh; border-radius: 16px 16px 0 0; }
  @keyframes drawer-in { from { transform: translateY(40px); opacity: 0; } }
}
