/* Carta pública: cabeçalho, capa, barra fixa, seções, cartões e estados. Mobile primeiro. */

.page {
  max-width: var(--main-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- linha de cabeçalho (72px, não fica fixa) ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 72px;
}

.search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search .icon-search {
  position: absolute;
  left: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--ink-muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: var(--tap);
  padding: 0 44px 0 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  background: var(--surface);
  font-size: var(--text-md); /* 16px evita o zoom automático do iOS */
  appearance: none;
}

.search input::placeholder {
  color: var(--ink-muted);
}

.search input:focus-visible {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  position: absolute;
  right: 0;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  color: var(--ink);
  isolation: isolate;
}

/* área de toque de 44px; o disco visível continua com 32px */
.search-clear::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
}

.search-clear[hidden] {
  display: none;
}

.filter-btn {
  position: relative;
}

.badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.badge[hidden] {
  display: none;
}

/* ---------- capa ---------- */

.cover {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: #1c2a24;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 56px;
  background: linear-gradient(to bottom, transparent, var(--paper));
  pointer-events: none;
}

/* sem imagem: atmosfera própria (camadas de cor + curvas de nível, como terraços de vinhedo) */
.cover--plain {
  background:
    radial-gradient(110% 100% at 88% 0%, color-mix(in srgb, var(--accent) 70%, transparent), transparent 62%),
    radial-gradient(80% 90% at 0% 100%, color-mix(in srgb, var(--type-fortificado) 55%, transparent), transparent 66%),
    linear-gradient(165deg, #2a3b33, #16211c);
}

.cover--plain::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='240' viewBox='0 0 480 240' fill='none' stroke='%23fff' stroke-opacity='.22' stroke-width='1.2'%3E%3Cellipse cx='380' cy='30' rx='40' ry='16'/%3E%3Cellipse cx='380' cy='30' rx='84' ry='34'/%3E%3Cellipse cx='380' cy='30' rx='130' ry='52'/%3E%3Cellipse cx='380' cy='30' rx='180' ry='72'/%3E%3Cellipse cx='380' cy='30' rx='236' ry='94'/%3E%3Cellipse cx='380' cy='30' rx='296' ry='118'/%3E%3C/svg%3E") right top / cover no-repeat;
}

/* ---------- linha do estabelecimento ---------- */

.venue {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 4px 16px;
}

.venue-logo {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-photo);
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--surface);
}

.venue-logo--mono {
  display: grid;
  place-items: center;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1.5rem / 1 var(--font-display);
}

.venue-text {
  flex: 1;
  min-width: 0;
}

.venue-name {
  font: 600 var(--text-xl) / 1.25 var(--font-display);
  letter-spacing: -0.01em;
}

.venue-sub {
  color: var(--ink-muted);
  font-size: var(--text-sm);
  line-height: 1.4;
}

/* ---------- barra fixa: abas + chips (108px) ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-rows: 48px 44px;
  row-gap: 4px;
  height: var(--bar-h);
  padding-bottom: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-bar);
}

.bar-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  /* alinha com o `main` em telas largas e usa a margem de 16px no celular */
  padding-inline: max(var(--gutter), calc((100% - var(--main-max)) / 2 + var(--gutter)));
  scroll-padding-inline: var(--gutter);
}

.bar-row::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 48px;
  padding: 0 12px;
  font-size: var(--text-md);
  color: var(--ink-muted);
  white-space: nowrap;
}

/* reserva a largura do texto em negrito para a aba ativa não "pular" */
.tab::before {
  content: attr(data-label);
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 600;
}

.tab::after {
  content: "";
  position: absolute;
  inset: auto 12px 0;
  height: 2px;
  background: var(--accent);
  scale: 0 1;
  transition: scale var(--duration-normal) var(--ease-out);
}

.tab[aria-current="true"] {
  color: var(--ink);
  font-weight: 600;
}

.tab[aria-current="true"]::after {
  scale: 1 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}

.chip:hover {
  background: var(--surface-2);
}

.chip[aria-current="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.chip[aria-current="true"] .dot {
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.7);
}

/* ---------- divisor da carta e seções ---------- */

.menu-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  color: var(--accent-ink);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.menu-divider::before,
.menu-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-strong);
  opacity: 0.55;
}

.type-section {
  scroll-margin-top: calc(var(--bar-h) + 4px);
}

.type-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 20px;
  font: 600 var(--text-xl) / 1.3 var(--font-display);
  letter-spacing: -0.01em;
}

.type-title .dot {
  align-self: center;
}

.type-count {
  color: var(--ink-muted);
  font: 500 var(--text-sm) / 1 var(--font-body);
}

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 24px;
}

.cards > li {
  border-bottom: 1px solid var(--line);
}

/* ---------- cartão (foto 120×120; o cartão inteiro é o alvo de toque) ---------- */

.card {
  display: flex;
  gap: 16px;
  width: 100%;
  min-height: 152px;
  padding: 16px 0;
  text-align: left;
  border-radius: var(--radius-m);
  transition: background-color var(--duration-fast);
}

.card:hover {
  background: var(--accent-tint);
}

.card:active {
  background: var(--accent-soft);
}

.photo {
  position: relative;
  flex: none;
  width: 120px;
  height: 120px;
  overflow: hidden;
  border-radius: var(--radius-photo);
  background: var(--surface-2);
  box-shadow: var(--shadow-photo);
}

.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 250ms ease-out;
}

.photo img.is-loaded {
  opacity: 1;
}

.photo-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--ink) 30%, var(--surface-2));
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 120px;
}

.card-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 1.0625rem / 1.5rem var(--font-display);
  letter-spacing: -0.005em;
}

.card-price {
  display: block;
  margin-top: 2px;
  color: var(--accent-ink);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

.card-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  line-height: 20px;
}

.tags {
  display: flex;
  gap: 6px;
  margin-top: auto;
  height: 22px;
  overflow: hidden;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}

.tag .dot {
  width: 8px;
  height: 8px;
}

/* ---------- vazio e erro ---------- */

.state {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 32px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}

.state-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-ink);
}

.state-title {
  font: 600 var(--text-xl) / 1.3 var(--font-display);
}

.state-hint {
  max-width: 28ch;
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.state .btn-primary {
  margin-top: 16px;
}

.fixed-cta {
  position: fixed;
  inset: auto var(--gutter) max(16px, var(--safe-bottom));
  z-index: 20;
  display: flex;
  justify-content: center;
}

.fixed-cta .btn-primary {
  width: 100%;
  max-width: calc(var(--main-max) - 2 * var(--gutter));
  box-shadow: 0 10px 24px -10px rgb(28 42 36 / 0.6);
}

.app.has-cta .page-end {
  padding-bottom: 96px;
}

.page-end {
  padding-block: 32px max(32px, var(--safe-bottom));
}

/* ---------- modo busca: só campo, divisor e resultados ---------- */

.app.is-searching .cover,
.app.is-searching .venue,
.app.is-searching .bar {
  display: none;
}

/* ---------- aviso rápido ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, var(--safe-bottom));
  z-index: 70;
  translate: -50% 12px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--text-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal), translate var(--duration-normal) var(--ease-out);
}

.toast.show {
  translate: -50% 0;
  opacity: 1;
}

/* ---------- esqueleto (HTML do servidor, antes do JS montar a tela) ---------- */

.skeleton {
  animation: sk-pulse 1.4s ease-in-out infinite alternate;
}

.sk-header,
.sk-cover,
.sk-bar,
.sk-photo,
.sk-lines i {
  background: var(--surface-2);
}

.sk-header {
  height: 72px;
}

.sk-cover {
  height: 200px;
}

.sk-bar {
  height: var(--bar-h);
  margin-top: 16px;
  border-radius: 0;
}

.sk-list {
  max-width: var(--main-max);
  margin: 24px auto 0;
  padding-inline: var(--gutter);
}

.sk-card {
  display: flex;
  gap: 16px;
  min-height: 152px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.sk-photo {
  flex: none;
  width: 120px;
  height: 120px;
  border-radius: var(--radius-photo);
}

.sk-lines {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 10px;
}

.sk-lines i {
  display: block;
  height: 14px;
  border-radius: 4px;
}

.sk-lines i:nth-child(1) {
  width: 70%;
  height: 18px;
}

.sk-lines i:nth-child(2) {
  width: 35%;
}

@keyframes sk-pulse {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

.noscript {
  padding: 16px;
  text-align: center;
}

/* ---------- telas maiores: a foto não cresce; só as colunas e a capa ---------- */

@media (min-width: 640px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .cover {
    height: 400px;
    border-radius: var(--radius-l);
  }

  .cover-wrap {
    max-width: var(--main-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
