/* Um Gelato — loja. Mobile-first, sem dependências externas. */
:root {
  --laranja: #f57c00;
  --laranja-btn: #b45309;   /* branco sobre este tom = 5.0:1 (AA) */
  --laranja-escuro: #9a4708;
  --creme: #fffbf5;
  --branco: #ffffff;
  --tinta: #141210;
  --tinta-suave: #6b6259;
  --borda: #ece3d8;
  --verde: #0f7a40;        /* branco sobre este tom = 5.4:1 (AA) */
  --raio: 16px;
  --sombra: 0 1px 2px rgba(20, 18, 16, .06), 0 6px 16px rgba(20, 18, 16, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 16px calc(96px + env(safe-area-inset-bottom));
  background: var(--creme);
  color: var(--tinta);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }

img { max-width: 100%; display: block; }

/* ── cabeçalho ── */
.topo {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -16px;
  padding: 12px 16px;
  background: rgba(255, 251, 245, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borda);
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--branco);
  box-shadow: var(--sombra);
}

.topo-texto h1 { font-size: 1.15rem; letter-spacing: -.01em; }

.topo-texto p {
  margin: 2px 0 0;
  font-size: .8rem;
  color: var(--tinta-suave);
}

/* ── seções ── */
.secao {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tinta-suave);
  margin: 24px 0 10px;
}

.aviso-carregando {
  color: var(--tinta-suave);
  text-align: center;
  padding: 40px 0;
}

.grid { display: grid; gap: 10px; }

/* ── card ── */
.card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
}

.card-arte {
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--creme);
}

.card-arte-fallback {
  display: grid;
  place-items: center;
  padding: 8px;
  font-size: .7rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.card-corpo {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-nome {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -.01em;
}

.card-meta {
  margin: 0;
  font-size: .875rem;
  color: var(--tinta-suave);
}

.card-selo {
  margin: 0;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1e0;
  color: var(--laranja-escuro);
  font-size: .72rem;
  font-weight: 600;
}

/* ── botões ── */
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: transform .06s ease, filter .15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active { transform: scale(.98); }

.btn:focus-visible, .btn-step:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--laranja);
  outline-offset: 2px;
}

.btn-primario { background: var(--laranja-btn); color: #fff; }
.btn-primario:hover { filter: brightness(1.05); }

.btn-whats { background: var(--verde); color: #fff; }
.btn-whats:hover { filter: brightness(1.08); }

.btn-secundario { background: #f3ece3; color: var(--tinta); }

.btn-adicionar {
  align-self: flex-start;
  margin-top: 2px;
  padding: 8px 18px;
  min-height: 44px;
  background: #fff1e0;
  color: var(--laranja-escuro);
  border: 1px solid #f6d6b3;
}

/* ── stepper ── */
.controle {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.btn-step {
  width: 40px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--borda);
  background: var(--branco);
  color: var(--tinta);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-step:disabled { opacity: .35; cursor: not-allowed; }

.controle-qtd {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── barra fixa ── */
.barra {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--branco);
  border-top: 1px solid var(--borda);
  box-shadow: 0 -6px 20px rgba(20, 18, 16, .07);
}

.barra-info {
  display: flex;
  flex-direction: column;
  font-size: .78rem;
  color: var(--tinta-suave);
}

.barra-info strong {
  font-size: 1.05rem;
  color: var(--tinta);
  font-variant-numeric: tabular-nums;
}

/* ── checkout ── */
dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100%;
  max-height: 100%;
}

dialog::backdrop { background: rgba(20, 18, 16, .45); }

.checkout-form {
  width: min(480px, 100vw);
  margin: auto;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--branco);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

dialog[open] { margin: auto auto 0; }

.checkout-form h2 { font-size: 1.1rem; }

.checkout-itens {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 32vh;
  overflow-y: auto;
  padding: 10px 0;
  border-block: 1px solid var(--borda);
}

.checkout-linha {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: .9rem;
}

.checkout-linha span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }

.checkout-total {
  margin: 0;
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
}

.checkout-total strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

label { font-size: .85rem; font-weight: 600; }

.campo-duplo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.campo-duplo label { display: block; margin-bottom: 4px; }

fieldset.pagamento {
  border: 0;
  padding: 0;
  margin: 2px 0 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagamento legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: .85rem;
  font-weight: 600;
}

.chip { position: relative; }

.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--borda);
  border-radius: 12px;
  background: var(--branco);
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.chip input:checked + span {
  background: var(--laranja-btn);
  border-color: var(--laranja-btn);
  color: #fff;
}

.chip input:focus-visible + span {
  outline: 3px solid var(--laranja);
  outline-offset: 2px;
}

.opcional { font-weight: 400; color: var(--tinta-suave); }

input, textarea {
  font: inherit;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--borda);
  border-radius: 12px;
  background: var(--creme);
  color: var(--tinta);
  resize: vertical;
}

.checkout-nota {
  margin: 4px 0 0;
  font-size: .78rem;
  color: var(--tinta-suave);
}

.checkout-acoes {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.checkout-acoes .btn { flex: 1; }

/* ── estados ── */
.vazio {
  text-align: center;
  padding: 48px 16px;
  color: var(--tinta-suave);
}

.vazio p:first-child { font-size: 2rem; margin: 0 0 8px; }

.dica { font-size: .85rem; }

.rodape-nota {
  margin: 32px 0 0;
  font-size: .75rem;
  color: var(--tinta-suave);
  text-align: center;
}

/* ── toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 30;
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--tinta);
  color: #fff;
  font-size: .85rem;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.toast.visivel { opacity: 1; transform: translate(-50%, 0); }

/* ── telas maiores ── */
@media (min-width: 640px) {
  body { max-width: 760px; margin: 0 auto; padding-inline: 20px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .card-arte { width: 104px; height: 104px; flex-basis: 104px; }
  dialog[open] { margin: auto; }
  .checkout-form { border-radius: 20px; }
}

@media (min-width: 1000px) {
  body { max-width: 980px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
